+ Post New Thread
Results 1 to 13 of 13
  1. #1
    Full Member level 1
    Points: 943, Level: 6

    Join Date
    Jan 2017
    Posts
    97
    Helped
    1 / 1
    Points
    943
    Level
    6

    $freq while using AC analysis to access lookup table

    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

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 261,871, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,764
    Helped
    13912 / 13912
    Points
    261,871
    Level
    100

    Re: $freq while using AC analysis to access lookup table

    Forgot to mention the circuit analysis tool.



  3. #3
    Advanced Member level 5
    Points: 17,409, Level: 31
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    2,681
    Helped
    724 / 724
    Points
    17,409
    Level
    31

    Re: $freq while using AC analysis to access lookup table

    Quote Originally Posted by NikosTS View Post
    My thought was using something like $table_model( $freq, "table_link.dat")
    If you mean Verilog-A, $freq is not available in Verilog-A.

    https://www.edaboard.com/showthread.php?373837#6



  4. #4
    Full Member level 1
    Points: 943, Level: 6

    Join Date
    Jan 2017
    Posts
    97
    Helped
    1 / 1
    Points
    943
    Level
    6

    Re: $freq while using AC analysis to access lookup table

    Thank you both for the replies.

    Quote Originally Posted by FvM View Post
    Forgot to mention the circuit analysis tool.
    I use Spectre if that is what you mean.

    - - - Updated - - -

    Quote Originally Posted by pancho_hideboo View Post
    If you mean Verilog-A, $freq is not available in Verilog-A.

    https://www.edaboard.com/showthread.php?373837#6
    Yes I am using verilogA to model a filter.
    Is there any other way to search a table using frequency as the input?
    Last edited by NikosTS; 20th November 2019 at 08:51.



  5. #5
    Advanced Member level 5
    Points: 17,409, Level: 31
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    2,681
    Helped
    724 / 724
    Points
    17,409
    Level
    31

    Re: $freq while using AC analysis to access lookup table

    Use spectre primitive, nport.

    If you use Keysight ADSsim, use DAC(Data Access Component).

    https://www.edaboard.com/showthread.php?364412/page2#23
    Last edited by pancho_hideboo; 20th November 2019 at 10:31.


    1 members found this post helpful.

  6. #6
    Full Member level 1
    Points: 943, Level: 6

    Join Date
    Jan 2017
    Posts
    97
    Helped
    1 / 1
    Points
    943
    Level
    6

    Re: $freq while using AC analysis to access lookup table

    Quote Originally Posted by pancho_hideboo View Post
    Use spectre primitive, nport.

    If you use Keysight ADSsim, use DAC(Data Access Component).

    https://www.edaboard.com/showthread.php?364412/page2#23
    Thank you pancho, nport is indeed a way to associate frequency with magnitude. But it cannot be "translated" in VerilogA.
    Is there a way to only use VerilogA in order to manipulate the sweeped frequency and get the wanted magnitude?



    •   AltAdvertisement

        
       

  7. #7
    Advanced Member level 5
    Points: 17,409, Level: 31
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    2,681
    Helped
    724 / 724
    Points
    17,409
    Level
    31

    Re: $freq while using AC analysis to access lookup table

    Quote Originally Posted by NikosTS View Post
    Is there a way to only use VerilogA
    If you insist on Verilog-A, instantiate spectre’s primitive nport in Verilog-A.

    https://designers-guide.org/forum/Ya...m=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().


    1 members found this post helpful.

  8. #8
    Full Member level 1
    Points: 943, Level: 6

    Join Date
    Jan 2017
    Posts
    97
    Helped
    1 / 1
    Points
    943
    Level
    6

    Re: $freq while using AC analysis to access lookup table

    Quote Originally Posted by pancho_hideboo View Post
    If you insist on Verilog-A, instantiate spectre’s primitive nport in Verilog-A.

    https://designers-guide.org/forum/Ya...m=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?



  9. #9
    Advanced Member level 5
    Points: 17,409, Level: 31
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    2,681
    Helped
    724 / 724
    Points
    17,409
    Level
    31

    Re: $freq while using AC analysis to access lookup table

    Compare CDF parameter and spectre -h nport.

    Or simply use gnd node in Verilog-A.
    Ground node declaration.
    Last edited by pancho_hideboo; 21st November 2019 at 12:30.


    1 members found this post helpful.

  10. #10
    Full Member level 1
    Points: 943, Level: 6

    Join Date
    Jan 2017
    Posts
    97
    Helped
    1 / 1
    Points
    943
    Level
    6

    Re: $freq while using AC analysis to access lookup table

    Quote Originally Posted by pancho_hideboo View Post
    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...



  11. #11
    Advanced Member level 5
    Points: 17,409, Level: 31
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    2,681
    Helped
    724 / 724
    Points
    17,409
    Level
    31

    Re: $freq while using AC analysis to access lookup table

    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 by pancho_hideboo; 22nd November 2019 at 10:34.


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  12. #12
    Advanced Member level 5
    Points: 17,409, Level: 31
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    2,681
    Helped
    724 / 724
    Points
    17,409
    Level
    31

    Re: $freq while using AC analysis to access lookup table

    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



  13. #13
    Full Member level 1
    Points: 943, Level: 6

    Join Date
    Jan 2017
    Posts
    97
    Helped
    1 / 1
    Points
    943
    Level
    6

    Re: $freq while using AC analysis to access lookup table

    Quote Originally Posted by pancho_hideboo View Post
    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!



--[[ ]]--