summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/When.scala
diff options
context:
space:
mode:
authorJim Lawson2016-12-02 12:51:03 -0800
committerGitHub2016-12-02 12:51:03 -0800
commitd3ec37edd39799e8cf039e5caed915c00dff7eeb (patch)
tree03329ddc11ca15b9d6c7f832354a9cba20c87843 /src/test/scala/chiselTests/When.scala
parent1b53d893816d349f5ea18fa0ed13325b9f1b6917 (diff)
parenteba224e524b249207b47a3b378458c61c9b66e2c (diff)
Merge branch 'master' into exceptionfix
Diffstat (limited to 'src/test/scala/chiselTests/When.scala')
-rw-r--r--src/test/scala/chiselTests/When.scala48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/test/scala/chiselTests/When.scala b/src/test/scala/chiselTests/When.scala
index 6dc2dbac..d4491e13 100644
--- a/src/test/scala/chiselTests/When.scala
+++ b/src/test/scala/chiselTests/When.scala
@@ -11,44 +11,44 @@ import chisel3.util._
class WhenTester() extends BasicTester {
val cnt = Counter(4)
- when(Bool(true)) { cnt.inc() }
-
- val out = Wire(UInt.width(3))
- when(cnt.value === UInt(0)) {
- out := UInt(1)
- } .elsewhen (cnt.value === UInt(1)) {
- out := UInt(2)
- } .elsewhen (cnt.value === UInt(2)) {
- out := UInt(3)
+ when(true.B) { cnt.inc() }
+
+ val out = Wire(UInt(3.W))
+ when(cnt.value === 0.U) {
+ out := 1.U
+ } .elsewhen (cnt.value === 1.U) {
+ out := 2.U
+ } .elsewhen (cnt.value === 2.U) {
+ out := 3.U
} .otherwise {
- out := UInt(0)
+ out := 0.U
}
- assert(out === cnt.value + UInt(1))
+ assert(out === cnt.value + 1.U)
- when(cnt.value === UInt(3)) {
+ when(cnt.value === 3.U) {
stop()
}
}
class OverlappedWhenTester() extends BasicTester {
val cnt = Counter(4)
- when(Bool(true)) { cnt.inc() }
-
- val out = Wire(UInt.width(3))
- when(cnt.value <= UInt(0)) {
- out := UInt(1)
- } .elsewhen (cnt.value <= UInt(1)) {
- out := UInt(2)
- } .elsewhen (cnt.value <= UInt(2)) {
- out := UInt(3)
+ when(true.B) { cnt.inc() }
+
+ val out = Wire(UInt(3.W))
+ when(cnt.value <= 0.U) {
+ out := 1.U
+ } .elsewhen (cnt.value <= 1.U) {
+ out := 2.U
+ } .elsewhen (cnt.value <= 2.U) {
+ out := 3.U
} .otherwise {
- out := UInt(0)
+ out := 0.U
}
- assert(out === cnt.value + UInt(1))
+ assert(out === cnt.value + 1.U)
- when(cnt.value === UInt(3)) {
+ when(cnt.value === 3.U) {
stop()
}
}