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/UIntOps.scala | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/test/scala/chiselTests/UIntOps.scala') diff --git a/src/test/scala/chiselTests/UIntOps.scala b/src/test/scala/chiselTests/UIntOps.scala index 0c7e2dcd..a13077ba 100644 --- a/src/test/scala/chiselTests/UIntOps.scala +++ b/src/test/scala/chiselTests/UIntOps.scala @@ -4,6 +4,7 @@ package chiselTests import chisel3._ import org.scalatest._ +import chisel3.stage.ChiselStage import chisel3.testers.BasicTester import org.scalacheck.Shrink import org.scalatest.matchers.should.Matchers @@ -112,21 +113,21 @@ class UIntLitExtractTester extends BasicTester { stop() } -class UIntOpsSpec extends ChiselPropSpec with Matchers { +class UIntOpsSpec extends ChiselPropSpec with Matchers with Utils { // Disable shrinking on error. implicit val noShrinkListVal = Shrink[List[Int]](_ => Stream.empty) implicit val noShrinkInt = Shrink[Int](_ => Stream.empty) property("Bools can be created from 1 bit UInts") { - elaborate(new GoodBoolConversion) + ChiselStage.elaborate(new GoodBoolConversion) } property("Bools cannot be created from >1 bit UInts") { - a [Exception] should be thrownBy { elaborate(new BadBoolConversion) } + a [Exception] should be thrownBy extractCause[Exception] { ChiselStage.elaborate(new BadBoolConversion) } } property("UIntOps should elaborate") { - elaborate { new UIntOps } + ChiselStage.elaborate { new UIntOps } } property("UIntOpsTester should return the correct result") { @@ -134,7 +135,9 @@ class UIntOpsSpec extends ChiselPropSpec with Matchers { } property("Negative shift amounts are invalid") { - a [ChiselException] should be thrownBy { elaborate(new NegativeShift(UInt())) } + a [ChiselException] should be thrownBy extractCause[ChiselException] { + ChiselStage.elaborate(new NegativeShift(UInt())) + } } property("Bit extraction on literals should work for all non-negative indices") { @@ -142,7 +145,7 @@ class UIntOpsSpec extends ChiselPropSpec with Matchers { } property("asBools should support chained apply") { - elaborate(new Module { + ChiselStage.elaborate(new Module { val io = IO(new Bundle { val in = Input(UInt(8.W)) val out = Output(Bool()) @@ -151,4 +154,3 @@ class UIntOpsSpec extends ChiselPropSpec with Matchers { }) } } - -- cgit v1.2.3