From 0ad6ad019346c398ca478f2016a40d498cc41932 Mon Sep 17 00:00:00 2001 From: Raffaele Meloni Date: Tue, 25 Jun 2024 21:25:00 +0200 Subject: [PATCH 1/3] Update lib name to tywaves-chisel-api: the new official name with the new backend --- README.md | 29 ++++++++++++++++++++--------- build.sbt | 6 +++--- example/gcd.test.scala | 2 +- example/tydi-example.test.scala | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f851e1b..c12eba1 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ make install-tywaves-chisel-api Once published locally, you can use it in your project by adding the following line to your `build.sbt` file: ```scala -libraryDependencies += "com.github.rameloni" %% "tywaves-demo-backend" % "your-version-here" +libraryDependencies += "com.github.rameloni" %% "tywaves-chisel-api" % "your-version-here" ``` # Usage in a project through the Tywaves-Chisel-API @@ -228,14 +228,25 @@ The following list shows a summary of the features added by the Tywaves project # Versioning and tools -| Name of this scala package | Tywaves-Chisel-API (this repo) | Chisel | Firtool | Tywaves-rs | Surfer | -|------------------------------------------------------------|:-----------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------| -| `com.github.rameloni::tywaves-demo-backend:0.3.1-SNAPSHOT` | 0.3.1-SNAPSHOT (_coming soon_) | [v6.4.2-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.4.2-tywaves-SNAPSHOT) from `rameloni/chisel` (fork of chisel) | [v0.1.1](https://github.com/rameloni/circt/releases/tag/v0.1.1-tywaves-SNAPSHOT) from `rameloni/circt` (fork of circt) | [v0.1.2](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.2-SNAPSHOT) | [v0.3.1-tywaves-dev-SNAPSHOT]() from `surfer-tywaves-demo` _COMING SOON_ | -| `com.github.rameloni::tywaves-demo-backend:0.3.0-SNAPSHOT` | 0.3.0-SNAPSHOT (_coming soon_) | [v6.4.2-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.4.2-tywaves-SNAPSHOT) from `rameloni/chisel` (fork of chisel) | [v0.1.1](https://github.com/rameloni/circt/releases/tag/v0.1.1-tywaves-SNAPSHOT) from `rameloni/circt` (fork of circt) | [v0.1.1](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.1-SNAPSHOT) | [v0.3.0-tywaves-dev-SNAPSHOT](https://gitlab.com/rameloni/surfer-tywaves-demo/-/releases/v0.3.0-tywaves-dev-SNAPSHOT) from `surfer-tywaves-demo` | -| `com.github.rameloni::tywaves-demo-backend:0.2.1-SNAPSHOT` | [0.2.1-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.2.1-SNAPSHOT) | [v6.1.0-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.1.0-tywaves-SNAPSHOT) from `rameloni/chisel` (fork of chisel), _needed for the parametric workspace_ | [v1.75.0](https://github.com/llvm/circt/releases/tag/firtool-1.75.0) official repo | [v0.1.0](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.0-SNAPSHOT) | [v0.2.1-tywaves-dev-SNAPSHOT](https://gitlab.com/rameloni/surfer-tywaves-demo/-/releases/v0.2.1-tywaves-dev-SNAPSHOT) from `surfer-tywaves-demo` | -| `com.github.rameloni::tywaves-demo-backend:0.2.0-SNAPSHOT` | [0.2.0-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.2.0-SNAPSHOT) | [v6.1.0-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.1.0-tywaves-SNAPSHOT) from `rameloni/chisel` (fork of chisel), _needed for the parametric workspace_ | [v1.75.0](https://github.com/llvm/circt/releases/tag/firtool-1.75.0) official repo | - | [v0.2.0-tywaves-dev-SNAPSHOT](https://gitlab.com/rameloni/surfer-tywaves-demo/-/releases/v0.2.0-tywaves-dev-SNAPSHOT) from `surfer-tywaves-demo` | -| `com.github.rameloni::tywaves-demo-backend:0.1.0-SNAPSHOT` | [0.1.1-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.1.1-SNAPSHOT) | [v6.1.0-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.1.0-tywaves-SNAPSHOT) from `rameloni/chisel` (fork of chisel), _needed for the parametric workspace_ | [v1.75.0](https://github.com/llvm/circt/releases/tag/firtool-1.75.0) official repo | - | [v0.1.1-SNAPSHOT]() from `surfer-tywaves-demo` | -| `com.github.rameloni::tywaves-demo-backend:0.1.0-SNAPSHOT` | [0.1.0-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.1.0-SNAPSHOT) | [v6.1.0](https://github.com/chipsalliance/chisel/releases/tag/v6.1.0) official repo | [v1.62.0](https://github.com/llvm/circt/releases/tag/firtool-1.62.0) official repo | - | [v0.1.0-SNAPSHOT]() from `surfer-tywaves-demo` | +Use the new name of the library in your sbt dependencies: `com.github.rameloni::tywaves-chisel-api:`. + +| Release | Chisel fork version (from `rameloni/chisel`) | Firtool fork version (from `rameloni/circt`) | Tywaves-rs version | Surfer-tywaves version | +|:-------------------------------|:---------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------| +| 0.3.1-SNAPSHOT (_coming soon_) | [v6.4.2-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.4.2-tywaves-SNAPSHOT) | [v0.1.1](https://github.com/rameloni/circt/releases/tag/v0.1.1-tywaves-SNAPSHOT) | [v0.1.2](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.2-SNAPSHOT) | [v0.3.1-tywaves-dev-SNAPSHOT]() _COMING SOON_ | +| 0.3.0-SNAPSHOT (_coming soon_) | [v6.4.2-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.4.2-tywaves-SNAPSHOT) | [v0.1.1](https://github.com/rameloni/circt/releases/tag/v0.1.1-tywaves-SNAPSHOT) | [v0.1.1](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.1-SNAPSHOT) | [v0.3.0-tywaves-dev-SNAPSHOT](https://gitlab.com/rameloni/surfer-tywaves-demo/-/releases/v0.3.0-tywaves-dev-SNAPSHOT) | + +## Old backend implementations + +Use the old name of the library in your sbt dependencies: `com.github.rameloni::tywaves-demo-backend:`. + +| Release | Chisel fork version (from `rameloni/chisel`) | Firtool version (official CIRCT repo) | Tywaves-rs version | Surfer-tywaves version | +|:-----------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------|:------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------| +| [0.2.1-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.2.1-SNAPSHOT) | [v6.1.0-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.1.0-tywaves-SNAPSHOT) | [v1.75.0](https://github.com/llvm/circt/releases/tag/firtool-1.75.0) | [v0.1.0](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.0-SNAPSHOT) | [v0.2.1-tywaves-dev-SNAPSHOT](https://gitlab.com/rameloni/surfer-tywaves-demo/-/releases/v0.2.1-tywaves-dev-SNAPSHOT) | +| [0.2.0-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.2.0-SNAPSHOT) | [v6.1.0-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.1.0-tywaves-SNAPSHOT) | [v1.75.0](https://github.com/llvm/circt/releases/tag/firtool-1.75.0) | - | [v0.2.0-tywaves-dev-SNAPSHOT](https://gitlab.com/rameloni/surfer-tywaves-demo/-/releases/v0.2.0-tywaves-dev-SNAPSHOT) | +| [0.1.1-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.1.1-SNAPSHOT) | [v6.1.0-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.1.0-tywaves-SNAPSHOT) | [v1.75.0](https://github.com/llvm/circt/releases/tag/firtool-1.75.0) | - | [v0.1.1-SNAPSHOT]() | +| [0.1.0-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.1.0-SNAPSHOT) | [v6.1.0](https://github.com/chipsalliance/chisel/releases/tag/v6.1.0) official repo | [v1.62.0](https://github.com/llvm/circt/releases/tag/firtool-1.62.0) | - | [v0.1.0-SNAPSHOT]() | + +# [^1]: While `TywavesSimulator` is a central part of the Tywaves project and its functionalities are not fully supported yet, the `ParametricSimulator` is able to simulate any Chisel circuit. In case you need to simulate a circuit that is diff --git a/build.sbt b/build.sbt index 54df206..793e3fc 100644 --- a/build.sbt +++ b/build.sbt @@ -29,12 +29,12 @@ lazy val root = (project in file(".")) buildInfoPackage := "tywaves", buildInfoUsePackageAsPath := true, ).settings( - name := "TyWaves-demo-backend", + name := "tywaves-chisel-api", addCompilerPlugin( "org.chipsalliance" % "chisel-plugin" % chiselVersion cross CrossVersion.full ), - libraryDependencies += "org.chipsalliance" %% "chisel" % chiselVersion, - libraryDependencies += "org.scalatest" %% "scalatest" % scalatestVersion % "test", + libraryDependencies += "org.chipsalliance" %% "chisel" % chiselVersion, + libraryDependencies += "org.scalatest" %% "scalatest" % scalatestVersion % "test", // libraryDependencies += "io.circe" %% "circe-core" % circeVersion, // libraryDependencies += "io.circe" %% "circe-generic" % circeVersion, // libraryDependencies += "io.circe" %% "circe-generic-extras" % "0.14.3", diff --git a/example/gcd.test.scala b/example/gcd.test.scala index d438f6d..f7026f5 100644 --- a/example/gcd.test.scala +++ b/example/gcd.test.scala @@ -1,5 +1,5 @@ //> using scala "2.13.14" -//> using dep "com.github.rameloni::tywaves-demo-backend:0.3.0-SNAPSHOT" +//> using dep "com.github.rameloni::tywaves-chisel-api:0.3.0-SNAPSHOT" //> using dep "org.chipsalliance::chisel:6.4.0" //> using plugin "org.chipsalliance:::chisel-plugin:6.4.0" //> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations" diff --git a/example/tydi-example.test.scala b/example/tydi-example.test.scala index 52d9e20..46fa8c6 100644 --- a/example/tydi-example.test.scala +++ b/example/tydi-example.test.scala @@ -1,5 +1,5 @@ //> using scala "2.13.14" -//> using dep "com.github.rameloni::tywaves-demo-backend:0.3.0-SNAPSHOT" +//> using dep "com.github.rameloni::tywaves-chisel-api:0.3.0-SNAPSHOT" //> using dep "nl.tudelft::tydi-chisel::0.1.0" //> using plugin "org.chipsalliance:::chisel-plugin:6.4.0" //> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations" From 1ead30b333a9aa5cf0f405e1195550de878dc94b Mon Sep 17 00:00:00 2001 From: Raffaele Meloni Date: Tue, 25 Jun 2024 21:31:09 +0200 Subject: [PATCH 2/3] Add comments and remove hgldd generation in release mode for Tywaves --- README.md | 4 ++-- .../scala/tywaves/circuitmapper/TypedConverter.scala | 11 ++++++----- .../scala/tywaves/simulator/TywavesSimulator.scala | 3 +++ src/test/scala/gcd/GCDTest.scala | 6 +++++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c12eba1..99feb06 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ The following list shows a summary of the features added by the Tywaves project - [ ] Automatic/custom signal value rendering - [ ] For loops code generation -# Versioning and tools +# Versioning and tools ([ref](https://github.com/rameloni/tywaves-chisel-demo/wiki/Tywaves-internals#tywaves-software-architecture)) Use the new name of the library in your sbt dependencies: `com.github.rameloni::tywaves-chisel-api:`. @@ -235,7 +235,7 @@ Use the new name of the library in your sbt dependencies: `com.github.rameloni:: | 0.3.1-SNAPSHOT (_coming soon_) | [v6.4.2-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.4.2-tywaves-SNAPSHOT) | [v0.1.1](https://github.com/rameloni/circt/releases/tag/v0.1.1-tywaves-SNAPSHOT) | [v0.1.2](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.2-SNAPSHOT) | [v0.3.1-tywaves-dev-SNAPSHOT]() _COMING SOON_ | | 0.3.0-SNAPSHOT (_coming soon_) | [v6.4.2-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.4.2-tywaves-SNAPSHOT) | [v0.1.1](https://github.com/rameloni/circt/releases/tag/v0.1.1-tywaves-SNAPSHOT) | [v0.1.1](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.1-SNAPSHOT) | [v0.3.0-tywaves-dev-SNAPSHOT](https://gitlab.com/rameloni/surfer-tywaves-demo/-/releases/v0.3.0-tywaves-dev-SNAPSHOT) | -## Old backend implementations +## Old backend implementations ([ref](https://github.com/rameloni/tywaves-chisel-demo/wiki/An-alternative-solution-(old-demo-version))) Use the old name of the library in your sbt dependencies: `com.github.rameloni::tywaves-demo-backend:`. diff --git a/src/main/scala/tywaves/circuitmapper/TypedConverter.scala b/src/main/scala/tywaves/circuitmapper/TypedConverter.scala index b481d06..5cc29b4 100644 --- a/src/main/scala/tywaves/circuitmapper/TypedConverter.scala +++ b/src/main/scala/tywaves/circuitmapper/TypedConverter.scala @@ -43,15 +43,16 @@ private[tywaves] object TypedConverter { this.workingDir = Some(workingDir) hglddWithOptDir = workingDir + "/" + hglddWithOptDir hglddDebugDir = workingDir + "/" + hglddDebugDir + // hglddDebugDir = workingDir + "/" + "support-artifacts" // Annotations for ChiselStage val annotations = Seq(ChiselGeneratorAnnotation(generateModule)) ++ defaultFirtoolOptAnno - // Run without debug mode - chiselStage.execute( - chiselStageBaseArgs ++ Array("--target-dir", hglddWithOptDir), - annotations, - ) // execute returns the passThrough annotations in CIRCT transform stage + // Run without debug mode: TODO check it is actually not needed + // chiselStage.execute( + // chiselStageBaseArgs ++ Array("--target-dir", hglddWithOptDir), + // annotations, + // ) // execute returns the passThrough annotations in CIRCT transform stage // Run with debug mode val finalAnno = chiselStage.execute( diff --git a/src/main/scala/tywaves/simulator/TywavesSimulator.scala b/src/main/scala/tywaves/simulator/TywavesSimulator.scala index ede1289..4cf6394 100644 --- a/src/main/scala/tywaves/simulator/TywavesSimulator.scala +++ b/src/main/scala/tywaves/simulator/TywavesSimulator.scala @@ -31,6 +31,7 @@ object TywavesSimulator extends PeekPokeAPI { if (containTywaves) settings ++ Seq(FirtoolArgs(Seq("-O=debug", "-g", "--emit-hgldd", "--split-verilog", "-o=WORK.v"))) else settings + simulator.simulate(module, finalSettings, simName)(body) if (simulator.finalTracePath.nonEmpty && containTywaves) { @@ -38,6 +39,8 @@ object TywavesSimulator extends PeekPokeAPI { val extraScopes = Seq("TOP", Workspace.testbenchModuleName, "dut") // Create the debug info from the firtool and get the top module name + // TODO: this may not be needed anymore, since the debug info can be generated directly from chiselsim, by giving the right options to firtool + // But the problem is to call chiselstage with debug options TypedConverter.createDebugInfoHgldd(() => module, simulator.wantedWorkspacePath) // Run tywaves viewer if the Tywaves waveform generation is enabled by Tywaves(true) diff --git a/src/test/scala/gcd/GCDTest.scala b/src/test/scala/gcd/GCDTest.scala index 26c9ea9..83ed565 100644 --- a/src/test/scala/gcd/GCDTest.scala +++ b/src/test/scala/gcd/GCDTest.scala @@ -28,7 +28,11 @@ class GCDTest extends AnyFunSpec with Matchers { it("runs GCD correctly") { import TywavesSimulator._ - simulate(new GCD(), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_GCD_correctly") { + simulate( + new GCD(), + Seq(VcdTrace, WithTywavesWaveforms(false), WithFirtoolArgs(Seq("-g", "--emit-hgldd")), SaveWorkdir), + simName = "runs_GCD_correctly", + ) { gcd => gcd.io.a.poke(24.U) gcd.io.b.poke(36.U) From 3a525a6cd11df9686bc852d136d44eef59a34c7b Mon Sep 17 00:00:00 2001 From: Raffaele Meloni Date: Tue, 25 Jun 2024 21:37:18 +0200 Subject: [PATCH 3/3] Add to .gitignore vcd and fst files --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5f9b1dd..07fc7e9 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,7 @@ build/ *.anno.json -tmp/ \ No newline at end of file +tmp/ + +*.vcd +*.fst \ No newline at end of file