From c3a7f4e58c9ec6061264dc9a2449d601ae2c4f0b Mon Sep 17 00:00:00 2001 From: Dolu1990 Date: Fri, 10 Nov 2017 00:59:31 +0100 Subject: [PATCH] CSR unsetRegIfNoAssignement fix BranchPlugin doesn't emit the prediction cache when the STATIC setup is used --- src/main/scala/vexriscv/plugin/BranchPlugin.scala | 4 ++-- src/main/scala/vexriscv/plugin/CsrPlugin.scala | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/scala/vexriscv/plugin/BranchPlugin.scala b/src/main/scala/vexriscv/plugin/BranchPlugin.scala index f6c0e39..4276b91 100644 --- a/src/main/scala/vexriscv/plugin/BranchPlugin.scala +++ b/src/main/scala/vexriscv/plugin/BranchPlugin.scala @@ -147,8 +147,8 @@ class BranchPlugin(earlyBranch : Boolean, import pipeline._ import pipeline.config._ - val historyCache = Mem(BranchPredictorLine(), 1 << historyRamSizeLog2) setName("branchCache") - val historyCacheWrite = historyCache.writePort + val historyCache = if(prediction == DYNAMIC) Mem(BranchPredictorLine(), 1 << historyRamSizeLog2) setName("branchCache") else null + val historyCacheWrite = if(prediction == DYNAMIC) historyCache.writePort else null //Read historyCache if(prediction == DYNAMIC) fetch plug new Area{ diff --git a/src/main/scala/vexriscv/plugin/CsrPlugin.scala b/src/main/scala/vexriscv/plugin/CsrPlugin.scala index 47996aa..57c4470 100644 --- a/src/main/scala/vexriscv/plugin/CsrPlugin.scala +++ b/src/main/scala/vexriscv/plugin/CsrPlugin.scala @@ -260,10 +260,10 @@ class CsrPlugin(config : CsrPluginConfig) extends Plugin[VexRiscv] with Exceptio //Define CSR registers val misa = new Area{ - val base = Reg(UInt(2 bits)) init(U"01") - val extensions = Reg(Bits(26 bits)) init(misaExtensionsInit) + val base = Reg(UInt(2 bits)) init(U"01") unsetRegIfNoAssignement + val extensions = Reg(Bits(26 bits)) init(misaExtensionsInit) unsetRegIfNoAssignement } - val mtvec = RegInit(U(mtvecInit,xlen bits)) + val mtvec = RegInit(U(mtvecInit,xlen bits)) unsetRegIfNoAssignement val mepc = Reg(UInt(xlen bits)) val mstatus = new Area{ val MIE, MPIE = RegInit(False)