• 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. Verilog -A amp

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 125
  • Views 9513
  • 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

Verilog -A amp

black tea
black tea over 9 years ago

I want to design an Amp in cadence by verilog-A code. I write code like blow, but I don't know how to define two input value vin_offset and vin_high. the input signal is a sine wave, the vin_offset is offset value of the sine wave, and the vin_high is the largest value of sine wave, I want to know how to define these two input value in verilog-A code. Thank you very much.

//--------------------
// amp
//
// -  amplifer
//
// sigin:    input    (val,flow)
// sigout:    output    (val,flow)
//
// INSTANCE parameters
//    gain          = gain between input and output []
//    sigin_offset  = subtracted from 'sigin' before amplification (val)
//
// MODEL parameters
//    {none}
//

module amp(sigin, sigout);
input sigin;
output sigout;
electrical sigin, sigout;
parameter real gain = 0.5/(vin_high - vin_offset);


   analog
      V(sigout) <+ gain*V(sigin) + 0.5*gain - gain*vin_offset;

endmodule



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

    I have no idea what you're asking for. To be honest, it's far better that you determine what the model should be yourself - I was merely giving some pointers in the right direction. It sounds as if you have some kind of AGC model in mind (I don't see how the frequency can't change at the output if the input frequency does). Maybe it's just your English? The offset is pretty hard to get right unless you do some kind of long term average or a moving average - the way I showed it here was just integrating it and dividing it by the time - so the average will vary quite a lot at the beginning and settle down. You can see this in the image here: 

    n1 is the input signal (it's a sine wave which I superimposed on top of another slower sine wave to see how the offset calculation worked over time). As you can see by the pink line, the offset steadies out over time. The vin_high just follows the peak. Maybe you want more of a moving average though?

    There's an example of a moving average in a model here: 

    The same (or similar) example is in the documentation too - it's in the Cadence Verilog-A Language Reference manual in the examples chapter (Chapter 14 in MMSIM15.1).

    The netlist I used to test the model above (to produce the waveforms shown above) was:

    //

    A1 (n1 n2) amp
    V1 (n1 n3) vsource type=sine freq=1M dc=1 ampl=1
    Voffset (n3 0) vsource type=sine freq=10k dc=0 ampl=0.2
    ahdl_include "forum14.va"
    tran tran stop=200u
    save n1 n2 A1:vin_high A1:vin_offset

    Kind Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    I have no idea what you're asking for. To be honest, it's far better that you determine what the model should be yourself - I was merely giving some pointers in the right direction. It sounds as if you have some kind of AGC model in mind (I don't see how the frequency can't change at the output if the input frequency does). Maybe it's just your English? The offset is pretty hard to get right unless you do some kind of long term average or a moving average - the way I showed it here was just integrating it and dividing it by the time - so the average will vary quite a lot at the beginning and settle down. You can see this in the image here: 

    n1 is the input signal (it's a sine wave which I superimposed on top of another slower sine wave to see how the offset calculation worked over time). As you can see by the pink line, the offset steadies out over time. The vin_high just follows the peak. Maybe you want more of a moving average though?

    There's an example of a moving average in a model here: 

    The same (or similar) example is in the documentation too - it's in the Cadence Verilog-A Language Reference manual in the examples chapter (Chapter 14 in MMSIM15.1).

    The netlist I used to test the model above (to produce the waveforms shown above) was:

    //

    A1 (n1 n2) amp
    V1 (n1 n3) vsource type=sine freq=1M dc=1 ampl=1
    Voffset (n3 0) vsource type=sine freq=10k dc=0 ampl=0.2
    ahdl_include "forum14.va"
    tran tran stop=200u
    save n1 n2 A1:vin_high A1:vin_offset

    Kind Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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