From 6e03f63d525aac0bdf4a59b6fe66a0b4d5a3a25a Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Tue, 16 Jun 2020 11:59:15 -0400 Subject: Use ChiselStage in Tests This migrates the tests to Chisel 3.4/FIRRTL 1.4. This primarily involves removing usages of deprecated methods including: - Remove usages of Driver - Use ChiselStage methods instead of BackendCompilationUtilities methods - Use Dependency API for custom transforms - Use extractCause to unpack StackError Signed-off-by: Schuyler Eldridge --- src/test/scala/chiselTests/MixedVecSpec.scala | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/test/scala/chiselTests/MixedVecSpec.scala') diff --git a/src/test/scala/chiselTests/MixedVecSpec.scala b/src/test/scala/chiselTests/MixedVecSpec.scala index 5dd30270..1c823b18 100644 --- a/src/test/scala/chiselTests/MixedVecSpec.scala +++ b/src/test/scala/chiselTests/MixedVecSpec.scala @@ -3,6 +3,7 @@ package chiselTests import chisel3._ +import chisel3.stage.ChiselStage import chisel3.testers.BasicTester import chisel3.util._ import org.scalacheck.Shrink @@ -152,7 +153,7 @@ class MixedVecOneBitTester extends BasicTester { } } -class MixedVecSpec extends ChiselPropSpec { +class MixedVecSpec extends ChiselPropSpec with Utils { // Disable shrinking on error. // Not sure why this needs to be here, but the test behaves very weirdly without it (e.g. empty Lists, etc). implicit val noShrinkListVal = Shrink[List[Int]](_ => Stream.empty) @@ -208,22 +209,22 @@ class MixedVecSpec extends ChiselPropSpec { } property("MixedVecs should not be able to take hardware types") { - a [ExpectedChiselTypeException] should be thrownBy { - elaborate(new Module { + a [ExpectedChiselTypeException] should be thrownBy extractCause[ExpectedChiselTypeException] { + ChiselStage.elaborate(new Module { val io = IO(new Bundle {}) val hw = Wire(MixedVec(Seq(UInt(8.W), Bool()))) val illegal = MixedVec(hw) }) } - a [ExpectedChiselTypeException] should be thrownBy { - elaborate(new Module { + a [ExpectedChiselTypeException] should be thrownBy extractCause[ExpectedChiselTypeException] { + ChiselStage.elaborate(new Module { val io = IO(new Bundle {}) val hw = Reg(MixedVec(Seq(UInt(8.W), Bool()))) val illegal = MixedVec(hw) }) } - a [ExpectedChiselTypeException] should be thrownBy { - elaborate(new Module { + a [ExpectedChiselTypeException] should be thrownBy extractCause[ExpectedChiselTypeException] { + ChiselStage.elaborate(new Module { val io = IO(new Bundle { val v = Input(MixedVec(Seq(UInt(8.W), Bool()))) }) @@ -257,8 +258,8 @@ class MixedVecSpec extends ChiselPropSpec { } property("Connecting a MixedVec and something of different size should report a ChiselException") { - an [IllegalArgumentException] should be thrownBy { - elaborate(new Module { + an [IllegalArgumentException] should be thrownBy extractCause[IllegalArgumentException] { + ChiselStage.elaborate(new Module { val io = IO(new Bundle { val out = Output(MixedVec(Seq(UInt(8.W), Bool()))) }) @@ -266,8 +267,8 @@ class MixedVecSpec extends ChiselPropSpec { io.out := seq }) } - an [IllegalArgumentException] should be thrownBy { - elaborate(new Module { + an [IllegalArgumentException] should be thrownBy extractCause[IllegalArgumentException] { + ChiselStage.elaborate(new Module { val io = IO(new Bundle { val out = Output(MixedVec(Seq(UInt(8.W), Bool()))) }) -- cgit v1.2.3