How to print hexadecimal numbers in upper case

In reply to Aaron_Cui:

SystemVerilog has a toupper() string method.

module top;
   logic [15:0] val = 16'hcafe;
   string sval;
   initial begin
      sval.hextoa(val);
      $display("val= %s", sval.toupper());
   end
endmodule

1 Like