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/main/scala/Chisel/testers | |
| 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/main/scala/Chisel/testers')
| -rw-r--r-- | src/main/scala/Chisel/testers/BasicTester.scala | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main/scala/Chisel/testers/BasicTester.scala b/src/main/scala/Chisel/testers/BasicTester.scala index fecbe2a9..1079727c 100644 --- a/src/main/scala/Chisel/testers/BasicTester.scala +++ b/src/main/scala/Chisel/testers/BasicTester.scala @@ -8,18 +8,20 @@ import internal.Builder.pushCommand import firrtl._ class BasicTester extends Module { - val io = new Bundle { - val done = Bool() - val error = UInt(width = 4) - } - io.done := Bool(false) - io.error := UInt(0) + // The testbench has no IOs, rather it should communicate using printf, assert, and stop. + val io = new Bundle() def popCount(n: Long): Int = n.toBinaryString.count(_=='1') - /** Ends the test, reporting success. + /** Ends the test reporting success. + * + * Does not fire when in reset (defined as the encapsulating Module's + * reset). If your definition of reset is not the encapsulating Module's + * reset, you will need to gate this externally. */ def stop() { - pushCommand(Stop(Node(clock), 0)) + when (!reset) { + pushCommand(Stop(Node(clock), 0)) + } } } |
