-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
486 additions
and
187 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2022 Jiuyang Liu <[email protected]> | ||
|
||
package org.chipsalliance.t1.omreader.t1 | ||
|
||
import mainargs._ | ||
import org.chipsalliance.t1.omreaderlib.t1.T1 | ||
|
||
object T1 { | ||
implicit object PathRead extends TokensReader.Simple[os.Path] { | ||
def shortName = "path" | ||
def read(strs: Seq[String]): Either[String, os.Path] = Right(os.Path(strs.head, os.pwd)) | ||
} | ||
@main | ||
def vlen(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
println(new T1(os.read.bytes(mlirbcFile)).vlen) | ||
|
||
@main | ||
def dlen(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
println(new T1(os.read.bytes(mlirbcFile)).dlen) | ||
|
||
@main | ||
def instructions(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
new T1(os.read.bytes(mlirbcFile)).instructions.foreach(println) | ||
|
||
@main | ||
def extensions( | ||
@arg(name = "mlirbc-file") mlirbcFile: os.Path | ||
) = | ||
println(new T1(os.read.bytes(mlirbcFile)).extensions.mkString("")) | ||
|
||
@main | ||
def march(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
println(new T1(os.read.bytes(mlirbcFile)).march) | ||
|
||
@main | ||
def sram(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
new T1(os.read.bytes(mlirbcFile)).sram.foreach(s => println(upickle.default.write(s))) | ||
|
||
@main | ||
def retime(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
new T1(os.read.bytes(mlirbcFile)).retime.foreach(r => println(upickle.default.write(r))) | ||
|
||
def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2022 Jiuyang Liu <[email protected]> | ||
|
||
package org.chipsalliance.t1.omreader.t1rocketv | ||
|
||
import mainargs._ | ||
import org.chipsalliance.t1.omreaderlib.t1rocketv.T1RocketTile | ||
|
||
object T1RocketTile { | ||
implicit object PathRead extends TokensReader.Simple[os.Path] { | ||
def shortName = "path" | ||
def read(strs: Seq[String]): Either[String, os.Path] = Right(os.Path(strs.head, os.pwd)) | ||
} | ||
@main | ||
def vlen(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
println(new T1RocketTile(os.read.bytes(mlirbcFile)).vlen) | ||
|
||
@main | ||
def dlen(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
println(new T1RocketTile(os.read.bytes(mlirbcFile)).dlen) | ||
|
||
@main | ||
def instructions(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
new T1RocketTile(os.read.bytes(mlirbcFile)).instructions.foreach(println) | ||
|
||
@main | ||
def extensions( | ||
@arg(name = "mlirbc-file") mlirbcFile: os.Path | ||
) = | ||
println(new T1RocketTile(os.read.bytes(mlirbcFile)).extensions.mkString("")) | ||
|
||
@main | ||
def march(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
println(new T1RocketTile(os.read.bytes(mlirbcFile)).march) | ||
|
||
@main | ||
def sram(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
new T1RocketTile(os.read.bytes(mlirbcFile)).sram.foreach(s => println(upickle.default.write(s))) | ||
|
||
@main | ||
def retime(@arg(name = "mlirbc-file") mlirbcFile: os.Path) = | ||
new T1RocketTile(os.read.bytes(mlirbcFile)).retime.foreach(r => println(upickle.default.write(r))) | ||
|
||
def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2022 Jiuyang Liu <[email protected]> | ||
|
||
package org.chipsalliance.t1.omreaderlib | ||
|
||
import chisel3.panamaconverter.PanamaCIRCTConverter | ||
import chisel3.panamaom._ | ||
|
||
trait OMReader { | ||
val mlirbc: Array[Byte] | ||
val top: String | ||
protected lazy val cvt: PanamaCIRCTConverter = PanamaCIRCTConverter.newWithMlirBc(mlirbc) | ||
protected lazy val om: PanamaCIRCTOM = cvt.om() | ||
protected lazy val evaluator: PanamaCIRCTOMEvaluator = om.evaluator() | ||
protected lazy val basePath: PanamaCIRCTOMEvaluatorValueBasePath = om.newBasePathEmpty() | ||
protected lazy val entry: PanamaCIRCTOMEvaluatorValueObject = evaluator.instantiate(top, Seq(basePath)).get | ||
} |
Oops, something went wrong.