summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorducky2016-11-17 13:50:50 -0800
committerducky2016-11-21 13:32:47 -0800
commitebe7a0fb5774ec4bec919f9d3acd987d084d91b4 (patch)
tree08b892d84030edf9f3b21a17c9c3d5267fb2aeed /src/main
parenta2b97f8dc9c261ae4dc39ea4e11feed7723e22dd (diff)
better style
Diffstat (limited to 'src/main')
-rw-r--r--src/main/scala/chisel3/compatibility.scala10
-rw-r--r--src/main/scala/chisel3/util/ImplicitConversions.scala2
2 files changed, 7 insertions, 5 deletions
diff --git a/src/main/scala/chisel3/compatibility.scala b/src/main/scala/chisel3/compatibility.scala
index fbe37f50..ff627c1e 100644
--- a/src/main/scala/chisel3/compatibility.scala
+++ b/src/main/scala/chisel3/compatibility.scala
@@ -90,15 +90,15 @@ package object Chisel { // scalastyle:ignore package.object.name
def width(width: Width): SInt = apply(width)
/** Create an SInt literal with inferred width. */
- def apply(value: BigInt): SInt = value.S
+ def apply(value: BigInt): SInt = value.asSInt
/** Create an SInt literal with fixed width. */
- def apply(value: BigInt, width: Int): SInt = value.S(width.W)
+ def apply(value: BigInt, width: Int): SInt = value.asSInt(width.W)
/** Create an SInt literal with specified width. */
- def apply(value: BigInt, width: Width): SInt = value.S(width)
+ def apply(value: BigInt, width: Width): SInt = value.asSInt(width)
- def Lit(value: BigInt): SInt = value.S
- def Lit(value: BigInt, width: Int): SInt = value.S(width.W)
+ def Lit(value: BigInt): SInt = value.asSInt
+ def Lit(value: BigInt, width: Int): SInt = value.asSInt(width.W)
/** Create a SInt with a specified width - compatibility with Chisel2. */
def apply(dir: Option[Direction] = None, width: Int): SInt = apply(width.W)
diff --git a/src/main/scala/chisel3/util/ImplicitConversions.scala b/src/main/scala/chisel3/util/ImplicitConversions.scala
index 7f715ad4..c2ba710d 100644
--- a/src/main/scala/chisel3/util/ImplicitConversions.scala
+++ b/src/main/scala/chisel3/util/ImplicitConversions.scala
@@ -5,6 +5,8 @@ package chisel3.util
import chisel3._
object ImplicitConversions {
+ // The explicit fromIntToLiteral resolves an ambiguous conversion between fromIntToLiteral and
+ // UInt.asUInt.
implicit def intToUInt(x: Int): UInt = chisel3.core.fromIntToLiteral(x).asUInt
implicit def booleanToBool(x: Boolean): Bool = x.asBool
}