Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
6aa3592
feat: add some inst
Chrisqcwx Mar 19, 2023
6a5a383
feat: add branch inst
Chrisqcwx Mar 20, 2023
1562843
feat: add branch inst
Chrisqcwx Mar 20, 2023
53284e8
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu
Chrisqcwx Mar 20, 2023
20b2f67
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Mar 20, 2023
651dd92
feat: add branch inst
Chrisqcwx Mar 20, 2023
87b6016
fix: fix some bug in MulStage
Chrisqcwx Mar 20, 2023
4099b34
feat: add load store inst
Chrisqcwx Mar 20, 2023
b9592b2
feat: add load and store inst
Chrisqcwx Mar 21, 2023
f175e9e
Merge branch 'dev-yhy'
Chrisqcwx Mar 21, 2023
1cab7e2
fix: deal conflict
Chrisqcwx Mar 21, 2023
bae2228
fix: fix some bug in ExeStage
Chrisqcwx Mar 21, 2023
d240163
fix: add decoder fallback
Chrisqcwx Mar 21, 2023
dbfe974
delete temp issueStage
Chrisqcwx Mar 21, 2023
a1ab1a1
refactor: add insts in SimpleCpuSpec
Chrisqcwx Mar 22, 2023
aabdf2d
refactor: comments
Mar 22, 2023
7c3452c
fix: make bullshit in `IssueStage` smell better
Mar 22, 2023
8db4f3b
fix: when you are free to go, even you are still in blocking state, y…
Mar 22, 2023
9ce6d48
test some inst
Chrisqcwx Mar 22, 2023
a8d83f2
Merge branch 'dev-yhy' of github.com:Invalid-Syntax-NSCSCC/invalid-cp…
Chrisqcwx Mar 22, 2023
0f3eba8
fix: now it's not a mess in `IssueStage`
Mar 23, 2023
d7ea58c
Merge branch 'dev-yhy' of github.com:Invalid-Syntax-NSCSCC/invalid-cp…
Chrisqcwx Mar 23, 2023
9bb53df
refactor: refactor exeStage with state machine
Chrisqcwx Mar 23, 2023
ad419bf
refactor: alu
Chrisqcwx Mar 23, 2023
72a6c6a
refactor: reformat
Chrisqcwx Mar 24, 2023
1dc7725
feat: avoid recalculating mul and div in alu when stall
Chrisqcwx Mar 25, 2023
035f1c3
refactor: reformat
Chrisqcwx Mar 25, 2023
6a09062
deal with conflicts
Chrisqcwx Mar 25, 2023
02fde3c
deal with conflicts
Chrisqcwx Mar 25, 2023
31e519c
feat: add some inst
Chrisqcwx Mar 25, 2023
0d52bcd
refactor: reformat
Chrisqcwx Mar 25, 2023
f8f6b2b
feat: add mem stage
Chrisqcwx Mar 26, 2023
f77c9ee
refactor: rename MemLoadStoreNdPort -> MemLoadStoreInfoNdPort
Chrisqcwx Mar 26, 2023
2f84aaf
deal with conflicts
Chrisqcwx Mar 26, 2023
ddbca6c
Merge branch 'main' into dev-yhy
rewired-gh Mar 27, 2023
6b2c83c
refactor: modify some comment
Chrisqcwx Mar 27, 2023
0d3d633
Merge branch 'dev-yhy' of github.com:Invalid-Syntax-NSCSCC/invalid-cp…
Chrisqcwx Mar 27, 2023
1971768
deal with conflicts
Chrisqcwx Mar 27, 2023
97514d6
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Mar 27, 2023
e6cb6d4
refactor: refactor Mul module with booth algorithm and wallance tree.
Chrisqcwx Mar 27, 2023
03ddec4
fix: memLoadStoreInfoPort lack 1 cycle delay; feat: add CsrRegs
Chrisqcwx Mar 28, 2023
65881d7
refactor: reformat
Chrisqcwx Mar 28, 2023
dab47b2
fix: fix some bugs
Chrisqcwx Mar 28, 2023
3803d9d
feat: add some Exception; issue: add some TODO
Chrisqcwx Mar 28, 2023
e114584
fix: fix uninitialize error in issueStage
Chrisqcwx Mar 29, 2023
66365e1
feat: add some exceptions
Chrisqcwx Mar 29, 2023
7c26830
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Mar 29, 2023
1d06144
refactor: rename WbDebugPort --> InstInfoPort
Chrisqcwx Mar 29, 2023
3ab4472
feat: add cu's control of gprWrite
Chrisqcwx Mar 29, 2023
7726a4f
fix: delete divisor is zero exception (according to the instruction m…
Chrisqcwx Mar 30, 2023
f5b8001
refactor: add bundle-UInt support in csr
Chrisqcwx Mar 31, 2023
fa3c315
fix: deal conflicts
Chrisqcwx Mar 31, 2023
0604065
feat: add many csr regs
Chrisqcwx Mar 31, 2023
1b68755
feat: add clear and flush output in Cu
Chrisqcwx Mar 31, 2023
3b4fda5
feat: add clear and flush in pipeline
Chrisqcwx Mar 31, 2023
c8e1354
feat: add ecode and esubcode in cu
Chrisqcwx Apr 1, 2023
f40023b
refactor: reformat
Chrisqcwx Apr 1, 2023
0f41cc0
feat: add new pc in cu
Chrisqcwx Apr 1, 2023
c1e5fde
fix: delete some temp file
Chrisqcwx Apr 1, 2023
e68bd35
fix: deal with conflicts
Chrisqcwx Apr 1, 2023
8bc5b94
refactor: minor modified in csr
Chrisqcwx Apr 2, 2023
7dbd64a
fix: some bug in cu; feat: add some exception deal in cu and csr
Chrisqcwx Apr 2, 2023
cd38c1c
feat: add some assignment on csr regs
Chrisqcwx Apr 2, 2023
1430e7c
refactor: move some bundles from ctrl/bundles to ctrl/csrRegsBundles
Chrisqcwx Apr 2, 2023
e81a943
refactor: move exeOp from MemLoadStoreNdPort -> InstInfoPort
Chrisqcwx Apr 2, 2023
849f0f9
fix: fix some wrong in writing csrRegs[llbctl]
Chrisqcwx Apr 2, 2023
0b43c77
refactor: set the badvaddr control between csr and cu into a bundle
Chrisqcwx Apr 2, 2023
d74afa8
fix: fix some bug in llbit and fix a spelling error
Chrisqcwx Apr 2, 2023
b6e19f4
fix: fix assignment error in csr
Chrisqcwx Apr 2, 2023
f9ace03
refactor: reformat
Chrisqcwx Apr 2, 2023
de5a8a9
fix: fix an assign error in csr
Chrisqcwx Apr 2, 2023
ab970fe
feat: add some csr assignment
Chrisqcwx Apr 2, 2023
e9e30e9
fix: fix state behavior error in ExeStage
Chrisqcwx Apr 3, 2023
2b9c17b
docs: add a README in pipeline
Chrisqcwx Apr 3, 2023
646007b
feat: add decode of csr; fix: fix state behavior error in exe
Chrisqcwx Apr 3, 2023
2e0bd28
fix: delete the pipeline control in pc
Chrisqcwx Apr 4, 2023
b39e7ca
feat: add scoreboard for csr
Chrisqcwx Apr 4, 2023
e6e0059
fix: deal with conflicts
Chrisqcwx Apr 4, 2023
79afb30
refactor: replace isFlush port in instQueue with pipelinecontrol port
Chrisqcwx Apr 4, 2023
6c5e000
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Apr 5, 2023
cae7838
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Apr 7, 2023
751d375
fix: fix the init value of PC
Chrisqcwx Apr 8, 2023
6f334ba
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Apr 8, 2023
6cd3454
feat: add csrScoreboardBlocking in IssueStage
Chrisqcwx Apr 8, 2023
5023345
feat: add stable counter
Chrisqcwx Apr 9, 2023
122da68
fix: fix some bugs
Chrisqcwx Apr 9, 2023
a99b2cd
feat: add data forward for RegRead and free scoreboard
Chrisqcwx Apr 9, 2023
214e495
refactor: remove some comment
Chrisqcwx Apr 9, 2023
2804c28
refactor: replace the * in mulStage
Chrisqcwx Apr 11, 2023
6c955b6
feat: add etrn inst; fix: fix decode bug in decoder_special
Chrisqcwx Apr 11, 2023
a67bf69
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Apr 14, 2023
51a6dfb
docs: add some comment in readme for pipeline
Chrisqcwx Apr 15, 2023
7f59de4
refactor: jump branch new Pc calc by exe send to Ctrl Unit to decide …
Chrisqcwx Apr 17, 2023
01a0593
feat: try MultiInstQueue(do not worry, it does not connect to the cpu)
Chrisqcwx Apr 17, 2023
10bd5c0
refactor: decode in issueStage -> decode in instQueue
Chrisqcwx Apr 17, 2023
e775068
refactor: rename some ports
Chrisqcwx Apr 17, 2023
a1d64b3
test: test inst queue
Chrisqcwx Apr 17, 2023
c3ea059
feat: add BiCounter
Chrisqcwx Apr 17, 2023
03d449c
feat: add BiInstQueue (test success)
Chrisqcwx Apr 18, 2023
3cb8a2d
feat: add decode in BiInstQueue
Chrisqcwx Apr 18, 2023
4e9da76
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Apr 18, 2023
78c5973
add BiIssueStage(unfinish)
Chrisqcwx Apr 18, 2023
07e9b7d
feat: add reorder buffer (unfinished)
Chrisqcwx Apr 18, 2023
17d559b
feat: improve rob (unfinished)
Chrisqcwx Apr 18, 2023
775f0e4
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Apr 18, 2023
03c64c0
fix: remove data forward temporarily
Chrisqcwx Apr 18, 2023
676a8ce
feat: improve rob (unfinished)
Chrisqcwx Apr 18, 2023
2fac508
refactor: move some util module to utils
Chrisqcwx Apr 19, 2023
1f4c0c2
feat: add MinFinder
Chrisqcwx Apr 19, 2023
b483829
test: test MinFinder success
Chrisqcwx Apr 19, 2023
d11ece5
fix: fix logic bug in rob
Chrisqcwx Apr 19, 2023
af31b73
feat: finish RobStage (without test)
Chrisqcwx Apr 19, 2023
814e538
feat: add read ports in rob; refactor: rename DataForwardReadPort -> …
Chrisqcwx Apr 19, 2023
adb0903
feat: imporve BiIssueStage (好难啊啊啊啊啊啊)
Chrisqcwx Apr 19, 2023
435d9b8
refactor: remove some comments
Chrisqcwx Apr 19, 2023
084c860
feat: add IssueInfoWithValid Bundle
Chrisqcwx Apr 19, 2023
c1cbf10
feat: improve BiIssueStage
Chrisqcwx Apr 19, 2023
32c457b
feat: write a lot lot lot of bullshit in BiIssueStage
Chrisqcwx Apr 19, 2023
e6950e2
feat: finish BiIssueStage (without test) (with so many bullshit)
Chrisqcwx Apr 19, 2023
befc393
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Apr 19, 2023
4fcd9dd
fix : fix some bugs
Chrisqcwx Apr 19, 2023
ff4582f
refactor: replace all the bullshit with new implement in BiIssueStage
Chrisqcwx Apr 20, 2023
701d43b
feat: add memAccessPort in ExeStage
Chrisqcwx Apr 20, 2023
de08c98
refactor: remove some comment
Chrisqcwx Apr 20, 2023
d8e7540
fix: fix commit bug in rob
Chrisqcwx Apr 21, 2023
a6d9bbc
add support for robId in BiIssueStage
Chrisqcwx Apr 21, 2023
60d5f78
feat: add isUnsigned port in MemAccessPort
Chrisqcwx Apr 21, 2023
70a3918
refactor: tidy up the test files' path
Chrisqcwx Apr 21, 2023
49e5e0c
fix: fix some bugs in robStage
Chrisqcwx Apr 21, 2023
12f1571
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Apr 22, 2023
1650603
feat: add isUnsigned port in MemRequestNdPort
Chrisqcwx Apr 22, 2023
ab261d2
Merge branch 'main' of github.com:Invalid-Syntax-NSCSCC/invalid-cpu i…
Chrisqcwx Apr 23, 2023
2959188
fix: fix read bug in rob stage
Chrisqcwx Apr 24, 2023
09615ce
refactor: refactor some expression in rob
Chrisqcwx Apr 24, 2023
d7a216f
fix: fix unneccessary block in BiIssueStage
Chrisqcwx Apr 24, 2023
7eefdc0
feat: rob id distribute only write inst -> all inst
Chrisqcwx Apr 24, 2023
3eecb5e
refactor RobStage: out-of-order buffer -> in-order buffer
Chrisqcwx Apr 24, 2023
19b4220
fix: conflicts
Chrisqcwx Apr 24, 2023
73f756f
docs: modify readme in pipiline
Chrisqcwx Apr 29, 2023
3eb5af5
delete: remove RfMapTable
Chrisqcwx Apr 29, 2023
e795553
feat: add Rename (unfinish)
Chrisqcwx Apr 30, 2023
6c3d192
feat: if write port is x0, make the writeEn false (in decoder)
Chrisqcwx Apr 30, 2023
218cf4a
feat: improve rename (unfinish)
Chrisqcwx Apr 30, 2023
c5b8dcb
feat: improve rename
Chrisqcwx Apr 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/src/common/bundles/RfAccessInfoNdPort.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import chisel3.experimental.BundleLiterals.AddBundleLiteralConstructor
import chisel3.util._
import spec._

class RfAccessInfoNdPort extends Bundle {
class RfAccessInfoNdPort(addrWidth: internal.firrtl.Width = Width.Reg.addr) extends Bundle {
val en = Bool()
val addr = UInt(Width.Reg.addr)
val addr = UInt(addrWidth)
}

object RfAccessInfoNdPort {
Expand Down
2 changes: 1 addition & 1 deletion src/src/frontend/BiInstQueue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class BiInstQueue(
io.dequeuePorts(1).valid := !isEmptyByOne

// enqueue
val numWidth: Int = log2Ceil(issueNum)
// val numWidth: Int = log2Ceil(issueNum)

val enqEn = (io.enqueuePorts.map(port => (port.ready && port.valid)))
// val enqueueNum = io.enqueuePorts.map(_.valid).map(_.asUInt).reduce(_ + _)
Expand Down
3 changes: 3 additions & 0 deletions src/src/pipeline/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 发射设计
双发射:顺序发射+(伪)乱序执行+顺序写回 (未实现寄存器重命名,无法解决RAW造成的阻塞浪费)

# 线路复用情况

1. decode info for exeState
Expand Down
27 changes: 13 additions & 14 deletions src/src/pipeline/dispatch/BiIssueStage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import pipeline.dataforward.bundles.ReadPortWithValid
import pipeline.dispatch.bundles.IssueInfoWithValidBundle
import pipeline.rob.bundles.RobIdDistributePort

// TODO: deal WAR data hazard
class BiIssueStage(
issueNum: Int = 2,
scoreChangeNum: Int = Param.regFileWriteNum,
Expand Down Expand Up @@ -62,21 +63,19 @@ class BiIssueStage(
io.issuedInfoPorts := issueInfosReg

// fall back
if (true) {
io.fetchInstDecodePorts.foreach { port =>
port.ready := false.B
}
io.occupyPortss.foreach(_.foreach { port =>
port.en := false.B
port.addr := zeroWord
})
io.csrOccupyPortss.foreach(_.foreach { port =>
port.en := false.B
port.addr := zeroWord
})
io.issuedInfoPorts.foreach(_ := IssuedInfoNdPort.default)
io.instInfoPorts.foreach(_ := InstInfoNdPort.default)
io.fetchInstDecodePorts.foreach { port =>
port.ready := false.B
}
io.occupyPortss.foreach(_.foreach { port =>
port.en := false.B
port.addr := zeroWord
})
io.csrOccupyPortss.foreach(_.foreach { port =>
port.en := false.B
port.addr := zeroWord
})
io.issuedInfoPorts.foreach(_ := IssuedInfoNdPort.default)
io.instInfoPorts.foreach(_ := InstInfoNdPort.default)

/** Combine stage 1 : get fetch infos
*/
Expand Down
215 changes: 215 additions & 0 deletions src/src/pipeline/dispatch/Rename.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
package pipeline.dispatch

import chisel3._
import chisel3.util._
import pipeline.dispatch.bundles.ScoreboardChangeNdPort
import spec._
import pipeline.dispatch.enums.{PrfState => State}
import pipeline.dispatch.bundles.RenameRequestNdPort
import pipeline.dispatch.bundles.RenameResultNdPort
import utils.BiPriorityMux
import utils.BiCounter
import control.bundles.PipelineControlNDPort

// 重命名+计分板,仅供乱序发射使用,顺序发射时不需要
class Rename(
arfRegNum: Int = Count.reg,
prfRegNum: Int = 64,
changeNum: Int = Param.scoreboardChangeNum,
occupyNum: Int = Param.regFileWriteNum,
renameNum: Int = 2)
extends Module {

val arfNumLog: Int = log2Ceil(arfRegNum)
val prfNumLog: Int = log2Ceil(prfRegNum)
val io = IO(new Bundle {
val commitPorts = Input(Vec(changeNum, new ScoreboardChangeNdPort(prfNumLog.W)))
val freePorts = Input(Vec(changeNum, new ScoreboardChangeNdPort(prfNumLog.W)))
val regScores = Output(Vec(prfRegNum, State()))

val renameRequestPorts = Input(Vec(renameNum, new RenameRequestNdPort))
val renameResultPorts = Output(Vec(renameNum, new RenameResultNdPort))

val pipelineControlPort = Input(new PipelineControlNDPort)
})

require(renameNum == 2)

io <> DontCare

/** State Transform
*
* free ---rename request write------------> busy
*
* busy ---------write back----------------> retire
*
* retire --next prf ( -> same arf) commit--> empty
*/

val arfToPrfMap = RegInit(VecInit(Seq.range(0, arfRegNum).map(_.U(prfNumLog.W))))

val prfPrevMap = RegInit(VecInit(Seq.fill(prfRegNum)(0.U(prfNumLog.W))))

val prfStateReg = RegInit(VecInit(Seq.range(0, prfRegNum).map { index =>
if (index < arfRegNum) {
State.retire
} else {
State.free
}
}))

io.regScores.zip(prfStateReg).foreach {
case (dst, src) =>
dst := src
}

/** free queue
*/

val freeQueueLength = prfRegNum - arfRegNum
val freeQueue = RegInit(
VecInit(
Seq.range(arfRegNum, prfRegNum).map {
_.U(prfNumLog.W)
}
)
)

val enq_ptr = Module(new BiCounter(freeQueueLength))
val deq_ptr = Module(new BiCounter(freeQueueLength))
enq_ptr.io.inc := 0.U
enq_ptr.io.flush := io.pipelineControlPort.flush
deq_ptr.io.inc := 0.U
deq_ptr.io.flush := io.pipelineControlPort.flush

val maybeFull = RegInit(true.B)
val ptrMatch = enq_ptr.io.value === deq_ptr.io.value
val isEmpty = ptrMatch && !maybeFull
val isFull = ptrMatch && maybeFull

val storeNum = WireDefault(
Mux(
enq_ptr.io.value > deq_ptr.io.value,
enq_ptr.io.value - deq_ptr.io.value,
(freeQueueLength.U - deq_ptr.io.value) + enq_ptr.io.value
)
)
val emptyNum = WireDefault(freeQueueLength.U - storeNum)

val isEmptyByOne = WireDefault(storeNum === 1.U)
val isFullByOne = WireDefault(emptyNum === 1.U)

/** Rename Request From RenameStage
*
* free --> busy
*/

val deqRequest = WireDefault(VecInit(io.renameRequestPorts.map { port =>
(port.arfWritePort.en && port.arfWritePort.addr.orR)
}))
val deqNum = WireDefault(deqRequest.map(_.asUInt).reduce(_ +& _))

io.renameResultPorts.zip(io.renameRequestPorts).foreach {
case (dst, src) =>
dst.grfReadPorts.zip(src.arfReadPorts).foreach {
case (dstRead, srcRead) =>
dstRead.en := srcRead.en
dstRead.addr := arfToPrfMap(srcRead.addr)
}
}

when(!isEmpty) {
// 至少可重命名1个
when(deqRequest(0)) {
deq_ptr.io.inc := 1.U
io.renameResultPorts(0).grfWritePort.en := true.B

val renameAddr = WireDefault(freeQueue(deq_ptr.io.value))
io.renameResultPorts(0).grfWritePort.addr := renameAddr

prfPrevMap(renameAddr) := arfToPrfMap(
io.renameRequestPorts(0).arfWritePort.addr
)
arfToPrfMap(io.renameRequestPorts(0).arfWritePort.addr) := renameAddr

prfStateReg(renameAddr) := State.busy

// 覆盖1的写重命名
io.renameResultPorts.zip(io.renameRequestPorts).foreach {
case (dst, src) =>
dst.grfReadPorts.zip(src.arfReadPorts).foreach {
case (dstRead, srcRead) =>
dstRead.en := srcRead.en
}
}

io.renameRequestPorts(1)
.arfReadPorts
.zip(io.renameResultPorts(1).grfReadPorts)
.foreach {
case (dstRead, srcRead) =>
when(srcRead.addr === io.renameRequestPorts(0).arfWritePort.addr) {
dstRead.addr := renameAddr
}
}

when(deqRequest(1) && !isEmptyByOne) {
// 重命名2个
deq_ptr.io.inc := 2.U
io.renameResultPorts(1).grfWritePort.en := true.B

val renameAddr2 = WireDefault(freeQueue(deq_ptr.io.value + 1.U))
io.renameResultPorts(1).grfWritePort.addr := renameAddr2
prfStateReg(renameAddr2) := State.busy
arfToPrfMap(io.renameRequestPorts(1).arfWritePort.addr) := renameAddr2
when(
io.renameRequestPorts(1).arfWritePort.addr =/= io.renameRequestPorts(0).arfWritePort.addr
) {
prfPrevMap(renameAddr2) := arfToPrfMap(
io.renameRequestPorts(1).arfWritePort.addr
)
}.otherwise {
// write the same reg
prfPrevMap(renameAddr2) := renameAddr
}

}

}.elsewhen(deqRequest(1)) {
deq_ptr.io.inc := 1.U
io.renameResultPorts(1).grfWritePort.en := true.B

val renameAddr = WireDefault(freeQueue(deq_ptr.io.value))
io.renameResultPorts(1).grfWritePort.addr := renameAddr

prfPrevMap(renameAddr) := arfToPrfMap(
io.renameRequestPorts(1).arfWritePort.addr
)
arfToPrfMap(io.renameRequestPorts(1).arfWritePort.addr) := renameAddr

prfStateReg(renameAddr) := State.busy
}
}

/** Rename - Retire From WbStage
*
* busy --> retire
*/

io.freePorts.foreach { port =>
when(port.en) {
prfStateReg(port.addr) := State.retire
}
}

/** Rename - Next Commit From Rob
*
* retire -> empty
*/

io.commitPorts.foreach { port =>
when(port.en) {
prfStateReg(prfPrevMap(port.addr)) := State.free
}
}
}
12 changes: 12 additions & 0 deletions src/src/pipeline/dispatch/bundles/RenameRequestNdPort.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package pipeline.dispatch.bundles

import chisel3._
import common.bundles.RfAccessInfoNdPort

class RenameRequestNdPort(
regReadNum: Int = 2,
arfAddrWidth: internal.firrtl.Width = 5.W)
extends Bundle {
val arfWritePort = new RfAccessInfoNdPort(arfAddrWidth)
val arfReadPorts = Vec(regReadNum, new RfAccessInfoNdPort(arfAddrWidth))
}
20 changes: 20 additions & 0 deletions src/src/pipeline/dispatch/bundles/RenameResultNdPort.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package pipeline.dispatch.bundles

import chisel3._
import common.bundles.RfAccessInfoNdPort
import chisel3.experimental.BundleLiterals.AddBundleLiteralConstructor

class RenameResultNdPort(
regReadNum: Int = 2,
grfAddrWidth: internal.firrtl.Width = 6.W)
extends Bundle {
val grfWritePort = new RfAccessInfoNdPort(grfAddrWidth)
val grfReadPorts = Vec(regReadNum, new RfAccessInfoNdPort(grfAddrWidth))
}

object RenameResultNdPort {
def setDefault(port: RenameResultNdPort) {
port.grfWritePort := RfAccessInfoNdPort.default
port.grfReadPorts.foreach(_ := RfAccessInfoNdPort.default)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import chisel3._
import chisel3.util._
import spec._

class ScoreboardChangeNdPort extends Bundle {
class ScoreboardChangeNdPort(addrWidth: internal.firrtl.Width = Width.Reg.addr) extends Bundle {
val en = Bool()
val addr = UInt(Width.Reg.addr)
val addr = UInt(addrWidth)
}
11 changes: 6 additions & 5 deletions src/src/pipeline/dispatch/decode/Decoder_2R.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ import pipeline.dispatch.bundles.DecodeOutNdPort
class Decoder_2R extends Decoder {
io.out := DecodeOutNdPort.default

val opcode = WireDefault(io.instInfoPort.inst(31, 10))
val rj = WireDefault(io.instInfoPort.inst(9, 5))
val rd = WireDefault(io.instInfoPort.inst(4, 0))
val opcode = WireDefault(io.instInfoPort.inst(31, 10))
val rj = WireDefault(io.instInfoPort.inst(9, 5))
val rd = WireDefault(io.instInfoPort.inst(4, 0))
val rdIsNotZero = WireDefault(rd.orR)

io.out.info.isHasImm := false.B

switch(io.instInfoPort.inst) {
is(Inst.rdcnt_id_vl) {
io.out.info.gprWritePort.en := true.B
io.out.info.gprWritePort.en := rdIsNotZero
when(rd.orR) {
io.out.info.gprWritePort.addr := rj
io.out.info.exeOp := ExeInst.Op.rdcntid
Expand All @@ -27,7 +28,7 @@ class Decoder_2R extends Decoder {
}
}
is(Inst.rdcnt_vh) {
io.out.info.gprWritePort.en := true.B
io.out.info.gprWritePort.en := rdIsNotZero
io.out.info.gprWritePort.addr := rd
io.out.info.exeOp := ExeInst.Op.rdcntvh_w
}
Expand Down
11 changes: 6 additions & 5 deletions src/src/pipeline/dispatch/decode/Decoder_2RI12.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import pipeline.dispatch.bundles.DecodeOutNdPort
class Decoder_2RI12 extends Decoder {
io.out := DecodeOutNdPort.default

val opcode = WireDefault(io.instInfoPort.inst(31, 22))
val imm12 = WireDefault(io.instInfoPort.inst(21, 10))
val rj = WireDefault(io.instInfoPort.inst(9, 5))
val rd = WireDefault(io.instInfoPort.inst(4, 0))
val opcode = WireDefault(io.instInfoPort.inst(31, 22))
val imm12 = WireDefault(io.instInfoPort.inst(21, 10))
val rj = WireDefault(io.instInfoPort.inst(9, 5))
val rd = WireDefault(io.instInfoPort.inst(4, 0))
val rdIsNotZero = WireDefault(rd.orR)

def outInfo = io.out.info

Expand All @@ -32,7 +33,7 @@ class Decoder_2RI12 extends Decoder {
io.out.info.gprReadPorts(0).addr := rj
io.out.info.gprReadPorts(1).en := false.B
io.out.info.gprReadPorts(1).addr := DontCare
io.out.info.gprWritePort.en := true.B
io.out.info.gprWritePort.en := rdIsNotZero // true.B
io.out.info.gprWritePort.addr := rd

// Fallback
Expand Down
Loading