diff options
| author | Wesley W. Terpstra | 2018-06-18 19:40:17 +0200 |
|---|---|---|
| committer | Jack Koenig | 2018-06-18 10:40:17 -0700 |
| commit | 4cccd877c25116a1f0b90824aabfc689d7fe50ea (patch) | |
| tree | 6edf8b11b877995534bd202ecd95ccb2eb83468c /src/test | |
| parent | d0cdd3b4c3713bb7454868fac7fa9c43bae2332c (diff) | |
Fixed UIntToOH(x, 1) invocation with x.width == 0 (#778)
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/chiselTests/OneHotMuxSpec.scala | 14 |
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() } + |
