Skip to content

Commit 31774e0

Browse files
committed
Switch to Chisel 3.6 and Scala 2.13
1 parent 376622e commit 31774e0

14 files changed

+29
-28
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,13 @@ sbt "Test / run s4noc.PerformanceTest"
177177

178178
#### TODO (S4NOC)
179179

180+
* NetworkTest and LatencyTest disabled, as they (now) run too long
180181
* Share testing code between ideal and concrete NIs
181182
* Play with configuration
182183
* Check memory FIFO if it is memory in an FPGA
183184
* Should also check how much HW the translation is, probably nothing. Max 4 LUTs for a table for 16 cores
184185
* Play with FIFO buffer variations
186+
* Have Raw tester with Verilator annotation
185187

186188
To analyze memory issues (e.g., increase the heap size with Xmx) use a ```.sbtopts``` with
187189
```

build.sbt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
scalaVersion := "2.12.13"
1+
scalaVersion := "2.13.14"
22

33
scalacOptions ++= Seq(
44
"-deprecation",
@@ -7,19 +7,19 @@ scalacOptions ++= Seq(
77
"-language:reflectiveCalls",
88
)
99

10-
val chiselVersion = "3.5.5"
10+
val chiselVersion = "3.6.1"
1111
addCompilerPlugin("edu.berkeley.cs" %% "chisel3-plugin" % chiselVersion cross CrossVersion.full)
1212
libraryDependencies += "edu.berkeley.cs" %% "chisel3" % chiselVersion
13-
libraryDependencies += "edu.berkeley.cs" %% "chiseltest" % "0.5.5"
13+
libraryDependencies += "edu.berkeley.cs" %% "chiseltest" % "0.6.2"
1414

1515
// For FIFO buffers
16-
libraryDependencies += "edu.berkeley.cs" % "ip-contributions" % "0.5.1"
16+
libraryDependencies += "edu.berkeley.cs" % "ip-contributions" % "0.6.1"
1717

1818
// library name
1919
name := "soc-comm"
2020

2121
// library version
22-
version := "0.1.5"
22+
version := "0.1.6"
2323

2424
// groupId, SCM, license information
2525
organization := "io.github.t-crest"

src/main/scala/arbiter/ArbiterTree.scala

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package arbiter
22

33
import chisel3._
4-
// TODO: which Chisel version moves this into chisel3.util._?
5-
import chisel3.experimental.ChiselEnum
64
import chisel3.util._
75

86

src/main/scala/noc/Butterfly.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,5 @@ class Butterfly extends Module {
8282
}
8383

8484
object Butterfly extends App {
85-
(new chisel3.stage.ChiselStage).emitVerilog(new Butterfly(), Array("--target-dir", "generated"))
85+
emitVerilog(new Butterfly(), Array("--target-dir", "generated"))
8686
}

src/main/scala/s4noc/S4Router.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ class S4Router[T <: Data](schedule: Array[Array[Int]], dt: T) extends Module {
4545
}
4646

4747
object S4Router extends App {
48-
(new chisel3.stage.ChiselStage).emitVerilog(new S4Router(Schedule.genRandomSchedule(7), UInt(32.W)), Array("--target-dir", "generated"))
48+
emitVerilog(new S4Router(Schedule.genRandomSchedule(7), UInt(32.W)), Array("--target-dir", "generated"))
4949
}

src/main/scala/s4noc/Schedule.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Schedule(val n: Int) {
103103
schedule.foreach(a => {
104104
s += "( "
105105
a.foreach(v => {
106-
s += v + " "
106+
s += s"$v "
107107
})
108108
s += ")\n"
109109
})

src/main/scala/s4noc/ScheduleHardware.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ class ScheduleHardware[T <: Data](schedule: Array[Array[Int]], dt: T) extends Mo
3737
}
3838

3939
object ScheduleHardware extends App {
40-
(new chisel3.stage.ChiselStage).emitVerilog(new ScheduleHardware(Schedule(args(0).toInt).schedule, UInt(32.W)), Array("--target-dir", "generated"))
40+
emitVerilog(new ScheduleHardware(Schedule(args(0).toInt).schedule, UInt(32.W)), Array("--target-dir", "generated"))
4141
}

src/main/scala/s4noc/ScheduleTable.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ object ScheduleTable {
414414
" eel|"
415415

416416
def main(args: Array[String]): Unit = {
417-
var cnt = Source.fromFile(args(0)).getLines.length
418-
val lines = Source.fromFile(args(0)).getLines
417+
var cnt = Source.fromFile(args(0)).getLines().length
418+
val lines = Source.fromFile(args(0)).getLines()
419419
for (l <- lines) {
420420
val end = if (cnt > 1) " +" else ""
421421
println(" \"" + l + "l|\"" + end)

src/test/scala/noc/ButterflyTester.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ButterflyTester extends AnyFlatSpec with ChiselScalatestTester {
1212
c.io.inPorts(3).port(0).data.poke(7.U)
1313
for (i <- 0 until 10) {
1414
c.clock.step(1)
15-
println(c.io.outPorts(0).port(3).data.peek.litValue)
15+
println(c.io.outPorts(0).port(3).data.peekInt())
1616
}
1717
c.io.outPorts(0).port(3).data.expect(7.U)
1818
}

src/test/scala/s4noc/LatencyTest.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import soc._
77
/**
88
* Do some performance/latency tests.
99
*/
10-
class LatencyTest extends AnyFlatSpec with ChiselScalatestTester {
10+
class LatencyTest(dontRun: String) extends AnyFlatSpec with ChiselScalatestTester {
1111

1212
behavior of "S4NoC"
1313

@@ -33,7 +33,7 @@ class LatencyTest extends AnyFlatSpec with ChiselScalatestTester {
3333
assert(d.toInt == data(i))
3434
}
3535
println("" + CNT + " words sent")
36-
println("Bandwidth = " + (d.io.cycCnt.peek.litValue.toFloat / CNT) + " clock cycles per word")
36+
println("Bandwidth = " + (d.io.cycCnt.peekInt().toFloat / CNT) + " clock cycles per word")
3737

3838
th.join()
3939
}

src/test/scala/s4noc/NITester.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class NITester extends AnyFlatSpec with ChiselScalatestTester {
2121
for (i <- 1 until 30) {
2222
dut.clock.step()
2323
dut.io.networkPort.tx.valid.poke(false.B)
24-
if (dut.io.local.in.data.peek.litValue == 1) pass = true
24+
if (dut.io.local.in.data.peekInt() == 1) pass = true
2525
}
2626
assert(pass)
2727
}

src/test/scala/s4noc/NetworkTest.scala

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.scalatest.flatspec.AnyFlatSpec
99
* Test a 2x2 Network.
1010
*/
1111

12-
class NetworkTest extends AnyFlatSpec with ChiselScalatestTester {
12+
class NetworkTest(dontRun: String) extends AnyFlatSpec with ChiselScalatestTester {
1313
behavior of "2x2 Network"
1414

1515
"the NoC" should "work" in {
@@ -23,9 +23,9 @@ class NetworkTest extends AnyFlatSpec with ChiselScalatestTester {
2323
}
2424
dut.clock.step(1)
2525
for (j <- 0 until 4) {
26-
print(dut.io.local(j).out.valid.peek.litValue + " " + dut.io.local(j).out.data.peek.litValue + " ")
26+
print(s"${dut.io.local(j).out.valid.peekInt()} ${dut.io.local(j).out.data.peekInt()} ")
2727
}
28-
println
28+
println()
2929
}
3030
dut.io.local(0).out.data.expect(0x24.U)
3131
}
@@ -83,8 +83,8 @@ class NetworkTest extends AnyFlatSpec with ChiselScalatestTester {
8383
var cnt = 0
8484
val port = dut.io.local(core).out
8585
for (i <- 0 until TESTS + tdmLength) {
86-
val valid = port.valid.peek.litToBoolean
87-
val data = port.data.peek.litValue.toInt
86+
val valid = port.valid.peekBoolean()
87+
val data = port.data.peekInt().toInt
8888
val sndCnt = data >> 16
8989
val sndCore = (data >> 8) & 0xff
9090
val dest = data & 0xff
@@ -108,7 +108,7 @@ class NetworkTest extends AnyFlatSpec with ChiselScalatestTester {
108108
def dump(): Unit = {
109109
for (i <- 0 until n * n) {
110110
for (j <- 0 until 5) {
111-
// print(s"$i $j ${dut.net(i).io.ports(j).out.data.peek.litValue()} | ")
111+
// print(s"$i $j ${dut.net(i).io.ports(j).out.data.peekInt} | ")
112112
}
113113
// println
114114
}

src/test/scala/s4noc/PerformanceTest.scala

+5-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ object PerformanceTest extends App {
4444
/**
4545
* This is the interface directly to the network without an NI, or a CPU interface.
4646
*/
47-
RawTester.test(new Network(n, UInt(32.W)), Seq(VerilatorBackendAnnotation, chiseltest.internal.NoThreadingAnnotation)
47+
// RawTester.test(new Network(n, UInt(32.W)), Seq(VerilatorBackendAnnotation, chiseltest.internal.NoThreadingAnnotation)
48+
RawTester.test(new Network(n, UInt(32.W))
4849
) { d =>
4950

5051
def runIt(heatUp: Int, count: Int, drain: Int) = {
@@ -124,8 +125,8 @@ object PerformanceTest extends App {
124125

125126

126127
// Maybe this should go into its own class
127-
RawTester.test(new S4NoC(Config(n * n, MemType(256), MemType(26), MemType(256), 32)), Seq(VerilatorBackendAnnotation,
128-
chiseltest.internal.NoThreadingAnnotation)) { d =>
128+
// RawTester.test(new S4NoC(Config(n * n, MemType(256), MemType(26), MemType(256), 32)), Seq(VerilatorBackendAnnotation,
129+
RawTester.test(new S4NoC(Config(n * n, MemType(256), MemType(26), MemType(256), 32))) { d =>
129130

130131
var countCycles = 0
131132

@@ -166,7 +167,7 @@ object PerformanceTest extends App {
166167
// receive
167168
ni.rx.ready.poke(true.B)
168169
if (ni.rx.valid.peekBoolean()) {
169-
val recv = ni.rx.bits.data.peek.litValue.toInt
170+
val recv = ni.rx.bits.data.peekInt().toInt
170171
val to = (recv >> 16) & 0x0ff
171172
assert(to == core, s"$to should be $core")
172173
assert(t.check.contains((core, recv)), "Value out of thin air")

src/test/scala/s4noc/RouterTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class RouterTest extends AnyFlatSpec with ChiselScalatestTester {
3535
c.io.ports(3).in.valid.poke(true.B)
3636
c.io.ports(4).in.valid.poke(true.B)
3737
c.clock.step(1)
38-
println(f"${c.io.ports(0).out.data.peek.litValue.toInt}%02x ${c.io.ports(0).out.valid.peek.litValue}")
38+
println(f"${c.io.ports(0).out.data.peekInt()}%02x ${c.io.ports(0).out.valid.peekInt()}")
3939
}
4040
// TODO: these are NOT manually verified, but from the printout
4141
c.io.ports(0).out.data.expect(0x57.U)

0 commit comments

Comments
 (0)