@@ -10,6 +10,8 @@ import pipeline.dispatch.bundles.ScoreboardChangeNdPort
1010import spec .Param .isDiffTest
1111import spec ._
1212import pmu .bundles .PmuBranchPredictNdPort
13+ import pipeline .dispatch .bundles .FetchInstInfoBundle
14+ import pipeline .commit .bundles .PcInstBundle
1315
1416class WbNdPort extends Bundle {
1517 val gprWrite = new RfWriteNdPort
@@ -20,17 +22,26 @@ object WbNdPort {
2022 def default = 0 .U .asTypeOf(new WbNdPort )
2123}
2224
25+ class CommitNdPort extends Bundle {
26+ val gprWrite = new RfWriteNdPort
27+ val instInfo = new InstInfoNdPort
28+ val fetchInfo = new PcInstBundle
29+ }
30+
31+ object CommitNdPort {
32+ def default = 0 .U .asTypeOf(new CommitNdPort )
33+ }
34+
2335class CommitStage (
2436 commitNum : Int = Param .commitNum)
2537 extends Module {
2638 val io = IO (new Bundle {
27- val ins = Vec (commitNum, Flipped (Decoupled (new WbNdPort )))
39+ val ins = Vec (commitNum, Flipped (Decoupled (new CommitNdPort )))
2840
2941 // `CommitStage` -> `Cu` NO delay
30- val gprWritePorts = Output (Vec (commitNum, new RfWriteNdPort ))
31-
32- // `AddrTransStage` -> `CommitStage` -> `Cu` NO delay
42+ val gprWritePorts = Output (Vec (commitNum, new RfWriteNdPort ))
3343 val cuInstInfoPorts = Output (Vec (commitNum, new InstInfoNdPort ))
44+ val majorPc = Output (UInt (Width .Reg .data))
3445
3546 val pmu_branchInfo = if (Param .usePmu) Some (Output (new PmuBranchPredictNdPort )) else None
3647
@@ -79,6 +90,7 @@ class CommitStage(
7990 dstGprWrite := inBit.gprWrite
8091 dstGprWrite.en := in.valid && in.ready && inBit.gprWrite.en
8192 }
93+ io.majorPc := inBits.head.fetchInfo.pcAddr
8294
8395 io.pmu_branchInfo match {
8496 case None =>
@@ -97,14 +109,14 @@ class CommitStage(
97109 io.difftest match {
98110 case Some (dt) =>
99111 dt.valid := RegNext (inBits(0 ).instInfo.isValid && io.ins(0 ).valid && io.ins(0 ).ready, false .B ) // && nextCommit)
100- dt.pc := RegNext (inBits(0 ).instInfo.pc , 0 .U )
101- dt.instr := RegNext (inBits(0 ).instInfo .inst, 0 .U )
112+ dt.pc := RegNext (inBits(0 ).fetchInfo.pcAddr , 0 .U )
113+ dt.instr := RegNext (inBits(0 ).fetchInfo .inst, 0 .U )
102114 dt.wen := RegNext (inBits(0 ).gprWrite.en, false .B )
103115 dt.wdest := RegNext (inBits(0 ).gprWrite.addr, 0 .U )
104116 dt.wdata := RegNext (inBits(0 ).gprWrite.data, 0 .U )
105117 dt.csr_rstat := RegNext (
106- inBits(0 ).instInfo .inst(31 , 24 ) === Inst ._2RI14.csr_ &&
107- inBits(0 ).instInfo .inst(23 , 10 ) === " h5" .U ,
118+ inBits(0 ).fetchInfo .inst(31 , 24 ) === Inst ._2RI14.csr_ &&
119+ inBits(0 ).fetchInfo .inst(23 , 10 ) === " h5" .U ,
108120 false .B
109121 ) && io.ins(0 ).valid && io.ins(0 ).ready
110122 dt.ld_en := RegNext (inBits(0 ).instInfo.load.get.en, false .B )
@@ -127,8 +139,8 @@ class CommitStage(
127139
128140 if (commitNum == 2 ) {
129141 dt.valid_1 := RegNext (inBits(1 ).instInfo.isValid && io.ins(1 ).valid && io.ins(1 ).ready, false .B )
130- dt.instr_1 := RegNext (inBits(1 ).instInfo .inst, 0 .U )
131- dt.pc_1 := RegNext (inBits(1 ).instInfo.pc , 0 .U )
142+ dt.instr_1 := RegNext (inBits(1 ).fetchInfo .inst, 0 .U )
143+ dt.pc_1 := RegNext (inBits(1 ).fetchInfo.pcAddr , 0 .U )
132144 dt.wen_1 := RegNext (inBits(1 ).gprWrite.en, false .B )
133145 dt.wdest_1 := RegNext (inBits(1 ).gprWrite.addr, 0 .U )
134146 dt.wdata_1 := RegNext (inBits(1 ).gprWrite.data, 0 .U )
0 commit comments