Jump to content

Controlling timescale with set_timeout


Recommended Posts

What is the recommended way to control the timescale of the UVM timeout as set with set_timeout()?

 

Controlling the timescale in the calling code doesn't seem to work.

 

For example, 

 

`timescale 1ns/1ps

 

...

 

uvm_top.set_timeout(2000000ns, 1);

 

 

 

 

results in the timeout set to 2000ns.  UVM seems to be using a timescale of 1ps.

Link to comment
Share on other sites

The value that you pass in is of type time, which is essentially just an integer scaled to the timescale of the code where you the function. You're going to have to pre-scale it yourself to the appropriate value. UVM itself doesn't have a timescale defined (which is unfortunate because it makes use of #(...) delays), but you can usually set a default timescale for packages from the compiler command line.

Link to comment
Share on other sites

Hi Walker,

 

Communicating time values across multiple timescale domains has been a gotcha in Verilog since day one. Timescales only apply to scaling of literal time values, not values of variables or passed arguments. Therefore, you should always use a literal time value in any expression involving time to a normalized time unit.

Unfortunately, they didn't do this inside the UVM library. So if your UVM package is compiled with a default of timescale of 1ps, then you should do this to normalize it :

uvm_top.set_timeout(2000000ns/1ps, 1);

 

-Dave

Link to comment
Share on other sites

hi,

 

... this nasty timescale problem....

 

you got a few options

 

1. scale like dave suggests

2. force all timescales to be the same in your system

3. uvm could have implemented a workaround used in the tlm2 area (uvm_tlm_time) and use this data type to represent time instead of the broken,bad sv native "time" datatype. all uvm api would use this uvm_time data type  (

 

4. the solution i would prefer however is that the sv -1800 committee goes and provides a real "time" datatype which scales properly when switching timescale regions... (or even better get rid of timescale at all) 

Link to comment
Share on other sites

  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...