• 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. Mixed-Signal Design
  3. verilog AMS sine wave generator

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 64
  • Views 14637
  • 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 AMS sine wave generator

praseetha
praseetha over 3 years ago
 Re: Verilog AMS sine generator
Reply #2 - Today at 1:03am
    
Hi ,
 I have created a wrapper around my  .vams netlist of an anlog circuit. I want to drive a signal as an input from the digital domain to my analog netlist hence I created a wrapper.
The input to the wrapper is a frequency ,phase and amplitude but I want to drive a sine wave as input to my analog netlist, hence I am creating this in my wrapper and trying to feed that as input to my vams netlist as it needs a signal as an input.

This is the part of the code which I need help with:
electrical      bbmux_lp_n_ai;
 electrical      bbmux_lp_p_ai;
 electrical      lp_n_ai;
 electrical      lp_p_ai;
 
 real       offset = 2.5;
 
 assign  bbmux_lp_n_ai = offset + (bbmux_lp_n_ai_amplitude * $cos(2*3.14159265358979323846*bbmux_lp_n_ai_frequency*$abstime));
 assign  bbmux_lp_p_ai = offset + (bbmux_lp_p_ai_amplitude * $cos(2*3.14159265358979323846*bbmux_lp_p_ai_frequency*$abstime));
 assign  lp_n_ai = offset + (lp_n_ai_amplitude * $cos(2*3.14159265358979323846*lp_n_ai_frequency*$abstime));
 assign  lp_p_ai = offset + (lp_p_ai_amplitude * $cos(2*3.14159265358979323846*lp_p_ai_frequency*$abstime));
 

 
 
   // Instantiate the analog netlist
 rxbb_lp rxbb_lp_inst(
   .bbmux_lp_n_ai(bbmux_lp_n_ai) ,
   .bbmux_lp_p_ai(bbmux_lp_p_ai) ,
   .lp_n_ai(lp_n_ai) ,
   .lp_p_ai(lp_p_ai)
);
I also tried creating a seprate function as shown in the guide:
electrical g, gnd;
wire bbmux_lp_n_ai;
wire bbmux_lp_p_ai;
wire lp_n_ai;
wire lp_p_ai;

vsine #(.dc(0), .ampl(1.3), .freq() bbmux_lp_n_ai (g, gnd);
vsine #(.dc(0), .ampl(bbmux_lp_p_ai_amplitude), .freq(bbmux_lp_p_ai_frequency)) bbmux_lp_p_ai (g, gnd);
vsine #(.dc(0), .ampl(lp_n_ai_amplitude), .freq(lp_n_ai_frequency)) lp_n_ai (g, gnd);
vsine #(.dc(0), .ampl(lp_p_ai_amplitude), .freq(lp_p_ai_frequency)) lp_p_ai (g, gnd);







  // Instantiate the analog netlist
 rxbb_lp rxbb_lp_inst(
   .bbmux_lp_n_ai(bbmux_lp_n_ai) ,
   .bbmux_lp_p_ai(bbmux_lp_p_ai) ,
   .lp_n_ai(lp_n_ai) ,
   .lp_p_ai(lp_p_ai)
);



endmodule


module vsine(ampl,freq,phase,out);
input ampl;
input freq;
input phase;
output out;
voltage out;
real freq, ampl,phase;
parameter real offset=0.0;
analog begin
v(out) <+ ampl*sin(2.0*‘M_PI*freq*$abstime) + offset;
$bound_step(0.05/freq);
end
endmodule
  • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago

    As Ken pointed out in your post on The Designer's Guide forums (you didn't really disguise the fact that you'd posted there given the pasted Quote/Modify icons!), you haven't really asked a question. Since this is already an active discussion on the Designer's Guide, I won't answer it here too. Mainly because you've not actually asked a question and just pasted some code and said what you're doing, but also to avoid duplication, even though it's a different forum.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • praseetha
    praseetha over 3 years ago in reply to Andrew Beckett

    Hi Andrew, 

    I am trying to create a sine wave in my wrapper, to feed that as an input to my .vams netlist. I am not able to achieve that with this code script and I i am looking for a better way to achieve it as it is is not working. 

    Firstly, is this possile by the wrapper?

    second, is my method correct? or can I have some suggestions. 

    I am sorry that I have duplicated it as I was just looking for an open discussion and did not know that it is a problem. 

    Thank you

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to praseetha

    I see Ken has given you lots of answers in the Designer's Guide post so I won't repeat that work here. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • praseetha
    praseetha over 3 years ago in reply to Andrew Beckett

    Hi Andrew,

    Yes, he has, Thank you. 

    • 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