diff options
Diffstat (limited to 'src/test/scala/chiselTests/UIntOps.scala')
| -rw-r--r-- | src/test/scala/chiselTests/UIntOps.scala | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/UIntOps.scala b/src/test/scala/chiselTests/UIntOps.scala index d31d86a8..490af22b 100644 --- a/src/test/scala/chiselTests/UIntOps.scala +++ b/src/test/scala/chiselTests/UIntOps.scala @@ -91,6 +91,11 @@ class BadBoolConversion extends Module { io.b := io.u.toBool } +class NegativeShift(t: => Bits) extends Module { + val io = IO(new Bundle) + Reg(t) >> -1 +} + class UIntOpsSpec extends ChiselPropSpec with Matchers { // Disable shrinking on error. implicit val noShrinkListVal = Shrink[List[Int]](_ => Stream.empty) @@ -111,5 +116,9 @@ class UIntOpsSpec extends ChiselPropSpec with Matchers { property("UIntOpsTester should return the correct result") { assertTesterPasses { new UIntOpsTester(123, 7) } } + + property("Negative shift amounts are invalid") { + a [ChiselException] should be thrownBy { elaborate(new NegativeShift(UInt())) } + } } |
