Skip to content

Commit 0bfd385

Browse files
authored
Merge pull request #43 from rameloni/42-firtool-complains-on-field-access
Bug fix: Firtool complains on field access
2 parents 115b6ca + d59d35f commit 0bfd385

File tree

10 files changed

+120
-9
lines changed

10 files changed

+120
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ CHISEL_FORK_TAG=v6.4.3-tywaves-SNAPSHOT
1414

1515
# Circt (firtool) information
1616
CIRCT_FIRTOOL_ZIP_NAME=firtool-bin-linux-x64.tar.gz
17-
CIRCT_FORK_VERSION=0.1.4
17+
CIRCT_FORK_VERSION=0.1.5
1818
CIRCT_FORK_TAG=v${CIRCT_FORK_VERSION}-tywaves-SNAPSHOT
1919
CIRCT_FORK_FIRTOOL_ZIP_LINK=https://github.com/rameloni/circt/releases/download/${CIRCT_FORK_TAG}/${CIRCT_FIRTOOL_ZIP_NAME}
2020
CIRCT_FIRTOOL_NAME=firtool-type-dbg-info-${CIRCT_FORK_VERSION}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ Use the new name of the library in your sbt dependencies: `com.github.rameloni::
268268
> **IMPORTANT NOTE**: Always use the latest version of Tywaves
269269
270270
| Release | Chisel fork version (from `rameloni/chisel`) | Firtool fork version (from `rameloni/circt`) | Tywaves-rs version | Surfer-tywaves version |
271-
| :--------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------- |
271+
|:-----------------------------------------------------------------------------------------------| :------------------------------------------------------------------------------------------------- |:---------------------------------------------------------------------------------| :---------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------- |
272+
| [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) |
272273
| [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) |
273274
| [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) |
274275
| [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) |

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ val chiselVersion = "6.4.3-tywaves-SNAPSHOT" // Local version of chisel
22
val scalatestVersion = "3.2.16"
33
val circeVersion = "0.14.6"
44

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

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

1515
ThisBuild / organization := "com.github.rameloni"
16-
ThisBuild / version := "0.4.1-SNAPSHOT"
16+
ThisBuild / version := "0.4.2-SNAPSHOT"
1717
ThisBuild / scalaVersion := "2.13.14"
1818

1919
enablePlugins(ScalafmtPlugin)

example/detect2ones.test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//> using scala "2.13.14"
2-
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.0-SNAPSHOT"
2+
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.2-SNAPSHOT"
33
//> using dep "org.chipsalliance::chisel:6.4.0"
44
//> using plugin "org.chipsalliance:::chisel-plugin:6.4.0"
55
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"

example/gcd.test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//> using scala "2.13.14"
2-
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.0-SNAPSHOT"
2+
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.2-SNAPSHOT"
33
//> using dep "org.chipsalliance::chisel:6.4.0"
44
//> using plugin "org.chipsalliance:::chisel-plugin:6.4.0"
55
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"

example/myfsm.test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//> using scala "2.13.14"
2-
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.0-SNAPSHOT"
2+
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.2-SNAPSHOT"
33
//> using dep "org.chipsalliance::chisel:6.4.0"
44
//> using plugin "org.chipsalliance:::chisel-plugin:6.4.0"
55
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"

example/tydi-example-meaningfulnames.test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//> using scala "2.13.14"
2-
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.0-SNAPSHOT"
2+
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.2-SNAPSHOT"
33
//> using dep "nl.tudelft::tydi-chisel::0.1.0"
44
//> using plugin "org.chipsalliance:::chisel-plugin:6.4.0"
55
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"

example/tydi-example.test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//> using scala "2.13.14"
2-
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.0-SNAPSHOT"
2+
//> using dep "com.github.rameloni::tywaves-chisel-api:0.4.2-SNAPSHOT"
33
//> using dep "nl.tudelft::tydi-chisel::0.1.0"
44
//> using plugin "org.chipsalliance:::chisel-plugin:6.4.0"
55
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package memories
2+
3+
import chisel3._
4+
import chisel3.util.log2Ceil
5+
6+
7+
class MemIOBundle[T <: Data](depth: Int, t: T) extends Bundle {
8+
val rdAddr = Input(UInt(log2Ceil(depth).W))
9+
val rdData = Output(t)
10+
val wrEna = Input(Bool())
11+
val wrData = Input(t)
12+
val wrAddr = Input(UInt(log2Ceil(depth).W))
13+
}
14+
15+
/** A simple module for testing memories in Tywaves */
16+
class BlockMem[T <: Data](depth: Int, t: T) extends Module {
17+
val io = IO(new MemIOBundle(depth, t))
18+
19+
val mem = SyncReadMem(depth, t)
20+
io.rdData := mem.read(io.rdAddr)
21+
22+
when(io.wrEna) {
23+
mem.write(io.wrAddr, io.wrData)
24+
}
25+
}
26+
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package memories
2+
3+
import org.scalatest.funspec.AnyFunSpec
4+
import org.scalatest.matchers.must.Matchers
5+
6+
import tywaves.simulator._
7+
import tywaves.simulator.simulatorSettings._
8+
import chisel3._
9+
10+
class BlockMemTest extends AnyFunSpec with Matchers {
11+
describe("TywavesSimulator") {
12+
import TywavesSimulator._
13+
14+
it("runs BlockMem of UInt8") {
15+
val t = UInt(8.W)
16+
simulate(new BlockMem(15, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_uint8")(dut =>
17+
dut.clock.step(2)
18+
)
19+
}
20+
21+
it("runs BlockMem of Bundle") {
22+
23+
class ComplexElement extends Bundle {
24+
val a = new Bundle {
25+
val subA1 = UInt(8.W)
26+
val subA2 = SInt(8.W)
27+
}
28+
val payload = Bits(8.W)
29+
}
30+
31+
val t = new ComplexElement
32+
simulate(
33+
new BlockMem(4, t),
34+
Seq(VcdTrace, WithTywavesWaveforms(false), SaveWorkdirFile("workdir")),
35+
simName = "runs_mem_bundle",
36+
)(dut => dut.clock.step(2))
37+
}
38+
39+
it("runs BlockMem of Vec") {
40+
val t = Vec(4, UInt(8.W))
41+
simulate(new BlockMem(4, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_vec")(dut =>
42+
dut.clock.step(2)
43+
)
44+
}
45+
46+
it("runs BlockMem of Enum") {
47+
object SelType extends ChiselEnum { val A, B, C = Value }
48+
val t = SelType()
49+
simulate(new BlockMem(4, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_enum")(dut =>
50+
dut.clock.step(2)
51+
)
52+
}
53+
54+
it("runs BlockMem of Enum in Bundle") {
55+
object SelType extends ChiselEnum { val A, B, C = Value }
56+
class ComplexElement extends Bundle {
57+
val sel = SelType()
58+
val payload = Bits(8.W)
59+
}
60+
61+
val t = new ComplexElement
62+
simulate(new BlockMem(4, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_enum_bundle")(dut =>
63+
dut.clock.step(2)
64+
)
65+
}
66+
67+
it("runs BlockMem of Enum in Vec") {
68+
object SelType extends ChiselEnum { val A, B, C = Value }
69+
val t = Vec(4, SelType())
70+
simulate(new BlockMem(4, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_enum_vec")(dut =>
71+
dut.clock.step(2)
72+
)
73+
}
74+
75+
it("runs BlockMem of Enum in 2D-Vec") {
76+
object SelType extends ChiselEnum { val A, B, C = Value }
77+
val t = Vec(4, Vec(2, SelType()))
78+
simulate(new BlockMem(4, t), Seq(VcdTrace, WithTywavesWaveforms(false)), simName = "runs_mem_enum_2d_vec")(dut =>
79+
dut.clock.step(2)
80+
)
81+
}
82+
83+
}
84+
}

0 commit comments

Comments
 (0)