From 70be5e5d83e61bb8ed2d00c9854c1847fdc7e97f Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Fri, 18 Mar 2022 08:55:20 -0700 Subject: Ignore colons on inputs; use them to separate words in output. --- hdl/result_printer.sv | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'hdl/result_printer.sv') 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 (* syn_encoding = "one-hot" *) enum int unsigned { HIGH_NIBBLE , LOW_NIBBLE + , WORD_SEPARATOR } state; always @(posedge clock) begin @@ -50,12 +51,17 @@ module result_printer case (state) HIGH_NIBBLE: echo_data = b[7:4]; LOW_NIBBLE: echo_data = b[3:0]; + WORD_SEPARATOR: echo_data = ":"; endcase - if (echo_data < 10) - echo_data = echo_data + "0"; - else - echo_data = echo_data + "A" - 10; + if (state != WORD_SEPARATOR) begin + if (echo_data < 10) + echo_data = echo_data + "0"; + else + echo_data = echo_data + "A" - 10; + end state = state.next; + if (state == WORD_SEPARATOR && (byte_count != 1 || word_count == 1)) + state = state.next; if (state == state.first) begin byte_count = byte_count - 1; if (byte_count == 0) begin -- cgit v1.2.3