fix(SRAM.scala): change x_sel_1 RegNext to Reg(Bool()) #3733
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue:
Type of change: bug report
Impact: no functional change
Development Phase: implementation
Release Notes
File Changed: SRAM.scala
The code involved is as follows:
Change Description: In the original code within the SRAM.scala file, the signals r_sel_1 and w_sel_1 were being assigned values based on the rising edge of the clock using in.ax.bits.addr. Consequently, the rresp and wresp wire signals, which are directly controlled by r_sel_1 and w_sel_1, could result in incorrect behavior where the response signals did not accurately reflect the addr signal captured upon the successful handshake of the read address channel. This could potentially lead to an incorrect RESP_DECERR condition.
Detailed Explanation: Consider a scenario where the addr_read channel handshake is completed. Post-handshake, the raddr signal could theoretically take any value (as long as rvalid is 0), for instance, it could change to 0. The previous code version could inadvertently cause rresp to incorrectly transition to a value of 3 under such circumstances. If the master’s rready signal does not immediately assert to 1, but instead is delayed by one or more clock cycles, the response captured at the time of the successful read channel handshake could be 3. According to the AXI4 specification, a response value of 3 indicates that the rdata associated with the transaction is invalid.
Fix Implemented: The assignment of r_sel_1 and w_sel_1 has been modified to ensure that the rresp and wresp signals accurately reflect the addr signal captured at the moment of the successful read address channel handshake. This change prevents the occurrence of an invalid response code (3) being incorrectly assigned to rresp when the rready signal is delayed, thereby maintaining protocol compliance and data integrity as per the AXI4 specification.