latch事件寄存器编译通过
This commit is contained in:
@@ -33,19 +33,6 @@ class CommonRegisterBundle extends Bundle{
|
||||
val intStatus = UInt(32.W)
|
||||
val intMode = UInt(16.W)
|
||||
|
||||
|
||||
// val upRecErrorCnt = UInt(32.W)
|
||||
// val downRecErrorCnt = UInt(32.W)
|
||||
// val upForwardErrorCnt = UInt(32.W)
|
||||
// val downForwardErrorCnt = UInt(32.W)
|
||||
|
||||
// val qspiErrorCnt = UInt(32.W)
|
||||
// val forwardCnt = UInt(32.W)
|
||||
// val recByteCnt = UInt(32.W)
|
||||
// val forwardByteCnt = UInt(32.W)
|
||||
|
||||
|
||||
|
||||
val wdtStatus = UInt(32.W)
|
||||
val wdtEnable = UInt(32.W)
|
||||
val wdtTarCnt = Vec( 17, UInt(32.W) )
|
||||
@@ -61,48 +48,33 @@ class CommonRegisterBundle extends Bundle{
|
||||
val smUsedDepth = Vec(8, UInt(8.W))
|
||||
val smTrigLen = Vec(8, UInt(11.W)) //触发SM切换缓冲区的地址 (或读或写)
|
||||
|
||||
|
||||
val event = new Bundle{
|
||||
val latchCtl = Vec(2, UInt(4.W))
|
||||
val latchStatus = Vec(2, UInt(4.W))
|
||||
val posedgeTimeStampLatch = Vec(2, UInt(64.W))
|
||||
val negedgeTimeStampLatch = Vec(2, UInt(64.W))
|
||||
val mcuSMTimeStampEnq = UInt(64.W)
|
||||
val mcuSMTimeStampDeq = UInt(64.W)
|
||||
val lvdsSMTimeStampEnq = UInt(64.W)
|
||||
val lvdsSMTimeStampDeq = UInt(64.W)
|
||||
}
|
||||
}
|
||||
|
||||
class MasterRegisterBundle extends Bundle{
|
||||
|
||||
|
||||
val txSM = UInt(2.W)
|
||||
val rxSM = UInt(2.W)
|
||||
|
||||
val rplTimeStampTx = UInt(16.W)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
class SlaveRegisterBundle extends Bundle{
|
||||
|
||||
// val RAMSize = UInt(8.W)
|
||||
// val MMUNum = UInt(8.W)
|
||||
|
||||
// val nodeSeqAddr = UInt(16.W)
|
||||
// val nodeSetAddr = UInt(16.W)
|
||||
|
||||
|
||||
val ebmmu = Vec(8, new EBMMU_Bundle)
|
||||
|
||||
// val intStatus = UInt(16.W)
|
||||
// val mb = Vec(8, new Bundle{
|
||||
// val ctrl = UInt(8.W)
|
||||
// val status = UInt(8.W)
|
||||
// })
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val localDevIndex = UInt(16.W)
|
||||
|
||||
//链路寄存器组
|
||||
|
||||
// val isDevOnLeftModify = Bool()
|
||||
// val indexOfLeftDev = UInt(14.W)
|
||||
val isDevOnRight = UInt(2.W)
|
||||
val isDevOnRightModify = Bool()
|
||||
val indexOfRightDev = UInt(14.W)
|
||||
@@ -115,14 +87,8 @@ class SlaveRegisterBundle extends Bundle{
|
||||
val syncCfg = UInt(8.W)
|
||||
val syncWidth = Vec(4, UInt(16.W) )
|
||||
|
||||
|
||||
|
||||
val syncOffset = Vec(4, UInt(32.W))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -134,10 +100,6 @@ class InterfaceIO extends Bundle{
|
||||
|
||||
val lvds = Flipped(new RegAccessInterfaceIO)
|
||||
|
||||
|
||||
|
||||
// val modeSel = Output(Bool())
|
||||
|
||||
val txReq = Valid(new Bundle{
|
||||
val txSM = UInt(2.W)
|
||||
val rxSM = UInt(2.W)
|
||||
@@ -147,6 +109,9 @@ class InterfaceIO extends Bundle{
|
||||
val dSMdeq = Output( Vec(4, Bool()) )
|
||||
val uSMenq = Output( Vec(4, Bool()) )
|
||||
|
||||
val lvdsSMEnq = Input(Vec(4, Bool()))
|
||||
val lvdsSMDeq = Input(Vec(4, Bool()))
|
||||
|
||||
val sram_w = Flipped(Vec( 4, new SRAM2kWRIO)) //QSPI
|
||||
val sram_r = Flipped(Vec( 4, new SRAM2kRDIO)) //QSPI
|
||||
|
||||
@@ -156,10 +121,6 @@ class InterfaceIO extends Bundle{
|
||||
|
||||
val localDevIndex = Input(UInt(16.W))
|
||||
|
||||
// val isDevOnLeft = Input(UInt(2.W))
|
||||
// val isDevOnLeftModify = Input(Bool())
|
||||
// val indexOfLeftDev = Input(UInt(14.W))
|
||||
|
||||
val isDevOnRight = Input(UInt(2.W))
|
||||
val isDevOnRightModify = Input(Bool())
|
||||
val indexOfRightDev = Input(UInt(14.W))
|
||||
@@ -186,6 +147,8 @@ class InterfaceIO extends Bundle{
|
||||
|
||||
val smUsedDepth = Input( Vec(8, UInt(8.W)) )
|
||||
val isSMReset = Output( Vec(8, Bool()) )
|
||||
|
||||
val latchPin = Input(Vec(2, Bool()))
|
||||
}
|
||||
|
||||
|
||||
@@ -408,7 +371,38 @@ abstract class InterfaceBase extends Module{
|
||||
(for( i <- 0 until 17; j <- 0 until 4 ) yield {
|
||||
( addr === ("h408".U(16.W) + (4*i+j).U) ) -> cReg.wdtTarCnt(i)( 8*j+7, 8*j+0 )
|
||||
}) ++
|
||||
Seq(
|
||||
(addr === "h500".U ) -> cReg.event.latchCtl(0),
|
||||
(addr === "h502".U ) -> cReg.event.latchCtl(1),
|
||||
(addr === "h504".U ) -> cReg.event.latchStatus(0),
|
||||
(addr === "h506".U ) -> cReg.event.latchStatus(1),
|
||||
) ++
|
||||
( 0 until 8 ).map{ i =>
|
||||
( addr === ("h508".U(16.W) + i.U) ) -> cReg.event.posedgeTimeStampLatch(0)( 8*i+7, 8*i+0 )
|
||||
} ++
|
||||
( 0 until 8 ).map{ i =>
|
||||
( addr === ("h510".U(16.W) + i.U) ) -> cReg.event.negedgeTimeStampLatch(0)( 8*i+7, 8*i+0 )
|
||||
} ++
|
||||
( 0 until 8 ).map{ i =>
|
||||
( addr === ("h518".U(16.W) + i.U) ) -> cReg.event.posedgeTimeStampLatch(1)( 8*i+7, 8*i+0 )
|
||||
} ++
|
||||
( 0 until 8 ).map{ i =>
|
||||
( addr === ("h520".U(16.W) + i.U) ) -> cReg.event.negedgeTimeStampLatch(1)( 8*i+7, 8*i+0 )
|
||||
} ++
|
||||
( 0 until 8 ).map{ i =>
|
||||
( addr === ("h528".U(16.W) + i.U) ) -> cReg.event.mcuSMTimeStampEnq( 8*i+7, 8*i+0 )
|
||||
} ++
|
||||
( 0 until 8 ).map{ i =>
|
||||
( addr === ("h530".U(16.W) + i.U) ) -> cReg.event.mcuSMTimeStampDeq( 8*i+7, 8*i+0 )
|
||||
} ++
|
||||
( 0 until 8 ).map{ i =>
|
||||
( addr === ("h538".U(16.W) + i.U) ) -> cReg.event.lvdsSMTimeStampEnq( 8*i+7, 8*i+0 )
|
||||
} ++
|
||||
( 0 until 8 ).map{ i =>
|
||||
( addr === ("h540".U(16.W) + i.U) ) -> cReg.event.lvdsSMTimeStampDeq( 8*i+7, 8*i+0 )
|
||||
} ++
|
||||
Seq()
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -968,6 +962,77 @@ trait InterfaceSystem{ this: InterfaceBase =>
|
||||
|
||||
}
|
||||
|
||||
|
||||
trait InterfaceEvent{ this: InterfaceBase =>
|
||||
val isPosedgeOnce = for( i <- 0 until 2 ) yield RegEnable( dataw.extract(2), false.B, isEnW & ( addrw === ( "h500".U + (i*2).U ) ))
|
||||
val isNegedgeOnce = for( i <- 0 until 2 ) yield RegEnable( dataw.extract(3), false.B, isEnW & ( addrw === ( "h500".U + (i*2).U ) ))
|
||||
|
||||
val isPosedgeLatch = for( i <- 0 until 2 ) yield RegInit(false.B)
|
||||
val isNegedgeLatch = for( i <- 0 until 2 ) yield RegInit(false.B)
|
||||
|
||||
|
||||
val posedgeTimeStampLatch = for( i <- 0 until 2 ) yield RegInit(0.U(64.W))
|
||||
val negedgeTimeStampLatch = for( i <- 0 until 2 ) yield RegInit(0.U(64.W))
|
||||
|
||||
val mcuSMTimeStampEnq = RegInit(0.U(64.W))
|
||||
val mcuSMTimeStampDeq = RegInit(0.U(64.W))
|
||||
val lvdsSMTimeStampEnq = RegInit(0.U(64.W))
|
||||
val lvdsSMTimeStampDeq = RegInit(0.U(64.W))
|
||||
|
||||
for( i <- 0 until 2 ){
|
||||
when( dataw.extract(0) & isEnW & ( addrw === ( "h500".U + (i*2).U ) ) ){
|
||||
isPosedgeLatch(i):= false.B
|
||||
posedgeTimeStampLatch(i) := 0.U
|
||||
} .elsewhen( ~RegNext(io.latchPin(i), false.B) & io.latchPin(i) ){
|
||||
when( isPosedgeOnce(i) ){
|
||||
isPosedgeLatch(i) := true.B
|
||||
}
|
||||
when(~isPosedgeLatch(i)){
|
||||
posedgeTimeStampLatch(i) := cReg.timeStamp
|
||||
}
|
||||
}
|
||||
|
||||
when( dataw.extract(1) & isEnW & ( addrw === ( "h500".U + (i*2).U ) ) ){
|
||||
isNegedgeLatch(i) := false.B
|
||||
negedgeTimeStampLatch(i) := 0.U
|
||||
} .elsewhen( RegNext(io.latchPin(i), false.B) & ~io.latchPin(i) ){
|
||||
when( isNegedgeOnce(i) ){
|
||||
isNegedgeLatch(i) := true.B
|
||||
}
|
||||
when(~isNegedgeLatch(i)){
|
||||
negedgeTimeStampLatch(i) := cReg.timeStamp
|
||||
}
|
||||
}
|
||||
|
||||
when( io.uSMenq.reduce(_|_) ){
|
||||
mcuSMTimeStampEnq := cReg.timeStamp
|
||||
}
|
||||
|
||||
when( io.dSMdeq.reduce(_|_) ){
|
||||
mcuSMTimeStampDeq := cReg.timeStamp
|
||||
}
|
||||
|
||||
when( io.lvdsSMEnq.reduce(_|_) ){
|
||||
lvdsSMTimeStampEnq := cReg.timeStamp
|
||||
}
|
||||
|
||||
when( io.lvdsSMDeq.reduce(_|_) ){
|
||||
lvdsSMTimeStampDeq := cReg.timeStamp
|
||||
}
|
||||
|
||||
cReg.event.latchCtl(i) := (isPosedgeOnce(i) << 2) | (isNegedgeOnce(i) << 3)
|
||||
|
||||
cReg.event.latchStatus(i) := Cat( io.latchPin(i), isNegedgeLatch(i), isPosedgeLatch(i) )
|
||||
cReg.event.posedgeTimeStampLatch(i) := posedgeTimeStampLatch(i)
|
||||
cReg.event.negedgeTimeStampLatch(i) := negedgeTimeStampLatch(i)
|
||||
}
|
||||
|
||||
cReg.event.mcuSMTimeStampEnq := mcuSMTimeStampEnq
|
||||
cReg.event.mcuSMTimeStampDeq := mcuSMTimeStampDeq
|
||||
cReg.event.lvdsSMTimeStampEnq := lvdsSMTimeStampEnq
|
||||
cReg.event.lvdsSMTimeStampDeq := lvdsSMTimeStampDeq
|
||||
}
|
||||
|
||||
class Interface extends InterfaceBase
|
||||
with InterfaceMCUop
|
||||
with InterfaceCheckSM
|
||||
@@ -975,6 +1040,7 @@ with InterfaceLVDSop
|
||||
with InterfaceSync
|
||||
// with InterfaceWdt
|
||||
with InterfaceSystem
|
||||
with InterfaceEvent
|
||||
{
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user