Skip to content

Commit

Permalink
fix(TXDAT): fix BE of CopyBackWrData_I (#297)
Browse files Browse the repository at this point in the history
According to CHI spec, a requester must deassert all BE values in
CopyBackWrData_I and WriteDataCancal packets. Besides, in WriteData and
Snoop response Data a byte enable value of zero must set the associated
data byte value to zero.

Co-authored-by: zhanglinjuan <zhanglinjuan16@mails.ucas.ac.cn>
  • Loading branch information
Kumonda221-CrO3 and linjuanZ authored Dec 12, 2024
1 parent 494c7f8 commit e946a9a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/main/scala/coupledL2/tl2chi/TXDAT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ import chisel3.util._
import utility._
import org.chipsalliance.cde.config.Parameters
import coupledL2.{TaskWithData, TaskBundle, DSBlock, DSBeat}
import coupledL2.tl2chi.CHICohStates._

class TXDATBlockBundle(implicit p: Parameters) extends TXBlockBundle {
val blockSinkBReqEntrance = Bool()

override def apply() = 0.U.asTypeOf(this)
}

class TXDAT(implicit p: Parameters) extends TL2CHIL2Module {
class TXDAT(implicit p: Parameters) extends TL2CHIL2Module with HasCHIOpcodes {
val io = IO(new Bundle() {
val in = Flipped(DecoupledIO(new TaskWithData()))
val out = DecoupledIO(new CHIDAT())
Expand Down Expand Up @@ -117,6 +118,11 @@ class TXDAT(implicit p: Parameters) extends TL2CHIL2Module {
(next_beat, next_beatsOH)
}

def deassertData(data: UInt, mask: UInt): UInt = {
require(data.getWidth == mask.getWidth * 8)
FillInterleaved(8, mask) & data
}

def toCHIDATBundle(task: TaskBundle, beat: UInt, beatsOH: UInt): CHIDAT = {
val dat = WireInit(0.U.asTypeOf(new CHIDAT()))

Expand All @@ -137,6 +143,10 @@ class TXDAT(implicit p: Parameters) extends TL2CHIL2Module {
0.U(DATACHECK_WIDTH.W)
}

val deassertBE = task.chiOpcode.get === CopyBackWrData && task.resp.get === I ||
task.chiOpcode.get === WriteDataCancel
val be = Fill(BE_WIDTH, !deassertBE)

dat.tgtID := task.tgtID.get
dat.srcID := task.srcID.get
dat.txnID := task.txnID.get
Expand All @@ -151,8 +161,8 @@ class TXDAT(implicit p: Parameters) extends TL2CHIL2Module {
beatsOH,
List.tabulate(beatSize)(i => (i << (beatOffsetWidth - chunkOffsetWidth)).U)
)
dat.be := Fill(BE_WIDTH, 1.U(1.W))
dat.data := beat
dat.be := be
dat.data := deassertData(beat, be)
dat.resp := task.resp.get
dat.fwdState := task.fwdState.get
dat.traceTag := task.traceTag.get
Expand Down

0 comments on commit e946a9a

Please sign in to comment.