From 3810298986cd81dac900af42789def1440edbd1e Mon Sep 17 00:00:00 2001 From: Ruige Lee Date: Thu, 8 May 2025 11:22:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5phy=E5=B1=82=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/scala/backBoard/shin/SlaveParser.scala | 13 ++++++++----- tb/shinTest/ShinTopTb.v | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/main/scala/backBoard/shin/SlaveParser.scala b/src/main/scala/backBoard/shin/SlaveParser.scala index c319a48..ae8f5de 100644 --- a/src/main/scala/backBoard/shin/SlaveParser.scala +++ b/src/main/scala/backBoard/shin/SlaveParser.scala @@ -572,13 +572,16 @@ trait SlaveParserSync{ this: SlaveParserBase => val syncCnt = Reg(UInt(4.W)) - when( isSync ){ - syncCnt := syncCnt + 1.U - } .otherwise{ - syncCnt := 0.U + when( downRecParser.io.rec.fire ){ + when( isSync ){ + syncCnt := syncCnt + 1.U + } .otherwise{ + syncCnt := 0.U + } } - when( isSync ){ + + when( isSync & downRecParser.io.rec.fire ){ when( syncCnt === 0.U ){ mstTimeStamp := Cat( mstTimeStamp(63, 8), downRecParser.io.data.bits ) } .elsewhen( syncCnt === 1.U ){ diff --git a/tb/shinTest/ShinTopTb.v b/tb/shinTest/ShinTopTb.v index 2b6329f..dcd86d5 100644 --- a/tb/shinTest/ShinTopTb.v +++ b/tb/shinTest/ShinTopTb.v @@ -514,6 +514,7 @@ initial begin #50000 #50000 #50000 + #50000 begin @@ -628,7 +629,21 @@ initial begin // 同步 - #200000 + #90000 + #90000 + #90000 + #90000 + #90000 + #90000 + #90000 + #90000 + #90000 + #90000 + #90000 + #90000 + #90000 + #90000 + begin