Define UVM_PACKER_MAX_BYTES

Hi VA,

I would like to redefine the next define in my test-bench:
`define UVM_PACKER_MAX_BYTES 1500000

Where do you suggest to put/write this line?
Before importing the uvm_pkg::*?
So it will be used properly.

Thanks,
Michael

In reply to Michael54:

When you `include “uvm_macros.svh”, UVM_PACKER_MAX_BYTES gets define by

`ifndef UVM_PACKER_MAX_BYTES
 `define UVM_PACKER_MAX_BYTES `UVM_MAX_STREAMBITS
`endif

So all you need to do is define it before you include it. The easiest thing is using a command line compilation switch +define+UVM_PACKER_MAX_BYTES=1500000.

Also note that if you are using a pre-compiled UVM package, you will need to recompile the the uvm_pkg with this new setting.

And finally note that we recommend avoiding the UVM field automation macros and writing pack/unpack methods directly using the SystemVerilog streaming operators.

In reply to dave_59:

Thanks Dave,
I need this for a VIP I am integrating in my TB, not my decision.

May I ask what is the reason you recommend avoiding the UVM field automation macros and writing pack/unpack methods directly using the SystemVerilog streaming operators?

In reply to Michael54:

Because they are very inefficient. The UVM treats every integral field as a 4096-bit vector. Any operation you perform on an integral field has to copy and mask 4096 bits. There are a lot of hidden function calls for every operation, but each function call has to pass the field through it.

See http://verificationhorizons.verificationacademy.com/volume-7_issue-2/articles/stream/are-ovm-and-uvm-macros-evil-a-cost-benefit-analysis_vh-v7-i2.pdf

In reply to dave_59:

Hi Dave,
Do we need to override the pack/ unpack function or Do we need to override do_pack/unpack function.using streaming operator?
which one is good practice…

please help

Regards
Mechanic

In reply to Mechanic:

The link I provided above explains. But most efficient is using the convert2string method.