Skip to content

Commit

Permalink
[om] export ISA extensions and march
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO committed Jul 28, 2024
1 parent 353d75c commit c2f36de
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ $ nix run .#t1.<config-name>.ip.emu-omreader -- run --dump-methods

##### `dlen` : Integer

##### `extensionsJson` : Json

| Field | Type |
|---------------------------------|--------|
| `[*]` | string |

##### `march` : String

##### `decoderInstructionsJson` | `decoderInstructionsJsonPretty` : Json

| Field | Type |
Expand Down
10 changes: 10 additions & 0 deletions omreader/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ object Main {
println(simplyGetT1Reader(mlirbcFile).dlen)
}

@main
def march(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = {
println(simplyGetT1Reader(mlirbcFile).march)
}

@main
def extensionsJson(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = {
println(simplyGetT1Reader(mlirbcFile).extensionsJson)
}

@main
def decoderInstructionsJson(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = {
println(simplyGetT1Reader(mlirbcFile).decoderInstructionsJson)
Expand Down
6 changes: 6 additions & 0 deletions omreaderlib/src/Interface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ class T1Reader private[omreaderlib](evaluator: PanamaCIRCTOMEvaluator, basePath:
}
def decoderInstructionsJson: String = ujson.write(decoderInstructionsJsonImpl)
def decoderInstructionsJsonPretty: String = ujson.write(decoderInstructionsJsonImpl, 2)
def extensionsJson: String = {
val extensions = t1.field("extensions").asInstanceOf[PanamaCIRCTOMEvaluatorValueList]
val j = extensions.elements.map(_.asInstanceOf[PanamaCIRCTOMEvaluatorValuePrimitiveString].toString)
ujson.write(j)
}
def march: String = t1.field("march").asInstanceOf[PanamaCIRCTOMEvaluatorValuePrimitiveString].toString

def dumpMethods(): Unit = {
val mirror = runtimeMirror(getClass.getClassLoader).reflect(this)
Expand Down
14 changes: 14 additions & 0 deletions t1/src/T1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ class T1OM extends Class {
val dlenIn = IO(Input(Property[Int]()))
dlen := dlenIn

@public
val extensions = IO(Output(Property[Seq[String]]()))
@public
val extensionsIn = IO(Input(Property[Seq[String]]()))
extensions := extensionsIn

@public
val march = IO(Output(Property[String]()))
@public
val marchIn = IO(Input(Property[String]()))
march := marchIn

@public
val lanes = IO(Output(Property[Seq[AnyClassType]]()))
@public
Expand Down Expand Up @@ -340,6 +352,8 @@ class T1(val parameter: T1Parameter)

omInstance.vlenIn := Property(parameter.vLen)
omInstance.dlenIn := Property(parameter.dLen)
omInstance.extensionsIn := Property(parameter.extensions)
omInstance.marchIn := Property(s"rv32gc_${parameter.extensions.mkString("_")}_zvl${parameter.vLen}b")

/** the LSU Module */

Expand Down

0 comments on commit c2f36de

Please sign in to comment.