This commit is contained in:
Dolu1990 2018-04-09 09:12:30 +02:00
parent e00c0750eb
commit 4dd2997ad5
4 changed files with 21 additions and 36 deletions

View File

@ -379,7 +379,7 @@ class CsrPlugin(config : CsrPluginConfig) extends Plugin[VexRiscv] with Exceptio
when(enable){
fetcher.haltIt()
}
val done = ! List(decode, execute, memory, writeBack).map(_.arbitration.isValid).orR && fetcher.nextPc()._1
val done = ! List(execute, memory, writeBack).map(_.arbitration.isValid).orR && fetcher.nextPc()._1
// val done = History(doneAsync, 0 to 0).andR
}
@ -532,10 +532,9 @@ class CsrPlugin(config : CsrPluginConfig) extends Plugin[VexRiscv] with Exceptio
}
//Manage WFI instructions
if(wfiGen) when(decode.arbitration.isValid && decode.input(ENV_CTRL) === EnvCtrlEnum.WFI){
if(wfiGen) when(execute.arbitration.isValid && execute.input(ENV_CTRL) === EnvCtrlEnum.WFI){
when(!interrupt){
fetcher.haltIt()
decode.arbitration.haltItself := True
execute.arbitration.haltItself := True
}
}

View File

@ -174,6 +174,7 @@ class DebugPlugin(val debugClockDomain : ClockDomain) extends Plugin[VexRiscv] w
is(1) {
when(io.bus.cmd.wr) {
insertDecodeInstruction := True
//TODO !!!!
decode.arbitration.isValid.getDrivingReg setWhen (firstCycle)
decode.arbitration.haltItself setWhen (secondCycle)
io.bus.cmd.ready := !firstCycle && !secondCycle && execute.arbitration.isValid

View File

@ -9,18 +9,17 @@ import scala.collection.mutable.ArrayBuffer
abstract class IBusFetcherImpl(catchAccessFault : Boolean,
pendingMax : Int = 7,
resetVector : BigInt,
keepPcPlus4 : Boolean,
decodePcGen : Boolean,
compressedGen : Boolean,
cmdToRspStageCount : Int,
rspStageGen : Boolean,
injectorReadyCutGen : Boolean,
relaxedPcCalculation : Boolean,
prediction : BranchPrediction,
catchAddressMisaligned : Boolean,
abstract class IBusFetcherImpl(val catchAccessFault : Boolean,
val resetVector : BigInt,
val keepPcPlus4 : Boolean,
val decodePcGen : Boolean,
val compressedGen : Boolean,
val cmdToRspStageCount : Int,
val rspStageGen : Boolean,
val injectorReadyCutGen : Boolean,
val relaxedPcCalculation : Boolean,
val prediction : BranchPrediction,
val catchAddressMisaligned : Boolean,
injectorStage : Boolean) extends Plugin[VexRiscv] with JumpService with IBusFetcher{
var prefetchExceptionPort : Flow[ExceptionCause] = null
@ -244,13 +243,12 @@ abstract class IBusFetcherImpl(catchAccessFault : Boolean,
val injector = new Area {
val inputBeforeHalt = condApply(if(decodePcGen) decompressor.output else iBusRsp.output, injectorReadyCutGen)(_.s2mPipe(flush))
val decodeInput = if(injectorStage){
val inputBeforeStage = inputBeforeHalt.haltWhen(fetcherHalt)
val decodeInput = inputBeforeStage.m2sPipeWithFlush(killLastStage)
decode.insert(INSTRUCTION_ANTICIPATED) := Mux(decode.arbitration.isStuck, decode.input(INSTRUCTION), inputBeforeStage.rsp.inst)
val decodeInput = inputBeforeHalt.m2sPipeWithFlush(killLastStage)
decode.insert(INSTRUCTION_ANTICIPATED) := Mux(decode.arbitration.isStuck, decode.input(INSTRUCTION), inputBeforeHalt.rsp.inst)
decodeInput
} else {
inputBeforeHalt
}
}.haltWhen(fetcherHalt)
if(decodePcGen){
decodeNextPcValid := True

View File

@ -107,31 +107,18 @@ case class IBusSimpleBus(interfaceKeepData : Boolean) extends Bundle with IMaste
class IBusSimplePlugin(interfaceKeepData : Boolean, catchAccessFault : Boolean, pendingMax : Int = 7) extends IBusFetcherImpl(
catchAccessFault = catchAccessFault,
pendingMax = 7,
resetVector = BigInt(0x80000000l),
keepPcPlus4 = false,
decodePcGen = false,
compressedGen = false,
decodePcGen = true,
compressedGen = true,
cmdToRspStageCount = 1,
rspStageGen = false,
injectorReadyCutGen = false,
relaxedPcCalculation = false,
prediction = NONE,
catchAddressMisaligned = false,
catchAddressMisaligned = true,
injectorStage = true){
var iBus : IBusSimpleBus = null
def resetVector = BigInt(0x80000000l)
def keepPcPlus4 = false
def decodePcGen = false
def compressedGen = false
def cmdToRspStageCount = 1
def rspStageGen = false
def injectorReadyCutGen = false
def relaxedPcCalculation = false
def prediction : BranchPrediction = NONE
def catchAddressMisaligned = false
def injectorStage = true
override def setup(pipeline: VexRiscv): Unit = {
super.setup(pipeline)