The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 3:35pm
Pages: 1
Send Topic Print
cross statement (Read 2096 times)
nishant22
New Member
*
Offline



Posts: 8

cross statement
Jan 19th, 2009, 1:50am
 
Hi,
I have a big code for transmitter and have various cross statements which contribute to slowing down simulation speed considerably. Can anyone suggest like if my events are dependent on the rising or falling edge of the clock where vth= vdda(1)+vssa(0)/2 i write it as @cross(V(clk) -vth, 1) how can i replace the cross statements in my block with may be something better.
Thanks in advance
Nishant
Back to top
 
 
View Profile   IP Logged
rajdeep
Senior Member
****
Offline



Posts: 220
UK
Re: cross statement
Reply #1 - Jan 21st, 2009, 6:02am
 
Hi Nishant,

cross statements are used to enusure the simulator does not miss the all important events, like for your example positive edge of a clock. You may need to add tighter tolerances sometimes so that a numerical simulator like spectre doesnt miss it.

So, if you do not want to use cross, then you are taking a risk and your model is becoming less robust!!

But from my own experience sometimes you can remove some of the cross statements if you are sure that the simulator is anyway going to take time steps small enough to NOT miss the event.

I can suggest 3 ways:

1. For your clock example, consider clk is the signal name, and th = (vdd+vss)/2, be the threshold.
Then,....

analog begin
  clk_prev = clk_current;   // 2 real variables, storing the vakues of the clock signal in time tn and                                   // tn+1. Imagine what will happen if the gap between tn and tn+1 are not small enuf!!!
  clk_current = V(clk);
  if(clk_current > th && clk_prev < th)
               you have a positive edge of clock

  if(clk_current < th && clk_prev > th)
              you have a negative edge of clock
end

This works if your clock is an input and the simulator is not missing the clock edges. This might sound a bit confusing  ::) Actually it means the gap between tn and tn+1 (mentioned above) are small enough.

2. Relax the tolerances in your  cross statements.
3. Use bound_step or use max_step in your transient analysis.

Hope it helps!
Rajdeep

Back to top
 
 

Design is fun, verification is a requirement.
View Profile   IP Logged
nishant22
New Member
*
Offline



Posts: 8

Re: cross statement
Reply #2 - Jan 21st, 2009, 7:38am
 
Thanks Rajdeep!
It definitely would help, for my basic concern is keeping my simulation speed intact and as events are dependent on the edges and i guess your way would work, ill try it! thnx But as a good VA  practice if else or cross or delay should be avoided so i thought if there is a better way out.
Back to top
 
 
View Profile   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.