$sformatf with unpacked type

Hi,

I am trying to display the the content of my queue as hexadecimal all I get is are decimal values:

Case A: $sformatf with UVM_INFO

        `uvm_info("LRU", $sformatf("Contents: %0p", lru), UVM_HIGH)

Result: Decimal output

UVM_INFO sv/tb_mmu_refmodel.sv(5160) @ 968965000: reporter [LRU] Contents: 833 257 818 418

Case B: $displayh

        $displayh("Contents: %0p", lru);

Result: Hex output but not inside UVM_INFO

Contents: 341 101 332 1a2

Case C: $sformatf with %x or %h with UVM_INFO

        `uvm_info("LRU", $sformatf("Contents: %0x", lru), UVM_HIGH)
        `uvm_info("LRU", $sformatf("Contents: %0h", lru), UVM_HIGH)

Result: Error
tb_mmu_refmodel.sv(5162): $sformatf : Argument is an unpacked type, and may only be printed with the ‘%p’ format.

So how to display an unpacked type with $sformat in hex ?

Thank you in advance

In reply to Ep1c F4iL:

You have to use $swriteh(tmp_string,“%p”,lru); and then use tmp_string in your `umm_info statement.

You can put this in a function (like convert2string) so you do not incur the overhead unless the message is enabled.

In reply to dave_59:

Ok that is neat and working
On a side note this is the difference with %p and %0p with my LRU queue

UVM_INFO tb_mmu_refmodel.sv(5193) @ 473515000: reporter [LRU] Contents: '{000000c3, 000001d3, 00000262, 000002c1}

UVM_INFO tb_mmu_refmodel.sv(5191) @ 473515000: reporter [LRU] Contents: c3 1d3 262 2c1

Thank you