summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/UIntOps.scala
diff options
context:
space:
mode:
authorSchuyler Eldridge2020-06-16 11:59:15 -0400
committerSchuyler Eldridge2020-06-22 20:00:10 -0400
commit6e03f63d525aac0bdf4a59b6fe66a0b4d5a3a25a (patch)
tree482481bcfe93ea5dfcece80772ce1957fb68c74c /src/test/scala/chiselTests/UIntOps.scala
parentcc4fa583690292d690804144fe92427f0c9f5fdf (diff)
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 <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/test/scala/chiselTests/UIntOps.scala')
-rw-r--r--src/test/scala/chiselTests/UIntOps.scala16
1 files changed, 9 insertions, 7 deletions
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 {
})
}
}
-