Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Re: discrepency between behavioral simulation and post routesimulation

Reply
Thread Tools

Re: discrepency between behavioral simulation and post routesimulation

 
 
JimLewis
Guest
Posts: n/a
 
      11-25-2009
Hi Karl,
Advice: Take a training class, they will get you doing testbenches
right.

First setup clock.
Next drive reset for several clocks and deassert it with
respect to clock plus a propagation delay.
Next Drive stimulus with a propagation delay with respect to clock.

For your gate simulation, make sure to back annotate at least
nominal timing - without it, you may be failing due to delta
cycle races that are not in the real circuit.

Make sure your design double samples reset before distributing
it to your circuit.



architecture test of testbench is
constant tperiod_Clk : time := 20 ns ;
constant tpd : time := 2 ns ; -- representationve prop delay

signal clk : std_logic := '0' ;
. . .

begin

Clk <= not Clk after tperiod_Clk ;

-- leave reset asserted for a while
DriveReset : process
begin
Reset <= 'X' ; -- unknown at start
wait until Clk = '1' ; -- rising edge clk
Reset <= '1' after 2.5 * tperiod_Clk, '0' after 10 * tperiod_Clk +
tpd ;
wait ;
end process ;


DriveStimulus : process
begin
wait until Reset = '0' ; -- out of reset
wait until Clk = '1' ;
wait until Clk = '1' ;

data <= "1010" after tpd ;
wait until Clk = '1' ; -- wait 2 clocks are part of symbol
processing
wait until Clk = '1' ;

data <= "0010" after tpd ;
wait until Clk = '1' ;
wait until Clk = '1' ;

data <= "1110" after tpd ;
wait until Clk = '1' ;
wait until Clk = '1' ;

data <= "1110" after tpd ;
wait until Clk = '1' ;
wait until Clk = '1' ;

wait for 10 * tperiod_Clk ;
-- report "Just Kidding" severity failure ; -- old way to stop
the sim
std.env.stop(0) ; -- new way to stop a sim, supported by
ModelSim + Aldec
end process ;


You will learn this and more about testbenches in our
Comprehensive VHDL Introduction classes.

Best,
Jim Lewis
VHDL Training Guru
http://www.synthworks.com
 
Reply With Quote
 
 
 
 
KJ
Guest
Posts: n/a
 
      11-26-2009
On Nov 25, 6:22*pm, JimLewis <J...@SynthWorks.com> wrote:

Given the name of the constant...
> * constant tperiod_Clk : time := 20 ns ;


The assignment below is not quite right...
> * Clk <= not Clk after tperiod_Clk ;
>


It should be...
Clk <= not Clk after (tperiod_Clk / 2);

I generally write it as...
Clk <= not(Simulation_Complete) and not Clk after (tperiod_Clk / 2);

Where 'Simulation_Complete' is a signal set by the testbench to
indicate when the simulation is completing. That way instead of
ending like this which throws an assertion failure...

> * * *wait for 10 * tperiod_Clk ;
> * * *-- report "Just Kidding" severity failure ; *-- old way to stop
> the sim


One can end in a graceful manner like this...
Simulation_Complete <= '1';
report "Simulation completed";
wait;

I don't use the hammer to stop the sim...
> * * *std.env.stop(0) ; *-- new way to stop a sim, supported by
> ModelSim + Aldec


But do appreciate that there is a hammer that I might want to use in
the future.

Kevin Jennings
 
Reply With Quote
 
 
 
 
karl bezzoto
Guest
Posts: n/a
 
      11-26-2009
Many thanks for your answers. i'll try them later and let them know
how it goes.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
struct calcsize discrepency? Glen Rice Python 9 12-06-2011 08:55 AM
Problem with ASP.NET Page Type discrepency. varnk ASP General 1 03-13-2010 03:40 PM
Problem with post-route simulation / timing simulation jasperng VHDL 0 11-27-2008 06:23 AM
what's the differences between the behavioral model and the RTLmodel? risingsunxy@googlemail.com VHDL 7 03-10-2006 02:22 PM
EDK Modelsim Behavioral Simulation Error hansman VHDL 3 01-30-2004 09:05 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57