summaryrefslogtreecommitdiff
path: root/src/test/scala/ChiselTests/Outer.scala
diff options
context:
space:
mode:
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)
+ }
+}