diff --git a/src/main/scala/xiangshan/backend/exu/Exu.scala b/src/main/scala/xiangshan/backend/exu/Exu.scala index 3f61ca27f02cae18ffbf25ea300f217642f67f96..21c88da0edfaaf5b738a8e58f31c5d417d67bd0e 100644 --- a/src/main/scala/xiangshan/backend/exu/Exu.scala +++ b/src/main/scala/xiangshan/backend/exu/Exu.scala @@ -32,6 +32,7 @@ case class ExuParameters case class ExuConfig ( name: String, + blockName: String, // NOTE: for perf counter fuConfigs: Seq[FuConfig], wbIntPriority: Int, wbFpPriority: Int diff --git a/src/main/scala/xiangshan/backend/issue/ReservationStation.scala b/src/main/scala/xiangshan/backend/issue/ReservationStation.scala index ef860f28586f1ee4d66b34816210ae2a9f56e147..adc0fa84e52e850447cd7f6d0f57be90f1b2514e 100644 --- a/src/main/scala/xiangshan/backend/issue/ReservationStation.scala +++ b/src/main/scala/xiangshan/backend/issue/ReservationStation.scala @@ -136,7 +136,7 @@ class ReservationStation io.numExist := select.io.numExist select.io.redirectVec := ctrl.io.redirectVec select.io.readyVec := ctrl.io.readyVec - select.io.enq.valid := io.fromDispatch.valid && !(io.redirect.valid || io.flush) + select.io.enq.valid := io.fromDispatch.valid && !(io.redirect.valid || io.flush) io.fromDispatch.ready := select.io.enq.ready select.io.deq.ready := io.deq.ready if (feedback) { @@ -404,7 +404,7 @@ class ReservationStationSelect XSPerfAccumulate("exuBlockDeq", issueValid && !io.deq.ready) XSPerfAccumulate("bubbleBlockEnq", haveBubble && !io.enq.ready) XSPerfAccumulate("validButNotSel", PopCount(selectMask) - haveReady) - + QueuePerf(iqSize, io.numExist, !io.enq.ready) XSPerfAccumulate("validUtil", PopCount(validQueue)) XSPerfAccumulate("emptyUtil", io.numExist - PopCount(validQueue) - PopCount(stateQueue.map(_ === s_replay)) - PopCount(stateQueue.map(_ === s_wait))) // NOTE: hard to count, use utilization - nonEmpty @@ -413,7 +413,7 @@ class ReservationStationSelect XSPerfAccumulate("waitUtil", PopCount(stateQueue.map(_ === s_wait))) XSPerfAccumulate("replayUtil", PopCount(stateQueue.map(_ === s_replay))) - + if (!feedback && nonBlocked) { XSPerfAccumulate("issueValidButBubbleDeq", selectReg && bubbleReg && (deqPtr === bubblePtr)) XSPerfAccumulate("bubbleShouldNotHaveDeq", selectReg && bubbleReg && (deqPtr === bubblePtr) && io.deq.ready) @@ -426,7 +426,7 @@ class ReservationStationSelect // NOTE: maybe useless, for logical queue and phyical queue make this no sense XSPerfAccumulate(s"replayTimeOfEntry${i}", io.memfeedback.valid && !io.memfeedback.bits.hit && io.memfeedback.bits.rsIdx === i.U) } - io.isFirstIssue := RegNext(ParallelPriorityMux(selectMask.asBools zip cntCountQueue) === 0.U) + io.isFirstIssue := RegNext(ParallelPriorityMux(selectMask.asBools zip cntCountQueue) === 0.U) } for(i <- 0 until iqSize) { if (i == 0) XSPerfAccumulate("empty", io.numExist === 0.U) @@ -698,6 +698,22 @@ class ReservationStationCtrl } } } + + def updateFilterByBlock(blockName: String) = { + srcUpdateListen.map(a => a.map(b => + b.zip(fastPortsCfg ++ slowPortsCfg) + .filter( + _._2.blockName == blockName + ).map(_._1) + )).flatten.flatten + } + + val intSrcUpdate = updateFilterByBlock("Int") + val memSrcUpdate = updateFilterByBlock("Mem") + val fpSrcUpdate = updateFilterByBlock("Fp") + XSPerfAccumulate(s"${exuCfg.blockName}_wakeup_by_Int", PopCount(Cat(intSrcUpdate))) + XSPerfAccumulate(s"${exuCfg.blockName}_wakeup_by_Mem", PopCount(Cat(memSrcUpdate))) + XSPerfAccumulate(s"${exuCfg.blockName}_wakeup_by_Fp", PopCount(Cat(fpSrcUpdate))) } class RSDataSingleSrc(srcLen: Int, numEntries: Int, numListen: Int, writePort: Int = 1) extends Module { @@ -860,4 +876,4 @@ class ReservationStationData pcMem.get.io.raddr(0) := io.sel io.pc := pcMem.get.io.rdata(0) } -} +} \ No newline at end of file diff --git a/src/main/scala/xiangshan/package.scala b/src/main/scala/xiangshan/package.scala index 6cc68e791b97542ad87e556e8e0703828ae0c137..33dfe70da3438ff61300ee1f355378df55d50424 100644 --- a/src/main/scala/xiangshan/package.scala +++ b/src/main/scala/xiangshan/package.scala @@ -487,15 +487,16 @@ package object xiangshan { UncertainLatency() ) - val AluExeUnitCfg = ExuConfig("AluExeUnit", Seq(aluCfg), 0, Int.MaxValue) - val JumpExeUnitCfg = ExuConfig("JmpExeUnit", Seq(jmpCfg, csrCfg, fenceCfg, i2fCfg), 2, Int.MaxValue) - val MulDivExeUnitCfg = ExuConfig("MulDivExeUnit", Seq(mulCfg, divCfg), 1, Int.MaxValue) - val FmacExeUnitCfg = ExuConfig("FmacExeUnit", Seq(fmacCfg), Int.MaxValue, 0) + val AluExeUnitCfg = ExuConfig("AluExeUnit", "Int", Seq(aluCfg), 0, Int.MaxValue) + val JumpExeUnitCfg = ExuConfig("JmpExeUnit", "Int", Seq(jmpCfg, csrCfg, fenceCfg, i2fCfg), 2, Int.MaxValue) + val MulDivExeUnitCfg = ExuConfig("MulDivExeUnit", "Int", Seq(mulCfg, divCfg), 1, Int.MaxValue) + val FmacExeUnitCfg = ExuConfig("FmacExeUnit", "Fp", Seq(fmacCfg), Int.MaxValue, 0) val FmiscExeUnitCfg = ExuConfig( "FmiscExeUnit", + "Fp", Seq(f2iCfg, f2fCfg, fdivSqrtCfg), Int.MaxValue, 1 ) - val LdExeUnitCfg = ExuConfig("LoadExu", Seq(lduCfg), wbIntPriority = 0, wbFpPriority = 0) - val StExeUnitCfg = ExuConfig("StoreExu", Seq(stuCfg, mouCfg), wbIntPriority = Int.MaxValue, wbFpPriority = Int.MaxValue) -} + val LdExeUnitCfg = ExuConfig("LoadExu", "Mem", Seq(lduCfg), wbIntPriority = 0, wbFpPriority = 0) + val StExeUnitCfg = ExuConfig("StoreExu", "Mem", Seq(stuCfg, mouCfg), wbIntPriority = Int.MaxValue, wbFpPriority = Int.MaxValue) +} \ No newline at end of file