summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/ComplexAssign.scala
diff options
context:
space:
mode:
authorAditya Naik2023-11-23 03:11:56 -0800
committerAditya Naik2023-11-23 03:11:56 -0800
commitaf415532cf160e63e971ceb301833b8433c18a50 (patch)
tree1fef70139846f57298c8e24a590490a74249f7dd /src/test/scala/chiselTests/ComplexAssign.scala
parent8200c0cdf1d471453946d5ae24bc99757b2ef02d (diff)
cleanup
Diffstat (limited to 'src/test/scala/chiselTests/ComplexAssign.scala')
-rw-r--r--src/test/scala/chiselTests/ComplexAssign.scala52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/test/scala/chiselTests/ComplexAssign.scala b/src/test/scala/chiselTests/ComplexAssign.scala
deleted file mode 100644
index 99313967..00000000
--- a/src/test/scala/chiselTests/ComplexAssign.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-
-package chiselTests
-
-import chisel3._
-import chisel3.testers.BasicTester
-import chisel3.util._
-import org.scalacheck.Shrink
-
-class Complex[T <: Data](val re: T, val im: T) extends Bundle
-
-class ComplexAssign(w: Int) extends Module {
- val io = IO(new Bundle {
- val e = Input(Bool())
- val in = Input(new Complex(UInt(w.W), UInt(w.W)))
- val out = Output(new Complex(UInt(w.W), UInt(w.W)))
- })
- when(io.e) {
- val tmp = Wire(new Complex(UInt(w.W), UInt(w.W)))
- tmp := io.in
- io.out.re := tmp.re
- io.out.im := tmp.im
- }.otherwise {
- io.out.re := 0.U
- io.out.im := 0.U
- }
-}
-
-class ComplexAssignTester(enList: List[Boolean], re: Int, im: Int) extends BasicTester {
- val (cnt, wrap) = Counter(true.B, enList.size)
- val dut = Module(new ComplexAssign(32))
- dut.io.in.re := re.asUInt
- dut.io.in.im := im.asUInt
- dut.io.e := VecInit(enList.map(_.asBool))(cnt)
- val re_correct = dut.io.out.re === Mux(dut.io.e, dut.io.in.re, 0.U)
- val im_correct = dut.io.out.im === Mux(dut.io.e, dut.io.in.im, 0.U)
- assert(re_correct && im_correct)
- when(wrap) {
- stop()
- }
-}
-
-class ComplexAssignSpec extends ChiselPropSpec {
- property("All complex assignments should return the correct result") {
- // Disable shrinking on error.
- implicit val noShrinkListVal = Shrink[List[Boolean]](_ => Stream.empty)
- implicit val noShrinkInt = Shrink[Int](_ => Stream.empty)
- forAll(enSequence(2), safeUInts, safeUInts) { (en: List[Boolean], re: Int, im: Int) =>
- assertTesterPasses { new ComplexAssignTester(en, re, im) }
- }
- }
-}