如何在 SystemVerilog 中 display/print 将类型解压为十六进制?

How to display/print unpacked type as hexadecimal in SystemVerilog?

我有一个解压缩的 int 数组:

int wanna_print [];
wanna_print = new[1];

可以这样打印:

$display("in hex: c86E [in dec: 51310] == %p", wanna_print[0]);

它将以十进制打印,但我需要十六进制。

我尝试了 %0h%h 而不是 %p,但它给出了这个错误:

Argument number 2 is an unpacked type, and may only be printed with the '%p' format.

如何以 十六进制 打印它? 可以 %p 以某种方式扩展吗?

我也试过$sformatf,但效果一样。

使用 $displayh 适用于我的 VCS:

module tb;

int wanna_print [];

initial begin
    wanna_print = new[1];
    wanna_print[0] = 51310;
    $displayh("in hex: c86E [in dec: 51310] == %p", wanna_print[0]);
end

endmodule

输出:

in hex: c86E [in dec: 51310] == 0000c86e

$displayh 在 IEEE 标准 1800-2017,第 21.2.1.2 节中描述 格式规范.

但是,我在使用 Cadence 时遇到编译错误。