How to add leading zeros to a transaction print?

da               integral          48    'h70a3607f03
sa               integral          48    'h17e813e940cb
ethtype          integral          16    'h7ac

For example, da field is 6 Bytes, but the print is 'h70a3607f03. I want it to display all 12 digits in HEX. Therefore, the print should display 'h0070a3607f03.

Is there a way to do this?

I have used do_print() method in the transaction class.

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);

In reply to Raj Thummar:

The UVM does not let you do this because the underlying uvm_field_int macros treat all integral values as 4096 bit packed array (See 0004999: uvm_printer doesn't provide mechanism for printing leading zeros - Accellera Mantis).

You would be much better off formatting the string yourself then trying to get the field automation macros to do it for you.

In reply to cgales:

Thank you for your response!

In reply to dave_59:

Thanks Dave, appreciate your prompt reply!