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/Decoder.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/Decoder.scala')
| -rw-r--r-- | src/test/scala/chiselTests/Decoder.scala | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/test/scala/chiselTests/Decoder.scala b/src/test/scala/chiselTests/Decoder.scala index 9ac0a3b7..7751804b 100644 --- a/src/test/scala/chiselTests/Decoder.scala +++ b/src/test/scala/chiselTests/Decoder.scala @@ -15,16 +15,16 @@ class Decoder(bitpats: List[String]) extends Module { io.matched := Vec(bitpats.map(BitPat(_) === io.inst)).reduce(_||_) } -class DecoderSpec extends ChiselPropSpec { +class DecoderTester(pairs: List[(String, String)]) extends BasicTester { + val (insts, bitpats) = pairs.unzip + val (cnt, wrap) = Counter(Bool(true), pairs.size) + val dut = Module(new Decoder(bitpats)) + dut.io.inst := Vec(insts.map(UInt(_)))(cnt) + when(!dut.io.matched) { io.done := Bool(true); io.error := cnt } + when(wrap) { io.done := Bool(true) } +} - class DecoderTester(pairs: List[(String, String)]) extends BasicTester { - val (insts, bitpats) = pairs.unzip - val (cnt, wrap) = Counter(Bool(true), pairs.size) - val dut = Module(new Decoder(bitpats)) - dut.io.inst := Vec(insts.map(UInt(_)))(cnt) - when(!dut.io.matched) { io.done := Bool(true); io.error := cnt } - when(wrap) { io.done := Bool(true) } - } +class DecoderSpec extends ChiselPropSpec { // Use a single Int to make both a specific instruction and a BitPat that will match it val bitpatPair = for(seed <- Arbitrary.arbitrary[Int]) yield { @@ -36,7 +36,7 @@ class DecoderSpec extends ChiselPropSpec { private def nPairs(n: Int) = Gen.containerOfN[List, (String,String)](n,bitpatPair) property("BitPat wildcards should be usable in decoding") { - forAll(nPairs(16)){ (pairs: List[(String, String)]) => + forAll(nPairs(4)){ (pairs: List[(String, String)]) => assert(execute{ new DecoderTester(pairs) }) } } |
