Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolu1990 committed Jan 9, 2024
1 parent efc15cc commit 8d43b13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/main/scala/vexiiriscv/execute/CsrAccessPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CsrAccessPlugin(layer : LaneLayer,

override def onDecodeTrap(): Unit = apiIo.onDecodeTrap := True
override def onDecodeUntrap(): Unit = apiIo.onDecodeTrap := False
override def onDecodeFlushPipeline(): Unit = apiIo.onDecodeFlushPipeline
override def onDecodeFlushPipeline(): Unit = apiIo.onDecodeFlushPipeline := True
override def onDecodeRead: Bool = apiIo.onDecodeRead
override def onDecodeWrite: Bool = apiIo.onDecodeWrite
override def onDecodeHartId: UInt = apiIo.onDecodeHartId
Expand Down Expand Up @@ -249,21 +249,26 @@ class CsrAccessPlugin(layer : LaneLayer,
trapPort.tval := UOP

val flushReg = RegInit(False) setWhen(flushPort.valid) clearWhen(!elp.isFreezed())
flushPort.valid setWhen(flushReg)
when(flushReg) {
flushPort.valid := True
bypass(Global.TRAP) := True
}

IDLE whenIsActive {
(regs.sels.values, sels.values).zipped.foreach(_ := _)

when(onDecodeDo) {
when(trap) {
flushPort.valid := True
trapPort.valid := True
bypass(Global.TRAP) := True
bypass(Global.COMMIT) := False
flushPort.valid := True
trapPort.valid := True
iLogic.freeze := False
} otherwise {
goto(READ)
when(apiIo.onDecodeFlushPipeline){
bypass(Global.TRAP) := True
flushPort.valid := True
trapPort.valid := True
trapPort.exception := False
trapPort.code := TrapReason.JUMP
Expand Down Expand Up @@ -397,12 +402,12 @@ class CsrAccessPlugin(layer : LaneLayer,
}
}

val completion = Flow(CompletionPayload()) //TODO is it realy necessary to have this port ?
val completion = Flow(CompletionPayload()) //Only used when !integrated
completion.valid := False
completion.uopId := regs.uopId
completion.hartId := regs.hartId
completion.trap := inject(Global.TRAP)
completion.commit := !inject(Global.TRAP)
completion.commit := inject(Global.COMMIT)

integrated match {
case true => {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/vexiiriscv/execute/LsuCachelessPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class LsuCachelessPlugin(var layer : LaneLayer,
trapPort.code := TrapReason.JUMP
trapPort.tval(0, INSTRUCTION_SLICE_COUNT_WIDTH + 1 bits) := 0
}

when(tpk.PAGE_FAULT || LOAD.mux(!tpk.ALLOW_READ, !tpk.ALLOW_WRITE)) {
skip := True
trapPort.exception := True
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/vexiiriscv/memory/MmuPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class MmuPlugin(var spec : MmuSpec,
csr.writeCancel(CSR.SATP, satpModeWrite =/= 0 && satpModeWrite =/= spec.satpMode)
// csr.readWriteRam(CSR.SATP) not suported by writeCancel

//TODO !!!! MISS SPEC : Changes to the sstatus fields SUM and MXR take effect immediately, without the need to execute an SFENCE.VMA instruction.
csr.onDecode(CSR.SATP){
csr.onDecodeFlushPipeline()
invalidatePort.cmd.valid := True
Expand Down

0 comments on commit 8d43b13

Please sign in to comment.