OpenCores
Issue List
orpsocv2 uart_decoder starts on X #74
Closed balau opened this issue over 14 years ago
balau commented over 14 years ago

The uart-nocache test, when launched with "UART_PRINTF=1", prints gibberish (it should print "Hello World.") because uart_decoder task starts decoding at the first X (beginning of the simulation) instead of waiting for the start bit. Here is a patch (svn diff) that fixes the problem:

Index: uart_decoder.v

--- uart_decoder.v (revision 59) +++ uart_decoder.v (working copy) @@ -74,9 +74,12 @@ task uart_decoder; reg 7:0 tx_byte; begin

+

  • while (`UART_TX_LINE !== 1'b1)
  •       @(`UART_TX_LINE);
  •  // Wait for start bit
  • while (`UART_TX_LINE == 1'b1)
  • while (UART_TX_LINE !== 1'b0) @(UART_TX_LINE); #(UART_TX_WAIT+(UART_TX_WAIT/2)); tx_byte0 = UART_TX_LINE; @@ -96,11 +99,11 @@ tx_byte[7] =UART_TX_LINE; #UART_TX_WAIT; //Check for stop bit
  • if (`UART_TX_LINE == 1'b0)
  • if (`UART_TX_LINE !== 1'b1) begin //$display("* WARNING: user stop bit not received when expected at time %d__", $time); // Wait for return to idle
  •   while (`UART_TX_LINE == 1'b0)
  •   while (`UART_TX_LINE !== 1'b1)
    @(`UART_TX_LINE);
      //$display("* USER UART returned to idle at time %d",$time);
    end
julius was assigned about 14 years ago
julius commented about 14 years ago

Applied to ORSPoCv2 and it appears to work. Thanks.

julius closed this about 14 years ago

Assignee
julius
Labels
Bug