summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/Padding.scala
diff options
context:
space:
mode:
authorHenry Cook2015-11-06 13:23:24 -0800
committerHenry Cook2015-11-06 13:25:07 -0800
commit7fe61318433a8ecaac80ef2b547a88ab9dc04aec (patch)
tree466be7da48a2dfe57b37ada346ebaf01e82389f8 /src/test/scala/chiselTests/Padding.scala
parent89c5d10c81808406b6ae684e1e122d440466280c (diff)
added elaboration tests for remaining old Chisel3 examples
Diffstat (limited to 'src/test/scala/chiselTests/Padding.scala')
-rw-r--r--src/test/scala/chiselTests/Padding.scala41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/Padding.scala b/src/test/scala/chiselTests/Padding.scala
new file mode 100644
index 00000000..35a4c4a6
--- /dev/null
+++ b/src/test/scala/chiselTests/Padding.scala
@@ -0,0 +1,41 @@
+// See LICENSE for license details.
+
+package chiselTests
+import Chisel._
+
+class Padder extends Module {
+ val io = new Bundle {
+ val a = Bits(INPUT, 4)
+ val asp = SInt(OUTPUT, 8)
+ val aup = UInt(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)
+ }
+}
+*/
+
+class PadderSpec extends ChiselPropSpec {
+
+ property("Padder should elaborate") {
+ elaborate { new Padder }
+ }
+
+ ignore("PadderTester should return the correct result") { }
+}