Browse Source

fix(transport): eliminate hierarchical reference u_frame_rx.state in host_uart_endpoint

- Add hunting_o port to frame_rx.v
- Connect hunting_o to parser_hunting in host_uart_endpoint.v
- Clean up implicit wire warning
Prod2U Recovery 2 months ago
parent
commit
fa83b719ad
2 changed files with 9 additions and 4 deletions
  1. 3 1
      src/common/frame_rx.v
  2. 6 3
      src/transport/host_uart_endpoint.v

+ 3 - 1
src/common/frame_rx.v

@@ -35,13 +35,15 @@ module frame_rx #(
     output wire [7:0] crc_data_o,
     output wire [7:0] crc_data_o,
     input  wire       crc_busy_i,
     input  wire       crc_busy_i,
     input  wire       crc_data_done_i,
     input  wire       crc_data_done_i,
-    input  wire [15:0] crc_value_i
+    input  wire [15:0] crc_value_i,
+    output wire       hunting_o
 `ifdef FORMAL
 `ifdef FORMAL
     , output wire formal_crc_accepted_o
     , output wire formal_crc_accepted_o
     , output wire formal_bad_crc_event_o
     , output wire formal_bad_crc_event_o
 `endif
 `endif
 );
 );
     localparam [3:0] ST_WAIT_A5 = 4'd0;
     localparam [3:0] ST_WAIT_A5 = 4'd0;
+    assign hunting_o = (state == ST_WAIT_A5);
     localparam [3:0] ST_WAIT_5A = 4'd1;
     localparam [3:0] ST_WAIT_5A = 4'd1;
     localparam integer USE_LENGTH8 = (LENGTH_BYTES == 1);
     localparam integer USE_LENGTH8 = (LENGTH_BYTES == 1);
     localparam [3:0] ST_TYPE = 4'd2;
     localparam [3:0] ST_TYPE = 4'd2;

+ 6 - 3
src/transport/host_uart_endpoint.v

@@ -130,6 +130,8 @@ module host_uart_endpoint #(
         .data_done(rx_crc_data_done), .crc(rx_crc_value)
         .data_done(rx_crc_data_done), .crc(rx_crc_value)
     );
     );
 
 
+    wire parser_hunting;
+
     frame_rx #(
     frame_rx #(
         .MAX_PAYLOAD(MAX_PAYLOAD),
         .MAX_PAYLOAD(MAX_PAYLOAD),
         .INTER_BYTE_TIMEOUT_CYCLES(INTER_BYTE_TIMEOUT_CYCLES),
         .INTER_BYTE_TIMEOUT_CYCLES(INTER_BYTE_TIMEOUT_CYCLES),
@@ -148,7 +150,8 @@ module host_uart_endpoint #(
         .crc_start_o(rx_crc_start), .crc_data_valid_o(rx_crc_data_valid),
         .crc_start_o(rx_crc_start), .crc_data_valid_o(rx_crc_data_valid),
         .crc_data_o(rx_crc_data),
         .crc_data_o(rx_crc_data),
         .crc_busy_i(rx_crc_busy), .crc_data_done_i(rx_crc_data_done),
         .crc_busy_i(rx_crc_busy), .crc_data_done_i(rx_crc_data_done),
-        .crc_value_i(rx_crc_value)
+        .crc_value_i(rx_crc_value),
+        .hunting_o(parser_hunting)
     );
     );
 
 
     // The parser holds its frame on frame_valid until the endpoint
     // The parser holds its frame on frame_valid until the endpoint
@@ -174,7 +177,7 @@ module host_uart_endpoint #(
     // (seen != hunting), so ownership survives the idle line between
     // (seen != hunting), so ownership survives the idle line between
     // the claim edge and the first byte of the frame.
     // the claim edge and the first byte of the frame.
     reg parser_busy_seen;
     reg parser_busy_seen;
-    wire parser_idle = (u_frame_rx.state == 4'd0) && !parser_frame_valid &&
+    wire parser_idle = parser_hunting && !parser_frame_valid &&
         parser_busy_seen;
         parser_busy_seen;
 
 
     always @(posedge clk or negedge rst_n) begin
     always @(posedge clk or negedge rst_n) begin
@@ -197,7 +200,7 @@ module host_uart_endpoint #(
             ttl_rx_sync1 <= ttl_rx_sync0;
             ttl_rx_sync1 <= ttl_rx_sync0;
             rs232_rx_prev <= rs232_rx_sync1;
             rs232_rx_prev <= rs232_rx_sync1;
             ttl_rx_prev <= ttl_rx_sync1;
             ttl_rx_prev <= ttl_rx_sync1;
-            if (u_frame_rx.state != 4'd0)
+            if (!parser_hunting)
                 parser_busy_seen <= 1'b1;
                 parser_busy_seen <= 1'b1;
             else if (rx_owner == OWNER_NONE)
             else if (rx_owner == OWNER_NONE)
                 parser_busy_seen <= 1'b0;
                 parser_busy_seen <= 1'b0;