在32数据通道下传输正确

This commit is contained in:
RuigeLee
2023-10-20 20:56:44 +08:00
parent f17d405369
commit 69ccc32603
4 changed files with 53 additions and 15 deletions

View File

@@ -53,7 +53,7 @@ class SwitchMux(edgeOut: TLEdgeOut)(implicit p: Parameters) extends SwitchModule
def ptr = "h80002000".U
def txLength = 8.U
def txLength = 64.U
def PerPacketCrcEn = true.B
def PerPacketPad = true.B
@@ -93,7 +93,7 @@ class SwitchMux(edgeOut: TLEdgeOut)(implicit p: Parameters) extends SwitchModule
val dmaAddress = Reg( UInt(32.W) )
when( stateCur === stateIdle && stateNxt =/= stateIdle ){
when( stateCur === stateIdle ){
dmaAddress := ptr
} .elsewhen( io.dmaMst.A.fire ){
dmaAddress := dmaAddress + 4.U

View File

@@ -35,21 +35,57 @@ class TxBuffIO extends Bundle{
}
class TxBuff extends Module{
abstract class TxBuffBase extends Module{
val io: TxBuffIO = IO(new TxBuffIO)
io.enq.data.ready := true.B
io.enq.req.ready := true.B
io.enq.resp.valid := false.B
io.enq.resp.bits := DontCare
io.deq.data.valid := false.B
io.deq.data.bits := 0.U
val buff = Module(new Queue( UInt(32.W), 2048/4 ))
val reqInfo = Reg(new Transmit_Req_Bundle)
val respInfo = Reg(new Transmit_Resp_Bundle)
val enqCnt = Reg(UInt(16.W))
val deqReqValid = RegInit(false.B)
io.deq.req.valid := false.B
io.deq.req.bits := DontCare
io.deq.resp.ready := true.B
}
trait TxBuffEnq{ this: TxBuffBase =>
io.enq.data <> buff.io.enq
when( io.enq.req.fire ){
enqCnt := 0.U
reqInfo := io.enq.req.bits
} .elsewhen( io.enq.data.fire ){
enqCnt := enqCnt + 4.U
// when( enqCnt + 4.U >= reqInfo.txLength ){
// }
}
io.enq.req.ready := ~buff.io.deq.valid
when( io.deq.req.fire ){
deqReqValid := false.B
} .elsewhen( io.enq.data.fire && enqCnt === 32.U ) {
deqReqValid := true.B
}
}
trait TxBuffDeq{ this: TxBuffBase =>
io.deq.resp <> io.enq.resp
io.deq.req.valid := deqReqValid
io.deq.req.bits := reqInfo
io.deq.data <> buff.io.deq
}
class TxBuff extends TxBuffBase with TxBuffEnq with TxBuffDeq

View File

@@ -112,8 +112,10 @@ class MacTileLinkTx extends Module with RequireAsyncReset{
TxByteCnt := TxByteCnt + 1.U
}
when(io.TxStartFrm_sync & ~TxStartFrm | io.TxUsedData & Flop & TxByteCnt === 3.U &
~LastWord | TxStartFrm & io.TxUsedData & Flop & TxByteCnt === 0.U ){
when(
io.TxStartFrm_sync & ~TxStartFrm |
io.TxUsedData & Flop & TxByteCnt === 3.U & ~LastWord |
TxStartFrm & io.TxUsedData & Flop & TxByteCnt === 0.U ){
ReadTxDataFromFifo_tck := true.B
} .elsewhen(io.ReadTxDataFromFifo_syncb & ~RegNext(io.ReadTxDataFromFifo_syncb, false.B)){
ReadTxDataFromFifo_tck := false.B

View File

@@ -144,7 +144,7 @@ abstract class MacTileLinkBase() extends Module{
}
when((TxLength === 0.U) & io.TxUsedData){
when(((TxLength - 4.U) === 0.U) & io.TxUsedData){
TxEndFrm_wb := true.B
} .elsewhen(txRetryPulse | txDonePulse | txAbortPulse){
TxEndFrm_wb := false.B