Skip to content

Commit 8faa17c

Browse files
authored
build: bump to chisel 6 and fix deprecation warning
1 parent 90aaf59 commit 8faa17c

File tree

12 files changed

+52
-51
lines changed

12 files changed

+52
-51
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ test:
1010

1111

1212
test-top-l2:
13-
mill -i HuanCun.test.runMain huancun.TestTop_L2 -td build
13+
mill -i HuanCun.test.runMain huancun.TestTop_L2 -td build --target systemverilog --split-verilog
1414

1515
test-top-l2standalone:
16-
mill -i HuanCun.test.runMain huancun.TestTop_L2_Standalone -td build
16+
mill -i HuanCun.test.runMain huancun.TestTop_L2_Standalone -td build --target systemverilog --split-verilog
1717

1818
test-top-l2l3:
19-
mill -i HuanCun.test.runMain huancun.TestTop_L2L3 -td build
19+
mill -i HuanCun.test.runMain huancun.TestTop_L2L3 -td build --target systemverilog --split-verilog
2020

2121
test-top-fullsys:
22-
mill -i HuanCun.test.runMain huancun.TestTop_FullSys -td build
22+
mill -i HuanCun.test.runMain huancun.TestTop_FullSys -td build --target systemverilog --split-verilog
2323

2424
basic-test:
2525
mill -i HuanCun.test.testOnly -o -s huancun.ConnectionTester

build.sc

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,24 @@ import $file.`rocket-chip`.common
66
import $file.`rocket-chip`.cde.common
77
import $file.`rocket-chip`.hardfloat.common
88

9-
val defaultVersions = Map(
10-
"chisel3" -> "3.6.0",
11-
"chisel3-plugin" -> "3.6.0",
12-
"chiseltest" -> "0.6.2",
13-
"scala" -> "2.13.10",
14-
)
9+
val defaultScalaVersion = "2.13.15"
1510

16-
def getVersion(dep: String, org: String = "edu.berkeley.cs", cross: Boolean = false) = {
17-
val version = sys.env.getOrElse(dep + "Version", defaultVersions(dep))
18-
if (cross)
19-
ivy"$org:::$dep:$version"
20-
else
21-
ivy"$org::$dep:$version"
22-
}
11+
def defaultVersions = Map(
12+
"chisel" -> ivy"org.chipsalliance::chisel:6.6.0",
13+
"chisel-plugin" -> ivy"org.chipsalliance:::chisel-plugin:6.6.0",
14+
"chiseltest" -> ivy"edu.berkeley.cs::chiseltest:6.0.0"
15+
)
2316

