summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3/core
diff options
context:
space:
mode:
authorJim Lawson2016-07-25 14:06:51 -0700
committerJim Lawson2016-07-25 17:07:33 -0700
commit7aa05590382b0528799ad5e9f1318ce42e409793 (patch)
tree9af7c7513f60efa30c59172a234a8f2926b5430f /chiselFrontend/src/main/scala/chisel3/core
parent3624751e2e63ba9f107c795529edfe48cf8340b2 (diff)
Minimize differences with master.
Remove .Lit(x) usage. Undo "private" scope change. Change "firing" back to "fire". Add package level NODIR definition.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala2
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Bits.scala18
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Mem.scala6
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala4
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/When.scala4
5 files changed, 18 insertions, 16 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala
index 7707d906..459a3b67 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala
@@ -239,7 +239,7 @@ trait VecLike[T <: Data] extends collection.IndexedSeq[T] with HasId {
/** Helper function that appends an index (literal value) to each element,
* useful for hardware generators which output an index.
*/
- private def indexWhereHelper(p: T => Bool) = this map p zip (0 until length).map(i => UInt.Lit(i))
+ private def indexWhereHelper(p: T => Bool) = this map p zip (0 until length).map(i => UInt(i))
/** Outputs the index of the first element for which p outputs true.
*/
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala
index 20ac0e4a..6ec455ca 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala
@@ -404,8 +404,8 @@ sealed class UInt private[core] (width: Width, lit: Option[ULit] = None)
final def unary_- (): UInt = macro SourceInfoTransform.noArg
final def unary_-% (): UInt = macro SourceInfoTransform.noArg
- def do_unary_- (implicit sourceInfo: SourceInfo) : UInt = UInt.Lit(0) - this
- def do_unary_-% (implicit sourceInfo: SourceInfo): UInt = UInt.Lit(0) -% this
+ def do_unary_- (implicit sourceInfo: SourceInfo) : UInt = UInt(0) - this
+ def do_unary_-% (implicit sourceInfo: SourceInfo): UInt = UInt(0) -% this
override def do_+ (that: UInt)(implicit sourceInfo: SourceInfo): UInt = this +% that
override def do_- (that: UInt)(implicit sourceInfo: SourceInfo): UInt = this -% that
@@ -453,8 +453,8 @@ sealed class UInt private[core] (width: Width, lit: Option[ULit] = None)
final def andR(): Bool = macro SourceInfoTransform.noArg
final def xorR(): Bool = macro SourceInfoTransform.noArg
- def do_orR(implicit sourceInfo: SourceInfo): Bool = this != UInt.Lit(0)
- def do_andR(implicit sourceInfo: SourceInfo): Bool = ~this === UInt.Lit(0)
+ def do_orR(implicit sourceInfo: SourceInfo): Bool = this != UInt(0)
+ def do_andR(implicit sourceInfo: SourceInfo): Bool = ~this === UInt(0)
def do_xorR(implicit sourceInfo: SourceInfo): Bool = redop(sourceInfo, XorReduceOp)
override def do_< (that: UInt)(implicit sourceInfo: SourceInfo): Bool = compop(sourceInfo, LessOp, that)
@@ -523,6 +523,8 @@ private[core] sealed trait UIntFactory {
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. */
@@ -581,8 +583,8 @@ sealed class SInt private (width: Width, lit: Option[SLit] = None)
final def unary_- (): SInt = macro SourceInfoTransform.noArg
final def unary_-% (): SInt = macro SourceInfoTransform.noArg
- def unary_- (implicit sourceInfo: SourceInfo): SInt = SInt.Lit(0) - this
- def unary_-% (implicit sourceInfo: SourceInfo): SInt = SInt.Lit(0) -% this
+ def unary_- (implicit sourceInfo: SourceInfo): SInt = SInt(0) - this
+ def unary_-% (implicit sourceInfo: SourceInfo): SInt = SInt(0) -% this
/** add (default - no growth) operator */
override def do_+ (that: SInt)(implicit sourceInfo: SourceInfo): SInt =
@@ -649,7 +651,7 @@ sealed class SInt private (width: Width, lit: Option[SLit] = None)
final def abs(): UInt = macro SourceInfoTransform.noArg
- def do_abs(implicit sourceInfo: SourceInfo): UInt = Mux(this < SInt.Lit(0), (-this).asUInt, this.asUInt)
+ def do_abs(implicit sourceInfo: SourceInfo): UInt = Mux(this < SInt(0), (-this).asUInt, this.asUInt)
override def do_<< (that: Int)(implicit sourceInfo: SourceInfo): SInt =
binop(sourceInfo, SInt(this.width + that), ShiftLeftOp, that)
@@ -769,7 +771,7 @@ object Mux {
* @param alt the value chosen when `cond` is false
* @example
* {{{
- * val muxOut = Mux(data_in === UInt.Lit(3), UInt(3, 4), UInt(0, 4))
+ * val muxOut = Mux(data_in === UInt(3), UInt(3, 4), UInt(0, 4))
* }}}
*/
def apply[T <: Data](cond: Bool, con: T, alt: T): T = macro MuxTransform.apply[T]
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Mem.scala b/chiselFrontend/src/main/scala/chisel3/core/Mem.scala
index fd0897a2..931a0489 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Mem.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Mem.scala
@@ -36,7 +36,7 @@ sealed abstract class MemBase[T <: Data](t: T, val length: Int) extends HasId wi
/** Creates a read accessor into the memory with static addressing. See the
* class documentation of the memory for more detailed information.
*/
- def apply(idx: Int): T = apply(UInt.Lit(idx))
+ def apply(idx: Int): T = apply(UInt(idx))
/** Creates a read/write accessor into the memory with dynamic addressing.
* See the class documentation of the memory for more detailed information.
@@ -103,7 +103,7 @@ sealed abstract class MemBase[T <: Data](t: T, val length: Int) extends HasId wi
* @note when multiple conflicting writes are performed on a Mem element, the
* result is undefined (unlike Vec, where the last assignment wins)
*/
-sealed class Mem[T <: Data] private (t: T, length: Int) extends MemBase(t, length)
+sealed class Mem[T <: Data](t: T, length: Int) extends MemBase(t, length)
object SeqMem {
@deprecated("SeqMem argument order should be size, t; this will be removed by the official release", "chisel3")
@@ -137,7 +137,7 @@ object SeqMem {
* @note when multiple conflicting writes are performed on a Mem element, the
* result is undefined (unlike Vec, where the last assignment wins)
*/
-sealed class SeqMem[T <: Data] private (t: T, n: Int) extends MemBase[T](t, n) {
+sealed class SeqMem[T <: Data](t: T, n: Int) extends MemBase[T](t, n) {
def read(addr: UInt, enable: Bool): T = {
implicit val sourceInfo = UnlocatableSourceInfo
val a = Wire(UInt())
diff --git a/chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala b/chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala
index f4eec422..0872ec41 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala
@@ -24,7 +24,7 @@ private[chisel3] object SeqUtils {
def count(in: Seq[Bool]): UInt = macro SourceInfoTransform.inArg
def do_count(in: Seq[Bool])(implicit sourceInfo: SourceInfo): UInt = in.size match {
- case 0 => UInt.Lit(0)
+ case 0 => UInt(0)
case 1 => in.head
case n => count(in take n/2) +& count(in drop n/2)
}
@@ -47,7 +47,7 @@ private[chisel3] object SeqUtils {
if (in.tail.isEmpty) {
in.head._2
} else {
- val masked = for ((s, i) <- in) yield Mux(s, i.toBits, Bits.Lit(0))
+ val masked = for ((s, i) <- in) yield Mux(s, i.toBits, Bits(0))
val width = in.map(_._2.width).reduce(_ max _)
in.head._2.cloneTypeWidth(width).fromBits(masked.reduceLeft(_|_))
}
diff --git a/chiselFrontend/src/main/scala/chisel3/core/When.scala b/chiselFrontend/src/main/scala/chisel3/core/When.scala
index 7049eb82..196e7903 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/When.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/When.scala
@@ -18,9 +18,9 @@ object when { // scalastyle:ignore object.name
*
* @example
* {{{
- * when ( myData === UInt.Lit(3) ) {
+ * when ( myData === UInt(3) ) {
* // Some logic to run when myData equals 3.
- * } .elsewhen ( myData === UInt.Lit(1) ) {
+ * } .elsewhen ( myData === UInt(1) ) {
* // Some logic to run when myData equals 1.
* } .otherwise {
* // Some logic to run when myData is neither 3 nor 1.