From 492310e6fa66e9d8a47a48ea6dc406fde961dcf8 Mon Sep 17 00:00:00 2001 From: Charles Papon Date: Fri, 28 Feb 2020 17:21:59 +0100 Subject: [PATCH] DBusCachedPlugin fix noWriteBack redo priority --- .../scala/vexriscv/plugin/DBusCachedPlugin.scala | 2 +- src/main/scala/vexriscv/plugin/Fetcher.scala | 4 ++-- .../scala/vexriscv/plugin/IBusSimplePlugin.scala | 2 +- .../scala/vexriscv/TestIndividualFeatures.scala | 14 ++++++++------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/scala/vexriscv/plugin/DBusCachedPlugin.scala b/src/main/scala/vexriscv/plugin/DBusCachedPlugin.scala index f0eaa81..fd45dd8 100644 --- a/src/main/scala/vexriscv/plugin/DBusCachedPlugin.scala +++ b/src/main/scala/vexriscv/plugin/DBusCachedPlugin.scala @@ -145,7 +145,7 @@ class DBusCachedPlugin(val config : DataCacheConfig, decoderService.add(FENCE, Nil) mmuBus = pipeline.service(classOf[MemoryTranslator]).newTranslationPort(MemoryTranslatorPort.PRIORITY_DATA ,memoryTranslatorPortConfig) - redoBranch = pipeline.service(classOf[JumpService]).createJumpInterface(if(pipeline.writeBack != null) pipeline.writeBack else pipeline.execute) + redoBranch = pipeline.service(classOf[JumpService]).createJumpInterface(if(pipeline.writeBack != null) pipeline.writeBack else pipeline.memory) if(catchSomething) exceptionBus = pipeline.service(classOf[ExceptionService]).newExceptionPort(if(pipeline.writeBack == null) pipeline.memory else pipeline.writeBack) diff --git a/src/main/scala/vexriscv/plugin/Fetcher.scala b/src/main/scala/vexriscv/plugin/Fetcher.scala index cac8789..8463238 100644 --- a/src/main/scala/vexriscv/plugin/Fetcher.scala +++ b/src/main/scala/vexriscv/plugin/Fetcher.scala @@ -159,7 +159,7 @@ abstract class IBusFetcherImpl(val resetVector : BigInt, } pc(0) := False - if(!pipeline(RVC_GEN)) pc(1) := False + if(!compressedGen) pc(1) := False output.valid := !fetcherHalt && booted output.payload := pc @@ -590,7 +590,7 @@ abstract class IBusFetcherImpl(val resetVector : BigInt, val compressor = compressedGen generate new Area{ val predictionBranch = iBusRspContext.hit && !iBusRspContext.hazard && iBusRspContext.line.branchWish(1) - val unalignedWordIssue = iBusRsp.output.valid && predictionBranch && decompressor.throw2Bytes && !decompressor.isInputHighRvc + val unalignedWordIssue = iBusRsp.output.valid && predictionBranch && iBusRspContext.line.last2Bytes && Mux(decompressor.unaligned, !decompressor.isInputHighRvc, decompressor.isInputLowRvc && !decompressor.isInputHighRvc) when(unalignedWordIssue){ historyWrite.valid := True diff --git a/src/main/scala/vexriscv/plugin/IBusSimplePlugin.scala b/src/main/scala/vexriscv/plugin/IBusSimplePlugin.scala index 56ad76f..ed5cbb4 100644 --- a/src/main/scala/vexriscv/plugin/IBusSimplePlugin.scala +++ b/src/main/scala/vexriscv/plugin/IBusSimplePlugin.scala @@ -343,7 +343,7 @@ class IBusSimplePlugin( resetVector : BigInt, //Manage flush for iBus transactions in flight val discardCounter = Reg(UInt(log2Up(pendingMax + 1) bits)) init (0) discardCounter := discardCounter - (iBus.rsp.fire && discardCounter =/= 0).asUInt - when(fetcherflushIt) { + when(iBusRsp.stages.last.flush) { if(secondStagePersistence) discardCounter := pendingCmd + cmd.valid.asUInt - iBus.rsp.fire.asUInt else diff --git a/src/test/scala/vexriscv/TestIndividualFeatures.scala b/src/test/scala/vexriscv/TestIndividualFeatures.scala index 7f00d1f..3ed94a0 100644 --- a/src/test/scala/vexriscv/TestIndividualFeatures.scala +++ b/src/test/scala/vexriscv/TestIndividualFeatures.scala @@ -628,13 +628,15 @@ class TestIndividualFeatures extends FunSuite { } } - val testId : Option[mutable.HashSet[Int]] = None - val seed = sys.env.getOrElse("VEXRISCV_REGRESSION_SEED", Random.nextLong().toString).toLong -// + var testId : Option[mutable.HashSet[Int]] = None + var seed = sys.env.getOrElse("VEXRISCV_REGRESSION_SEED", Random.nextInt(1000000000).toString).toLong + // val testId = Some(mutable.HashSet(3,4,9,11,13,16,18,19,20,21)) -// val testId = Some(mutable.HashSet(11)) -// val testId = Some(mutable.HashSet(6)) -// val seed = 9095713085965080531l +// val testId = Some(mutable.HashSet(15)) +// seed = -7374992264756372315l +// testId = Some(mutable.HashSet(1,2,6,14,15,16,19)) +// testId = Some(mutable.HashSet(1,2,6,14)) +// testId = Some(mutable.HashSet(1)) val rand = new Random(seed)