From 827bbb2852771e34b7c15b29add0938624db0d7d Mon Sep 17 00:00:00 2001 From: Ruige Lee Date: Tue, 19 Aug 2025 15:19:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=BB=E7=AB=99CRC?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E9=80=BB=E8=BE=91=EF=BC=88=E6=AC=A0=E4=B8=80?= =?UTF-8?q?=E6=8B=8D=EF=BC=89=EF=BC=9B=E5=A2=9E=E5=8A=A022=E5=8F=B7?= =?UTF-8?q?=E5=AF=84=E5=AD=98=E5=99=A8=EF=BC=8C=E6=8F=90=E7=A4=BA=E4=B8=BB?= =?UTF-8?q?=E7=AB=99=E6=8E=A5=E6=94=B6CRC=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/scala/backBoard/shin/Interface.scala | 12 ++++++++++++ src/main/scala/backBoard/shin/MasterParser.scala | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/scala/backBoard/shin/Interface.scala b/src/main/scala/backBoard/shin/Interface.scala index 7319745..54480c3 100644 --- a/src/main/scala/backBoard/shin/Interface.scala +++ b/src/main/scala/backBoard/shin/Interface.scala @@ -114,6 +114,7 @@ class MasterRegisterBundle extends Bundle{ val txSM = UInt(2.W) val rxSM = UInt(2.W) + val isRecCRCErr = UInt(4.W) val rplTimeStampTx = UInt(16.W) } @@ -264,6 +265,7 @@ abstract class InterfaceBase extends Module{ Seq( (addr === "h20".U & isMstMode) -> Cat(mReg.rxSM, mReg.txSM, 0.U(1.W) ), + (addr === "h22".U & isMstMode) -> mReg.isRecCRCErr, //(addr === "h21".U & isMstMode) -> mReg.txLength, (addr === "h24".U & isMstMode) -> mReg.rplTimeStampTx(7,0), @@ -635,6 +637,16 @@ trait InterfaceMCUop{ this: InterfaceBase => mReg.rxSM := RegEnable( dataw(4,3), 0.U(2.W), isEnW & addrw === "h20".U ) // mReg.txLength := Cat( RegEnable( dataw, 0.U, isEnW & addrw === "h22".U ), RegEnable( dataw, 0.U, isEnW & addrw === "h21".U ) ) + val isMstRecCRCErr = RegInit(0.U(4.W)) + mReg.isRecCRCErr := isMstRecCRCErr + when( isEnW & addrw === "h22".U(16.W) ){ + isMstRecCRCErr := 0.U + } .elsewhen( io.upRecStat.isCRCError & isMstMode ){ + isMstRecCRCErr := isMstRecCRCErr | (1.U << mReg.rxSM) + } + + + ( 0 until 128 ).map{ i => cReg.custom(i) := RegEnable( dataw, 0.U(8.W), isEnW & (addrw === ("h180".U(16.W) + i.U)) ) } diff --git a/src/main/scala/backBoard/shin/MasterParser.scala b/src/main/scala/backBoard/shin/MasterParser.scala index 4587998..7d1be5e 100644 --- a/src/main/scala/backBoard/shin/MasterParser.scala +++ b/src/main/scala/backBoard/shin/MasterParser.scala @@ -154,7 +154,7 @@ abstract class MasterParserBase extends Module{ io.rsp.valid := io.upIn.fire & io.upIn.bits.tlast - io.rsp.bits.isError := io.upIn.fire & io.upIn.bits.tlast & recCrcCheck =/= rxcrc.io.crc + io.rsp.bits.isError := io.upIn.fire & io.upIn.bits.tlast & (Cat( recCrcCheck(31,8), io.upIn.bits.tdata ) =/= rxcrc.io.crc) // io.rsp.bits.length := rxCnt + 1.U