@@ -35,10 +35,15 @@ class ReservationStation(implicit p: Parameters) extends CoreModule()(p) {
3535 val readResp = Flipped (CollectorResponse (Isa .maxNumRegs, isWrite = false ))
3636 val readData = Flipped (new CollectorOperandRead )
3737 }
38- val perf = Output (Vec (numWarps, new Bundle {
38+ val perf = Output (new Bundle {
39+ val cyclesDispatched = Perf .T
3940 val cyclesEligible = Perf .T
40- val stallsRSFull = Perf .T
41- }))
41+ val perWarp = Vec (numWarps, new Bundle {
42+ val cyclesDispatched = Perf .T
43+ val cyclesEligible = Perf .T
44+ val stallsRSFull = Perf .T
45+ })
46+ })
4247 })
4348
4449 val numEntries = muonParams.numIssueQueueEntries
@@ -101,7 +106,7 @@ class ReservationStation(implicit p: Parameters) extends CoreModule()(p) {
101106 val rowEmptyVec = VecInit ((0 until numEntries).map(! validTable(_)))
102107 val hasEmptyRow = rowEmptyVec.reduce(_ || _)
103108 io.admit.ready := hasEmptyRow
104- io.perf.zipWithIndex.foreach { case (p, wid) =>
109+ io.perf.perWarp. zipWithIndex.foreach { case (p, wid) =>
105110 p.stallsRSFull :=
106111 PerfCounter (io.admit.valid && ! hasEmptyRow &&
107112 io.admit.bits.ibufEntry.uop.wid === wid.U )
@@ -125,6 +130,15 @@ class ReservationStation(implicit p: Parameters) extends CoreModule()(p) {
125130 val rsOccupancy = WireDefault (PopCount (validTable))
126131 dontTouch(rsOccupancy)
127132
133+ io.perf.cyclesDispatched := PerfCounter (rsOccupancy =/= 0 .U )
134+ io.perf.perWarp.zipWithIndex.foreach { case (p, wid) =>
135+ val validThisWarp = (0 until numEntries).map { i =>
136+ validTable(i) && (instTable(i).uop.wid === wid.U )
137+ }
138+ val hasThisWarp = validThisWarp.reduce(_ || _)
139+ p.cyclesDispatched := PerfCounter (hasThisWarp)
140+ }
141+
128142 // -----------------
129143 // collector control
130144 // -----------------
@@ -353,7 +367,9 @@ class ReservationStation(implicit p: Parameters) extends CoreModule()(p) {
353367 dontTouch(issuedId)
354368
355369 // connect per-warp eligible perf counters
356- io.perf.zipWithIndex.foreach { case (p, wid) =>
370+ val hasEligible = eligibles.map(_.valid).reduce(_ || _)
371+ io.perf.cyclesEligible := PerfCounter (hasEligible)
372+ io.perf.perWarp.zipWithIndex.foreach { case (p, wid) =>
357373 val eligiblesThisWarp = eligibles.map { row =>
358374 row.valid && (row.bits.entry.uop.wid === wid.U )
359375 }
0 commit comments