summaryrefslogtreecommitdiff
path: root/src/test/scala/ChiselTests/ComplexAssign.scala
diff options
context:
space:
mode:
authorHenry Cook2015-08-12 19:32:43 -0700
committerHenry Cook2015-08-12 19:32:57 -0700
commit85d7403f9bf7bc2b3520f924736c237f21f70ebd (patch)
tree64560f779063a419395a2fb8a31ea52c52af4404 /src/test/scala/ChiselTests/ComplexAssign.scala
parent7e69966362b1dbd9835695250494857f3a3767c8 (diff)
being to convert tests to scala-test; tests compile and run
Diffstat (limited to 'src/test/scala/ChiselTests/ComplexAssign.scala')
-rw-r--r--src/test/scala/ChiselTests/ComplexAssign.scala40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/test/scala/ChiselTests/ComplexAssign.scala b/src/test/scala/ChiselTests/ComplexAssign.scala
deleted file mode 100644
index 88c79d56..00000000
--- a/src/test/scala/ChiselTests/ComplexAssign.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-package ChiselTests
-import Chisel._
-import Chisel.testers._
-
-class Complex[T <: Data](val re: T, val im: T) extends Bundle {
- override def cloneType: this.type =
- new Complex(re.cloneType, im.cloneType).asInstanceOf[this.type]
-}
-
-class ComplexAssign(W: Int) extends Module {
- val io = new Bundle {
- val e = new Bool(INPUT)
- val in = new Complex(Bits(width = W), Bits(width = W)).asInput
- val out = new Complex(Bits(width = W), Bits(width = W)).asOutput
- }
- when (io.e) {
- val w = Wire(new Complex(Bits(width = W), Bits(width = W)))
- w := io.in
- io.out.re := w.re
- io.out.im := w.im
- } .otherwise {
- io.out.re := Bits(0)
- io.out.im := Bits(0)
- }
-}
-
-class ComplexAssignTester(c: ComplexAssign) extends Tester(c) {
- for (t <- 0 until 4) {
- val test_e = rnd.nextInt(2)
- val test_in_re = rnd.nextInt(256)
- val test_in_im = rnd.nextInt(256)
-
- poke(c.io.e, test_e)
- poke(c.io.in.re, test_in_re)
- poke(c.io.in.im, test_in_im)
- step(1)
- expect(c.io.out.re, if (test_e == 1) test_in_re else 0)
- expect(c.io.out.im, if (test_e == 1) test_in_im else 0)
- }
-}