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,757 Views
Registered: ‎08-31-2009

Assert time variaable?

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

 

variable t1 : time;

variable t2 : time;

variable td : time;

 

process

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". The time should be the same, and I was the same, why the assert clause assert an error?

 

 

0 Kudos
2 Replies
Adventurer
Adventurer
2,754 Views
Registered: ‎09-15-2008

Re: Assert time variaable?

try this:

 

assert   td = 200ns

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

 

The assert statement ends with the ";"

 

0 Kudos
Historian
Historian
2,741 Views
Registered: ‎02-25-2008

Re: Assert time variaable?

The variables must be declared within the process.
----------------------------Yes, I do this for a living.
0 Kudos