From 601cccd3dc579c946b850b9e3d57c43123615494 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Sat, 4 Mar 2023 16:43:32 -0500 Subject: [PATCH] uart_rx: Add state machine debug Add a textual description of the state machine for easier debugging. Signed-off-by: Sean Anderson --- rtl/uart_rx.v | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/rtl/uart_rx.v b/rtl/uart_rx.v index 7d23c8a..5a0cd2a 100644 --- a/rtl/uart_rx.v +++ b/rtl/uart_rx.v @@ -118,4 +118,26 @@ module uart_rx ( end end +`ifndef SYNTHESIS + reg [255:0] state_text; + + always @(*) begin + case (state) + ERROR: state_text = "ERROR"; + IDLE: state_text = "IDLE"; + START: state_text = "START"; + D0: state_text = "D0"; + D1: state_text = "D1"; + D2: state_text = "D2"; + D3: state_text = "D3"; + D4: state_text = "D4"; + D5: state_text = "D5"; + D6: state_text = "D6"; + D7: state_text = "D7"; + STOP: state_text = "STOP"; + endcase + end +`endif + + endmodule