blob: 8f4d60f42bb19eb9ac2b50ac233e119e22d79558 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// See LICENSE for license details.
package Chisel.testers
import Chisel._
import internal._
import internal.Builder.pushCommand
import internal.firrtl._
class BasicTester extends Module {
// 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.
*
* 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() {
when (!reset) {
pushCommand(Stop(Node(clock), 0))
}
}
/** Called this class or a subclass's constructor has finished giving
* developers of chisel testers a post construction hook.
* For example, a decoupled tester subclassing BasicTester could override finish in order to
* add flow control logic around loading the device under test's input io from a Vec of values
*/
def finish(): Unit = {}
}
|