UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
2,219 Views
Registered: ‎08-31-2009

Assert time variable, modified

I want to check a clock(5M, i.e. period 200ns) signal in testbench. And wrote the clauses like below

 

 

process 

 

variable t1 : time;

variable t2 : time;

variable td : time;

 

 

begin

   wait until (clk'event and clk = '1'); 

   t1 := now;

   wait until (clk'event and clk = '1'); 

   t2 := now;

 

   td := t2 - t1;

 

   assert   td = 200ns;

   report "actually td is " & time'image(td) & " !" severity error

 

   wait;

end process;

 

Then I got " actually td is 200000000fs !" as output.

 

Then I change the assert clause to "assert   td = 200000000fs", and re-run the simulation, then I still got " actually td is 200000000fs !"

Why the time variable mis-compared, even I change "ns" to "fs". Why can not ISim identify the same time vaule? Why the same 200 ns

beside " = " are juded as different value?
0 Kudos
1 Reply
Adventurer
Adventurer
2,206 Views
Registered: ‎09-15-2008

Re: Assert time variable, modified

try  :

assert   (td = 200 ns)

   report ("actually td is " & time'image(td) & " !") severity error;

 

also be aware that your code check only one clock cycle because of the latest wait statement.

0 Kudos