Add jump priority managment in PcPlugins
This commit is contained in:
parent
506e0e3f60
commit
93110d3b95
|
@ -8,7 +8,7 @@ import spinal.lib._
|
|||
import scala.beans.BeanProperty
|
||||
|
||||
trait JumpService{
|
||||
def createJumpInterface(stage : Stage) : Flow[UInt]
|
||||
def createJumpInterface(stage : Stage, priority : Int = 0) : Flow[UInt]
|
||||
}
|
||||
|
||||
trait DecoderService{
|
||||
|
|
|
@ -41,9 +41,9 @@ object TestsWorkspace {
|
|||
// ),
|
||||
new IBusCachedPlugin(
|
||||
config = InstructionCacheConfig(
|
||||
cacheSize = 4096,
|
||||
cacheSize = 1024,
|
||||
bytePerLine = 32,
|
||||
wayCount = 4,
|
||||
wayCount = 2,
|
||||
wrappedMemAccess = true,
|
||||
addressWidth = 32,
|
||||
cpuDataWidth = 32,
|
||||
|
|
|
@ -32,7 +32,7 @@ class IBusCachedPlugin(config : InstructionCacheConfig, askMemoryTranslation : B
|
|||
))
|
||||
|
||||
//TODO manage priority with branch prediction
|
||||
redoBranch = pipeline.service(classOf[JumpService]).createJumpInterface(pipeline.decode)
|
||||
redoBranch = pipeline.service(classOf[JumpService]).createJumpInterface(pipeline.decode, priority = 1) //Priority 1 will win against branch predictor
|
||||
|
||||
if(catchSomething) {
|
||||
val exceptionService = pipeline.service(classOf[ExceptionService])
|
||||
|
|
|
@ -9,11 +9,11 @@ import scala.collection.mutable.ArrayBuffer
|
|||
class PcManagerSimplePlugin(resetVector : BigInt,
|
||||
relaxedPcCalculation : Boolean = false) extends Plugin[VexRiscv] with JumpService{
|
||||
//FetchService interface
|
||||
case class JumpInfo(interface : Flow[UInt], stage: Stage)
|
||||
case class JumpInfo(interface : Flow[UInt], stage: Stage, priority : Int)
|
||||
val jumpInfos = ArrayBuffer[JumpInfo]()
|
||||
override def createJumpInterface(stage: Stage): Flow[UInt] = {
|
||||
override def createJumpInterface(stage: Stage, priority : Int = 0): Flow[UInt] = {
|
||||
val interface = Flow(UInt(32 bits))
|
||||
jumpInfos += JumpInfo(interface,stage)
|
||||
jumpInfos += JumpInfo(interface,stage, priority)
|
||||
interface
|
||||
}
|
||||
var prefetchExceptionPort : Flow[ExceptionCause] = null
|
||||
|
@ -59,7 +59,10 @@ class PcManagerSimplePlugin(resetVector : BigInt,
|
|||
|
||||
//JumpService hardware implementation
|
||||
val jump = if(jumpInfos.length != 0) new Area {
|
||||
val sortedByStage = jumpInfos.sortWith((a, b) => pipeline.indexOf(a.stage) > pipeline.indexOf(b.stage))
|
||||
val sortedByStage = jumpInfos.sortWith((a, b) => {
|
||||
(pipeline.indexOf(a.stage) > pipeline.indexOf(b.stage)) ||
|
||||
(pipeline.indexOf(a.stage) == pipeline.indexOf(b.stage) && a.priority > b.priority)
|
||||
})
|
||||
val valids = sortedByStage.map(_.interface.valid)
|
||||
val pcs = sortedByStage.map(_.interface.payload)
|
||||
|
||||
|
|
|
@ -199,6 +199,8 @@ public:
|
|||
|
||||
|
||||
Workspace(string name){
|
||||
//setIStall(false);
|
||||
//setDStall(false);
|
||||
staticMutex.lock();
|
||||
testsCounter++;
|
||||
staticMutex.unlock();
|
||||
|
|
Loading…
Reference in New Issue