The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 4:19pm
Pages: 1
Send Topic Print
How to add Reset (Read 882 times)
afridi
Junior Member
**
Offline



Posts: 24

How to add Reset
Jun 20th, 2011, 3:28am
 
How can I get a reset input and reset the D-flip flop in the following code ? Your kind help would be appreciated as I have no knowledge of Verilog

module d_ff(vin_d, vclk, vout_q, vout_qbar);
input vclk, vin_d;
output vout_q, vout_qbar;
electrical vout_q, vout_qbar, vclk, vin_d;
parameter real vlogic_high = 5;
parameter real vlogic_low = 0;
parameter real vtrans_clk = 2.5;
parameter real vtrans = 2.5;
parameter real tdel = 3u from [0:inf);
parameter real trise = 1u from (0:inf);
parameter real tfall = 1u from (0:inf);

integer x;

 analog begin
     @ (cross( V(vclk) - vtrans_clk, +1 ))
           x = (V(vin_d) > vtrans);
     V(vout_q) <+ transition( vlogic_high*x +  vlogic_low*!x, tdel, trise, tfall );
     V(vout_qbar) <+ transition( vlogic_high*!x + vlogic_low*x, tdel, trise, tfall );

  end

endmodule
Back to top
 
 

The more things you do, the more you can do.(Lucille Ball)
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: How to add Reset
Reply #1 - Jun 20th, 2011, 7:25am
 
There's a DFF with reset on this web site, if you'd tried looking:

http://www.designers-guide.org/VerilogAMS/functional-blocks/dff/dff.va
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
afridi
Junior Member
**
Offline



Posts: 24

Re: How to add Reset
Reply #2 - Jun 20th, 2011, 8:36am
 
yes i looked at it but i was confused.there are 2 D flip flops on http://www.designers-guide.org/VerilogAMS/ page , one is under the heading of functional models other is RF models. will both work in cadence virtuoso ?
secondly can u kindly also point me to some comprehensive book on Verilog-A?
Back to top
 
 

The more things you do, the more you can do.(Lucille Ball)
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: How to add Reset
Reply #3 - Jun 20th, 2011, 11:26am
 
Virtuoso is not a simulator (I think it is now a "product line").  I would suggest you try the functional model first and see how it works for you.

"The Designer's Guide to Verilog-AMS" is the best book I know of.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.