Jump to content

can we pass `define inside `uvm_do_with ?

Recommended Posts

Hello all,

I am trying to pass a define value inside the `uvm_do_with like below.

`uvm_do_with(req,{req.addr ==`BLOCK_ADDR ;})

I am seeing below error:

Error-[sE] Syntax error

Following verilog source has syntax error :

"../env/xx_seq_lib.sv", 146 (expanding macro): token is '''

`uvm_do_with(req,{req.addr == `BLOCK_ADDR;})

Please let me know how can i pass the define value.

Thank you


Link to comment
Share on other sites

This code works perfectly fine for Questa and VCS (don't have access to NC). Only thing that I can guess about it is maybe it's something to do with SV 2009 vs. SV 2005, and whether your simulator supports 2009 or not. `uvm_do_with expands to `uvm_do_on_pri_with, which will expand and substitute in the constraint block containing `BLOCK_ADDR. Maybe this extra level of expansion is a limitation with 2005, but not for 2009. I don't know; I'm really guessing on this one.

Besides, I think it's a better practice to define BLOCK_ADDR as either a UVM configuration variable (so that it can be modified at run time), or at least as a parameter. And, I think it's better to use start_item/finish_item instead of any of these `uvm_do_* macros, and do a randomize with after you start_item. In general, I'd avoid the preprocessor as much as possible, with a couple of exceptions (factory registration, UVM message reporting).

Link to comment
Share on other sites

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.

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...