修复smunit计数器位宽

This commit is contained in:
Ruige Lee
2025-07-31 10:55:05 +08:00
parent f59692b030
commit 638308eba6

View File

@@ -85,10 +85,11 @@ abstract class SMUnitBase(depth: Int = 4) extends Module {
( (rPtr(log2Ceil(depth)-1, 0)) === i.U ) -> io.sram(i).rd.datar
})
val cnt = RegInit(0.U((log2Ceil(depth)).W)); io.cnt := cnt
val cnt = RegInit(0.U((log2Ceil(depth+1)).W)); io.cnt := cnt
when( io.enq & ~isFull ){
cnt := cnt + 1.U
assert(cnt =/= depth.U)
} .elsewhen( io.deq & ~isEmpty ){
cnt := cnt - 1.U
assert(cnt =/= 0.U)