diff options
| author | Henry Cook | 2015-11-04 09:21:07 -0800 |
|---|---|---|
| committer | Henry Cook | 2015-11-04 09:21:07 -0800 |
| commit | a3c9680d1e2b84693759747a4779341ba80c4a50 (patch) | |
| tree | e97ab1d8394b0463ec7f600fce7ba278bd68d93a /src/test/scala/chiselTests/ComplexAssign.scala | |
| parent | 23d15d166d2ed32f8bd9a153a806c09982659011 (diff) | |
Remove Parameters library and refactor Driver.
In addition to removing all the extraneous Driver invocations that created various top-level Parameters instances,
this commit also lays the groundwork for stanza-firrtl/verilator based testing of Modules that extend BasicTester.
The execution-based tests have been updated accordingly. They will only succeed if firrtl and verilator binaries have been installed.
Further work is needed on individual tests to use assertions instead of .io.error.
Diffstat (limited to 'src/test/scala/chiselTests/ComplexAssign.scala')
| -rw-r--r-- | src/test/scala/chiselTests/ComplexAssign.scala | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/test/scala/chiselTests/ComplexAssign.scala b/src/test/scala/chiselTests/ComplexAssign.scala index 09743e04..64fc8bda 100644 --- a/src/test/scala/chiselTests/ComplexAssign.scala +++ b/src/test/scala/chiselTests/ComplexAssign.scala @@ -29,23 +29,23 @@ class ComplexAssign(w: Int) extends Module { } } +class ComplexAssignTester(enList: List[Boolean], re: Int, im: Int) extends BasicTester { + val (cnt, wrap) = Counter(Bool(true), enList.size) + val dut = Module(new ComplexAssign(32)) + dut.io.in.re := UInt(re) + dut.io.in.im := UInt(im) + dut.io.e := Vec(enList.map(Bool(_)))(cnt) + val re_correct = dut.io.out.re === Mux(dut.io.e, dut.io.in.re, UInt(0)) + val im_correct = dut.io.out.im === Mux(dut.io.e, dut.io.in.im, UInt(0)) + when(!re_correct || !im_correct) { + io.done := Bool(true); io.error := cnt + } .elsewhen(wrap) { io.done := Bool(true) } +} + class ComplexAssignSpec extends ChiselPropSpec { - class ComplexAssignTester(enList: List[Boolean], re: Int, im: Int) extends BasicTester { - val (cnt, wrap) = Counter(Bool(true), enList.size) - val dut = Module(new ComplexAssign(32)) - dut.io.in.re := UInt(re) - dut.io.in.im := UInt(im) - dut.io.e := Vec(enList.map(Bool(_)))(cnt) - val re_correct = dut.io.out.re === Mux(dut.io.e, dut.io.in.re, UInt(0)) - val im_correct = dut.io.out.im === Mux(dut.io.e, dut.io.in.im, UInt(0)) - when(!re_correct || !im_correct) { - io.done := Bool(true); io.error := cnt - } .elsewhen(wrap) { io.done := Bool(true) } - } - property("All complex assignments should return the correct result") { - forAll(enSequence(4), safeUInts, safeUInts) { (en: List[Boolean], re: Int, im: Int) => + forAll(enSequence(2), safeUInts, safeUInts) { (en: List[Boolean], re: Int, im: Int) => assert(execute{ new ComplexAssignTester(en, re, im) }) } } |
