summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/Decoder.scala
diff options
context:
space:
mode:
authorHenry Cook2015-08-14 14:28:56 -0700
committerHenry Cook2015-08-14 14:28:56 -0700
commit3dade9a48f059e3eecc7048bcd1cd1db48cdb56a (patch)
tree447f263f04de6ac3eac6e943ab57febf94e54f62 /src/test/scala/chiselTests/Decoder.scala
parent0e1297437944956b3dd443436258f4c682190ca4 (diff)
more tests
Diffstat (limited to 'src/test/scala/chiselTests/Decoder.scala')
-rw-r--r--src/test/scala/chiselTests/Decoder.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/scala/chiselTests/Decoder.scala b/src/test/scala/chiselTests/Decoder.scala
index cc463600..7562ea2a 100644
--- a/src/test/scala/chiselTests/Decoder.scala
+++ b/src/test/scala/chiselTests/Decoder.scala
@@ -8,9 +8,9 @@ import Chisel.testers.BasicTester
class Decoder(bitpats: List[String]) extends Module {
val io = new Bundle {
val inst = UInt(INPUT, 32)
- val match_idx = UInt(OUTPUT, 5)
+ val matched = Bool(OUTPUT)
}
- io.match_idx := Vec(bitpats.map(BitPat(_) === io.inst)).indexWhere{i: Bool => i}
+ io.matched := Vec(bitpats.map(BitPat(_) === io.inst)).reduce(_||_)
}
class DecoderSpec extends ChiselPropSpec {
@@ -20,7 +20,7 @@ class DecoderSpec extends ChiselPropSpec {
val (cnt, wrap) = Counter(Bool(true), pairs.size)
val dut = Module(new Decoder(bitpats))
dut.io.inst := Vec(insts.map(UInt(_)))(cnt)
- when(dut.io.match_idx != cnt) { io.done := Bool(true); io.error := cnt }
+ when(!dut.io.matched) { io.done := Bool(true); io.error := cnt }
when(wrap) { io.done := Bool(true) }
}