From 920f6dc168d8e486733666368c7e363065b685ee Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Fri, 2 Sep 2016 12:53:08 -0700 Subject: Add direction-only (no width) UInt factory method. --- chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'chiselFrontend') diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index 8b3723f5..611a49be 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -558,6 +558,15 @@ private[core] sealed trait UIntFactory { case Direction.Unspecified => result } } + /** Create a UInt with a specified direction, but unspecified width - compatibility with Chisel2. */ + def apply(dir: Direction): UInt = { + val result = apply(Width()) + dir match { + case Direction.Input => Input(result) + case Direction.Output => Output(result) + case Direction.Unspecified => result + } + } private def parse(n: String) = { val (base, num) = n.splitAt(1) -- cgit v1.2.3