Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Input() and Output() and test for same. #862

Merged
merged 1 commit into from
Jul 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/scala/chisel3/compatibility.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
14 changes: 14 additions & 0 deletions src/test/scala/chiselTests/CompatibilitySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

}