diff --git a/verif/trace/verilog/nanosoc_axi_stream_io_8_txd_from_file.v b/verif/trace/verilog/nanosoc_axi_stream_io_8_txd_from_file.v
index 76d41cbe0b32ee3ae8abe43bfd28e0a5e23caddd..e62e3e5ea0157d3c1b60063da37366319946e589 100644
--- a/verif/trace/verilog/nanosoc_axi_stream_io_8_txd_from_file.v
+++ b/verif/trace/verilog/nanosoc_axi_stream_io_8_txd_from_file.v
@@ -27,6 +27,28 @@ module nanosoc_axi_stream_io_8_txd_from_file
   output wire  [7:0] txd8_data
   );
 
+function [7:0] FNmap_hex_digit;
+input [3:0] nibble;
+case (nibble[3:0])
+4'b0000: FNmap_hex_digit = "0" & 8'hff;
+4'b0001: FNmap_hex_digit = "1" & 8'hff;
+4'b0010: FNmap_hex_digit = "2" & 8'hff;
+4'b0011: FNmap_hex_digit = "3" & 8'hff;
+4'b0100: FNmap_hex_digit = "4" & 8'hff;
+4'b0101: FNmap_hex_digit = "5" & 8'hff;
+4'b0110: FNmap_hex_digit = "6" & 8'hff;
+4'b0111: FNmap_hex_digit = "7" & 8'hff;
+4'b1000: FNmap_hex_digit = "8" & 8'hff;
+4'b1001: FNmap_hex_digit = "9" & 8'hff;
+4'b1010: FNmap_hex_digit = "a" & 8'hff;
+4'b1011: FNmap_hex_digit = "b" & 8'hff;
+4'b1100: FNmap_hex_digit = "c" & 8'hff;
+4'b1101: FNmap_hex_digit = "d" & 8'hff;
+4'b1110: FNmap_hex_digit = "e" & 8'hff;
+4'b1111: FNmap_hex_digit = "f" & 8'hff;
+//default: FNmap_hex_digit = "0" & 8'hff;
+endcase
+endfunction
 
  //----------------------------------------------
  //-- File I/O
@@ -84,11 +106,11 @@ localparam BUFSIZE = (64 * 1024);
        adpbuf[11] = 8'h0a; // newline
        adpbuf[12] = "U"; // set upload filesize (N bytes)
        adpbuf[13] = " "; // only up to 1Mbyte for now!
-       adpbuf[14] = "0" + codesize[19:16]; //
-       adpbuf[15] = "0" + codesize[15:12]; //
-       adpbuf[16] = "0" + codesize[11: 8]; //
-       adpbuf[17] = "0" + codesize[ 7: 4]; //
-       adpbuf[18] = "0" + codesize[ 3: 0]; //
+       adpbuf[14] = FNmap_hex_digit(codesize[19:16]); //
+       adpbuf[15] = FNmap_hex_digit(codesize[15:12]); //
+       adpbuf[16] = FNmap_hex_digit(codesize[11: 8]); //
+       adpbuf[17] = FNmap_hex_digit(codesize[ 7: 4]); //
+       adpbuf[18] = FNmap_hex_digit(codesize[ 3: 0]); //
        adpbuf[19] = 8'h0a; // newline
        $readmemh(CODEFILENAME, adpbuf, 20);
        adpbuf[clen+20] = "C"; // control