What meaning of '#' is in this line?

Status
Not open for further replies.

ruwan2

Member level 5
Joined
Nov 29, 2011
Messages
90
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
2,141
Hi,

I know '#' in verilog means delay time. What is its meaning in this verilog-AMS example? I do not see the explanation in verilog-ams reference book.

Thanks,

Code:
module motorckt;
parameter real freq=100;
electrical gnd; ground gnd;
electrical drive;
rotational shaft;
motor m1 (drive, gnd, shaft);
[COLOR="#0000CD"]vsine #(.freq(freq), .ampl(1.0)) v1 (drive, gnd);[/COLOR]
 
Last edited by a moderator:

Deja Vu, seems like a discussion about this just occurred for System Verilog.

The #(.freq(freq), .ampl(1.0)) specifies the overridden values for the parameters freq and ampl of the vsine module instance (search for parameter override in the IEEE Std 1800-2012).

This parameter override feature for instantiated modules is the same for Verilog, SV, and Verilog-AMS. Afaik, AMS is mostly an extension to Verilog.
 
Reactions: ruwan2

    ruwan2

    Points: 2
    Helpful Answer Positive Rating
Thanks for your reply. I still has a little question on reading the following code.

pfd #(2.0) pfd1 (e1, rf, e2);


It has only one data after '#'. It means the first variable (e1) is overwritten?



Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
`include "disciplines.vams"
`include "constants.vams"
 
module pll(rf, out); 
 
    inout      rf, out;
    electrical rf, out, e1, e2, gnd;
    ground     gnd;
 
    parameter real tau  = 1.0e-3;
    parameter real gain = 1.0;
    parameter real fc   = 2.0e3;
    parameter real cap  = 150.0e-9;
 
    pfd #(2.0)             pfd1 (e1, rf, e2);
 
 
...............
 
`include "disciplines.vams"
`include "constants.vams"
 
module pfd(in, src, out);
 
    inout      in, src, out;
    electrical in, src, out;
 
    parameter real gain = 1.0;
 
    analog
        V(out) <+ gain * V(src) * tanh(20.0 * V(in));
 
endmodule

 
Last edited by a moderator:

E1 is a port not a parameter.

I'm kink of surprised that the parameter in a pre 2001 port declaration can be overridden with a 2001 style parameter overriide. The pre 2001 method was done using defparam.
 

Thanks for your reply. I still has a little question on reading the following code.

pfd #(2.0) pfd1 (e1, rf, e2);


It has only one data after '#'. It means the first variable (e1) is overwritten?
It means override the parameter gain inside the module pfd. There is only one parameter in that module, but if there were more, then it would mean only override the first parameter declared inside that module

ads-ee, you can override V1995 style parameters declared inside the body of a module using the V2001 instantiation override syntax as long as there are no other V2001 parameter declarations in the module header. The order the parameters are declared inside the module are the order they are overridden. What you can't do is mix V1995 style parameters with V2001 style parameters, and then try to override both using the V2001 instantiation override syntax; only the V2001 parameter declarations can be overridden in that case.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…