Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Bump to chisel 6 release #705

Merged
merged 8 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ jobs:
# 4.034: Chipyard
# 4.038: Ubuntu 20.10
# 4.108: Fedora 34
# 4.200: currently the latest version on brew (MacOS)
# 4.202: added "forcePerInstance" to support our coverage flow
version: ["4.028", "4.032", "4.034", "4.038", "4.108", "4.200", "4.202"]
# 5.018: currently the latest version on brew (macOS)
# 5.020: latest release
version: ["4.028", "4.032", "4.034", "4.038", "4.108", "4.200", "4.202", "5.018", "5.020"]

steps:
- name: Checkout
Expand Down
9 changes: 5 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

lazy val commonSettings = Seq(
organization := "edu.berkeley.cs",
scalaVersion := "2.13.10",
crossScalaVersions := Seq("2.13.10")
scalaVersion := "2.13.12",
crossScalaVersions := Seq("2.13.12")
)

val chiselVersion = "6.0.0-M3"
val chiselVersion = "6.0.0"
val firrtlVersion = "6.0-SNAPSHOT"

lazy val chiseltestSettings = Seq(
name := "chiseltest",
// we keep in sync with chisel version names
version := "6.0-SNAPSHOT",
version := "6.0.0",
scalacOptions := Seq(
"-deprecation",
"-feature",
"-Xcheckinit",
"-language:reflectiveCalls",
// do not warn about firrtl imports, once the firrtl repo is removed, we will need to import the code
"-Wconf:cat=deprecation&msg=Importing from firrtl is deprecated:s",
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.8.2
sbt.version=1.9.8
6 changes: 3 additions & 3 deletions src/main/scala/chiseltest/iotesters/PeekPokeTester.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ abstract class PeekPokeTester[T <: Module](val dut: T) extends LazyLogging {
private def maskedBigInt(bigInt: BigInt, width: Int): BigInt = bigInt & ((BigInt(1) << width) - 1)

// helps us work around the fact that signal.width is private!
private def getFirrtlWidth(signal: Bits): chisel3.internal.firrtl.Width = signal.widthOption match {
case Some(value) => chisel3.internal.firrtl.KnownWidth(value)
case None => chisel3.internal.firrtl.UnknownWidth()
private def getFirrtlWidth(signal: Bits): chisel3.Width = signal.widthOption match {
case Some(value) => chisel3.KnownWidth(value)
case None => chisel3.UnknownWidth()
}

/** Locate a specific bundle element, given a name path. TODO: Handle Vecs
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/chiseltest/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ package object chiseltest {
}

// helps us work around the fact that signal.width is private!
def getFirrtlWidth(signal: Bits): chisel3.internal.firrtl.Width = signal.widthOption match {
case Some(value) => chisel3.internal.firrtl.KnownWidth(value)
case None => chisel3.internal.firrtl.UnknownWidth()
def getFirrtlWidth(signal: Bits): chisel3.Width = signal.widthOption match {
case Some(value) => chisel3.KnownWidth(value)
case None => chisel3.UnknownWidth()
}

def boolBitsToString(bits: BigInt): String = (bits != 0).toString
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/chiseltest/simulator/ChiselBridge.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ private object ChiselBridge {
// ignoreDecodeTableAnnotation since it is not needed by the firrtl compiler
case _: DecodeTableAnnotation => None
//
case _ => throw new NotImplementedError(s"TODO: convert ${anno}")
case _ => Some(UnsupportedAnnotation(anno.getClass.getSimpleName, anno.toString))
kammoh marked this conversation as resolved.
Show resolved Hide resolved
// case _ => throw new NotImplementedError(s"TODO: convert ${anno}")
}

private def convert(c: Circuit): firrtl2.ir.Circuit =
Expand Down
22 changes: 17 additions & 5 deletions src/main/scala/chiseltest/simulator/VerilatorCoverage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ private object VerilatorCoverage {
Coverage.collectCoverageAnnotations(annos) ++ annos.collect { case a: OrderedCoverPointsAnnotation => a }
}

def loadCoverage(annos: AnnotationSeq, coverageData: os.Path): List[(String, Long)] = {
def loadCoverage(annos: AnnotationSeq, coverageData: os.Path, version: (Int, Int)): List[(String, Long)] = {
val entries = parseCoverageData(coverageData)
verilatorCoverageToCoverageMap(entries, annos)
verilatorCoverageToCoverageMap(entries, annos, version)
}

private def verilatorCoverageToCoverageMap(es: List[CoverageEntry], annos: AnnotationSeq): List[(String, Long)] = {
private def verilatorCoverageToCoverageMap(es: List[CoverageEntry], annos: AnnotationSeq, version: (Int, Int))
: List[(String, Long)] = {
// map from module name to an ordered list of cover points in said module
val coverPoints = annos.collect { case a: OrderedCoverPointsAnnotation => a.target.module -> a.covers }.toMap
// map from instance path name to the name of the module
Expand All @@ -49,8 +50,19 @@ private object VerilatorCoverage {
// process the coverage entries on a per instance basis
es.groupBy(_.path).toList.flatMap { case (name, entries) =>
// we look up the cover points by first converting to the module name
val covers = coverPoints(instToModule(name))
processInstanceCoverage(name, covers, entries)
instToModule.get(name) match {
case Some(module) =>
val covers = coverPoints(module)
processInstanceCoverage(name, covers, entries)
case None if name.contains("*") =>
instToModule.flatMap {
case (inst, module) if inst.matches(name.replace("*", ".*")) =>
val covers = coverPoints(module)
processInstanceCoverage(inst, covers, entries)
case _ => Nil
}
case _ => throw new RuntimeException(s"Could not find module for instance: $name")
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/chiseltest/simulator/VerilatorSimulator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private object VerilatorSimulator extends Simulator {
val coverageFile = targetDir / "coverage.dat"
def readCoverage(): List[(String, Long)] = {
assert(os.exists(coverageFile), s"Could not find `$coverageFile` file!")
VerilatorCoverage.loadCoverage(coverageAnnos, coverageFile)
VerilatorCoverage.loadCoverage(coverageAnnos, coverageFile, (majorVersion, minorVersion))
}

val args = getSimulatorArgs(state)
Expand Down Expand Up @@ -152,7 +152,7 @@ private object VerilatorSimulator extends Simulator {
val coverageFile = targetDir / "coverage.dat"
def readCoverage(): List[(String, Long)] = {
assert(os.exists(coverageFile), s"Could not find `$coverageFile` file!")
VerilatorCoverage.loadCoverage(coverageAnnos, coverageFile)
VerilatorCoverage.loadCoverage(coverageAnnos, coverageFile, (majorVersion, minorVersion))
}

val args = getSimulatorArgs(state)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/treadle2/stage/phases/GetFirrtlAst.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object GetFirrtlAst extends Phase {
def handleFirrtlFile(): Option[AnnotationSeq] = {
annotationSeq.collectFirst { case FirrtlFileAnnotation(fileName) => fileName } match {
case Some(fileName) =>
val file = io.Source.fromFile(fileName)
val file = scala.io.Source.fromFile(fileName)
val text = file.mkString
file.close()

Expand Down
4 changes: 1 addition & 3 deletions src/test/scala/chiseltest/simulator/Verilator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class VerilatorSpecificTests extends FlatSpecWithTargetDir {
val (_, out) = CaptureStdout {
sim.findVersions()
}
assert(out.contains("Found Verilator 4"))
assert(out.contains("Found Verilator "))
}

it should "print out commands and verilator results in debug mode" taggedAs RequiresVerilator in {
Expand All @@ -45,8 +45,6 @@ class VerilatorSpecificTests extends FlatSpecWithTargetDir {
val verilatorBinName = if (JNAUtils.isWindows) { "verilator_bin" }
else { "verilator" }
assert(out.contains(s"${verilatorBinName} --cc --exe "))
assert(out.contains("g++"))
assert(out.contains("perl"))
assert(out.contains("make -C"))
}
}
2 changes: 1 addition & 1 deletion src/test/scala/chiseltest/tests/VecPokeExpectTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.scalatest.freespec.AnyFreeSpec

class UsesVec extends Module {
val in = IO(Input(Vec(4, UInt(5.W))))
val addr = IO(Input(UInt(8.W)))
val addr = IO(Input(UInt(2.W)))
val out = IO(Output(UInt(5.W)))

out := in(addr)
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/treadle2/ModuleInLineSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ModuleInLineSpec extends AnyFlatSpec with Matchers with LazyLogging {

it should "expand instances as found" in {
val stream = getClass.getResourceAsStream("/treadle/three_deep.fir")
val input = io.Source.fromInputStream(stream).mkString
val input = scala.io.Source.fromInputStream(stream).mkString

TreadleTestHarness(Seq(FirrtlSourceAnnotation(input))) { tester =>
tester.engine.symbolTable.outputPortsNames.size should be > 0
Expand All @@ -21,7 +21,7 @@ class ModuleInLineSpec extends AnyFlatSpec with Matchers with LazyLogging {

it should "nester registers should all be using the same clock" in {
val stream = getClass.getResourceAsStream("/treadle/NestedModsWithReg.fir")
val input = io.Source.fromInputStream(stream).mkString
val input = scala.io.Source.fromInputStream(stream).mkString

TreadleTestHarness(Seq(FirrtlSourceAnnotation(input))) { tester =>
def testIt(): Unit = {
Expand Down
Loading