mirror of
https://github.com/rdolbeau/VexRiscvBPluginGenerator.git
synced 2025-04-18 18:44:42 -04:00
drop patch, see the VexRiscv branch three_operands instead
This commit is contained in:
parent
cc4b44258c
commit
5a21dd7521
1 changed files with 0 additions and 238 deletions
|
@ -1,238 +0,0 @@
|
|||
diff --git a/src/main/scala/vexriscv/Riscv.scala b/src/main/scala/vexriscv/Riscv.scala
|
||||
index ee9be3d..c554429 100644
|
||||
--- a/src/main/scala/vexriscv/Riscv.scala
|
||||
+++ b/src/main/scala/vexriscv/Riscv.scala
|
||||
@@ -11,6 +11,7 @@ object Riscv{
|
||||
def funct3Range = 14 downto 12
|
||||
def rs1Range = 19 downto 15
|
||||
def rs2Range = 24 downto 20
|
||||
+ def rs3Range = 31 downto 27
|
||||
def csrRange = 31 downto 20
|
||||
|
||||
case class IMM(instruction : Bits) extends Area{
|
||||
diff --git a/src/main/scala/vexriscv/VexRiscv.scala b/src/main/scala/vexriscv/VexRiscv.scala
|
||||
index 5f7865c..7a64a74 100644
|
||||
--- a/src/main/scala/vexriscv/VexRiscv.scala
|
||||
+++ b/src/main/scala/vexriscv/VexRiscv.scala
|
||||
@@ -36,8 +36,10 @@ case class VexRiscvConfig(){
|
||||
object BYPASSABLE_MEMORY_STAGE extends Stageable(Bool)
|
||||
object RS1 extends Stageable(Bits(32 bits))
|
||||
object RS2 extends Stageable(Bits(32 bits))
|
||||
+ object RS3 extends Stageable(Bits(32 bits))
|
||||
object RS1_USE extends Stageable(Bool)
|
||||
object RS2_USE extends Stageable(Bool)
|
||||
+ object RS3_USE extends Stageable(Bool)
|
||||
object RESULT extends Stageable(UInt(32 bits))
|
||||
object PC extends Stageable(UInt(32 bits))
|
||||
object PC_CALC_WITHOUT_JUMP extends Stageable(UInt(32 bits))
|
||||
@@ -52,6 +54,7 @@ case class VexRiscvConfig(){
|
||||
|
||||
object SRC1 extends Stageable(Bits(32 bits))
|
||||
object SRC2 extends Stageable(Bits(32 bits))
|
||||
+ object SRC3 extends Stageable(Bits(32 bits))
|
||||
object SRC_ADD_SUB extends Stageable(Bits(32 bits))
|
||||
object SRC_ADD extends Stageable(Bits(32 bits))
|
||||
object SRC_SUB extends Stageable(Bits(32 bits))
|
||||
@@ -81,8 +84,13 @@ case class VexRiscvConfig(){
|
||||
object Src2CtrlEnum extends SpinalEnum(binarySequential){
|
||||
val RS, IMI, IMS, PC = newElement() //TODO remplacing ZERO could avoid 32 muxes if SRC_ADD can be disabled
|
||||
}
|
||||
+
|
||||
+ object Src3CtrlEnum extends SpinalEnum(binarySequential){
|
||||
+ val RS, IMI = newElement()
|
||||
+ }
|
||||
object SRC1_CTRL extends Stageable(Src1CtrlEnum())
|
||||
object SRC2_CTRL extends Stageable(Src2CtrlEnum())
|
||||
+ object SRC3_CTRL extends Stageable(Src3CtrlEnum())
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/main/scala/vexriscv/demo/smp/VexRiscvSmpCluster.scala b/src/main/scala/vexriscv/demo/smp/VexRiscvSmpCluster.scala
|
||||
index e01bd87..3966005 100644
|
||||
--- a/src/main/scala/vexriscv/demo/smp/VexRiscvSmpCluster.scala
|
||||
+++ b/src/main/scala/vexriscv/demo/smp/VexRiscvSmpCluster.scala
|
||||
@@ -17,6 +17,7 @@ import spinal.lib.system.debugger.SystemDebuggerConfig
|
||||
import vexriscv.ip.{DataCacheAck, DataCacheConfig, DataCacheMemBus, InstructionCache, InstructionCacheConfig}
|
||||
import vexriscv.plugin.{BranchPlugin, CsrAccess, CsrPlugin, CsrPluginConfig, DBusCachedPlugin, DBusSimplePlugin, DYNAMIC_TARGET, DebugPlugin, DecoderSimplePlugin, FullBarrelShifterPlugin, HazardSimplePlugin, IBusCachedPlugin, IBusSimplePlugin, IntAluPlugin, MmuPlugin, MmuPortConfig, MulDivIterativePlugin, MulPlugin, RegFilePlugin, STATIC, SrcPlugin, StaticMemoryTranslatorPlugin, YamlPlugin}
|
||||
import vexriscv.{Riscv, VexRiscv, VexRiscvBmbGenerator, VexRiscvConfig, plugin}
|
||||
+import vexriscv.plugin._
|
||||
|
||||
import scala.collection.mutable
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
@@ -262,12 +263,17 @@ object VexRiscvSmpClusterGen {
|
||||
mulUnrollFactor = 32,
|
||||
divUnrollFactor = 1
|
||||
),
|
||||
- new CsrPlugin(CsrPluginConfig.openSbi(mhartid = hartId, misa = Riscv.misaToInt("imas")).copy(utimeAccess = CsrAccess.READ_ONLY)),
|
||||
+ //new CsrPlugin(CsrPluginConfig.openSbi(mhartid = hartId, misa = Riscv.misaToInt("imas")).copy(utimeAccess = CsrAccess.READ_ONLY)),
|
||||
+ new CsrPlugin(CsrPluginConfig.openSbi(mhartid = hartId, misa = Riscv.misaToInt("imas")).copy(utimeAccess = CsrAccess.READ_ONLY, mcycleAccess = CsrAccess.READ_ONLY, ucycleAccess = CsrAccess.READ_ONLY)),
|
||||
new BranchPlugin(
|
||||
earlyBranch = earlyBranch,
|
||||
catchAddressMisaligned = true,
|
||||
fenceiGenAsAJump = false
|
||||
),
|
||||
+ new BitManipAllPlugin,
|
||||
+ new BitManipZclmulPlugin,
|
||||
+ new CryptoZknePlugin,
|
||||
+ new CryptoZknhPlugin,
|
||||
new YamlPlugin(s"cpu$hartId.yaml")
|
||||
)
|
||||
)
|
||||
diff --git a/src/main/scala/vexriscv/plugin/HazardSimplePlugin.scala b/src/main/scala/vexriscv/plugin/HazardSimplePlugin.scala
|
||||
index 1ed1d83..47d8bc1 100644
|
||||
--- a/src/main/scala/vexriscv/plugin/HazardSimplePlugin.scala
|
||||
+++ b/src/main/scala/vexriscv/plugin/HazardSimplePlugin.scala
|
||||
@@ -33,6 +33,7 @@ class HazardSimplePlugin(bypassExecute : Boolean = false,
|
||||
import pipeline.config._
|
||||
val src0Hazard = False
|
||||
val src1Hazard = False
|
||||
+ val src2Hazard = False
|
||||
|
||||
val readStage = service(classOf[RegFileService]).readStage()
|
||||
|
||||
@@ -40,6 +41,7 @@ class HazardSimplePlugin(bypassExecute : Boolean = false,
|
||||
val runtimeBypassableValue = if(runtimeBypassable != null) stage.input(runtimeBypassable) else True
|
||||
val addr0Match = if(pessimisticAddressMatch) True else stage.input(INSTRUCTION)(rdRange) === readStage.input(INSTRUCTION)(rs1Range)
|
||||
val addr1Match = if(pessimisticAddressMatch) True else stage.input(INSTRUCTION)(rdRange) === readStage.input(INSTRUCTION)(rs2Range)
|
||||
+ val addr2Match = if(pessimisticAddressMatch) True else stage.input(INSTRUCTION)(rdRange) === readStage.input(INSTRUCTION)(rs3Range)
|
||||
when(stage.arbitration.isValid && stage.input(REGFILE_WRITE_VALID)) {
|
||||
if (bypassable) {
|
||||
when(runtimeBypassableValue) {
|
||||
@@ -49,6 +51,9 @@ class HazardSimplePlugin(bypassExecute : Boolean = false,
|
||||
when(addr1Match) {
|
||||
readStage.input(RS2) := stage.output(REGFILE_WRITE_DATA)
|
||||
}
|
||||
+ when(addr2Match) {
|
||||
+ readStage.input(RS3) := stage.output(REGFILE_WRITE_DATA)
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,6 +65,9 @@ class HazardSimplePlugin(bypassExecute : Boolean = false,
|
||||
when(addr1Match) {
|
||||
src1Hazard := True
|
||||
}
|
||||
+ when(addr2Match) {
|
||||
+ src2Hazard := True
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,6 +84,7 @@ class HazardSimplePlugin(bypassExecute : Boolean = false,
|
||||
|
||||
val addr0Match = if(pessimisticAddressMatch) True else writeBackBuffer.address === readStage.input(INSTRUCTION)(rs1Range)
|
||||
val addr1Match = if(pessimisticAddressMatch) True else writeBackBuffer.address === readStage.input(INSTRUCTION)(rs2Range)
|
||||
+ val addr2Match = if(pessimisticAddressMatch) True else writeBackBuffer.address === readStage.input(INSTRUCTION)(rs3Range)
|
||||
when(writeBackBuffer.valid) {
|
||||
if (bypassWriteBackBuffer) {
|
||||
when(addr0Match) {
|
||||
@@ -84,6 +93,9 @@ class HazardSimplePlugin(bypassExecute : Boolean = false,
|
||||
when(addr1Match) {
|
||||
readStage.input(RS2) := writeBackBuffer.data
|
||||
}
|
||||
+ when(addr2Match) {
|
||||
+ readStage.input(RS3) := writeBackBuffer.data
|
||||
+ }
|
||||
} else {
|
||||
when(addr0Match) {
|
||||
src0Hazard := True
|
||||
@@ -91,6 +103,9 @@ class HazardSimplePlugin(bypassExecute : Boolean = false,
|
||||
when(addr1Match) {
|
||||
src1Hazard := True
|
||||
}
|
||||
+ when(addr2Match) {
|
||||
+ src2Hazard := True
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,9 +121,12 @@ class HazardSimplePlugin(bypassExecute : Boolean = false,
|
||||
when(!readStage.input(RS2_USE)) {
|
||||
src1Hazard := False
|
||||
}
|
||||
+ when(!readStage.input(RS3_USE)) {
|
||||
+ src2Hazard := False
|
||||
+ }
|
||||
}
|
||||
|
||||
- when(readStage.arbitration.isValid && (src0Hazard || src1Hazard)){
|
||||
+ when(readStage.arbitration.isValid && (src0Hazard || src1Hazard | src2Hazard)){
|
||||
readStage.arbitration.haltByOther := True
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/scala/vexriscv/plugin/IntAluPlugin.scala b/src/main/scala/vexriscv/plugin/IntAluPlugin.scala
|
||||
index 0520c2f..d99e5c2 100644
|
||||
--- a/src/main/scala/vexriscv/plugin/IntAluPlugin.scala
|
||||
+++ b/src/main/scala/vexriscv/plugin/IntAluPlugin.scala
|
||||
@@ -25,6 +25,7 @@ class IntAluPlugin extends Plugin[VexRiscv]{
|
||||
val immediateActions = List[(Stageable[_ <: BaseType],Any)](
|
||||
SRC1_CTRL -> Src1CtrlEnum.RS,
|
||||
SRC2_CTRL -> Src2CtrlEnum.IMI,
|
||||
+ SRC3_CTRL -> Src3CtrlEnum.RS,
|
||||
REGFILE_WRITE_VALID -> True,
|
||||
BYPASSABLE_EXECUTE_STAGE -> True,
|
||||
BYPASSABLE_MEMORY_STAGE -> True,
|
||||
@@ -34,6 +35,7 @@ class IntAluPlugin extends Plugin[VexRiscv]{
|
||||
val nonImmediateActions = List[(Stageable[_ <: BaseType],Any)](
|
||||
SRC1_CTRL -> Src1CtrlEnum.RS,
|
||||
SRC2_CTRL -> Src2CtrlEnum.RS,
|
||||
+ SRC3_CTRL -> Src3CtrlEnum.RS,
|
||||
REGFILE_WRITE_VALID -> True,
|
||||
BYPASSABLE_EXECUTE_STAGE -> True,
|
||||
BYPASSABLE_MEMORY_STAGE -> True,
|
||||
diff --git a/src/main/scala/vexriscv/plugin/RegFilePlugin.scala b/src/main/scala/vexriscv/plugin/RegFilePlugin.scala
|
||||
index 0b7bcd2..834f836 100644
|
||||
--- a/src/main/scala/vexriscv/plugin/RegFilePlugin.scala
|
||||
+++ b/src/main/scala/vexriscv/plugin/RegFilePlugin.scala
|
||||
@@ -29,6 +29,7 @@ class RegFilePlugin(regFileReadyKind : RegFileReadKind,
|
||||
val decoderService = pipeline.service(classOf[DecoderService])
|
||||
decoderService.addDefault(RS1_USE,False)
|
||||
decoderService.addDefault(RS2_USE,False)
|
||||
+ decoderService.addDefault(RS3_USE,False)
|
||||
decoderService.addDefault(REGFILE_WRITE_VALID,False)
|
||||
}
|
||||
|
||||
@@ -74,16 +75,18 @@ class RegFilePlugin(regFileReadyKind : RegFileReadKind,
|
||||
def shadowPrefix(that : Bits) = if(withShadow) global.shadow.read ## that else that
|
||||
val regFileReadAddress1 = U(shadowPrefix(srcInstruction(Riscv.rs1Range)))
|
||||
val regFileReadAddress2 = U(shadowPrefix(srcInstruction(Riscv.rs2Range)))
|
||||
+ val regFileReadAddress3 = U(shadowPrefix(srcInstruction(Riscv.rs3Range)))
|
||||
|
||||
- val (rs1Data,rs2Data) = regFileReadyKind match{
|
||||
- case `ASYNC` => (global.regFile.readAsync(regFileReadAddress1),global.regFile.readAsync(regFileReadAddress2))
|
||||
+ val (rs1Data,rs2Data,rs3Data) = regFileReadyKind match{
|
||||
+ case `ASYNC` => (global.regFile.readAsync(regFileReadAddress1),global.regFile.readAsync(regFileReadAddress2),global.regFile.readAsync(regFileReadAddress3))
|
||||
case `SYNC` =>
|
||||
val enable = if(!syncUpdateOnStall) !readStage.arbitration.isStuck else null
|
||||
- (global.regFile.readSync(regFileReadAddress1, enable),global.regFile.readSync(regFileReadAddress2, enable))
|
||||
+ (global.regFile.readSync(regFileReadAddress1, enable),global.regFile.readSync(regFileReadAddress2, enable),global.regFile.readSync(regFileReadAddress3, enable))
|
||||
}
|
||||
|
||||
insert(RS1) := rs1Data
|
||||
insert(RS2) := rs2Data
|
||||
+ insert(RS3) := rs3Data
|
||||
}
|
||||
|
||||
//Write register file
|
||||
@@ -112,4 +115,4 @@ class RegFilePlugin(regFileReadyKind : RegFileReadKind,
|
||||
}
|
||||
}
|
||||
}
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/src/main/scala/vexriscv/plugin/SrcPlugin.scala b/src/main/scala/vexriscv/plugin/SrcPlugin.scala
|
||||
index eb5ab1f..24aab5c 100644
|
||||
--- a/src/main/scala/vexriscv/plugin/SrcPlugin.scala
|
||||
+++ b/src/main/scala/vexriscv/plugin/SrcPlugin.scala
|
||||
@@ -39,6 +39,10 @@ class SrcPlugin(separatedAddSub : Boolean = false, executeInsertion : Boolean =
|
||||
Src2CtrlEnum.IMS -> imm.s_sext.resized,
|
||||
Src2CtrlEnum.PC -> output(PC).asBits
|
||||
)
|
||||
+ insert(SRC3) := input(SRC3_CTRL).mux(
|
||||
+ Src3CtrlEnum.RS -> output(RS3),
|
||||
+ Src2CtrlEnum.IMI -> imm.i_sext.resized
|
||||
+ )
|
||||
}
|
||||
|
||||
val addSubStage = if(decodeAddSub) decode else execute
|
Loading…
Add table
Reference in a new issue