Save pre-TMEM-bank Radiance changes
This commit is contained in:
@@ -1197,18 +1197,6 @@ class VortexTLAdapter(
|
||||
val outResp = chiselTypeOf(outTL._1.d)
|
||||
})
|
||||
val (bundle, edge) = outTL
|
||||
val sourceGen = Module(
|
||||
new SourceGenerator(
|
||||
newSourceWidth,
|
||||
Some(inReqT.source),
|
||||
ignoreInUse = false
|
||||
)
|
||||
)
|
||||
sourceGen.io.gen := io.outReq.fire // use up a source ID only when request is created
|
||||
sourceGen.io.reclaim.valid := io.outResp.fire
|
||||
sourceGen.io.reclaim.bits := io.outResp.bits.source
|
||||
sourceGen.io.meta := io.inReq.bits.source
|
||||
|
||||
// io passthrough logic
|
||||
// TLBundleA <> VortexBundleA
|
||||
io.outReq.valid := io.inReq.valid
|
||||
@@ -1217,29 +1205,70 @@ class VortexTLAdapter(
|
||||
io.outReq.bits.size := io.inReq.bits.size
|
||||
io.outReq.bits.source := io.inReq.bits.source
|
||||
io.outReq.bits.address := io.inReq.bits.address
|
||||
// Get requires contiguous mask; only copy core's potentially-partial mask
|
||||
// when writing
|
||||
val outMaskWidth = io.outReq.bits.mask.getWidth
|
||||
val inMaskWidth = io.inReq.bits.mask.getWidth
|
||||
val outDataWidth = io.outReq.bits.data.getWidth
|
||||
val inDataWidth = io.inReq.bits.data.getWidth
|
||||
val byteOffset = io.inReq.bits.address(log2Ceil(outMaskWidth) - 1, 0)
|
||||
val responseOffsetWidth = log2Ceil(outMaskWidth)
|
||||
val responseSourceWidth = inReqT.source.getWidth
|
||||
val sourceGen = Module(
|
||||
new SourceGenerator(
|
||||
newSourceWidth,
|
||||
Some(UInt((responseSourceWidth + responseOffsetWidth).W)),
|
||||
ignoreInUse = false
|
||||
)
|
||||
)
|
||||
sourceGen.io.gen := io.outReq.fire // use up a source ID only when request is created
|
||||
sourceGen.io.reclaim.valid := io.outResp.fire
|
||||
sourceGen.io.reclaim.bits := io.outResp.bits.source
|
||||
sourceGen.io.meta := Cat(byteOffset, io.inReq.bits.source)
|
||||
|
||||
val alignedMask = Wire(UInt(outMaskWidth.W))
|
||||
val alignedData = Wire(UInt(outDataWidth.W))
|
||||
if (outMaskWidth == inMaskWidth) {
|
||||
alignedMask := io.inReq.bits.mask
|
||||
} else {
|
||||
val paddedMask = Wire(UInt(outMaskWidth.W))
|
||||
paddedMask := io.inReq.bits.mask
|
||||
alignedMask := (paddedMask << byteOffset)(outMaskWidth - 1, 0)
|
||||
}
|
||||
if (outDataWidth == inDataWidth) {
|
||||
alignedData := io.inReq.bits.data
|
||||
} else {
|
||||
val paddedData = Wire(UInt(outDataWidth.W))
|
||||
paddedData := io.inReq.bits.data
|
||||
alignedData := (paddedData << (byteOffset << 3))(outDataWidth - 1, 0)
|
||||
}
|
||||
|
||||
// PutFull requires the TL-canonical full mask for address+size; PutPartial
|
||||
// can carry the core-provided byte mask.
|
||||
io.outReq.bits.mask := Mux(
|
||||
edge.hasData(io.outReq.bits),
|
||||
io.inReq.bits.mask,
|
||||
// generate TL-correct mask
|
||||
io.outReq.bits.opcode === TLMessages.PutPartialData,
|
||||
alignedMask,
|
||||
edge.mask(io.inReq.bits.address, io.inReq.bits.size)
|
||||
)
|
||||
io.outReq.bits.data := io.inReq.bits.data
|
||||
io.outReq.bits.data := alignedData
|
||||
io.outReq.bits.corrupt := 0.U
|
||||
io.inReq.ready := io.outReq.ready
|
||||
// VortexBundleD <> TLBundleD
|
||||
io.inResp.valid := io.outResp.valid
|
||||
io.inResp.bits.opcode := io.outResp.bits.opcode
|
||||
io.inResp.bits.size := io.outResp.bits.size
|
||||
io.inResp.bits.source := io.outResp.bits.source
|
||||
io.inResp.bits.data := io.outResp.bits.data
|
||||
val responseMeta = sourceGen.io.peek.asUInt
|
||||
val responseSource = responseMeta(responseSourceWidth - 1, 0)
|
||||
val responseByteOffset =
|
||||
responseMeta(responseSourceWidth + responseOffsetWidth - 1, responseSourceWidth)
|
||||
io.inResp.bits.source := responseSource
|
||||
if (outDataWidth == inDataWidth) {
|
||||
io.inResp.bits.data := io.outResp.bits.data
|
||||
} else {
|
||||
io.inResp.bits.data := (io.outResp.bits.data >> (responseByteOffset << 3))(inDataWidth - 1, 0)
|
||||
}
|
||||
io.outResp.ready := io.inResp.ready
|
||||
|
||||
// "man-in-the-middle"
|
||||
io.inReq.ready := io.outReq.ready && sourceGen.io.id.valid
|
||||
io.outReq.valid := io.inReq.valid && sourceGen.io.id.valid
|
||||
io.outReq.bits.source := sourceGen.io.id.bits
|
||||
// translate upstream response back to its old sourceId
|
||||
io.inResp.bits.source := sourceGen.io.peek
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user