summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3/core/Bits.scala
diff options
context:
space:
mode:
authorJim Lawson2016-07-25 16:36:06 -0700
committerJim Lawson2016-07-25 17:07:54 -0700
commite09a09e3f4e5d6d8650b1db4add96c0a5b09e8ca (patch)
tree50fdf82e8e9b60e729c3db86c6c00a98608f4de7 /chiselFrontend/src/main/scala/chisel3/core/Bits.scala
parent7aa05590382b0528799ad5e9f1318ce42e409793 (diff)
Enable current (chisel2-style) compatibility mode.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Bits.scala')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Bits.scala18
1 files changed, 14 insertions, 4 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala
index 6ec455ca..ecae7340 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala
@@ -521,10 +521,6 @@ private[core] sealed trait UIntFactory {
def width(width: Int): UInt = apply(Width(width))
/** Create a UInt port with specified width. */
def width(width: Width): UInt = new UInt(width)
- /** Create a UInt with a specified width - compatibility with Chisel2. */
- def apply(dummy: Option[Direction] = None, width: Int): UInt = apply(Width(width))
- /** Create a UInt literal with inferred width.- compatibility with Chisel2. */
- def apply(value: BigInt): UInt = apply(value, Width())
/** Create a UInt literal with fixed width. */
def apply(value: BigInt, width: Int): UInt = Lit(value, Width(width))
/** Create a UInt literal with inferred width. */
@@ -546,6 +542,20 @@ private[core] sealed trait UIntFactory {
result
}
+ /** Create a UInt with a specified width - compatibility with Chisel2. */
+ def apply(dummy: Option[Direction] = None, width: Int): UInt = apply(Width(width))
+ /** Create a UInt literal with inferred width.- compatibility with Chisel2. */
+ def apply(value: BigInt): UInt = apply(value, Width())
+ /** Create a UInt with a specified direction and width - compatibility with Chisel2. */
+ def apply(direction: Direction, width: Int): UInt = {
+ val result = apply(Width(width))
+ direction 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)
val radix = base match {