2417
trait HasChisel extends ScalaModule {
2518
def chiselModule: Option[ScalaModule] = None
2619

2720
def chiselPluginJar: T[Option[PathRef]] = None
2821

29-
def chiselIvy: Option[Dep] = Some(getVersion("chisel3"))
22+
def chiselIvy: Option[Dep] = Some(defaultVersions("chisel"))
3023

31-
def chiselPluginIvy: Option[Dep] = Some(getVersion("chisel3-plugin", cross=true))
24+
def chiselPluginIvy: Option[Dep] = Some(defaultVersions("chisel-plugin"))
3225

33-
override def scalaVersion = defaultVersions("scala")
26+
override def scalaVersion = defaultScalaVersion
3427

3528
override def scalacOptions = super.scalacOptions() ++
3629
Agg("-language:reflectiveCalls", "-Ymacro-annotations", "-Ytasty-reader")
@@ -45,9 +38,9 @@ object rocketchip extends `rocket-chip`.common.RocketChipModule with HasChisel {
4538
val rcPath = os.pwd / "rocket-chip"
4639
override def millSourcePath = rcPath
4740

48-
def mainargsIvy = ivy"com.lihaoyi::mainargs:0.5.0"
41+
def mainargsIvy = ivy"com.lihaoyi::mainargs:0.7.0"
4942

50-
def json4sJacksonIvy = ivy"org.json4s::json4s-jackson:4.0.5"
43+
def json4sJacksonIvy = ivy"org.json4s::json4s-jackson:4.0.7"
5144

5245
object macros extends `rocket-chip`.common.MacrosModule with HasChisel {
5346
def scalaReflectIvy = ivy"org.scala-lang:scala-reflect:${scalaVersion}"
@@ -87,8 +80,10 @@ object HuanCun extends SbtModule with HasChisel with millbuild.common.HuanCunMod
8780

8881
object test extends SbtModuleTests with TestModule.ScalaTest {
8982
override def ivyDeps = super.ivyDeps() ++ Agg(
90-
getVersion("chiseltest"),
83+
defaultVersions("chiseltest"),
9184
)
9285
}
9386

87+
override def scalacOptions = super.scalacOptions() ++ Agg("-deprecation", "-feature")
88+
9489
}

src/main/scala/huancun/DataStorage.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ class DataStorage(implicit p: Parameters) extends HuanCunModule {
246246
dataSel.io.en(1) := io.sourceC_raddr.fire
247247
}
248248

249-
io.sourceD_rdata.data := Cat(dataSelModules.map(_.io.out(0)).reverse)
250-
io.sourceD_rdata.corrupt := Cat(dataSelModules.map(_.io.err_out(0))).orR
251-
io.sourceC_rdata.data := Cat(dataSelModules.map(_.io.out(1)).reverse)
252-
io.sourceC_rdata.corrupt := Cat(dataSelModules.map(_.io.err_out(1))).orR
249+
io.sourceD_rdata.data := Cat(dataSelModules.map(_.io.out(0)).reverse.toIndexedSeq)
250+
io.sourceD_rdata.corrupt := Cat(dataSelModules.map(_.io.err_out(0)).toIndexedSeq).orR
251+
io.sourceC_rdata.data := Cat(dataSelModules.map(_.io.out(1)).reverse.toIndexedSeq)
252+
io.sourceC_rdata.corrupt := Cat(dataSelModules.map(_.io.err_out(1)).toIndexedSeq).orR
253253

254254
val d_addr_reg = RegNextN(io.sourceD_raddr.bits, sramLatency)
255255
val c_addr_reg = RegNextN(io.sourceC_raddr.bits, sramLatency)

src/main/scala/huancun/HuanCun.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ class HuanCun(implicit p: Parameters) extends LazyModule with HasHuanCunParamete
265265

266266
val sizeBytes = cacheParams.toCacheParams.capacity.toDouble
267267
def sizeBytesToStr(sizeBytes: Double): String = sizeBytes match {
268-
case _ if sizeBytes >= 1024 * 1024 => (sizeBytes / 1024 / 1024) + "MB"
269-
case _ if sizeBytes >= 1024 => (sizeBytes / 1024) + "KB"
268+
case _ if sizeBytes >= 1024 * 1024 => s"${sizeBytes / 1024 / 1024}MB"
269+
case _ if sizeBytes >= 1024 => s"${sizeBytes / 1024}KB"
270270
case _ => "B"
271271
}
272272
val sizeStr = sizeBytesToStr(sizeBytes)

src/main/scala/huancun/Slice.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package huancun
2121

22+
import scala.language.existentials
2223
import org.chipsalliance.cde.config.Parameters
2324
import chisel3._
2425
import chisel3.util._
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
package huancun.utils
22

3-
import firrtl.annotations.{Annotation, ModuleName, Named, SingleTargetAnnotation}
43
import chisel3._
54
import chisel3.experimental.ChiselAnnotation
65

7-
case class SRAMClkDivBy2Annotation(mod: ModuleName) extends SingleTargetAnnotation[ModuleName] {
8-
override val target: ModuleName = mod
6+
case class SRAMClkDivBy2Annotation(mod: firrtl.annotations.ModuleName)
7+
extends firrtl.annotations.SingleTargetAnnotation[firrtl.annotations.ModuleName] {
8+
override val target: firrtl.annotations.ModuleName = mod
99

10-
override def duplicate(n: ModuleName): Annotation = this.copy(n)
10+
override def duplicate(n: firrtl.annotations.ModuleName): firrtl.annotations.Annotation = this.copy(n)
1111
}
1212

13-
case class SRAMSpecialDepthAnnotation(mod: ModuleName) extends SingleTargetAnnotation[ModuleName] {
14-
override val target: ModuleName = mod
13+
case class SRAMSpecialDepthAnnotation(mod: firrtl.annotations.ModuleName)
14+
extends firrtl.annotations.SingleTargetAnnotation[firrtl.annotations.ModuleName] {
15+
override val target: firrtl.annotations.ModuleName = mod
1516

16-
override def duplicate(n: ModuleName): Annotation = this.copy(n)
17+
override def duplicate(n: firrtl.annotations.ModuleName): firrtl.annotations.Annotation = this.copy(n)
1718
}
1819

1920
object CustomAnnotations {
2021
def annotateClkDivBy2(mod: Module) = {
2122
chisel3.experimental.annotate(new ChiselAnnotation {
22-
override def toFirrtl: Annotation = SRAMClkDivBy2Annotation(mod.toNamed)
23+
override def toFirrtl: firrtl.annotations.Annotation = SRAMClkDivBy2Annotation(mod.toNamed)
2324
})
2425
}
2526
def annotateSpecialDepth(mod: Module) = {
2627
chisel3.experimental.annotate(new ChiselAnnotation {
27-
override def toFirrtl: Annotation = SRAMSpecialDepthAnnotation(mod.toNamed)
28+
override def toFirrtl: firrtl.annotations.Annotation = SRAMSpecialDepthAnnotation(mod.toNamed)
2829
})
2930
}
3031
}

src/test/scala/huancun/AllocatorTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import freechips.rocketchip.tilelink.{BankBinder, TLCacheCork, TLFuzzer, TLRAM,
88
class AllocatorTest extends L2Tester {
99

1010
val system = LazyModule(new ExampleSystem())
11-
chisel3.stage.ChiselStage.elaborate(system.module)
11+
circt.stage.ChiselStage.convert(system.module)
1212

1313
val mshrAlloc = chisel3.aop.Select.collectDeep[MSHRAlloc](system.module){
1414
case alloc: MSHRAlloc =>

src/test/scala/huancun/DSTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import freechips.rocketchip.diplomacy.LazyModule
66
class DSTest extends L2Tester {
77

88
val system = LazyModule(new ExampleSystem())
9-
chisel3.stage.ChiselStage.elaborate(system.module)
9+
circt.stage.ChiselStage.convert(system.module)
1010

1111
val datastorage = chisel3.aop.Select.collectDeep[DataStorage](system.module){
1212
case ds: DataStorage =>

src/test/scala/huancun/L2Tester.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ import org.chipsalliance.cde.config.Config
55
import chiseltest._
66
import chiseltest.{VerilatorBackendAnnotation, WriteVcdAnnotation}
77
import chiseltest.simulator.{VerilatorCFlags, VerilatorFlags}
8-
import firrtl.AnnotationSeq
9-
import firrtl.stage.RunFirrtlTransformAnnotation
8+
import firrtl2.AnnotationSeq
109
import org.scalatest.flatspec._
1110
import org.scalatest.matchers.should._
1211
import huancun.prefetch._
1312

1413
abstract class L2Tester extends AnyFlatSpec with ChiselScalatestTester with Matchers with HasTestAnnos {
1514
behavior of "L2"
16-
implicit val defaultConfig = new Config((_, _, _) => {
15+
implicit val defaultConfig: Config = new Config((_, _, _) => {
1716
case HCCacheParamsKey => HCCacheParameters(
1817
prefetch = Some(BOPParameters()),// None,
1918
inclusive = false,

0 commit comments

Comments
 (0)