Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

$freq while using AC analysis to access lookup table

Status
Not open for further replies.

NikosTS

Advanced Member level 4
Joined
Jan 30, 2017
Messages
119
Helped
1
Reputation
2
Reaction score
2
Trophy points
18
Activity points
1,054
Hello all,
I have saved in a table the response of a filter. The table contains 2 columns; the first contains the frequency and the second the corresponding magnitude.
I am building a model that will instantly "read" the value of the frequency during an AC analysis and using that value will find the corresponding magnitude through the table.

My thought was using something like $table_model( $freq, "table_link.dat") and assigning that value to the output, but it doesnt seem to work. Actually it seems like the only value of frequency is 0Hz.

Any ideas?

Thank you in advance
 

Last edited:


If you insist on Verilog-A, instantiate spectre’s primitive nport in Verilog-A.

https://designers-guide.org/forum/YaBB.pl?num=1574240440#2

Other possibility is “deriv(ac_stim(1))/(M_TWO_PI)”.

I don’t know whether it works as independent variable for table_model().

Hello and thank you for the reply.
Instantiating the nport in VerilogA seems like a very good way to get the response I want. However, I can only connect the ports by order and not by name.
Specifically:
I want to instantiate an nport with 2 ports and NO common reference. The instance will have 4 pins : p1,m1,p2,m2 (at least in schematic editor ).
My VerilogA model has 4 pins also : INP,INN,OP,ON and I want to connect port (p1 with INP) , (m1 with INN) , (p2 with OP), (m2 with ON).

My code works and simulates correctly when I instantiate the nport as :
nport #(params) NPORT0(INP,INN,OP,ON )
but produces an error when I try to instantiate it as:
nport #(params) NPORT0(.p1(INP),.m1(INN),.p2(OP),.m2(ON) ) .

Any ideas on this?
 

Compare CDF parameter and spectre -h nport.

Or simply use gnd node in Verilog-A.
Ground node declaration.
 
Last edited:
Compare CDF parameter and spectre -h nport.

Or simply use gnd node in Verilog-A.
Ground node declaration.

Indeed the corresponding CDF parameters were not the same as the pins of the nport.
For anyone's interest : pins p1,p2,p3... etc must be instantiated as port names t1,t2,t3... and pins m1,m2,m3.... as b1,b2,b3...
 

Code:
`include "constants.vams"
`include "disciplines.vams"

module my_freq(out);
output out;
voltage out;

electrical gnd;
ground gnd;

voltage hoge;

analog begin
   V(hoge) <+ ac_stim();
   V(out) <+ abs( ddt( V(hoge) ) ) / `M_TWO_PI;
end //analog

endmodule
Try this code.
You can get analysis frequency value in Verilog-A.
Also I showed gnd node definition in Verilog-A.

nport #(params) NPORT0(.t1(INP),.b1(gnd),.t2(OP),.b2(gnd) )
 
Last edited:
Correction.
Code:
`include "constants.vams"
`include "disciplines.vams"

module my_freq(out);
output out;
voltage out;

electrical gnd;
ground gnd;

voltage aho, boke;

analog begin
   V(aho) <+ ac_stim();
   V(boke) <+ ddt( V(aho) ) / `M_TWO_PI;
   V(out) <+ abs( V(boke) );
end //analog

endmodule
 

Correction.
Code:
`include "constants.vams"
`include "disciplines.vams"

module my_freq(out);
output out;
voltage out;

electrical gnd;
ground gnd;

voltage aho, boke;

analog begin
   V(aho) <+ ac_stim();
   V(boke) <+ ddt( V(aho) ) / `M_TWO_PI;
   V(out) <+ abs( V(boke) );
end //analog

endmodule

Hello pancho thank you for the reply,
I havent had the time to test that piece of code but I am not sure if it will help me anyway. The nport way works really well until now!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top