Hazarplugin tell to branch plugin if the RS are hazardous in the execute stage
This commit is contained in:
parent
c2b9544794
commit
7075e08d9f
|
@ -208,6 +208,8 @@ class BranchPlugin(earlyBranch : Boolean,
|
|||
branchExceptionPort.valid := arbitration.isValid && input(BRANCH_DO) && jumpInterface.payload(1)
|
||||
branchExceptionPort.code := 0
|
||||
branchExceptionPort.badAddr := jumpInterface.payload
|
||||
|
||||
if(branchStage == execute) branchExceptionPort.valid clearWhen(service(classOf[HazardService]).hazardOnExecuteRS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -289,6 +291,8 @@ class BranchPlugin(earlyBranch : Boolean,
|
|||
branchExceptionPort.valid := arbitration.isValid && unalignedJump
|
||||
branchExceptionPort.code := 0
|
||||
branchExceptionPort.badAddr := input(BRANCH_CALC) //pipeline.stages(pipeline.indexOf(branchStage)-1).input
|
||||
|
||||
if(branchStage == execute) branchExceptionPort.valid clearWhen(service(classOf[HazardService]).hazardOnExecuteRS)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -366,6 +370,8 @@ class BranchPlugin(earlyBranch : Boolean,
|
|||
branchExceptionPort.valid := arbitration.isValid && input(BRANCH_DO) && input(BRANCH_CALC)(1)
|
||||
branchExceptionPort.code := 0
|
||||
branchExceptionPort.badAddr := input(BRANCH_CALC)
|
||||
|
||||
if(branchStage == execute) branchExceptionPort.valid clearWhen(service(classOf[HazardService]).hazardOnExecuteRS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,16 +4,24 @@ import vexriscv._
|
|||
import spinal.core._
|
||||
import spinal.lib._
|
||||
|
||||
trait HazardService{
|
||||
def hazardOnExecuteRS : Bool
|
||||
}
|
||||
|
||||
class HazardSimplePlugin(bypassExecute : Boolean = false,
|
||||
bypassMemory: Boolean = false,
|
||||
bypassWriteBack: Boolean = false,
|
||||
bypassWriteBackBuffer : Boolean = false,
|
||||
pessimisticUseSrc : Boolean = false,
|
||||
pessimisticWriteRegFile : Boolean = false,
|
||||
pessimisticAddressMatch : Boolean = false) extends Plugin[VexRiscv] {
|
||||
pessimisticAddressMatch : Boolean = false) extends Plugin[VexRiscv] with HazardService{
|
||||
import Riscv._
|
||||
|
||||
|
||||
def hazardOnExecuteRS = {
|
||||
if(pipeline.service(classOf[RegFileService]).readStage() == pipeline.execute) pipeline.execute.arbitration.isStuckByOthers else False
|
||||
}
|
||||
|
||||
override def setup(pipeline: VexRiscv): Unit = {
|
||||
import pipeline.config._
|
||||
val decoderService = pipeline.service(classOf[DecoderService])
|
||||
|
@ -105,3 +113,10 @@ class HazardSimplePlugin(bypassExecute : Boolean = false,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class NoHazardPlugin extends Plugin[VexRiscv] with HazardService {
|
||||
override def build(pipeline: VexRiscv): Unit = {}
|
||||
|
||||
def hazardOnExecuteRS = False
|
||||
}
|
Loading…
Reference in New Issue