The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 8:16pm
Pages: 1
Send Topic Print
instantiation inside analog block? (Read 3381 times)
Go,TB
Junior Member
**
Offline



Posts: 11

instantiation inside analog block?
Aug 21st, 2012, 12:33am
 
I'm new to Verilog-AMS modeling and need helps to check my code as below.

What the main module means to do is just to delay the clock signal to a D-flip-flop, and then the output of the D-flip-flop is delayed as output of the main module.

//define D flip-flop
module adffp (d, clk, q)
......
......
endmodule

//main ckt module
module testx (inx, clk, outx);
input inx; voltage inx;
input clk; voltage clk;
output outx; voltage outx;
parameter real vh=1;
parameter real vl=0;
parameter real td=20n;

electrical clkdd; //internal net
electrical outdd; //internal net

analog begin
     V(clkdd) <+ absdelay(V(clk), 2*td); //delay clk signal by "2*td"
     adffp dffpx (inx, clkdd, outdd); //instantiation of adffp module with clkdd and inx
     V(outx) <+ absdelay(V(outdd), 5*td); //delay outdd by "5*td" and then port it out
end
endmodule
[/color]

The simulation is done by HSPICE and it complains that
"Syntax error, unsupported syntax or illegal keyword at/before 'dffpx', ..."

I wonder if it's legal to instantiate the module "adffp" inside analog behavior block. Is there better way to implement the function?

Thanks!
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: instantiation inside analog block?
Reply #1 - Aug 21st, 2012, 2:19am
 
Go,TB,
The module instantiation in your code does not comply with the LRM v2.3.1 (http://www.designers-guide.org/VerilogAMS/vams231.pdf), sec. 5.2 (syntax 5-1): Instantiation is not analog.

- B O E
Back to top
 
 
View Profile   IP Logged
Go,TB
Junior Member
**
Offline



Posts: 11

Re: instantiation inside analog block?
Reply #2 - Aug 21st, 2012, 11:20am
 
Thanks for reply.

I checked the document you referred. It is like that I can't instantiate the module inside an analog block since the instantiation itself is not analog behavior.

I take the instantiation out of analog block and the code is like:

//define D flip-flop
module adffp (d, clk, q)
......
......
endmodule

//main ckt module
module testx (inx, clk, outx);
input inx; voltage inx;
input clk; voltage clk;
output outx; voltage outx;
parameter real vh=1;
parameter real vl=0;
parameter real td=20n;

electrical clkdd; //internal net
electrical outdd; //internal net

analog begin
    V(clkdd) <+ absdelay(V(clk), 2*td); //delay clk signal by "2*td"
end

    adffp dffpx (inx, clkdd, outdd); //instantiation of adffp module with clkdd and inx

analog begin
    V(outx) <+ absdelay(V(outdd), 5*td); //delay outdd by "5*td" and then port it out
end
endmodule


This work-around can get the job done somehow. But I noticed a warning like:
port 'inx' declared, but not used

I can't figure out what's going on over there. Just guess that probably this is not best practice to implement the function.

Thanks!
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: instantiation inside analog block?
Reply #3 - Aug 22nd, 2012, 7:13am
 
Go,TB wrote on Aug 21st, 2012, 11:20am:
This work-around can get the job done somehow.
Work around? It is specified behavior.
Quote:
But I noticed a warning like:
port 'inx' declared, but not used

I can't figure out what's going on over there.
I don't see any reason for this message in the code fragment you provided. It compiles nicely with my tools.
- B O E
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.