Skip to content

Commit ad35e44

Browse files
committed
.
1 parent b97cdc2 commit ad35e44

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/main/scala/rocket/Decoder.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ object CustomInstructions {
4646
rocket("c.flush.d.l1", Encoding.fromString("111111000000?????000000001110011")),
4747
rocket("c.discard.d.l1", Encoding.fromString("111111000010?????000000001110011")),
4848
rocket("cease", Encoding.fromString("00110000010100000000000001110011"))
49-
).map(RocketDecodePattern.apply)
49+
)
5050

5151
private def rocc(name: String, encoding: Encoding) =
5252
Instruction(name, encoding, Seq(), Seq(InstructionSet("rv_rocc")), None, false, true)
@@ -75,7 +75,7 @@ object CustomInstructions {
7575
rocc("custom3.rd", Encoding.fromString("?????????????????100?????1111011")),
7676
rocc("custom3.rd.rs1", Encoding.fromString("?????????????????110?????1111011")),
7777
rocc("custom3.rd.rs1.rs2", Encoding.fromString("?????????????????111?????1111011"))
78-
).map(RocketDecodePattern.apply)
78+
)
7979
}
8080

8181
/** Parameter for InstructionDecoder
@@ -92,6 +92,8 @@ case class InstructionDecoderParameter(
9292
/** factory to generate the rocket core decoder. */
9393
class InstructionDecoder(p: InstructionDecoderParameter) {
9494
private val instructions = p.instructions
95+
instructions.foreach(println)
96+
9597

9698
// functions below is my little reminder, which is used for future rocket core refactoring, just keep it, I'll remove it later in the future.
9799
private def hasAnySetIn(sets: String*): Boolean = sets.exists(set => instructions.flatMap(_.instructionSets.map(_.name)).exists(_.contains(set)))

src/main/scala/rocket/RocketCore.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ class Rocket(tile: RocketTile)(implicit p: Parameters) extends CoreModule()(p)
186186

187187
val decoderParameter = org.chipsalliance.rocketcore.decoder.InstructionDecoderParameter(
188188
// TODO: configurable
189-
org.chipsalliance.rvdecoderdb.fromFile.instructions(os.pwd / "dependencies" / "riscv-opcodes")
189+
(org.chipsalliance.rvdecoderdb.fromFile.instructions(os.pwd / "dependencies" / "riscv-opcodes") ++
190+
// TODO: select rocc instructions via configuration.
191+
org.chipsalliance.rocketcore.decoder.CustomInstructions.roccSet ++
192+
org.chipsalliance.rocketcore.decoder.CustomInstructions.rocketSet)
190193
.filter { i =>
191194
i.instructionSets.map(_.name) match {
192195
// I

0 commit comments

Comments
 (0)