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){ when(enable){
fetcher.haltIt() 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 // val done = History(doneAsync, 0 to 0).andR
} }
@ -532,10 +532,9 @@ class CsrPlugin(config : CsrPluginConfig) extends Plugin[VexRiscv] with Exceptio
} }
//Manage WFI instructions //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){ when(!interrupt){
fetcher.haltIt() execute.arbitration.haltItself := True
decode.arbitration.haltItself := True
} }
} }

View File

@ -174,6 +174,7 @@ class DebugPlugin(val debugClockDomain : ClockDomain) extends Plugin[VexRiscv] w
is(1) { is(1) {
when(io.bus.cmd.wr) { when(io.bus.cmd.wr) {
insertDecodeInstruction := True insertDecodeInstruction := True
//TODO !!!!
decode.arbitration.isValid.getDrivingReg setWhen (firstCycle) decode.arbitration.isValid.getDrivingReg setWhen (firstCycle)
decode.arbitration.haltItself setWhen (secondCycle) decode.arbitration.haltItself setWhen (secondCycle)
io.bus.cmd.ready := !firstCycle && !secondCycle && execute.arbitration.isValid 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, abstract class IBusFetcherImpl(val catchAccessFault : Boolean,
pendingMax : Int = 7, val resetVector : BigInt,
resetVector : BigInt, val keepPcPlus4 : Boolean,
keepPcPlus4 : Boolean, val decodePcGen : Boolean,
decodePcGen : Boolean, val compressedGen : Boolean,
compressedGen : Boolean, val cmdToRspStageCount : Int,
cmdToRspStageCount : Int, val rspStageGen : Boolean,
rspStageGen : Boolean, val injectorReadyCutGen : Boolean,
injectorReadyCutGen : Boolean, val relaxedPcCalculation : Boolean,
relaxedPcCalculation : Boolean, val prediction : BranchPrediction,
prediction : BranchPrediction, val catchAddressMisaligned : Boolean,
catchAddressMisaligned : Boolean,
injectorStage : Boolean) extends Plugin[VexRiscv] with JumpService with IBusFetcher{ injectorStage : Boolean) extends Plugin[VexRiscv] with JumpService with IBusFetcher{
var prefetchExceptionPort : Flow[ExceptionCause] = null var prefetchExceptionPort : Flow[ExceptionCause] = null
@ -244,13 +243,12 @@ abstract class IBusFetcherImpl(catchAccessFault : Boolean,
val injector = new Area { val injector = new Area {
val inputBeforeHalt = condApply(if(decodePcGen) decompressor.output else iBusRsp.output, injectorReadyCutGen)(_.s2mPipe(flush)) val inputBeforeHalt = condApply(if(decodePcGen) decompressor.output else iBusRsp.output, injectorReadyCutGen)(_.s2mPipe(flush))
val decodeInput = if(injectorStage){ val decodeInput = if(injectorStage){
val inputBeforeStage = inputBeforeHalt.haltWhen(fetcherHalt) val decodeInput = inputBeforeHalt.m2sPipeWithFlush(killLastStage)
val decodeInput = inputBeforeStage.m2sPipeWithFlush(killLastStage) decode.insert(INSTRUCTION_ANTICIPATED) := Mux(decode.arbitration.isStuck, decode.input(INSTRUCTION), inputBeforeHalt.rsp.inst)
decode.insert(INSTRUCTION_ANTICIPATED) := Mux(decode.arbitration.isStuck, decode.input(INSTRUCTION), inputBeforeStage.rsp.inst)
decodeInput decodeInput
} else { } else {
inputBeforeHalt inputBeforeHalt
} }.haltWhen(fetcherHalt)
if(decodePcGen){ if(decodePcGen){
decodeNextPcValid := True 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( class IBusSimplePlugin(interfaceKeepData : Boolean, catchAccessFault : Boolean, pendingMax : Int = 7) extends IBusFetcherImpl(
catchAccessFault = catchAccessFault, catchAccessFault = catchAccessFault,
pendingMax = 7,
resetVector = BigInt(0x80000000l), resetVector = BigInt(0x80000000l),
keepPcPlus4 = false, keepPcPlus4 = false,
decodePcGen = false, decodePcGen = true,
compressedGen = false, compressedGen = true,
cmdToRspStageCount = 1, cmdToRspStageCount = 1,
rspStageGen = false, rspStageGen = false,
injectorReadyCutGen = false, injectorReadyCutGen = false,
relaxedPcCalculation = false, relaxedPcCalculation = false,
prediction = NONE, prediction = NONE,
catchAddressMisaligned = false, catchAddressMisaligned = true,
injectorStage = true){ injectorStage = true){
var iBus : IBusSimpleBus = null 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 = { override def setup(pipeline: VexRiscv): Unit = {
super.setup(pipeline) super.setup(pipeline)