summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/OneHotMuxSpec.scala
diff options
context:
space:
mode:
authorSchuyler Eldridge2020-03-10 21:18:36 -0400
committerSchuyler Eldridge2020-03-11 16:04:05 -0400
commitd67c4100bd9e24cb9337ad932ba342fd5c49dee4 (patch)
tree89a379e775edef44a03fbd6112249bb9b59404af /src/test/scala/chiselTests/OneHotMuxSpec.scala
parentd83235f635e4b048c063c8314e1340bca2db395f (diff)
Wrap elaboration in ChiselException
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com> squash! Wrap elaboration in ChiselException
Diffstat (limited to 'src/test/scala/chiselTests/OneHotMuxSpec.scala')
-rw-r--r--src/test/scala/chiselTests/OneHotMuxSpec.scala16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/test/scala/chiselTests/OneHotMuxSpec.scala b/src/test/scala/chiselTests/OneHotMuxSpec.scala
index 7476ebe2..e6c9add4 100644
--- a/src/test/scala/chiselTests/OneHotMuxSpec.scala
+++ b/src/test/scala/chiselTests/OneHotMuxSpec.scala
@@ -4,6 +4,7 @@ package chiselTests
import chisel3._
import chisel3.experimental.FixedPoint
+import chisel3.internal.ChiselException
import chisel3.testers.BasicTester
import chisel3.util.{Mux1H, UIntToOH}
import org.scalatest._
@@ -31,23 +32,31 @@ class OneHotMuxSpec extends FreeSpec with Matchers with ChiselRunners {
assertTesterPasses(new ParameterizedAggregateOneHotTester)
}
"simple one hot mux with all aggregates containing inferred width fixed values should NOT work" in {
- intercept[ChiselException] {
+ intercept [ChiselException] {
assertTesterPasses(new InferredWidthAggregateOneHotTester)
}
}
"simple one hot mux with all fixed width bundles but with different bundles should Not work" in {
- intercept[IllegalArgumentException] {
+ try {
assertTesterPasses(new DifferentBundleOneHotTester)
+ } catch {
+ case a: ChiselException => a.getCause match {
+ case _: IllegalArgumentException =>
+ }
}
}
"UIntToOH with output width greater than 2^(input width)" in {
assertTesterPasses(new UIntToOHTester)
}
"UIntToOH should not accept width of zero (until zero-width wires are fixed" in {
- intercept[java.lang.IllegalArgumentException] {
+ try {
assertTesterPasses(new BasicTester {
val out = UIntToOH(0.U, 0)
})
+ } catch {
+ case a: ChiselException => a.getCause match {
+ case _: IllegalArgumentException =>
+ }
}
}
@@ -305,4 +314,3 @@ class UIntToOHTester extends BasicTester {
stop()
}
-