Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • soclabs/nanosoc_tech
1 result
Show changes
Commits on Source (2)
Subproject commit aa64ace1bb88e1c396f6bae6fb34de2af57a980f
Subproject commit 7572912a3cde67880b0579db6f2e970ebaf2002d
......@@ -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
......