diff options
Diffstat (limited to '')
| -rw-r--r-- | hdl/command_parser.sv | 12 | ||||
| -rw-r--r-- | hdl/result_printer.sv | 14 |
2 files changed, 19 insertions, 7 deletions
diff --git a/hdl/command_parser.sv b/hdl/command_parser.sv index cf4fe65..964ac12 100644 --- a/hdl/command_parser.sv +++ b/hdl/command_parser.sv | |||
| @@ -91,7 +91,9 @@ module command_parser | |||
| 91 | end | 91 | end |
| 92 | 92 | ||
| 93 | READ_ADDRESS: if (input_byte_valid) begin | 93 | READ_ADDRESS: if (input_byte_valid) begin |
| 94 | if (input_byte >= "0" && input_byte <= "9") begin | 94 | if (input_byte == ":") begin |
| 95 | // ignore | ||
| 96 | end else if (input_byte >= "0" && input_byte <= "9") begin | ||
| 95 | command_data.address = command_data.address << 4; | 97 | command_data.address = command_data.address << 4; |
| 96 | command_data.address[$clog2(`RAM_LINE_WORDS)+:4] = input_byte - "0"; | 98 | command_data.address[$clog2(`RAM_LINE_WORDS)+:4] = input_byte - "0"; |
| 97 | end else if (input_byte >= "a" && input_byte <= "f") begin | 99 | end else if (input_byte >= "a" && input_byte <= "f") begin |
| @@ -109,7 +111,9 @@ module command_parser | |||
| 109 | READ_DATA: if (input_byte_valid) begin | 111 | READ_DATA: if (input_byte_valid) begin |
| 110 | automatic bit [$bits(command_data.data)-1:0] flat_data = command_data.data; | 112 | automatic bit [$bits(command_data.data)-1:0] flat_data = command_data.data; |
| 111 | flat_data = flat_data << 4; | 113 | flat_data = flat_data << 4; |
| 112 | if (input_byte >= "0" && input_byte <= "9") begin | 114 | if (input_byte == ":") begin |
| 115 | // ignore | ||
| 116 | end else if (input_byte >= "0" && input_byte <= "9") begin | ||
| 113 | flat_data[3:0] = input_byte - "0"; | 117 | flat_data[3:0] = input_byte - "0"; |
| 114 | command_data.data = flat_data; | 118 | command_data.data = flat_data; |
| 115 | end else if (input_byte >= "a" && input_byte <= "f") begin | 119 | end else if (input_byte >= "a" && input_byte <= "f") begin |
| @@ -126,7 +130,9 @@ module command_parser | |||
| 126 | end | 130 | end |
| 127 | 131 | ||
| 128 | READ_ZERO_COUNT: if (input_byte_valid) begin | 132 | READ_ZERO_COUNT: if (input_byte_valid) begin |
| 129 | if (input_byte >= "0" && input_byte <= "9") begin | 133 | if (input_byte == ":") begin |
| 134 | // ignore | ||
| 135 | end else if (input_byte >= "0" && input_byte <= "9") begin | ||
| 130 | zero_count = zero_count << 4; | 136 | zero_count = zero_count << 4; |
| 131 | zero_count[3:0] = input_byte - "0"; | 137 | zero_count[3:0] = input_byte - "0"; |
| 132 | end else if (input_byte >= "a" && input_byte <= "f") begin | 138 | end else if (input_byte >= "a" && input_byte <= "f") begin |
diff --git a/hdl/result_printer.sv b/hdl/result_printer.sv index 4f27d0e..6e1bd53 100644 --- a/hdl/result_printer.sv +++ b/hdl/result_printer.sv | |||
| @@ -21,6 +21,7 @@ module result_printer | |||
| 21 | (* syn_encoding = "one-hot" *) enum int unsigned | 21 | (* syn_encoding = "one-hot" *) enum int unsigned |
| 22 | { HIGH_NIBBLE | 22 | { HIGH_NIBBLE |
| 23 | , LOW_NIBBLE | 23 | , LOW_NIBBLE |
| 24 | , WORD_SEPARATOR | ||
| 24 | } state; | 25 | } state; |
| 25 | 26 | ||
| 26 | always @(posedge clock) begin | 27 | always @(posedge clock) begin |
| @@ -50,12 +51,17 @@ module result_printer | |||
| 50 | case (state) | 51 | case (state) |
| 51 | HIGH_NIBBLE: echo_data = b[7:4]; | 52 | HIGH_NIBBLE: echo_data = b[7:4]; |
| 52 | LOW_NIBBLE: echo_data = b[3:0]; | 53 | LOW_NIBBLE: echo_data = b[3:0]; |
| 54 | WORD_SEPARATOR: echo_data = ":"; | ||
| 53 | endcase | 55 | endcase |
| 54 | if (echo_data < 10) | 56 | if (state != WORD_SEPARATOR) begin |
| 55 | echo_data = echo_data + "0"; | 57 | if (echo_data < 10) |
| 56 | else | 58 | echo_data = echo_data + "0"; |
| 57 | echo_data = echo_data + "A" - 10; | 59 | else |
| 60 | echo_data = echo_data + "A" - 10; | ||
| 61 | end | ||
| 58 | state = state.next; | 62 | state = state.next; |
| 63 | if (state == WORD_SEPARATOR && (byte_count != 1 || word_count == 1)) | ||
| 64 | state = state.next; | ||
| 59 | if (state == state.first) begin | 65 | if (state == state.first) begin |
| 60 | byte_count = byte_count - 1; | 66 | byte_count = byte_count - 1; |
| 61 | if (byte_count == 0) begin | 67 | if (byte_count == 0) begin |
