@@ -63,6 +63,8 @@ class Scoreboard(implicit p: Parameters) extends CoreModule()(p) with HasDebugCo
6363 // TODO: reads epoch
6464 }
6565
66+ val sbDebugLevel = 2
67+
6668 // flip-flops
6769 val readTable = RegInit (VecInit .fill(muonParams.numPhysRegs)(0 .U (scoreboardReadCountBits.W )))
6870 val writeTable = RegInit (VecInit .fill(muonParams.numPhysRegs)(0 .U (scoreboardWriteCountBits.W )))
@@ -200,7 +202,7 @@ class Scoreboard(implicit p: Parameters) extends CoreModule()(p) with HasDebugCo
200202 newCount := currCount + u.incr - u.decr
201203 }
202204
203- debugf(cf " applyUpdates: [ ${debug}] ${countName} pReg: ${u.pReg}, newCount: ${newCount}, currCount: ${currCount}, incr: ${u.incr}( ${u.incr.getWidth}W), decr: ${u.decr}( ${u.decr.getWidth}W), success: ${success}, overflow: ${overflow}, underflow: ${underflow}\n " )
205+ debugf(sbDebugLevel, cf " applyUpdates: [ ${debug}] ${countName} pReg: ${u.pReg}, newCount: ${newCount}, currCount: ${currCount}, incr: ${u.incr}( ${u.incr.getWidth}W), decr: ${u.decr}( ${u.decr.getWidth}W), success: ${success}, overflow: ${overflow}, underflow: ${underflow}\n " )
204206
205207 // underflow should never be possible since the number of retired
206208 // regs should strictly be smaller than the pending regs, i.e. no
@@ -210,7 +212,7 @@ class Scoreboard(implicit p: Parameters) extends CoreModule()(p) with HasDebugCo
210212 // cf"scoreboard: ${countName} underflow at pReg=${u.pReg} " +
211213 // cf"(currCount=${currCount}, incr=${u.incr}, decr=${u.decr})")
212214 }.elsewhen (u.incr === u.decr && u.incr =/= 0 .U ) {
213- debugf(cf " applyUpdates: [ ${debug}] ${countName} incr/decr cancel; pReg: ${u.pReg}, newCount: ${newCount}, currCount: ${currCount}( ${currCount.getWidth}W), incr: ${u.incr}( ${u.incr.getWidth}W), decr: ${u.decr}( ${u.decr.getWidth}W) \n " )
215+ debugf(sbDebugLevel, cf " applyUpdates: [ ${debug}] ${countName} incr/decr cancel; pReg: ${u.pReg}, newCount: ${newCount}, currCount: ${currCount}( ${currCount.getWidth}W), incr: ${u.incr}( ${u.incr.getWidth}W), decr: ${u.decr}( ${u.decr.getWidth}W) \n " )
214216 }
215217 }
216218
@@ -242,10 +244,10 @@ class Scoreboard(implicit p: Parameters) extends CoreModule()(p) with HasDebugCo
242244 when (r.dirty) {
243245 assert(r.pReg =/= 0 .U , " update to x0 not filtered in the logic?" )
244246 if (isWrite) {
245- debugf(cf " scoreboard: committed write (pReg: ${r.pReg}, new pendingWrites: ${r.counter}) \n " )
247+ debugf(sbDebugLevel, cf " scoreboard: committed write (pReg: ${r.pReg}, new pendingWrites: ${r.counter}) \n " )
246248 writeTable(r.pReg) := r.counter
247249 } else {
248- debugf(cf " scoreboard: committed read (pReg: ${r.pReg}, new pendingReads: ${r.counter}) \n " )
250+ debugf(sbDebugLevel, cf " scoreboard: committed read (pReg: ${r.pReg}, new pendingReads: ${r.counter}) \n " )
249251 readTable(r.pReg) := r.counter
250252 }
251253 }
@@ -273,7 +275,7 @@ class Scoreboard(implicit p: Parameters) extends CoreModule()(p) with HasDebugCo
273275 io.hazard.updateRS.success := io.hazard.updateRS.enable && rsSuccess
274276
275277 when (io.hazard.updateRS.enable) {
276- debugf(cf " scoreboard: received RS update " )
278+ debugf(sbDebugLevel, cf " scoreboard: received RS update " )
277279 printUpdate(io.hazard.updateRS)
278280
279281 // these contain coll/wb updates
@@ -286,29 +288,29 @@ class Scoreboard(implicit p: Parameters) extends CoreModule()(p) with HasDebugCo
286288 }
287289
288290 when (! rsReadSuccess) {
289- debugf(cf " scoreboard: failed to commit RS update due to read overflow: " )
291+ debugf(sbDebugLevel, cf " scoreboard: failed to commit RS update due to read overflow: " )
290292 printUpdate(io.hazard.updateRS)
291293 }.elsewhen (! rsWriteSuccess) {
292- debugf(cf " scoreboard: failed to commit RS update due to write overflow: " )
294+ debugf(sbDebugLevel, cf " scoreboard: failed to commit RS update due to write overflow: " )
293295 printUpdate(io.hazard.updateRS)
294296 }
295297
296- debugf(cf " scoreboard: table received RS update; content beforehand: \n " )
298+ debugf(sbDebugLevel, cf " scoreboard: table received RS update; content beforehand: \n " )
297299 printTable
298300 }.elsewhen (io.updateWB.enable || io.updateColl.enable) {
299301 when (io.updateWB.enable) {
300- debugf(" scoreboard: received WB update " )
302+ debugf(sbDebugLevel, " scoreboard: received WB update " )
301303 printUpdate(io.updateWB)
302304 }
303305 when (io.updateColl.enable) {
304- debugf(" scoreboard: received coll update " )
306+ debugf(sbDebugLevel, " scoreboard: received coll update " )
305307 printUpdate(io.updateColl)
306308 }
307309
308310 commitUpdate(collRecs, isWrite = false )
309311 commitUpdate(wbRecs, isWrite = true )
310312
311- debugf(cf " scoreboard: table received coll/WB update; content beforehand: \n " )
313+ debugf(sbDebugLevel, cf " scoreboard: table received coll/WB update; content beforehand: \n " )
312314 printTable
313315 }
314316
@@ -338,39 +340,39 @@ class Scoreboard(implicit p: Parameters) extends CoreModule()(p) with HasDebugCo
338340
339341 def printUpdate (upd : ScoreboardUpdate ) = {
340342 def printReg (reg : ScoreboardRegUpdate ) = {
341- debugfAppend(cf " {pReg: ${reg.pReg}, incr: " )
343+ debugfAppend(sbDebugLevel, cf " {pReg: ${reg.pReg}, incr: " )
342344 when (reg.incr) {
343- debugfAppend(" 1" )
345+ debugfAppend(sbDebugLevel, " 1" )
344346 }.elsewhen (reg.decr) {
345- debugfAppend(" -1" )
347+ debugfAppend(sbDebugLevel, " -1" )
346348 }.otherwise {
347- debugfAppend(" 0" )
349+ debugfAppend(sbDebugLevel, " 0" )
348350 }
349- debugfAppend(" }" )
351+ debugfAppend(sbDebugLevel, " }" )
350352 }
351353
352- debugfAppend(" {rs1: " )
354+ debugfAppend(sbDebugLevel, " {rs1: " )
353355 printReg(upd.reads(0 ))
354- debugfAppend(" , rs2: " )
356+ debugfAppend(sbDebugLevel, " , rs2: " )
355357 printReg(upd.reads(1 ))
356- debugfAppend(" , rs3: " )
358+ debugfAppend(sbDebugLevel, " , rs3: " )
357359 printReg(upd.reads(2 ))
358- debugfAppend(" , rd: " )
360+ debugfAppend(sbDebugLevel, " , rd: " )
359361 printReg(upd.write)
360- debugfAppend(" }\n " )
362+ debugfAppend(sbDebugLevel, " }\n " )
361363 }
362364
363365 def printTable = {
364366 // @perf: NOTE: this can instantiate a read port for *every* table entries;
365367 // make sure to guard this with debug
366- debugf(" =" * 8 + " Scoreboard " + " =" * 8 + " \n " )
368+ debugf(sbDebugLevel, " =" * 8 + " Scoreboard " + " =" * 8 + " \n " )
367369 for (i <- 0 until muonParams.numPhysRegs) {
368370 val reads = readTable(i)
369371 val writes = writeTable(i)
370372 when (reads > 0 .U || writes > 0 .U ) {
371- debugf(cf " p ${i} | writes: ${writes} | reads: ${reads}\n " )
373+ debugf(sbDebugLevel, cf " p ${i} | writes: ${writes} | reads: ${reads}\n " )
372374 }
373375 }
374- debugf(" =" * 28 + " \n " )
376+ debugf(sbDebugLevel, " =" * 28 + " \n " )
375377 }
376378}
0 commit comments