summaryrefslogtreecommitdiff
path: root/src/test/scala/ChiselTests/Mul.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/Mul.scala
parent7e69966362b1dbd9835695250494857f3a3767c8 (diff)
being to convert tests to scala-test; tests compile and run
Diffstat (limited to 'src/test/scala/ChiselTests/Mul.scala')
-rw-r--r--src/test/scala/ChiselTests/Mul.scala35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/test/scala/ChiselTests/Mul.scala b/src/test/scala/ChiselTests/Mul.scala
deleted file mode 100644
index fe61705e..00000000
--- a/src/test/scala/ChiselTests/Mul.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-package ChiselTests
-import Chisel._
-import Chisel.testers._
-import scala.collection.mutable.ArrayBuffer
-
-class Mul(val w: Int) extends Module {
- val io = new Bundle {
- val x = UInt(INPUT, w)
- val y = UInt(INPUT, w)
- val z = UInt(OUTPUT, 2 * w)
- }
- val muls = new ArrayBuffer[UInt]()
-
- val n = 1 << w
-
- for (i <- 0 until n)
- for (j <- 0 until n)
- muls += UInt(i * j, 2 * w)
- val tbl = Vec(muls)
- // val ad = (io.x << w) | io.y
- io.z := tbl(((io.x << w) | io.y).toUInt)
-}
-
-
-class MulTester(c: Mul) extends Tester(c) {
- val maxInt = 1 << c.w
- for (i <- 0 until 10) {
- val x = rnd.nextInt(maxInt)
- val y = rnd.nextInt(maxInt)
- poke(c.io.x, x)
- poke(c.io.y, y)
- step(1)
- expect(c.io.z, (x * y))
- }
-}