From dbd072172f6312893e1922e48ed768ae0fab9a89 Mon Sep 17 00:00:00 2001 From: ducky Date: Fri, 11 Dec 2015 14:25:42 -0800 Subject: Refactor tests to use stop() and assert() instead of io.error/io.done Gate assert, printf, stop by reset Fix testbenches that never worked Change simulation prints to display cycle at which test was signaled to end, not when simulator stops Better documentation for Counter --- src/test/scala/chiselTests/Decoder.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/test/scala/chiselTests/Decoder.scala') diff --git a/src/test/scala/chiselTests/Decoder.scala b/src/test/scala/chiselTests/Decoder.scala index 7751804b..8a9c5a5b 100644 --- a/src/test/scala/chiselTests/Decoder.scala +++ b/src/test/scala/chiselTests/Decoder.scala @@ -20,8 +20,13 @@ class DecoderTester(pairs: List[(String, String)]) extends BasicTester { 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.matched) { io.done := Bool(true); io.error := cnt } - when(wrap) { io.done := Bool(true) } + when(!dut.io.matched) { + assert(cnt === UInt(0)) + stop() + } + when(wrap) { + stop() + } } class DecoderSpec extends ChiselPropSpec { -- cgit v1.2.3