diff options
| author | Adam Izraelevitz | 2015-12-11 17:21:36 -0800 |
|---|---|---|
| committer | Adam Izraelevitz | 2015-12-11 17:21:36 -0800 |
| commit | b8cd46de6c01febdbdba7ecb83db494bad8a7a94 (patch) | |
| tree | c3a0f10dd286ae2bba50c31b987ab39c45189898 /src/test/scala/chiselTests/BitwiseOps.scala | |
| parent | bffc67c2bbeb107d2ff9903aa35e85fbb7da73f9 (diff) | |
| parent | dbd072172f6312893e1922e48ed768ae0fab9a89 (diff) | |
Merge pull request #67 from ucb-bar/asserttest
Refactor tests to use stop() and assert() instead of io.error/io.done
Diffstat (limited to 'src/test/scala/chiselTests/BitwiseOps.scala')
| -rw-r--r-- | src/test/scala/chiselTests/BitwiseOps.scala | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/test/scala/chiselTests/BitwiseOps.scala b/src/test/scala/chiselTests/BitwiseOps.scala index d180c11e..31feaada 100644 --- a/src/test/scala/chiselTests/BitwiseOps.scala +++ b/src/test/scala/chiselTests/BitwiseOps.scala @@ -8,18 +8,17 @@ import org.scalatest.prop._ import Chisel.testers.BasicTester class BitwiseOpsTester(w: Int, _a: Int, _b: Int) extends BasicTester { - io.done := Bool(true) val mask = (1 << w) - 1 - val a = UInt(_a) - val b = UInt(_b) - when(~a != UInt(mask & ~_a)) { io.error := UInt(1) } - when((a & b) != UInt(mask & (_a & _b))) { io.error := UInt(2) } - when((a | b) != UInt(mask & (_a | _b))) { io.error := UInt(3) } - when((a ^ b) != UInt(mask & (_a ^ _b))) { io.error := UInt(4) } + val a = UInt(_a, w) + val b = UInt(_b, w) + assert(~a === UInt(mask & ~_a)) + assert((a & b) === UInt(_a & _b)) + assert((a | b) === UInt(_a | _b)) + assert((a ^ b) === UInt(_a ^ _b)) + stop() } class BitwiseOpsSpec extends ChiselPropSpec { - property("All bit-wise ops should return the correct result") { forAll(safeUIntPair) { case(w: Int, a: Int, b: Int) => assert(execute{ new BitwiseOpsTester(w, a, b) }) |
