summaryrefslogtreecommitdiff
path: root/src/test/scala/ChiselTests/Pads.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/Pads.scala
parent7e69966362b1dbd9835695250494857f3a3767c8 (diff)
being to convert tests to scala-test; tests compile and run
Diffstat (limited to 'src/test/scala/ChiselTests/Pads.scala')
-rw-r--r--src/test/scala/ChiselTests/Pads.scala29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/test/scala/ChiselTests/Pads.scala b/src/test/scala/ChiselTests/Pads.scala
deleted file mode 100644
index 325d3cc5..00000000
--- a/src/test/scala/ChiselTests/Pads.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-package ChiselTests
-import Chisel._
-import Chisel.testers._
-
-class Pads extends Module {
- val io = new Bundle {
- val a = Bits(INPUT, 4)
- val asp = Bits(OUTPUT, 8)
- val aup = Bits(OUTPUT, 8)
- }
- io.asp := io.a.toSInt
- io.aup := io.a.toUInt
-}
-
-class PadsTester(c: Pads) extends Tester(c) {
- def pads(x: BigInt, s: Int, w: Int) = {
- val sign = (x & (1 << (s-1)))
- val wmask = (1 << w) - 1
- val bmask = (1 << s) - 1
- if (sign == 0) x else ((~bmask | x) & wmask)
- }
- for (t <- 0 until 16) {
- val test_a = rnd.nextInt(1 << 4)
- poke(c.io.a, test_a)
- step(1)
- expect(c.io.asp, pads(test_a, 4, 8))
- expect(c.io.aup, test_a)
- }
-}