diff options
| author | chick | 2016-02-09 11:24:08 -0800 |
|---|---|---|
| committer | chick | 2016-02-09 11:24:08 -0800 |
| commit | d1611f81badf54aaf460ba37f01dc98c4005d82a (patch) | |
| tree | 19249e3bb9f006b5bb334fff3b8a3fd90e72fe83 /src/test/scala/chiselTests | |
| parent | c2db03d0a752e084c1ca452ee477c88d930d0bc6 (diff) | |
Added support for finish method of BasicTester to be overridden in a subclass which allows tester to have clean up and other construction code executed after a user code executed during constructor of that subclass
Diffstat (limited to 'src/test/scala/chiselTests')
| -rw-r--r-- | src/test/scala/chiselTests/DeqIOSpec.scala | 54 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/TesterDriverSpec.scala | 10 |
2 files changed, 25 insertions, 39 deletions
diff --git a/src/test/scala/chiselTests/DeqIOSpec.scala b/src/test/scala/chiselTests/DeqIOSpec.scala index 8f7937ab..dfa63eb1 100644 --- a/src/test/scala/chiselTests/DeqIOSpec.scala +++ b/src/test/scala/chiselTests/DeqIOSpec.scala @@ -8,52 +8,28 @@ import Chisel.testers.BasicTester /** * Created by chick on 2/8/16. */ -class UsesDeqIOInfo extends Bundle { - val test_width = 32 +class FinishTester extends BasicTester { + var finish_was_run = false - val info_data = UInt(width = test_width) + override def finish(): Unit = { + finish_was_run = true + } } -class UsesDeqIO extends Module { - val io = new Bundle { - val in = new DeqIO(new UsesDeqIOInfo) - val out = new EnqIO(new UsesDeqIOInfo) +class FinishTesterSpec extends ChiselFlatSpec { + class DummyCircuit extends Module { + val io = new Bundle { + val in = Bool(INPUT) + val out = Bool(OUTPUT) + } } -} -class DeqIOSpec extends ChiselFlatSpec { runTester { - new BasicTester { - val dut = new UsesDeqIO - - "DeqIO" should "set the direction of it's parameter to INPUT" in { - assert(dut.io.in.bits.info_data.dir === INPUT) - } - "DeqIO" should "create a valid input and ready output" in { - assert(dut.io.in.valid.dir === INPUT) - assert(dut.io.in.ready.dir === OUTPUT) - } - "EnqIO" should "set the direction of it's parameter OUTPUT" in { - assert(dut.io.out.bits.info_data.dir === OUTPUT) - } - "EnqIO" should "create a valid input and ready output" in { - assert(dut.io.out.valid.dir === OUTPUT) - assert(dut.io.out.ready.dir === INPUT) - } - - val in_clone = dut.io.in.cloneType - val out_clone = dut.io.out.cloneType - - "A deqIO device" should "clone itself with it's directions intact" in { - assert(dut.io.in.bits.info_data.dir == in_clone.bits.info_data.dir) - assert(dut.io.in.ready.dir == in_clone.ready.dir) - assert(dut.io.in.valid.dir == in_clone.valid.dir) - } + new FinishTester { + val dut = new DummyCircuit - "A enqIO device" should "clone itself with it's directions intact" in { - assert(dut.io.out.bits.info_data.dir == out_clone.bits.info_data.dir) - assert(dut.io.out.ready.dir == out_clone.ready.dir) - assert(dut.io.out.valid.dir == out_clone.valid.dir) + "Extending BasicTester" should "allow developer to have finish method run automatically" in { + assert(finish_was_run) } } } diff --git a/src/test/scala/chiselTests/TesterDriverSpec.scala b/src/test/scala/chiselTests/TesterDriverSpec.scala new file mode 100644 index 00000000..ea1692f9 --- /dev/null +++ b/src/test/scala/chiselTests/TesterDriverSpec.scala @@ -0,0 +1,10 @@ +// See LICENSE for license details. + +package chiselTests + +/** + * Created by chick on 2/9/16. + */ +class TesterDriverSpec { + +} |
