Skip to content

Commit

Permalink
Merge pull request #43 from rameloni/42-firtool-complains-on-field-ac…
Browse files Browse the repository at this point in the history
…cess

Bug fix: Firtool complains on field access
  • Loading branch information
rameloni authored Oct 20, 2024
2 parents 115b6ca + d59d35f commit 0bfd385
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CHISEL_FORK_TAG=v6.4.3-tywaves-SNAPSHOT

# Circt (firtool) information
CIRCT_FIRTOOL_ZIP_NAME=firtool-bin-linux-x64.tar.gz
CIRCT_FORK_VERSION=0.1.4
CIRCT_FORK_VERSION=0.1.5
CIRCT_FORK_TAG=v${CIRCT_FORK_VERSION}-tywaves-SNAPSHOT
CIRCT_FORK_FIRTOOL_ZIP_LINK=https://github.com/rameloni/circt/releases/download/${CIRCT_FORK_TAG}/${CIRCT_FIRTOOL_ZIP_NAME}
CIRCT_FIRTOOL_NAME=firtool-type-dbg-info-${CIRCT_FORK_VERSION}
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ Use the new name of the library in your sbt dependencies: `com.github.rameloni::
> **IMPORTANT NOTE**: Always use the latest version of Tywaves
| Release | Chisel fork version (from `rameloni/chisel`) | Firtool fork version (from `rameloni/circt`) | Tywaves-rs version | Surfer-tywaves version |
| :--------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------- |
|:-----------------------------------------------------------------------------------------------| :------------------------------------------------------------------------------------------------- |:---------------------------------------------------------------------------------| :---------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------- |
| [0.4.2-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.4.2-SNAPSHOT) | [v6.4.3-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.4.3-tywaves-SNAPSHOT) | [v0.1.5](https://github.com/rameloni/circt/releases/tag/v0.1.5-tywaves-SNAPSHOT) | [v0.1.4](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.4-SNAPSHOT) | [v0.3.2-tywaves-dev-SNAPSHOT](https://gitlab.com/rameloni/surfer-tywaves-demo/-/releases/v0.3.2-tywaves-SNAPSHOT) |
| [0.4.1-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.4.1-SNAPSHOT) | [v6.4.3-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.4.3-tywaves-SNAPSHOT) | [v0.1.4](https://github.com/rameloni/circt/releases/tag/v0.1.4-tywaves-SNAPSHOT) | [v0.1.4](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.4-SNAPSHOT) | [v0.3.2-tywaves-dev-SNAPSHOT](https://gitlab.com/rameloni/surfer-tywaves-demo/-/releases/v0.3.2-tywaves-SNAPSHOT) |
| [0.4.0-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.4.0-SNAPSHOT) | [v6.4.3-tywaves-SNAPSHOT](https://github.com/rameloni/chisel/releases/tag/v6.4.3-tywaves-SNAPSHOT) | [v0.1.3](https://github.com/rameloni/circt/releases/tag/v0.1.3-tywaves-SNAPSHOT) | [v0.1.4](https://github.com/rameloni/tywaves-rs/releases/tag/v0.1.4-SNAPSHOT) | [v0.3.2-tywaves-dev-SNAPSHOT](https://gitlab.com/rameloni/surfer-tywaves-demo/-/releases/v0.3.2-tywaves-SNAPSHOT) |
| [0.3.0-SNAPSHOT](https://github.com/rameloni/tywaves-chisel-demo/releases/tag/v0.3.0-SNAPSHOT) | [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) |
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ val chiselVersion = "6.4.3-tywaves-SNAPSHOT" // Local version of chisel
val scalatestVersion = "3.2.16"
val circeVersion = "0.14.6"

val firtoolVersion = "0.1.4"
val firtoolVersion = "0.1.5"
val firtoolFullName = "firtool-type-dbg-info-" ++ firtoolVersion

val surferTywavesVersion = "0.3.2"
Expand All @@ -13,7 +13,7 @@ Compile / scalaSource := baseDirectory.value / "src/main/scala"
Test / scalaSource := baseDirectory.value / "src/test/scala"

ThisBuild / organization := "com.github.rameloni"
ThisBuild / version := "0.4.1-SNAPSHOT"
ThisBuild / version := "0.4.2-SNAPSHOT"
ThisBuild / scalaVersion := "2.13.14"

enablePlugins(ScalafmtPlugin)
Expand Down
2 changes: 1 addition & 1 deletion example/detect2ones.test.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//> using scala "2.13.14"
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.0-SNAPSHOT"
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.2-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"
Expand Down
2 changes: 1 addition & 1 deletion example/gcd.test.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//> using scala "2.13.14"
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.0-SNAPSHOT"
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.2-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"
Expand Down
2 changes: 1 addition & 1 deletion example/myfsm.test.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//> using scala "2.13.14"
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.0-SNAPSHOT"
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.2-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"
Expand Down
2 changes: 1 addition & 1 deletion example/tydi-example-meaningfulnames.test.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//> using scala "2.13.14"
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.0-SNAPSHOT"
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.2-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"
Expand Down
2 changes: 1 addition & 1 deletion example/tydi-example.test.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//> using scala "2.13.14"
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.0-SNAPSHOT"
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.2-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"
Expand Down
26 changes: 26 additions & 0 deletions src/test/scala/memories/BlockMem.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package memories

import chisel3._
import chisel3.util.log2Ceil


class MemIOBundle[T <: Data](depth: Int, t: T) extends Bundle {
val rdAddr = Input(UInt(log2Ceil(depth).W))
val rdData = Output(t)
val wrEna = Input(Bool())
val wrData = Input(t)
val wrAddr = Input(UInt(log2Ceil(depth).W))
}

/** A simple module for testing memories in Tywaves */
class BlockMem[T <: Data](depth: Int, t: T) extends Module {
val io = IO(new MemIOBundle(depth, t))

val mem = SyncReadMem(depth, t)
io.rdData := mem.read(io.rdAddr)

when(io.wrEna) {
mem.write(io.wrAddr, io.wrData)
}
}

84 changes: 84 additions & 0 deletions src/test/scala/memories/BlockMemTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package memories

import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.must.Matchers

import tywaves.simulator._
import tywaves.simulator.simulatorSettings._
import chisel3._

class BlockMemTest extends AnyFunSpec with Matchers {
describe("TywavesSimulator") {
import TywavesSimulator._

it("runs BlockMem of UInt8") {
val t = UInt(8.W)
simulate(new BlockMem(15, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_uint8")(dut =>
dut.clock.step(2)
)
}

it("runs BlockMem of Bundle") {

class ComplexElement extends Bundle {
val a = new Bundle {
val subA1 = UInt(8.W)
val subA2 = SInt(8.W)
}
val payload = Bits(8.W)
}

val t = new ComplexElement
simulate(
new BlockMem(4, t),
Seq(VcdTrace, WithTywavesWaveforms(false), SaveWorkdirFile("workdir")),
simName = "runs_mem_bundle",
)(dut => dut.clock.step(2))
}

it("runs BlockMem of Vec") {
val t = Vec(4, UInt(8.W))
simulate(new BlockMem(4, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_vec")(dut =>
dut.clock.step(2)
)
}

it("runs BlockMem of Enum") {
object SelType extends ChiselEnum { val A, B, C = Value }
val t = SelType()
simulate(new BlockMem(4, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_enum")(dut =>
dut.clock.step(2)
)
}

it("runs BlockMem of Enum in Bundle") {
object SelType extends ChiselEnum { val A, B, C = Value }
class ComplexElement extends Bundle {
val sel = SelType()
val payload = Bits(8.W)
}

val t = new ComplexElement
simulate(new BlockMem(4, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_enum_bundle")(dut =>
dut.clock.step(2)
)
}

it("runs BlockMem of Enum in Vec") {
object SelType extends ChiselEnum { val A, B, C = Value }
val t = Vec(4, SelType())
simulate(new BlockMem(4, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_enum_vec")(dut =>
dut.clock.step(2)
)
}

it("runs BlockMem of Enum in 2D-Vec") {
object SelType extends ChiselEnum { val A, B, C = Value }
val t = Vec(4, Vec(2, SelType()))
simulate(new BlockMem(4, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_enum_2d_vec")(dut =>
dut.clock.step(2)
)
}

}
}

0 comments on commit 0bfd385

Please sign in to comment.