From 8f96e509215e092799cddd992dc2e42bedd4e2ad Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Thu, 19 Jul 2018 10:23:03 -0700 Subject: Add support for Input() and Output() (available in Chisel2 since ucb-bar/chisel2-deprecated#734) and test for same. --- src/main/scala/chisel3/compatibility.scala | 3 +++ src/test/scala/chiselTests/CompatibilitySpec.scala | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/main/scala/chisel3/compatibility.scala b/src/main/scala/chisel3/compatibility.scala index a1af6236..7eebcee0 100644 --- a/src/main/scala/chisel3/compatibility.scala +++ b/src/main/scala/chisel3/compatibility.scala @@ -19,6 +19,9 @@ package object Chisel { // scalastyle:ignore package.object.name case object OUTPUT extends Direction case object NODIR extends Direction + val Input = chisel3.core.Input + val Output = chisel3.core.Output + object Flipped { def apply[T<:Data](target: T): T = chisel3.core.Flipped[T](target) } diff --git a/src/test/scala/chiselTests/CompatibilitySpec.scala b/src/test/scala/chiselTests/CompatibilitySpec.scala index eb38cab1..339f2af1 100644 --- a/src/test/scala/chiselTests/CompatibilitySpec.scala +++ b/src/test/scala/chiselTests/CompatibilitySpec.scala @@ -322,4 +322,18 @@ class CompatibiltySpec extends ChiselFlatSpec with GeneratorDrivenPropertyChecks }) } + "Chisel3 IO constructs" should "be useable in Chisel2" in { + import Chisel._ + elaborate(new Module { + val io = IO(new Bundle { + val in = Input(Bool()) + val foo = Output(Bool()) + val bar = Flipped(Bool()) + }) + Chisel.assert(io.in.dir == INPUT) + Chisel.assert(io.foo.dir == OUTPUT) + Chisel.assert(io.bar.dir == INPUT) + }) + } + } -- cgit v1.2.3