summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/chiselTests')
-rw-r--r--src/test/scala/chiselTests/OneHotMuxSpec.scala14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/test/scala/chiselTests/OneHotMuxSpec.scala b/src/test/scala/chiselTests/OneHotMuxSpec.scala
index e12d7913..be252bef 100644
--- a/src/test/scala/chiselTests/OneHotMuxSpec.scala
+++ b/src/test/scala/chiselTests/OneHotMuxSpec.scala
@@ -43,6 +43,14 @@ class OneHotMuxSpec extends FreeSpec with Matchers with ChiselRunners {
"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] {
+ assertTesterPasses(new BasicTester {
+ val out = UIntToOH(0.U, 0)
+ })
+ }
+ }
+
}
class SimpleOneHotTester extends BasicTester {
@@ -288,9 +296,13 @@ class DifferentBundleOneHotTester extends BasicTester {
class UIntToOHTester extends BasicTester {
val out = UIntToOH(1.U, 3)
-
require(out.getWidth == 3)
assert(out === 2.U)
+ val out2 = UIntToOH(0.U, 1)
+ require(out2.getWidth == 1)
+ assert(out2 === 1.U)
+
stop()
}
+