Skip to content

Commit b6cadaa

Browse files
committed
Add support for Input() and Output() (available in Chisel2 since ucb-bar/chisel2-deprecated#734) and test for same.
(cherry picked from commit 8f96e50)
1 parent 36d3893 commit b6cadaa

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/main/scala/chisel3/compatibility.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ package object Chisel { // scalastyle:ignore package.object.name
1919
case object OUTPUT extends Direction
2020
case object NODIR extends Direction
2121

22+
val Input = chisel3.core.Input
23+
val Output = chisel3.core.Output
24+
2225
object Flipped {
2326
def apply[T<:Data](target: T): T = chisel3.core.Flipped[T](target)
2427
}

src/test/scala/chiselTests/CompatibilitySpec.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,4 +304,18 @@ class CompatibiltySpec extends ChiselFlatSpec with GeneratorDrivenPropertyChecks
304304
}
305305
}
306306

307+
"Chisel3 IO constructs" should "be useable in Chisel2" in {
308+
import Chisel._
309+
elaborate(new Module {
310+
val io = IO(new Bundle {
311+
val in = Input(Bool())
312+
val foo = Output(Bool())
313+
val bar = Flipped(Bool())
314+
})
315+
Chisel.assert(io.in.dir == INPUT)
316+
Chisel.assert(io.foo.dir == OUTPUT)
317+
Chisel.assert(io.bar.dir == INPUT)
318+
})
319+
}
320+
307321
}

0 commit comments

Comments
 (0)