diff options
| author | chick | 2016-02-09 11:32:19 -0800 |
|---|---|---|
| committer | chick | 2016-02-09 11:32:19 -0800 |
| commit | 29dc51f8a1e1ebb3072fd6e7bd5fba7c331d029b (patch) | |
| tree | 1b45f55f2bdbf0ca0835528a2ee839f2a7934eea /src | |
| parent | d1611f81badf54aaf460ba37f01dc98c4005d82a (diff) | |
fixed test for finish method being put in the wrong place
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/chiselTests/DeqIOSpec.scala | 54 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/TesterDriverSpec.scala | 32 |
2 files changed, 70 insertions, 16 deletions
diff --git a/src/test/scala/chiselTests/DeqIOSpec.scala b/src/test/scala/chiselTests/DeqIOSpec.scala index dfa63eb1..8f7937ab 100644 --- a/src/test/scala/chiselTests/DeqIOSpec.scala +++ b/src/test/scala/chiselTests/DeqIOSpec.scala @@ -8,28 +8,52 @@ import Chisel.testers.BasicTester /** * Created by chick on 2/8/16. */ -class FinishTester extends BasicTester { - var finish_was_run = false +class UsesDeqIOInfo extends Bundle { + val test_width = 32 - override def finish(): Unit = { - finish_was_run = true - } + val info_data = UInt(width = test_width) } -class FinishTesterSpec extends ChiselFlatSpec { - class DummyCircuit extends Module { - val io = new Bundle { - val in = Bool(INPUT) - val out = Bool(OUTPUT) - } +class UsesDeqIO extends Module { + val io = new Bundle { + val in = new DeqIO(new UsesDeqIOInfo) + val out = new EnqIO(new UsesDeqIOInfo) } +} +class DeqIOSpec extends ChiselFlatSpec { runTester { - new FinishTester { - val dut = new DummyCircuit + 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) + } - "Extending BasicTester" should "allow developer to have finish method run automatically" in { - assert(finish_was_run) + "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) } } } diff --git a/src/test/scala/chiselTests/TesterDriverSpec.scala b/src/test/scala/chiselTests/TesterDriverSpec.scala index ea1692f9..6271d382 100644 --- a/src/test/scala/chiselTests/TesterDriverSpec.scala +++ b/src/test/scala/chiselTests/TesterDriverSpec.scala @@ -5,6 +5,36 @@ package chiselTests /** * Created by chick on 2/9/16. */ -class TesterDriverSpec { +import Chisel._ +import Chisel.testers.BasicTester +/** + * Created by chick on 2/8/16. + */ +class FinishTester extends BasicTester { + var finish_was_run = false + + override def finish(): Unit = { + finish_was_run = true + } +} + +class TesterDriverSpec extends ChiselFlatSpec { + class DummyCircuit extends Module { + val io = new Bundle { + val in = Bool(INPUT) + val out = Bool(OUTPUT) + } + } + + runTester { + new FinishTester { + val dut = new DummyCircuit + + "Extending BasicTester" should "allow developer to have finish method run automatically" in { + assert(finish_was_run) + } + } + } } + |
