Skip to content

No compatible way to set the compat packer to be the default. #24

@jrefice

Description

@jrefice

From https://forums.accellera.org/topic/8170-use-the-uvm_compat_packer-trigger-compilation-issues/:

I want to use the uvm_compat_pkg to compatible the original uvm_packer.

  begin
     uvm_compat_pkg::uvm_compat_packer compat_packer = new();
     uvm_packer::set_default(compat_packer);
  end

it triggered the compilation issue:

 Could not find member 'set_default' in class 'uvm_packer', at 
 "*/VCS2024.09-SP2/85540268/uvm-1.2/base/uvm_packer.svh",

----------------------readme.md from official version ------------------------

The uvm_packer was re-worked after UVM1.2. If data is packed and the resulting bit- or byte-stream is subsequently unpacked, the unpack output will match the original data in both old and new versions, however the stream itself can be different between versions. If the value of the stream is important, the way to get user code compatible with multiple versions is to move to the uvm_compat_packer. As mentioned above, based on version defines, the uvm_compat_packer is either a typedef for the library version of uvm_packer or a new class that inherits from the library version and modifies functions as required.

How the user code is modified to use uvm_compat_packer depends on how the user code currently refers to uvm_packer. If, for example, the user code uses the default packer, then adding these lines to execute before the first usage of the packer will work:

  begin
     uvm_compat_pkg::uvm_compat_packer compat_packer = new();
     uvm_packer::set_default(compat_packer);
  end

Since 1.2 only had uvm_default_packer and 1800.2 uses uvm_packer::set_default(...), the compat packer should provide a uvm_compat_packer::set_default(...) that works in both.
We

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions