How to add leading zeros to a transaction print?

In reply to Raj Thummar:

You can specify the output width in the format string:


module testbench();
  string out_string;
  
  initial begin
    out_string = $sformatf("Padded value: %12h\n", 48'h70a3607f03);
    $display(out_string);
  end
endmodule