Skip to content

Commit

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

##### `dlen` : Integer

##### `extensionsJson` : Json

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

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

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

@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
5 changes: 5 additions & 0 deletions omreaderlib/src/Interface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ 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 dumpMethods(): Unit = {
val mirror = runtimeMirror(getClass.getClassLoader).reflect(this)
Expand Down
7 changes: 7 additions & 0 deletions t1/src/T1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ 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 lanes = IO(Output(Property[Seq[AnyClassType]]()))
@public
Expand Down Expand Up @@ -340,6 +346,7 @@ class T1(val parameter: T1Parameter)

omInstance.vlenIn := Property(parameter.vLen)
omInstance.dlenIn := Property(parameter.dLen)
omInstance.extensionsIn := Property(parameter.extensions)

/** the LSU Module */

Expand Down

0 comments on commit c6fcf59

Please sign in to comment.