diff options
| author | Jim Lawson | 2016-09-02 14:47:29 -0700 |
|---|---|---|
| committer | Jim Lawson | 2016-09-02 14:47:29 -0700 |
| commit | 85a65019641130949fcc9082e42231a7c3618f0a (patch) | |
| tree | 913f85060bf72c3231747b78d10fce1c97255ed3 /chiselFrontend | |
| parent | fcdc5035675e9891d6c68c97d270a25fb60b3d64 (diff) | |
Add/cleanup UInt/SInt factory methods.
Diffstat (limited to 'chiselFrontend')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index 6fdec340..625f985d 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -538,12 +538,16 @@ private[core] sealed trait UIntFactory { } /** Create a UInt with a specified width - compatibility with Chisel2. */ + // NOTE: This resolves UInt(width = 32) def apply(dir: 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(dir: Direction, width: Int): UInt = { - val result = apply(Width(width)) + def apply(dir: Direction, width: Int): UInt = apply(dir, Width(width)) + /** Create a UInt with a specified direction, but unspecified width - compatibility with Chisel2. */ + def apply(dir: Direction): UInt = apply(dir, Width()) + def apply(dir: Direction, wWidth: Width): UInt = { + val result = apply(wWidth) dir match { case Direction.Input => Input(result) case Direction.Output => Output(result) @@ -707,8 +711,11 @@ object SInt { /** Create a SInt with a specified width - compatibility with Chisel2. */ def apply(dir: Option[Direction] = None, width: Int): SInt = apply(Width(width)) /** Create a SInt with a specified direction and width - compatibility with Chisel2. */ - def apply(dir: Direction, width: Int): SInt = { - val result = apply(Width(width)) + def apply(dir: Direction, width: Int): SInt = apply(dir, Width(width)) + /** Create a SInt with a specified direction, but unspecified width - compatibility with Chisel2. */ + def apply(dir: Direction): SInt = apply(dir, Width()) + def apply(dir: Direction, wWidth: Width): SInt = { + val result = apply(wWidth) dir match { case Direction.Input => Input(result) case Direction.Output => Output(result) |
