From 0dea0304affe0e54a5c496258a1896c1c9918a62 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Sat, 6 Aug 2022 14:51:23 -0400 Subject: [PATCH] pcs: tx: Process link failure synchronously There's no strict requirement for us to handle linke failures immediately. The PMA's link timer will ensure the signal stays low, so we don't have to worry about missing it. This fixes some strange Xs during initialization. Fixes: d351291 ("Initial commit") Signed-off-by: Sean Anderson --- rtl/pcs.v | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rtl/pcs.v b/rtl/pcs.v index 78b3159..1284228 100644 --- a/rtl/pcs.v +++ b/rtl/pcs.v @@ -209,14 +209,15 @@ module pcs_tx ( end endcase + if (!link_status) begin + tx_next = 0; + code_next = `CODE_I; + state_next = IDLE; + end end - always @(posedge clk, negedge link_status) begin - if (!link_status) begin - tx <= 0; - code <= `CODE_I; - state <= IDLE; - end else if (ce) begin + always @(posedge clk) begin + if (ce) begin last_data <= data; tx <= tx_next; code <= code_next;