Skip to content

Commit

Permalink
Fix a DTIM X-prop issue (#2822)
Browse files Browse the repository at this point in the history
* Fix a DTIM X-prop issue

Convert PutPartials to PutFulls when the mask is full to avoid RMW.

* Rework ScratchpadSlavePort fix, since it dovetails with DTIM fix

Co-authored-by: Andrew Waterman <andrew@sifive.com>
  • Loading branch information
ingallsj and aswaterman authored Apr 19, 2021
1 parent d56e216 commit 86a2f2c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/scala/rocket/ScratchpadSlavePort.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ class ScratchpadSlavePort(address: Seq[AddressSet], coreDataBytes: Int, usingAto
TLAtomics.AND -> M_XA_AND,
TLAtomics.SWAP -> M_XA_SWAP)),
TLMessages.Get -> M_XRD))

// Convert full PutPartial into PutFull to work around RMWs causing X-prop problems.
// Also prevent cmd becoming X out of reset by checking for s_init.
val mask_full = {
val desired_mask = new StoreGen(a.size, a.address, 0.U, coreDataBytes).mask
(a.mask | ~desired_mask).andR
}
when (state === s_init || (a.opcode === TLMessages.PutPartialData && mask_full)) {
req.cmd := M_XWR
}

req.size := a.size
req.signed := false
req.addr := a.address
Expand All @@ -91,7 +102,6 @@ class ScratchpadSlavePort(address: Seq[AddressSet], coreDataBytes: Int, usingAto
io.dmem.req.valid := dmem_req_valid_likely
tl_in.a.ready := io.dmem.req.ready && ready
io.dmem.req.bits := formCacheReq(Mux(state === s_replay, acq, tl_in.a.bits))
when (state === s_init) { io.dmem.req.bits.cmd := M_XRD } // To fix an X-pessimism problem, don't let cmd become X
io.dmem.s1_data.data := acq.data
io.dmem.s1_data.mask := acq.mask
io.dmem.s1_kill := state =/= s_wait1
Expand Down

0 comments on commit 86a2f2c

Please sign in to comment.