summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests
diff options
context:
space:
mode:
authorJim Lawson2016-07-25 16:36:06 -0700
committerJim Lawson2016-07-25 17:07:54 -0700
commite09a09e3f4e5d6d8650b1db4add96c0a5b09e8ca (patch)
tree50fdf82e8e9b60e729c3db86c6c00a98608f4de7 /src/test/scala/chiselTests
parent7aa05590382b0528799ad5e9f1318ce42e409793 (diff)
Enable current (chisel2-style) compatibility mode.
Diffstat (limited to 'src/test/scala/chiselTests')
-rw-r--r--src/test/scala/chiselTests/IOCompatibility.scala45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/IOCompatibility.scala b/src/test/scala/chiselTests/IOCompatibility.scala
new file mode 100644
index 00000000..b904d77e
--- /dev/null
+++ b/src/test/scala/chiselTests/IOCompatibility.scala
@@ -0,0 +1,45 @@
+// See LICENSE for license details.
+
+package chiselTests
+
+import chisel3._
+
+class IOCSimpleIO extends Bundle {
+ val in = UInt(INPUT, 32)
+ val out = UInt(OUTPUT, 32)
+}
+
+class IOCPlusOne extends Module {
+ val io = new IOCSimpleIO
+ io.out := io.in + UInt(1)
+}
+
+class IOCModuleVec(val n: Int) extends Module {
+ val io = new Bundle {
+ val ins = Vec(n, UInt(INPUT, 32))
+ val outs = Vec(n, UInt(OUTPUT, 32))
+ }
+ val pluses = Vec.fill(n){ Module(new IOCPlusOne).io }
+ for (i <- 0 until n) {
+ pluses(i).in := io.ins(i)
+ io.outs(i) := pluses(i).out
+ }
+}
+
+class IOCModuleWire extends Module {
+ val io = new IOCSimpleIO
+ val inc = Wire(Module(new IOCPlusOne).io.chiselCloneType)
+ inc.in := io.in
+ io.out := inc.out
+}
+
+class IOCompatibilitySpec extends ChiselPropSpec {
+
+ property("IOCModuleVec should elaborate") {
+ elaborate { new IOCModuleVec(2) }
+ }
+
+ property("IOCModuleWire should elaborate") {
+ elaborate { new IOCModuleWire }
+ }
+}