• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. variable $freq in veriloga

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 125
  • Views 17669
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

variable $freq in veriloga

RobinCommander
RobinCommander over 7 years ago

Can use $freq in veriloga if I want to create an expression for say a frequency dependent gain in AC analysis?

I gave this a try but so far it hasn't worked but the veriloga compiler and the spectre aps linter haven't complained either.

Thanks,

Robin

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    Robin,

    There's limited support for this - from MMSIM15.1 ISR3 onwards. Not sure what version you're using.

    I think it's a bit fussy as to what works and what doesn't. My initial attempts didn't work, but using this:

    `include "disciplines.vams"
    `include "constants.vams"

    module forumdollarfreq2 (vp,vn);
    inout vp,vn;
    electrical vp,vn;

    real r,tn;
    analog begin
      //r = $table_model($freq, "./resFreq.tbl", "1CL");
      r = $freq/1000.0;
      tn = 4.0 * `P_K * $temperature * r;
      I(vp, vn) <+ (V(vp, vn) + sqrt(tn)) / r ;
    end

    endmodule

    (either with or without the table model) worked fine.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RobinCommander
    RobinCommander over 7 years ago in reply to Andrew Beckett

    My latest version is MMSIM 15.10.803

    As you say it might be a bit fussy as your example does work, but my current experiment is not working although it might have worked briefly before I made some edits.

    Is there any documentation or mention in a release note for this $freq feature?

    Also I haven't been able to probe veriloga internal variables in AC simulation but I can for dc or tran.

    Thanks,

    Robin

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to RobinCommander

    Hi Robin,

    The fact that it is not documented tells me that it's not really fully released yet - because it only works in narrow cases. Even then, it's not going to work in time-domain analysis. I wouldn't expect you to be able to probe the variables either because that's not something that can be done in ac analysis (similarly you can't access device operating point parameters during an ac analysis). Maybe I shouldn't have given the "working" example ;-)

    Probably makes most sense to open a case with customer support so that we can take a look at specifically what you're trying to achieve and then assess how ready the capability is (or isn't) with R&D.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RobinCommander
    RobinCommander over 7 years ago in reply to Andrew Beckett

    Hi Andrew,

    This should give an idea of what I was trying to do - a low pass with variable roll off rate.

    In my simulations it had a flat frequency response of 1.

    Regards,

    Robin

    `include "discipline.h"
    `include "constants.h"


    // low pass filter with 3dB/octave roll off
    //

    module low_rolloff2(sigin, sigout);
    input sigin;
    output sigout;
    electrical sigin, sigout;
    parameter real F0 = 10M;   // cutoff
    //parameter real rolloff = 0.5; // 1 = normal RC, 0.5 = 1/sqrt(f) etc

    real FreqGain;

    analog begin

        //FreqGain = 1/(1+pow($freq/F0,rolloff));
        FreqGain = 1/(1+sqrt(abs($freq/F0)));
        V(sigout) <+ V(sigin)*FreqGain;

    end

    endmodule

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • RobinCommander
    RobinCommander over 7 years ago in reply to Andrew Beckett

    Hi Andrew,

    This should give an idea of what I was trying to do - a low pass with variable roll off rate.

    In my simulations it had a flat frequency response of 1.

    Regards,

    Robin

    `include "discipline.h"
    `include "constants.h"


    // low pass filter with 3dB/octave roll off
    //

    module low_rolloff2(sigin, sigout);
    input sigin;
    output sigout;
    electrical sigin, sigout;
    parameter real F0 = 10M;   // cutoff
    //parameter real rolloff = 0.5; // 1 = normal RC, 0.5 = 1/sqrt(f) etc

    real FreqGain;

    analog begin

        //FreqGain = 1/(1+pow($freq/F0,rolloff));
        FreqGain = 1/(1+sqrt(abs($freq/F0)));
        V(sigout) <+ V(sigin)*FreqGain;

    end

    endmodule

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • RobinCommander
    RobinCommander over 7 years ago in reply to RobinCommander

    p.s.

    If I make the output a current and connect output to a resistor load then I get something that looks like the expected behaviour.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Frank Wiedmann
    Frank Wiedmann over 7 years ago in reply to RobinCommander

    For this purpose, you could also try to use the fracpole component. For more information, type "spectre -h fracpole" at the command line. The article at http://www.designers-guide.org/modeling/suite.pdf has some additional background information. I have not actually tried this myself so far, so if you try this and it works for you, I would appreciate a short note.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information