summaryrefslogtreecommitdiff
path: root/src/test/scala/ChiselTests/Outer.scala
diff options
context:
space:
mode:
authorJim Lawson2015-07-24 17:17:01 -0700
committerJim Lawson2015-07-24 17:17:01 -0700
commite73450165c59d68b524689a7169e03140a41a1c5 (patch)
treeb7236f80d9abf60775ecbcefe6f7ca25557dce73 /src/test/scala/ChiselTests/Outer.scala
parent94893bad972ded686a2c68dd334aa40b92e3b85d (diff)
parent3976145bb8c7595ad0f0a7fbb4ccbbd3030d8873 (diff)
Merge pull request #1 from ucb-bar/packagedir
Packagedir
Diffstat (limited to 'src/test/scala/ChiselTests/Outer.scala')
-rw-r--r--src/test/scala/ChiselTests/Outer.scala32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/scala/ChiselTests/Outer.scala b/src/test/scala/ChiselTests/Outer.scala
new file mode 100644
index 00000000..8e206f90
--- /dev/null
+++ b/src/test/scala/ChiselTests/Outer.scala
@@ -0,0 +1,32 @@
+package ChiselTests
+import Chisel._
+
+class Inner extends Module {
+ val io = new Bundle {
+ val in = Bits(INPUT, 8)
+ val out = Bits(OUTPUT, 8)
+ }
+ io.out := io.in +% Bits(1)
+}
+
+class Outer extends Module {
+ val io = new Bundle {
+ val in = Bits(INPUT, 8)
+ val out = Bits(OUTPUT, 8)
+ }
+ // val c = Module(new Inner)
+ val c = Array(Module(new Inner))
+ // val w = Wire(Bits(NO_DIR, 8))
+ // w := io.in
+ c(0).io.in := io.in
+ io.out := (c(0).io.out * Bits(2))(7,0)
+}
+
+class OuterTester(c: Outer) extends Tester(c) {
+ for (t <- 0 until 16) {
+ val test_in = rnd.nextInt(256)
+ poke(c.io.in, test_in)
+ step(1)
+ expect(c.io.out, ((test_in + 1) * 2)&255)
+ }
+}