summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/Aggregate.scala (renamed from chiselFrontend/src/main/scala/Chisel/Aggregate.scala)28
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/Assert.scala (renamed from chiselFrontend/src/main/scala/Chisel/Assert.scala)10
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/Bits.scala (renamed from chiselFrontend/src/main/scala/Chisel/Bits.scala)46
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/BlackBox.scala (renamed from chiselFrontend/src/main/scala/Chisel/BlackBox.scala)14
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/Data.scala (renamed from chiselFrontend/src/main/scala/Chisel/Data.scala)41
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/Mem.scala (renamed from chiselFrontend/src/main/scala/Chisel/Mem.scala)10
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/Module.scala (renamed from chiselFrontend/src/main/scala/Chisel/Module.scala)28
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/Printf.scala (renamed from chiselFrontend/src/main/scala/Chisel/Printf.scala)12
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/Reg.scala (renamed from chiselFrontend/src/main/scala/Chisel/Reg.scala)12
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/SeqUtils.scala (renamed from chiselFrontend/src/main/scala/Chisel/SeqUtils.scala)6
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/When.scala (renamed from chiselFrontend/src/main/scala/Chisel/When.scala)10
-rw-r--r--chiselFrontend/src/main/scala/chisel/internal/Builder.scala (renamed from chiselFrontend/src/main/scala/Chisel/internal/Builder.scala)37
-rw-r--r--chiselFrontend/src/main/scala/chisel/internal/Error.scala (renamed from chiselFrontend/src/main/scala/Chisel/internal/Error.scala)8
-rw-r--r--chiselFrontend/src/main/scala/chisel/internal/SourceInfo.scala (renamed from chiselFrontend/src/main/scala/Chisel/internal/SourceInfo.scala)4
-rw-r--r--chiselFrontend/src/main/scala/chisel/internal/firrtl/IR.scala (renamed from chiselFrontend/src/main/scala/Chisel/internal/firrtl/IR.scala)14
-rw-r--r--coreMacros/src/main/scala/chisel/internal/sourceinfo/SourceInfoTransform.scala (renamed from coreMacros/src/main/scala/Chisel/internal/sourceinfo/SourceInfoTransform.scala)4
-rw-r--r--src/main/scala/Chisel/package.scala31
-rw-r--r--src/main/scala/chisel/Driver.scala (renamed from src/main/scala/Chisel/Driver.scala)2
-rw-r--r--src/main/scala/chisel/compatibility.scala150
-rw-r--r--src/main/scala/chisel/compatibility/FileSystemUtilities.scala (renamed from src/main/scala/Chisel/FileSystemUtilities.scala)4
-rw-r--r--src/main/scala/chisel/compatibility/Main.scala (renamed from src/main/scala/Chisel/Main.scala)4
-rw-r--r--src/main/scala/chisel/compatibility/debug.scala8
-rw-r--r--src/main/scala/chisel/compatibility/throwException.scala (renamed from src/main/scala/Chisel/throwException.scala)4
-rw-r--r--src/main/scala/chisel/internal/firrtl/Emitter.scala (renamed from src/main/scala/Chisel/internal/firrtl/Emitter.scala)8
-rw-r--r--src/main/scala/chisel/package.scala82
-rw-r--r--src/main/scala/chisel/testers/BasicTester.scala (renamed from src/main/scala/Chisel/testers/BasicTester.scala)4
-rw-r--r--src/main/scala/chisel/testers/TesterDriver.scala (renamed from src/main/scala/Chisel/testers/TesterDriver.scala)5
-rw-r--r--src/main/scala/chisel/util/Arbiter.scala (renamed from src/main/scala/Chisel/util/Arbiter.scala)4
-rw-r--r--src/main/scala/chisel/util/BitPat.scala (renamed from src/main/scala/Chisel/BitPat.scala)5
-rw-r--r--src/main/scala/chisel/util/Bitwise.scala (renamed from src/main/scala/Chisel/util/Bitwise.scala)5
-rw-r--r--src/main/scala/chisel/util/Cat.scala (renamed from src/main/scala/Chisel/util/Cat.scala)5
-rw-r--r--src/main/scala/chisel/util/CircuitMath.scala (renamed from src/main/scala/Chisel/util/CircuitMath.scala)4
-rw-r--r--src/main/scala/chisel/util/Conditional.scala (renamed from src/main/scala/Chisel/util/Conditional.scala)8
-rw-r--r--src/main/scala/chisel/util/Counter.scala (renamed from src/main/scala/Chisel/util/Counter.scala)4
-rw-r--r--src/main/scala/chisel/util/Decoupled.scala (renamed from src/main/scala/Chisel/util/Decoupled.scala)6
-rw-r--r--src/main/scala/chisel/util/Enum.scala (renamed from src/main/scala/Chisel/util/Enum.scala)4
-rw-r--r--src/main/scala/chisel/util/ImplicitConversions.scala (renamed from src/main/scala/Chisel/ImplicitConversions.scala)4
-rw-r--r--src/main/scala/chisel/util/LFSR.scala (renamed from src/main/scala/Chisel/util/LFSR.scala)4
-rw-r--r--src/main/scala/chisel/util/Lookup.scala (renamed from src/main/scala/Chisel/util/Lookup.scala)4
-rw-r--r--src/main/scala/chisel/util/Math.scala (renamed from src/main/scala/Chisel/util/Math.scala)4
-rw-r--r--src/main/scala/chisel/util/Mux.scala (renamed from src/main/scala/Chisel/util/Mux.scala)5
-rw-r--r--src/main/scala/chisel/util/OneHot.scala (renamed from src/main/scala/Chisel/util/OneHot.scala)4
-rw-r--r--src/main/scala/chisel/util/Reg.scala (renamed from src/main/scala/Chisel/util/Reg.scala)4
-rw-r--r--src/main/scala/chisel/util/TransitName.scala (renamed from src/main/scala/Chisel/util/TransitName.scala)3
-rw-r--r--src/main/scala/chisel/util/Valid.scala (renamed from src/main/scala/Chisel/util/Valid.scala)4
-rw-r--r--src/test/scala/chiselTests/Assert.scala5
-rw-r--r--src/test/scala/chiselTests/BitwiseOps.scala4
-rw-r--r--src/test/scala/chiselTests/BlackBox.scala6
-rw-r--r--src/test/scala/chiselTests/BundleWire.scala4
-rw-r--r--src/test/scala/chiselTests/ChiselSpec.scala4
-rw-r--r--src/test/scala/chiselTests/ComplexAssign.scala6
-rw-r--r--src/test/scala/chiselTests/Counter.scala7
-rw-r--r--src/test/scala/chiselTests/Decoder.scala7
-rw-r--r--src/test/scala/chiselTests/DeqIOSpec.scala5
-rw-r--r--src/test/scala/chiselTests/Direction.scala4
-rw-r--r--src/test/scala/chiselTests/EnableShiftRegister.scala4
-rw-r--r--src/test/scala/chiselTests/GCD.scala4
-rw-r--r--src/test/scala/chiselTests/Harness.scala5
-rw-r--r--src/test/scala/chiselTests/LFSR16.scala6
-rw-r--r--src/test/scala/chiselTests/MemorySearch.scala5
-rw-r--r--src/test/scala/chiselTests/Module.scala3
-rw-r--r--src/test/scala/chiselTests/MulLookup.scala4
-rw-r--r--src/test/scala/chiselTests/MultiAssign.scala6
-rw-r--r--src/test/scala/chiselTests/OptionBundle.scala4
-rw-r--r--src/test/scala/chiselTests/Padding.scala3
-rw-r--r--src/test/scala/chiselTests/ParameterizedModule.scala4
-rw-r--r--src/test/scala/chiselTests/Printf.scala4
-rw-r--r--src/test/scala/chiselTests/Reg.scala4
-rw-r--r--src/test/scala/chiselTests/Risc.scala4
-rw-r--r--src/test/scala/chiselTests/SIntOps.scala5
-rw-r--r--src/test/scala/chiselTests/Stack.scala5
-rw-r--r--src/test/scala/chiselTests/Stop.scala4
-rw-r--r--src/test/scala/chiselTests/Tbl.scala6
-rw-r--r--src/test/scala/chiselTests/TesterDriverSpec.scala5
-rw-r--r--src/test/scala/chiselTests/UIntOps.scala5
-rw-r--r--src/test/scala/chiselTests/Vec.scala6
-rw-r--r--src/test/scala/chiselTests/VectorPacketIO.scala5
-rw-r--r--src/test/scala/chiselTests/VendingMachine.scala4
-rw-r--r--src/test/scala/chiselTests/When.scala6
79 files changed, 560 insertions, 270 deletions
diff --git a/chiselFrontend/src/main/scala/Chisel/Aggregate.scala b/chiselFrontend/src/main/scala/chisel/core/Aggregate.scala
index 1eef5d69..38a42fea 100644
--- a/chiselFrontend/src/main/scala/Chisel/Aggregate.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/Aggregate.scala
@@ -1,21 +1,21 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
import scala.collection.immutable.ListMap
import scala.collection.mutable.{ArrayBuffer, HashSet, LinkedHashMap}
import scala.language.experimental.macros
-import internal._
-import internal.Builder.pushCommand
-import internal.firrtl._
-import internal.sourceinfo.{SourceInfo, DeprecatedSourceInfo, VecTransform, SourceInfoTransform}
+import chisel.internal._
+import chisel.internal.Builder.pushCommand
+import chisel.internal.firrtl._
+import chisel.internal.sourceinfo.{SourceInfo, DeprecatedSourceInfo, VecTransform, SourceInfoTransform}
/** An abstract class for data types that solely consist of (are an aggregate
* of) other Data objects.
*/
sealed abstract class Aggregate(dirArg: Direction) extends Data(dirArg) {
- private[Chisel] def cloneTypeWidth(width: Width): this.type = cloneType
+ private[core] def cloneTypeWidth(width: Width): this.type = cloneType
def width: Width = flatten.map(_.width).reduce(_ + _)
}
@@ -163,8 +163,8 @@ sealed class Vec[T <: Data] private (gen: => T, val length: Int)
Vec(length, gen).asInstanceOf[this.type]
private val t = gen
- private[Chisel] def toType: String = s"${t.toType}[$length]"
- private[Chisel] lazy val flatten: IndexedSeq[Bits] =
+ private[chisel] def toType: String = s"${t.toType}[$length]"
+ private[chisel] lazy val flatten: IndexedSeq[Bits] =
(0 until length).flatMap(i => this.apply(i).flatten)
for ((elt, i) <- self zipWithIndex)
@@ -315,7 +315,7 @@ class Bundle extends Aggregate(NO_DIR) {
/** Returns a list of elements in this Bundle.
*/
- private[Chisel] lazy val namedElts = {
+ private[core] lazy val namedElts = {
val nameMap = LinkedHashMap[String, Data]()
val seen = HashSet[Data]()
for (m <- getClass.getMethods.sortWith(_.getName < _.getName)) {
@@ -331,17 +331,17 @@ class Bundle extends Aggregate(NO_DIR) {
}
ArrayBuffer(nameMap.toSeq:_*) sortWith {case ((an, a), (bn, b)) => (a._id > b._id) || ((a eq b) && (an > bn))}
}
- private[Chisel] def toType = {
+ private[chisel] def toType = {
def eltPort(elt: Data): String = {
val flipStr = if (elt.isFlip) "flip " else ""
s"${flipStr}${elt.getRef.name} : ${elt.toType}"
}
s"{${namedElts.reverse.map(e => eltPort(e._2)).mkString(", ")}}"
}
- private[Chisel] lazy val flatten = namedElts.flatMap(_._2.flatten)
- private[Chisel] def addElt(name: String, elt: Data): Unit =
+ private[chisel] lazy val flatten = namedElts.flatMap(_._2.flatten)
+ private[core] def addElt(name: String, elt: Data): Unit =
namedElts += name -> elt
- private[Chisel] override def _onModuleClose: Unit = // scalastyle:ignore method.name
+ private[chisel] override def _onModuleClose: Unit = // scalastyle:ignore method.name
for ((name, elt) <- namedElts) { elt.setRef(this, _namespace.name(name)) }
override def cloneType : this.type = {
@@ -372,6 +372,6 @@ class Bundle extends Aggregate(NO_DIR) {
}
}
-private[Chisel] object Bundle {
+private[core] object Bundle {
val keywords = List("flip", "asInput", "asOutput", "cloneType", "toBits")
}
diff --git a/chiselFrontend/src/main/scala/Chisel/Assert.scala b/chiselFrontend/src/main/scala/chisel/core/Assert.scala
index c086f014..00cb00f4 100644
--- a/chiselFrontend/src/main/scala/Chisel/Assert.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/Assert.scala
@@ -1,14 +1,14 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
import scala.reflect.macros.blackbox.Context
import scala.language.experimental.macros
-import internal._
-import internal.Builder.pushCommand
-import internal.firrtl._
-import internal.sourceinfo.SourceInfo
+import chisel.internal._
+import chisel.internal.Builder.pushCommand
+import chisel.internal.firrtl._
+import chisel.internal.sourceinfo.SourceInfo
object assert { // scalastyle:ignore object.name
/** Checks for a condition to be valid in the circuit at all times. If the
diff --git a/chiselFrontend/src/main/scala/Chisel/Bits.scala b/chiselFrontend/src/main/scala/chisel/core/Bits.scala
index bc8cc8e2..38e71f8d 100644
--- a/chiselFrontend/src/main/scala/Chisel/Bits.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/Bits.scala
@@ -1,15 +1,15 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
import scala.language.experimental.macros
-import internal._
-import internal.Builder.pushOp
-import internal.firrtl._
-import internal.sourceinfo.{SourceInfo, DeprecatedSourceInfo, SourceInfoTransform, SourceInfoWhiteboxTransform,
+import chisel.internal._
+import chisel.internal.Builder.pushOp
+import chisel.internal.firrtl._
+import chisel.internal.sourceinfo.{SourceInfo, DeprecatedSourceInfo, SourceInfoTransform, SourceInfoWhiteboxTransform,
UIntTransform, MuxTransform}
-import firrtl.PrimOp._
+import chisel.internal.firrtl.PrimOp._
/** Element is a leaf data type: it cannot contain other Data objects. Example
* uses are for representing primitive data types, like integers and bits.
@@ -25,9 +25,9 @@ sealed abstract class Bits(dirArg: Direction, width: Width, override val litArg:
// Arguments for: self-checking code (can't do arithmetic on bits)
// Arguments against: generates down to a FIRRTL UInt anyways
- private[Chisel] def fromInt(x: BigInt, w: Int): this.type
+ private[chisel] def fromInt(x: BigInt, w: Int): this.type
- private[Chisel] def flatten: IndexedSeq[Bits] = IndexedSeq(this)
+ private[chisel] def flatten: IndexedSeq[Bits] = IndexedSeq(this)
def cloneType: this.type = cloneTypeWidth(width)
@@ -118,16 +118,16 @@ sealed abstract class Bits(dirArg: Direction, width: Width, override val litArg:
final def do_apply(x: BigInt, y: BigInt)(implicit sourceInfo: SourceInfo): UInt =
apply(x.toInt, y.toInt)
- private[Chisel] def unop[T <: Data](sourceInfo: SourceInfo, dest: T, op: PrimOp): T =
+ private[core] def unop[T <: Data](sourceInfo: SourceInfo, dest: T, op: PrimOp): T =
pushOp(DefPrim(sourceInfo, dest, op, this.ref))
- private[Chisel] def binop[T <: Data](sourceInfo: SourceInfo, dest: T, op: PrimOp, other: BigInt): T =
+ private[core] def binop[T <: Data](sourceInfo: SourceInfo, dest: T, op: PrimOp, other: BigInt): T =
pushOp(DefPrim(sourceInfo, dest, op, this.ref, ILit(other)))
- private[Chisel] def binop[T <: Data](sourceInfo: SourceInfo, dest: T, op: PrimOp, other: Bits): T =
+ private[core] def binop[T <: Data](sourceInfo: SourceInfo, dest: T, op: PrimOp, other: Bits): T =
pushOp(DefPrim(sourceInfo, dest, op, this.ref, other.ref))
- private[Chisel] def compop(sourceInfo: SourceInfo, op: PrimOp, other: Bits): Bool =
+ private[core] def compop(sourceInfo: SourceInfo, op: PrimOp, other: Bits): Bool =
pushOp(DefPrim(sourceInfo, Bool(), op, this.ref, other.ref))
- private[Chisel] def redop(sourceInfo: SourceInfo, op: PrimOp): Bool =
+ private[core] def redop(sourceInfo: SourceInfo, op: PrimOp): Bool =
pushOp(DefPrim(sourceInfo, Bool(), op, this.ref))
/** Returns this wire zero padded up to the specified width.
@@ -356,13 +356,13 @@ abstract trait Num[T <: Data] {
/** A data type for unsigned integers, represented as a binary bitvector.
* Defines arithmetic operations between other integer types.
*/
-sealed class UInt private[Chisel] (dir: Direction, width: Width, lit: Option[ULit] = None)
+sealed class UInt private[core] (dir: Direction, width: Width, lit: Option[ULit] = None)
extends Bits(dir, width, lit) with Num[UInt] {
- private[Chisel] override def cloneTypeWidth(w: Width): this.type =
+ private[core] override def cloneTypeWidth(w: Width): this.type =
new UInt(dir, w).asInstanceOf[this.type]
- private[Chisel] def toType = s"UInt$width"
+ private[chisel] def toType = s"UInt$width"
- override private[Chisel] def fromInt(value: BigInt, width: Int): this.type =
+ override private[chisel] def fromInt(value: BigInt, width: Int): this.type =
UInt(value, width).asInstanceOf[this.type]
override def := (that: Data)(implicit sourceInfo: SourceInfo): Unit = that match {
@@ -482,7 +482,7 @@ sealed class UInt private[Chisel] (dir: Direction, width: Width, lit: Option[ULi
}
// This is currently a factory because both Bits and UInt inherit it.
-private[Chisel] sealed trait UIntFactory {
+private[core] sealed trait UIntFactory {
/** Create a UInt type with inferred width. */
def apply(): UInt = apply(NO_DIR, Width())
/** Create a UInt type or port with fixed width. */
@@ -535,16 +535,16 @@ object UInt extends UIntFactory
sealed class SInt private (dir: Direction, width: Width, lit: Option[SLit] = None)
extends Bits(dir, width, lit) with Num[SInt] {
- private[Chisel] override def cloneTypeWidth(w: Width): this.type =
+ private[core] override def cloneTypeWidth(w: Width): this.type =
new SInt(dir, w).asInstanceOf[this.type]
- private[Chisel] def toType = s"SInt$width"
+ private[chisel] def toType = s"SInt$width"
override def := (that: Data)(implicit sourceInfo: SourceInfo): Unit = that match {
case _: SInt => this connect that
case _ => this badConnect that
}
- override private[Chisel] def fromInt(value: BigInt, width: Int): this.type =
+ override private[chisel] def fromInt(value: BigInt, width: Int): this.type =
SInt(value, width).asInstanceOf[this.type]
final def unary_- (): SInt = macro SourceInfoTransform.noArg
@@ -666,12 +666,12 @@ object SInt {
/** A data type for booleans, defined as a single bit indicating true or false.
*/
sealed class Bool(dir: Direction, lit: Option[ULit] = None) extends UInt(dir, Width(1), lit) {
- private[Chisel] override def cloneTypeWidth(w: Width): this.type = {
+ private[core] override def cloneTypeWidth(w: Width): this.type = {
require(!w.known || w.get == 1)
new Bool(dir).asInstanceOf[this.type]
}
- override private[Chisel] def fromInt(value: BigInt, width: Int): this.type = {
+ override private[chisel] def fromInt(value: BigInt, width: Int): this.type = {
require((value == 0 || value == 1) && width == 1)
Bool(value == 1).asInstanceOf[this.type]
}
diff --git a/chiselFrontend/src/main/scala/Chisel/BlackBox.scala b/chiselFrontend/src/main/scala/chisel/core/BlackBox.scala
index b634f021..2126ebce 100644
--- a/chiselFrontend/src/main/scala/Chisel/BlackBox.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/BlackBox.scala
@@ -1,10 +1,10 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
-import internal.Builder.pushCommand
-import internal.firrtl.{ModuleIO, DefInvalid}
-import internal.sourceinfo.SourceInfo
+import chisel.internal.Builder.pushCommand
+import chisel.internal.firrtl.{ModuleIO, DefInvalid}
+import chisel.internal.sourceinfo.SourceInfo
/** Defines a black box, which is a module that can be referenced from within
* Chisel, but is not defined in the emitted Verilog. Useful for connecting
@@ -24,10 +24,10 @@ abstract class BlackBox extends Module {
// The body of a BlackBox is empty, the real logic happens in firrtl/Emitter.scala
// Bypass standard clock, reset, io port declaration by flattening io
// TODO(twigg): ? Really, overrides are bad, should extend BaseModule....
- override private[Chisel] def ports = io.elements.toSeq
+ override private[core] def ports = io.elements.toSeq
// Do not do reflective naming of internal signals, just name io
- override private[Chisel] def setRefs(): this.type = {
+ override private[core] def setRefs(): this.type = {
for ((name, port) <- ports) {
port.setRef(ModuleIO(this, _namespace.name(name)))
}
@@ -40,7 +40,7 @@ abstract class BlackBox extends Module {
// Don't setup clock, reset
// Cann't invalide io in one bunch, must invalidate each part separately
- override private[Chisel] def setupInParent(implicit sourceInfo: SourceInfo): this.type = _parent match {
+ override private[core] def setupInParent(implicit sourceInfo: SourceInfo): this.type = _parent match {
case Some(p) => {
// Just init instance inputs
for((_,port) <- ports) pushCommand(DefInvalid(sourceInfo, port.ref))
diff --git a/chiselFrontend/src/main/scala/Chisel/Data.scala b/chiselFrontend/src/main/scala/chisel/core/Data.scala
index d16843f7..cae38144 100644
--- a/chiselFrontend/src/main/scala/Chisel/Data.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/Data.scala
@@ -1,13 +1,13 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
import scala.language.experimental.macros
-import internal._
-import internal.Builder.pushCommand
-import internal.firrtl._
-import internal.sourceinfo.{SourceInfo, DeprecatedSourceInfo, UnlocatableSourceInfo, WireTransform, SourceInfoTransform}
+import chisel.internal._
+import chisel.internal.Builder.pushCommand
+import chisel.internal.firrtl._
+import chisel.internal.sourceinfo.{SourceInfo, DeprecatedSourceInfo, UnlocatableSourceInfo, WireTransform, SourceInfoTransform}
sealed abstract class Direction(name: String) {
override def toString: String = name
@@ -17,11 +17,6 @@ object INPUT extends Direction("input") { override def flip: Direction = OUTPUT
object OUTPUT extends Direction("output") { override def flip: Direction = INPUT }
object NO_DIR extends Direction("?") { override def flip: Direction = NO_DIR }
-@deprecated("debug doesn't do anything in Chisel3 as no pruning happens in the frontend", "chisel3")
-object debug { // scalastyle:ignore object.name
- def apply (arg: Data): Data = arg
-}
-
/** Mixing in this trait flips the direction of an Aggregate. */
trait Flipped extends Data {
this.overrideDirection(_.flip, !_)
@@ -38,9 +33,9 @@ abstract class Data(dirArg: Direction) extends HasId {
// Sucks this is mutable state, but cloneType doesn't take a Direction arg
private var isFlipVar = dirArg == INPUT
private var dirVar = dirArg
- private[Chisel] def isFlip = isFlipVar
+ private[core] def isFlip = isFlipVar
- private[Chisel] def overrideDirection(newDir: Direction => Direction,
+ private[core] def overrideDirection(newDir: Direction => Direction,
newFlip: Boolean => Boolean): this.type = {
this.isFlipVar = newFlip(this.isFlipVar)
for (field <- this.flatten)
@@ -51,16 +46,16 @@ abstract class Data(dirArg: Direction) extends HasId {
def asOutput: this.type = cloneType.overrideDirection(_ => OUTPUT, _ => false)
def flip(): this.type = cloneType.overrideDirection(_.flip, !_)
- private[Chisel] def badConnect(that: Data)(implicit sourceInfo: SourceInfo): Unit =
+ private[core] def badConnect(that: Data)(implicit sourceInfo: SourceInfo): Unit =
throwException(s"cannot connect ${this} and ${that}")
- private[Chisel] def connect(that: Data)(implicit sourceInfo: SourceInfo): Unit =
+ private[core] def connect(that: Data)(implicit sourceInfo: SourceInfo): Unit =
pushCommand(Connect(sourceInfo, this.lref, that.ref))
- private[Chisel] def bulkConnect(that: Data)(implicit sourceInfo: SourceInfo): Unit =
+ private[core] def bulkConnect(that: Data)(implicit sourceInfo: SourceInfo): Unit =
pushCommand(BulkConnect(sourceInfo, this.lref, that.lref))
- private[Chisel] def lref: Node = Node(this)
- private[Chisel] def ref: Arg = if (isLit) litArg.get else lref
- private[Chisel] def cloneTypeWidth(width: Width): this.type
- private[Chisel] def toType: String
+ private[core] def lref: Node = Node(this)
+ private[chisel] def ref: Arg = if (isLit) litArg.get else lref
+ private[core] def cloneTypeWidth(width: Width): this.type
+ private[chisel] def toType: String
def := (that: Data)(implicit sourceInfo: SourceInfo): Unit = this badConnect that
@@ -83,7 +78,7 @@ abstract class Data(dirArg: Direction) extends HasId {
// currently don't exist (while this information may be available during
// FIRRTL emission, it would break directionality querying from Chisel, which
// does get used).
- private[Chisel] def flatten: IndexedSeq[Bits]
+ private[chisel] def flatten: IndexedSeq[Bits]
/** Creates an new instance of this type, unpacking the input Bits into
* structured data.
@@ -150,9 +145,9 @@ object Clock {
// TODO: Document this.
sealed class Clock(dirArg: Direction) extends Element(dirArg, Width(1)) {
def cloneType: this.type = Clock(dirArg).asInstanceOf[this.type]
- private[Chisel] override def flatten: IndexedSeq[Bits] = IndexedSeq()
- private[Chisel] def cloneTypeWidth(width: Width): this.type = cloneType
- private[Chisel] def toType = "Clock"
+ private[chisel] override def flatten: IndexedSeq[Bits] = IndexedSeq()
+ private[core] def cloneTypeWidth(width: Width): this.type = cloneType
+ private[chisel] def toType = "Clock"
override def := (that: Data)(implicit sourceInfo: SourceInfo): Unit = that match {
case _: Clock => this connect that
diff --git a/chiselFrontend/src/main/scala/Chisel/Mem.scala b/chiselFrontend/src/main/scala/chisel/core/Mem.scala
index e34d5499..a2df2910 100644
--- a/chiselFrontend/src/main/scala/Chisel/Mem.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/Mem.scala
@@ -1,13 +1,13 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
import scala.language.experimental.macros
-import internal._
-import internal.Builder.pushCommand
-import internal.firrtl._
-import internal.sourceinfo.{SourceInfo, DeprecatedSourceInfo, UnlocatableSourceInfo, MemTransform}
+import chisel.internal._
+import chisel.internal.Builder.pushCommand
+import chisel.internal.firrtl._
+import chisel.internal.sourceinfo.{SourceInfo, DeprecatedSourceInfo, UnlocatableSourceInfo, MemTransform}
object Mem {
@deprecated("Mem argument order should be size, t; this will be removed by the official release", "chisel3")
diff --git a/chiselFrontend/src/main/scala/Chisel/Module.scala b/chiselFrontend/src/main/scala/chisel/core/Module.scala
index e2101538..1de3efe5 100644
--- a/chiselFrontend/src/main/scala/Chisel/Module.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/Module.scala
@@ -1,15 +1,15 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
import scala.collection.mutable.{ArrayBuffer, HashSet}
import scala.language.experimental.macros
-import internal._
-import internal.Builder.pushCommand
-import internal.Builder.dynamicContext
-import internal.firrtl._
-import internal.sourceinfo.{SourceInfo, InstTransform, UnlocatableSourceInfo}
+import chisel.internal._
+import chisel.internal.Builder.pushCommand
+import chisel.internal.Builder.dynamicContext
+import chisel.internal.firrtl._
+import chisel.internal.sourceinfo.{SourceInfo, InstTransform, UnlocatableSourceInfo}
object Module {
/** A wrapper method that all Module instantiations must be wrapped in
@@ -52,9 +52,9 @@ extends HasId {
def this(_reset: Bool) = this(None, Option(_reset))
def this(_clock: Clock, _reset: Bool) = this(Option(_clock), Option(_reset))
- private[Chisel] val _namespace = Builder.globalNamespace.child
- private[Chisel] val _commands = ArrayBuffer[Command]()
- private[Chisel] val _ids = ArrayBuffer[HasId]()
+ private[core] val _namespace = Builder.globalNamespace.child
+ private[chisel] val _commands = ArrayBuffer[Command]()
+ private[core] val _ids = ArrayBuffer[HasId]()
dynamicContext.currentModule = Some(this)
/** Name of the instance. */
@@ -67,18 +67,18 @@ extends HasId {
val clock = Clock(INPUT)
val reset = Bool(INPUT)
- private[Chisel] def addId(d: HasId) { _ids += d }
+ private[chisel] def addId(d: HasId) { _ids += d }
- private[Chisel] def ports: Seq[(String,Data)] = Vector(
+ private[core] def ports: Seq[(String,Data)] = Vector(
("clk", clock), ("reset", reset), ("io", io)
)
- private[Chisel] def computePorts = for((name, port) <- ports) yield {
+ private[core] def computePorts = for((name, port) <- ports) yield {
val bundleDir = if (port.isFlip) INPUT else OUTPUT
Port(port, if (port.dir == NO_DIR) bundleDir else port.dir)
}
- private[Chisel] def setupInParent(implicit sourceInfo: SourceInfo): this.type = {
+ private[core] def setupInParent(implicit sourceInfo: SourceInfo): this.type = {
_parent match {
case Some(p) => {
pushCommand(DefInvalid(sourceInfo, io.ref)) // init instance inputs
@@ -90,7 +90,7 @@ extends HasId {
}
}
- private[Chisel] def setRefs(): this.type = {
+ private[core] def setRefs(): this.type = {
for ((name, port) <- ports) {
port.setRef(ModuleIO(this, _namespace.name(name)))
}
diff --git a/chiselFrontend/src/main/scala/Chisel/Printf.scala b/chiselFrontend/src/main/scala/chisel/core/Printf.scala
index f068f637..a7970816 100644
--- a/chiselFrontend/src/main/scala/Chisel/Printf.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/Printf.scala
@@ -1,13 +1,13 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
import scala.language.experimental.macros
-import internal._
-import internal.Builder.pushCommand
-import internal.firrtl._
-import internal.sourceinfo.SourceInfo
+import chisel.internal._
+import chisel.internal.Builder.pushCommand
+import chisel.internal.firrtl._
+import chisel.internal.sourceinfo.SourceInfo
object printf { // scalastyle:ignore object.name
/** Prints a message in simulation.
@@ -29,7 +29,7 @@ object printf { // scalastyle:ignore object.name
}
}
- private[Chisel] def printfWithoutReset(fmt: String, data: Bits*)(implicit sourceInfo: SourceInfo) {
+ private[core] def printfWithoutReset(fmt: String, data: Bits*)(implicit sourceInfo: SourceInfo) {
val clock = Builder.dynamicContext.currentModule.get.clock
pushCommand(Printf(sourceInfo, Node(clock), fmt, data.map((d: Bits) => d.ref)))
}
diff --git a/chiselFrontend/src/main/scala/Chisel/Reg.scala b/chiselFrontend/src/main/scala/chisel/core/Reg.scala
index c8faa5c9..78461334 100644
--- a/chiselFrontend/src/main/scala/Chisel/Reg.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/Reg.scala
@@ -1,14 +1,14 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
-import internal._
-import internal.Builder.pushCommand
-import internal.firrtl._
-import internal.sourceinfo.{SourceInfo, UnlocatableSourceInfo}
+import chisel.internal._
+import chisel.internal.Builder.pushCommand
+import chisel.internal.firrtl._
+import chisel.internal.sourceinfo.{SourceInfo, UnlocatableSourceInfo}
object Reg {
- private[Chisel] def makeType[T <: Data](t: T = null, next: T = null, init: T = null): T = {
+ private[core] def makeType[T <: Data](t: T = null, next: T = null, init: T = null): T = {
if (t ne null) {
t.cloneType
} else if (next ne null) {
diff --git a/chiselFrontend/src/main/scala/Chisel/SeqUtils.scala b/chiselFrontend/src/main/scala/chisel/core/SeqUtils.scala
index 9a15fd5f..e31119a5 100644
--- a/chiselFrontend/src/main/scala/Chisel/SeqUtils.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/SeqUtils.scala
@@ -1,12 +1,12 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
import scala.language.experimental.macros
-import internal.sourceinfo.{SourceInfo, SourceInfoTransform}
+import chisel.internal.sourceinfo.{SourceInfo, SourceInfoTransform}
-private[Chisel] object SeqUtils {
+private[chisel] object SeqUtils {
/** Equivalent to Cat(r(n-1), ..., r(0)) */
def asUInt[T <: Bits](in: Seq[T]): UInt = macro SourceInfoTransform.inArg
diff --git a/chiselFrontend/src/main/scala/Chisel/When.scala b/chiselFrontend/src/main/scala/chisel/core/When.scala
index 90b3d1a5..5d484313 100644
--- a/chiselFrontend/src/main/scala/Chisel/When.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/When.scala
@@ -1,13 +1,13 @@
// See LICENSE for license details.
-package Chisel
+package chisel.core
import scala.language.experimental.macros
-import internal._
-import internal.Builder.pushCommand
-import internal.firrtl._
-import internal.sourceinfo.{SourceInfo}
+import chisel.internal._
+import chisel.internal.Builder.pushCommand
+import chisel.internal.firrtl._
+import chisel.internal.sourceinfo.{SourceInfo}
object when { // scalastyle:ignore object.name
/** Create a `when` condition block, where whether a block of logic is
diff --git a/chiselFrontend/src/main/scala/Chisel/internal/Builder.scala b/chiselFrontend/src/main/scala/chisel/internal/Builder.scala
index d0e28b7c..9c0a3514 100644
--- a/chiselFrontend/src/main/scala/Chisel/internal/Builder.scala
+++ b/chiselFrontend/src/main/scala/chisel/internal/Builder.scala
@@ -1,14 +1,15 @@
// See LICENSE for license details.
-package Chisel.internal
+package chisel.internal
import scala.util.DynamicVariable
import scala.collection.mutable.{ArrayBuffer, HashMap}
-import Chisel._
-import Chisel.internal.firrtl._
+import chisel._
+import core._
+import firrtl._
-private[Chisel] class Namespace(parent: Option[Namespace], keywords: Set[String]) {
+private[chisel] class Namespace(parent: Option[Namespace], keywords: Set[String]) {
private var i = 0L
private val names = collection.mutable.HashSet[String]()
@@ -32,7 +33,7 @@ private[Chisel] class Namespace(parent: Option[Namespace], keywords: Set[String]
def child: Namespace = child(Set())
}
-private[Chisel] class IdGen {
+private[chisel] class IdGen {
private var counter = -1L
def next: Long = {
counter += 1
@@ -40,12 +41,12 @@ private[Chisel] class IdGen {
}
}
-private[Chisel] trait HasId {
- private[Chisel] def _onModuleClose {} // scalastyle:ignore method.name
- private[Chisel] val _parent = Builder.dynamicContext.currentModule
+private[chisel] trait HasId {
+ private[chisel] def _onModuleClose {} // scalastyle:ignore method.name
+ private[chisel] val _parent = Builder.dynamicContext.currentModule
_parent.foreach(_.addId(this))
- private[Chisel] val _id = Builder.idGen.next
+ private[chisel] val _id = Builder.idGen.next
override def hashCode: Int = _id.toInt
override def equals(that: Any): Boolean = that match {
case x: HasId => _id == x._id
@@ -62,12 +63,12 @@ private[Chisel] trait HasId {
for(hook <- postname_hooks) { hook(name) }
this
}
- private[Chisel] def addPostnameHook(hook: String=>Unit): Unit = postname_hooks += hook
+ private[chisel] def addPostnameHook(hook: String=>Unit): Unit = postname_hooks += hook
// Uses a namespace to convert suggestion into a true name
// Will not do any naming if the reference already assigned.
// (e.g. tried to suggest a name to part of a Bundle)
- private[Chisel] def forceName(default: =>String, namespace: Namespace): Unit =
+ private[chisel] def forceName(default: =>String, namespace: Namespace): Unit =
if(_ref.isEmpty) {
val candidate_name = suggested_name.getOrElse(default)
val available_name = namespace.name(candidate_name)
@@ -75,14 +76,14 @@ private[Chisel] trait HasId {
}
private var _ref: Option[Arg] = None
- private[Chisel] def setRef(imm: Arg): Unit = _ref = Some(imm)
- private[Chisel] def setRef(parent: HasId, name: String): Unit = setRef(Slot(Node(parent), name))
- private[Chisel] def setRef(parent: HasId, index: Int): Unit = setRef(Index(Node(parent), ILit(index)))
- private[Chisel] def setRef(parent: HasId, index: UInt): Unit = setRef(Index(Node(parent), index.ref))
- private[Chisel] def getRef: Arg = _ref.get
+ private[chisel] def setRef(imm: Arg): Unit = _ref = Some(imm)
+ private[chisel] def setRef(parent: HasId, name: String): Unit = setRef(Slot(Node(parent), name))
+ private[chisel] def setRef(parent: HasId, index: Int): Unit = setRef(Index(Node(parent), ILit(index)))
+ private[chisel] def setRef(parent: HasId, index: UInt): Unit = setRef(Index(Node(parent), index.ref))
+ private[chisel] def getRef: Arg = _ref.get
}
-private[Chisel] class DynamicContext {
+private[chisel] class DynamicContext {
val idGen = new IdGen
val globalNamespace = new Namespace(None, Set())
val components = ArrayBuffer[Component]()
@@ -90,7 +91,7 @@ private[Chisel] class DynamicContext {
val errors = new ErrorLog
}
-private[Chisel] object Builder {
+private[chisel] object Builder {
// All global mutable state must be referenced via dynamicContextVar!!
private val dynamicContextVar = new DynamicVariable[Option[DynamicContext]](None)
diff --git a/chiselFrontend/src/main/scala/Chisel/internal/Error.scala b/chiselFrontend/src/main/scala/chisel/internal/Error.scala
index 6c4c0880..f0481dc4 100644
--- a/chiselFrontend/src/main/scala/Chisel/internal/Error.scala
+++ b/chiselFrontend/src/main/scala/chisel/internal/Error.scala
@@ -1,20 +1,20 @@
// See LICENSE for license details.
-package Chisel.internal
+package chisel.internal
import scala.collection.mutable.ArrayBuffer
-import Chisel._
+import chisel.core._
class ChiselException(message: String, cause: Throwable) extends Exception(message, cause)
-private[Chisel] object throwException {
+private[chisel] object throwException {
def apply(s: String, t: Throwable = null): Nothing =
throw new ChiselException(s, t)
}
/** Records and reports runtime errors and warnings. */
-private[Chisel] class ErrorLog {
+private[chisel] class ErrorLog {
def hasErrors: Boolean = errors.exists(_.isFatal)
/** Log an error message */
diff --git a/chiselFrontend/src/main/scala/Chisel/internal/SourceInfo.scala b/chiselFrontend/src/main/scala/chisel/internal/SourceInfo.scala
index 66bfc7a4..c20bd130 100644
--- a/chiselFrontend/src/main/scala/Chisel/internal/SourceInfo.scala
+++ b/chiselFrontend/src/main/scala/chisel/internal/SourceInfo.scala
@@ -12,7 +12,7 @@
// writers to append source locator information at the point of a library
// function invocation.
-package Chisel.internal.sourceinfo
+package chisel.internal.sourceinfo
import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
@@ -42,7 +42,7 @@ object SourceInfoMacro {
def generate_source_info(c: Context): c.Tree = {
import c.universe._
val p = c.enclosingPosition
- q"_root_.Chisel.internal.sourceinfo.SourceLine(${p.source.file.name}, ${p.line}, ${p.column})"
+ q"_root_.chisel.internal.sourceinfo.SourceLine(${p.source.file.name}, ${p.line}, ${p.column})"
}
}
diff --git a/chiselFrontend/src/main/scala/Chisel/internal/firrtl/IR.scala b/chiselFrontend/src/main/scala/chisel/internal/firrtl/IR.scala
index 62784cee..70e9938b 100644
--- a/chiselFrontend/src/main/scala/Chisel/internal/firrtl/IR.scala
+++ b/chiselFrontend/src/main/scala/chisel/internal/firrtl/IR.scala
@@ -1,9 +1,11 @@
// See LICENSE for license details.
-package Chisel.internal.firrtl
-import Chisel._
-import Chisel.internal._
-import Chisel.internal.sourceinfo.{SourceInfo, NoSourceInfo}
+package chisel.internal.firrtl
+
+import chisel._
+import core._
+import chisel.internal._
+import chisel.internal.sourceinfo.{SourceInfo, NoSourceInfo}
case class PrimOp(val name: String) {
override def toString: String = name
@@ -53,8 +55,8 @@ case class Node(id: HasId) extends Arg {
}
abstract class LitArg(val num: BigInt, widthArg: Width) extends Arg {
- private[Chisel] def forcedWidth = widthArg.known
- private[Chisel] def width: Width = if (forcedWidth) widthArg else Width(minWidth)
+ private[chisel] def forcedWidth = widthArg.known
+ private[chisel] def width: Width = if (forcedWidth) widthArg else Width(minWidth)
protected def minWidth: Int
if (forcedWidth) {
diff --git a/coreMacros/src/main/scala/Chisel/internal/sourceinfo/SourceInfoTransform.scala b/coreMacros/src/main/scala/chisel/internal/sourceinfo/SourceInfoTransform.scala
index 82ad5b9e..10b677b6 100644
--- a/coreMacros/src/main/scala/Chisel/internal/sourceinfo/SourceInfoTransform.scala
+++ b/coreMacros/src/main/scala/chisel/internal/sourceinfo/SourceInfoTransform.scala
@@ -3,7 +3,7 @@
// This file transform macro definitions to explicitly add implicit source info to Chisel method
// calls.
-package Chisel.internal.sourceinfo
+package chisel.internal.sourceinfo
import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
@@ -23,7 +23,7 @@ trait SourceInfoTransformMacro {
val c: Context
import c.universe._
def thisObj = c.prefix.tree
- def implicitSourceInfo = q"implicitly[_root_.Chisel.internal.sourceinfo.SourceInfo]"
+ def implicitSourceInfo = q"implicitly[_root_.chisel.internal.sourceinfo.SourceInfo]"
}
class WireTransform(val c: Context) extends SourceInfoTransformMacro {
diff --git a/src/main/scala/Chisel/package.scala b/src/main/scala/Chisel/package.scala
deleted file mode 100644
index f05e8b5d..00000000
--- a/src/main/scala/Chisel/package.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-package object Chisel {
- import scala.language.experimental.macros
-
- import internal.firrtl.Width
- import internal.sourceinfo.{SourceInfo, SourceInfoTransform}
-
- implicit class fromBigIntToLiteral(val x: BigInt) extends AnyVal {
- def U: UInt = UInt(x, Width())
- def S: SInt = SInt(x, Width())
- }
- implicit class fromIntToLiteral(val x: Int) extends AnyVal {
- def U: UInt = UInt(BigInt(x), Width())
- def S: SInt = SInt(BigInt(x), Width())
- }
- implicit class fromStringToLiteral(val x: String) extends AnyVal {
- def U: UInt = UInt(x)
- }
- implicit class fromBooleanToLiteral(val x: Boolean) extends AnyVal {
- def B: Bool = Bool(x)
- }
-
- implicit class fromUIntToBitPatComparable(val x: UInt) extends AnyVal {
- final def === (that: BitPat): Bool = macro SourceInfoTransform.thatArg
- final def != (that: BitPat): Bool = macro SourceInfoTransform.thatArg
- final def =/= (that: BitPat): Bool = macro SourceInfoTransform.thatArg
-
- def do_=== (that: BitPat)(implicit sourceInfo: SourceInfo): Bool = that === x
- def do_!= (that: BitPat)(implicit sourceInfo: SourceInfo): Bool = that != x
- def do_=/= (that: BitPat)(implicit sourceInfo: SourceInfo): Bool = that =/= x
- }
-}
diff --git a/src/main/scala/Chisel/Driver.scala b/src/main/scala/chisel/Driver.scala
index 02204684..ba2b1389 100644
--- a/src/main/scala/Chisel/Driver.scala
+++ b/src/main/scala/chisel/Driver.scala
@@ -1,6 +1,6 @@
// See LICENSE for license details.
-package Chisel
+package chisel
import scala.sys.process._
import java.io._
diff --git a/src/main/scala/chisel/compatibility.scala b/src/main/scala/chisel/compatibility.scala
new file mode 100644
index 00000000..56088562
--- /dev/null
+++ b/src/main/scala/chisel/compatibility.scala
@@ -0,0 +1,150 @@
+// See LICENSE for license details.
+
+// Allows legacy users to continue using Chisel (capital C) package name while
+// moving to the more standard package naming convention chisel (lowercase c).
+
+package object Chisel {
+ type Direction = chisel.core.Direction
+ val INPUT = chisel.core.INPUT
+ val OUTPUT = chisel.core.OUTPUT
+ val NO_DIR = chisel.core.NO_DIR
+
+ type Flipped = chisel.core.Flipped
+ type Data = chisel.core.Data
+ val Wire = chisel.core.Wire
+ val Clock = chisel.core.Clock
+ type Clock = chisel.core.Clock
+
+ type Aggregate = chisel.core.Aggregate
+ val Vec = chisel.core.Vec
+ type Vec[T <: Data] = chisel.core.Vec[T]
+ type VecLike[T <: Data] = chisel.core.VecLike[T]
+ type Bundle = chisel.core.Bundle
+
+ val assert = chisel.core.assert
+
+ type Element = chisel.core.Element
+ type Bits = chisel.core.Bits
+ val Bits = chisel.core.Bits
+ type Num[T <: Data] = chisel.core.Num[T]
+ type UInt = chisel.core.UInt
+ val UInt = chisel.core.UInt
+ type SInt = chisel.core.SInt
+ val SInt = chisel.core.SInt
+ type Bool = chisel.core.Bool
+ val Bool = chisel.core.Bool
+ val Mux = chisel.core.Mux
+
+ type BlackBox = chisel.core.BlackBox
+
+ val Mem = chisel.core.Mem
+ type MemBase[T <: Data] = chisel.core.MemBase[T]
+ type Mem[T <: Data] = chisel.core.Mem[T]
+ val SeqMem = chisel.core.SeqMem
+ type SeqMem[T <: Data] = chisel.core.SeqMem[T]
+
+ val Module = chisel.core.Module
+ type Module = chisel.core.Module
+
+ val printf = chisel.core.printf
+
+ val Reg = chisel.core.Reg
+
+ val when = chisel.core.when
+ type WhenContext = chisel.core.WhenContext
+
+
+ type BackendCompilationUtilities = chisel.BackendCompilationUtilities
+ val Driver = chisel.Driver
+ type FileSystemUtilities = chisel.compatibility.FileSystemUtilities
+ val ImplicitConversions = chisel.util.ImplicitConversions
+ val chiselMain = chisel.compatibility.chiselMain
+ val throwException = chisel.compatibility.throwException
+ val debug = chisel.compatibility.debug
+
+ object testers {
+ type BasicTester = chisel.testers.BasicTester
+ val TesterDriver = chisel.testers.TesterDriver
+ }
+
+
+ val log2Up = chisel.util.log2Up
+ val log2Ceil = chisel.util.log2Ceil
+ val log2Down = chisel.util.log2Down
+ val log2Floor = chisel.util.log2Floor
+ val isPow2 = chisel.util.isPow2
+
+ val BitPat = chisel.util.BitPat
+ type BitPat = chisel.util.BitPat
+
+ type ArbiterIO[T <: Data] = chisel.util.ArbiterIO[T]
+ type LockingArbiterLike[T <: Data] = chisel.util.LockingArbiterLike[T]
+ type LockingRRArbiter[T <: Data] = chisel.util.LockingRRArbiter[T]
+ type LockingArbiter[T <: Data] = chisel.util.LockingArbiter[T]
+ type RRArbiter[T <: Data] = chisel.util.RRArbiter[T]
+ type Arbiter[T <: Data] = chisel.util.Arbiter[T]
+
+ val FillInterleaved = chisel.util.FillInterleaved
+ val PopCount = chisel.util.PopCount
+ val Fill = chisel.util.Fill
+ val Reverse = chisel.util.Reverse
+
+ val Cat = chisel.util.Cat
+
+ val Log2 = chisel.util.Log2
+
+ val unless = chisel.util.unless
+ type SwitchContext[T <: Bits] = chisel.util.SwitchContext[T]
+ val is = chisel.util.is
+ val switch = chisel.util.switch
+
+ type Counter = chisel.util.Counter
+ val Counter = chisel.util.Counter
+
+ type DecoupledIO[+T <: Data] = chisel.util.DecoupledIO[T]
+ val Decoupled = chisel.util.Decoupled
+ type EnqIO[T <: Data] = chisel.util.EnqIO[T]
+ type DeqIO[T <: Data] = chisel.util.DeqIO[T]
+ type DecoupledIOC[+T <: Data] = chisel.util.DecoupledIOC[T]
+ type QueueIO[T <: Data] = chisel.util.QueueIO[T]
+ type Queue[T <: Data] = chisel.util.Queue[T]
+ val Queue = chisel.util.Queue
+
+ val Enum = chisel.util.Enum
+
+ val LFSR16 = chisel.util.LFSR16
+
+ val ListLookup = chisel.util.ListLookup
+ val Lookup = chisel.util.Lookup
+
+ val Mux1H = chisel.util.Mux1H
+ val PriorityMux = chisel.util.PriorityMux
+ val MuxLookup = chisel.util.MuxLookup
+ val MuxCase = chisel.util.MuxCase
+
+ val OHToUInt = chisel.util.OHToUInt
+ val PriorityEncoder = chisel.util.PriorityEncoder
+ val UIntToOH = chisel.util.UIntToOH
+ val PriorityEncoderOH = chisel.util.PriorityEncoderOH
+
+ val RegNext = chisel.util.RegNext
+ val RegInit = chisel.util.RegInit
+ val RegEnable = chisel.util.RegEnable
+ val ShiftRegister = chisel.util.ShiftRegister
+
+ type ValidIO[+T <: Data] = chisel.util.ValidIO[T]
+ val Valid = chisel.util.Valid
+ val Pipe = chisel.util.Pipe
+ type Pipe[T <: Data] = chisel.util.Pipe[T]
+
+
+ import chisel.internal.firrtl.Width
+ implicit def fromBigIntToLiteral(x: BigInt): chisel.fromBigIntToLiteral =
+ new chisel.fromBigIntToLiteral(x)
+ implicit def fromIntToLiteral(x: Int): chisel.fromIntToLiteral=
+ new chisel.fromIntToLiteral(x)
+ implicit def fromStringToLiteral(x: String): chisel.fromStringToLiteral=
+ new chisel.fromStringToLiteral(x)
+ implicit def fromBooleanToLiteral(x: Boolean): chisel.fromBooleanToLiteral=
+ new chisel.fromBooleanToLiteral(x)
+}
diff --git a/src/main/scala/Chisel/FileSystemUtilities.scala b/src/main/scala/chisel/compatibility/FileSystemUtilities.scala
index 575ae138..d12e627d 100644
--- a/src/main/scala/Chisel/FileSystemUtilities.scala
+++ b/src/main/scala/chisel/compatibility/FileSystemUtilities.scala
@@ -1,6 +1,8 @@
// See LICENSE for license details.
-package Chisel
+package chisel.compatibility
+
+import chisel._
@deprecated("FileSystemUtilities doesn't exist in chisel3", "3.0.0")
trait FileSystemUtilities {
diff --git a/src/main/scala/Chisel/Main.scala b/src/main/scala/chisel/compatibility/Main.scala
index a72debc3..9072bfcf 100644
--- a/src/main/scala/Chisel/Main.scala
+++ b/src/main/scala/chisel/compatibility/Main.scala
@@ -1,9 +1,11 @@
// See LICENSE for license details.
-package Chisel
+package chisel.compatibility
import java.io.File
+import chisel._
+
@deprecated("chiselMain doesn't exist in Chisel3", "3.0") object chiselMain {
def apply[T <: Module](args: Array[String], gen: () => T): Unit =
Predef.assert(false, "No more chiselMain in Chisel3")
diff --git a/src/main/scala/chisel/compatibility/debug.scala b/src/main/scala/chisel/compatibility/debug.scala
new file mode 100644
index 00000000..8850c76b
--- /dev/null
+++ b/src/main/scala/chisel/compatibility/debug.scala
@@ -0,0 +1,8 @@
+package chisel.compatibility
+
+import chisel.core._
+
+@deprecated("debug doesn't do anything in Chisel3 as no pruning happens in the frontend", "chisel3")
+object debug { // scalastyle:ignore object.name
+ def apply (arg: Data): Data = arg
+}
diff --git a/src/main/scala/Chisel/throwException.scala b/src/main/scala/chisel/compatibility/throwException.scala
index 702884aa..3b9fd06e 100644
--- a/src/main/scala/Chisel/throwException.scala
+++ b/src/main/scala/chisel/compatibility/throwException.scala
@@ -1,6 +1,8 @@
// See LICENSE for license details.
-package Chisel
+package chisel.compatibility
+
+import chisel._
@deprecated("throwException doesn't exist in Chisel3", "3.0.0")
@throws(classOf[Exception])
diff --git a/src/main/scala/Chisel/internal/firrtl/Emitter.scala b/src/main/scala/chisel/internal/firrtl/Emitter.scala
index 7ca3268a..e48eb226 100644
--- a/src/main/scala/Chisel/internal/firrtl/Emitter.scala
+++ b/src/main/scala/chisel/internal/firrtl/Emitter.scala
@@ -1,10 +1,10 @@
// See LICENSE for license details.
-package Chisel.internal.firrtl
-import Chisel._
-import Chisel.internal.sourceinfo.{NoSourceInfo, SourceLine}
+package chisel.internal.firrtl
+import chisel._
+import chisel.internal.sourceinfo.{NoSourceInfo, SourceLine}
-private[Chisel] object Emitter {
+private[chisel] object Emitter {
def emit(circuit: Circuit): String = new Emitter(circuit).toString
}
diff --git a/src/main/scala/chisel/package.scala b/src/main/scala/chisel/package.scala
new file mode 100644
index 00000000..f7ed6b13
--- /dev/null
+++ b/src/main/scala/chisel/package.scala
@@ -0,0 +1,82 @@
+package object chisel {
+ import scala.language.experimental.macros
+
+ import internal.firrtl.Width
+ import internal.sourceinfo.{SourceInfo, SourceInfoTransform}
+ import util.BitPat
+
+
+ type Direction = chisel.core.Direction
+ val INPUT = chisel.core.INPUT
+ val OUTPUT = chisel.core.OUTPUT
+ val NO_DIR = chisel.core.NO_DIR
+ type Flipped = chisel.core.Flipped
+ type Data = chisel.core.Data
+ val Wire = chisel.core.Wire
+ val Clock = chisel.core.Clock
+ type Clock = chisel.core.Clock
+
+ type Aggregate = chisel.core.Aggregate
+ val Vec = chisel.core.Vec
+ type Vec[T <: Data] = chisel.core.Vec[T]
+ type VecLike[T <: Data] = chisel.core.VecLike[T]
+ type Bundle = chisel.core.Bundle
+
+ val assert = chisel.core.assert
+
+ type Element = chisel.core.Element
+ type Bits = chisel.core.Bits
+ val Bits = chisel.core.Bits
+ type Num[T <: Data] = chisel.core.Num[T]
+ type UInt = chisel.core.UInt
+ val UInt = chisel.core.UInt
+ type SInt = chisel.core.SInt
+ val SInt = chisel.core.SInt
+ type Bool = chisel.core.Bool
+ val Bool = chisel.core.Bool
+ val Mux = chisel.core.Mux
+
+ type BlackBox = chisel.core.BlackBox
+
+ val Mem = chisel.core.Mem
+ type MemBase[T <: Data] = chisel.core.MemBase[T]
+ type Mem[T <: Data] = chisel.core.Mem[T]
+ val SeqMem = chisel.core.SeqMem
+ type SeqMem[T <: Data] = chisel.core.SeqMem[T]
+
+ val Module = chisel.core.Module
+ type Module = chisel.core.Module
+
+ val printf = chisel.core.printf
+
+ val Reg = chisel.core.Reg
+
+ val when = chisel.core.when
+ type WhenContext = chisel.core.WhenContext
+
+
+ implicit class fromBigIntToLiteral(val x: BigInt) extends AnyVal {
+ def U: UInt = UInt(x, Width())
+ def S: SInt = SInt(x, Width())
+ }
+ implicit class fromIntToLiteral(val x: Int) extends AnyVal {
+ def U: UInt = UInt(BigInt(x), Width())
+ def S: SInt = SInt(BigInt(x), Width())
+ }
+ implicit class fromStringToLiteral(val x: String) extends AnyVal {
+ def U: UInt = UInt(x)
+ }
+ implicit class fromBooleanToLiteral(val x: Boolean) extends AnyVal {
+ def B: Bool = Bool(x)
+ }
+
+ implicit class fromUIntToBitPatComparable(val x: UInt) extends AnyVal {
+ final def === (that: BitPat): Bool = macro SourceInfoTransform.thatArg
+ final def != (that: BitPat): Bool = macro SourceInfoTransform.thatArg
+ final def =/= (that: BitPat): Bool = macro SourceInfoTransform.thatArg
+
+ def do_=== (that: BitPat)(implicit sourceInfo: SourceInfo): Bool = that === x
+ def do_!= (that: BitPat)(implicit sourceInfo: SourceInfo): Bool = that != x
+ def do_=/= (that: BitPat)(implicit sourceInfo: SourceInfo): Bool = that =/= x
+ }
+}
diff --git a/src/main/scala/Chisel/testers/BasicTester.scala b/src/main/scala/chisel/testers/BasicTester.scala
index b8c1494a..36ff7c52 100644
--- a/src/main/scala/Chisel/testers/BasicTester.scala
+++ b/src/main/scala/chisel/testers/BasicTester.scala
@@ -1,7 +1,7 @@
// See LICENSE for license details.
-package Chisel.testers
-import Chisel._
+package chisel.testers
+import chisel._
import scala.language.experimental.macros
diff --git a/src/main/scala/Chisel/testers/TesterDriver.scala b/src/main/scala/chisel/testers/TesterDriver.scala
index a56bb8b7..5c0275e0 100644
--- a/src/main/scala/Chisel/testers/TesterDriver.scala
+++ b/src/main/scala/chisel/testers/TesterDriver.scala
@@ -1,7 +1,8 @@
// See LICENSE for license details.
-package Chisel.testers
-import Chisel._
+package chisel.testers
+
+import chisel._
import scala.io.Source
import scala.sys.process._
import java.io._
diff --git a/src/main/scala/Chisel/util/Arbiter.scala b/src/main/scala/chisel/util/Arbiter.scala
index 16ae9be5..3723f2a9 100644
--- a/src/main/scala/Chisel/util/Arbiter.scala
+++ b/src/main/scala/chisel/util/Arbiter.scala
@@ -3,7 +3,9 @@
/** Arbiters in all shapes and sizes.
*/
-package Chisel
+package chisel.util
+
+import chisel._
/** An I/O bundle for the Arbiter */
class ArbiterIO[T <: Data](gen: T, n: Int) extends Bundle {
diff --git a/src/main/scala/Chisel/BitPat.scala b/src/main/scala/chisel/util/BitPat.scala
index 96206f63..13bbe1b0 100644
--- a/src/main/scala/Chisel/BitPat.scala
+++ b/src/main/scala/chisel/util/BitPat.scala
@@ -1,10 +1,11 @@
// See LICENSE for license details.
-package Chisel
+package chisel.util
import scala.language.experimental.macros
-import Chisel.internal.sourceinfo.{SourceInfo, SourceInfoTransform}
+import chisel._
+import chisel.internal.sourceinfo.{SourceInfo, SourceInfoTransform}
object BitPat {
/** Parses a bit pattern string into (bits, mask, width).
diff --git a/src/main/scala/Chisel/util/Bitwise.scala b/src/main/scala/chisel/util/Bitwise.scala
index 239a295e..d7d62ea3 100644
--- a/src/main/scala/Chisel/util/Bitwise.scala
+++ b/src/main/scala/chisel/util/Bitwise.scala
@@ -3,7 +3,10 @@
/** Miscellaneous circuit generators operating on bits.
*/
-package Chisel
+package chisel.util
+
+import chisel._
+import chisel.core.SeqUtils
object FillInterleaved
{
diff --git a/src/main/scala/Chisel/util/Cat.scala b/src/main/scala/chisel/util/Cat.scala
index dd706e62..b47da706 100644
--- a/src/main/scala/Chisel/util/Cat.scala
+++ b/src/main/scala/chisel/util/Cat.scala
@@ -1,6 +1,9 @@
// See LICENSE for license details.
-package Chisel
+package chisel.util
+
+import chisel._
+import chisel.core.SeqUtils
object Cat {
/** Combine data elements together
diff --git a/src/main/scala/Chisel/util/CircuitMath.scala b/src/main/scala/chisel/util/CircuitMath.scala
index 06cab903..c3b94fdb 100644
--- a/src/main/scala/Chisel/util/CircuitMath.scala
+++ b/src/main/scala/chisel/util/CircuitMath.scala
@@ -3,7 +3,9 @@
/** Circuit-land math operations.
*/
-package Chisel
+package chisel.util
+
+import chisel._
/** Compute Log2 with truncation of a UInt in hardware using a Mux Tree
* An alternative interpretation is it computes the minimum number of bits needed to represent x
diff --git a/src/main/scala/Chisel/util/Conditional.scala b/src/main/scala/chisel/util/Conditional.scala
index 9cab25ef..01c12799 100644
--- a/src/main/scala/Chisel/util/Conditional.scala
+++ b/src/main/scala/chisel/util/Conditional.scala
@@ -3,13 +3,15 @@
/** Conditional blocks.
*/
-package Chisel
+package chisel.util
import scala.language.reflectiveCalls
import scala.language.experimental.macros
import scala.reflect.runtime.universe._
import scala.reflect.macros.blackbox._
+import chisel._
+
/** This is identical to [[Chisel.when when]] with the condition inverted */
object unless { // scalastyle:ignore object.name
def apply(c: Bool)(block: => Unit) {
@@ -59,7 +61,9 @@ object switch { // scalastyle:ignore object.name
def impl(c: Context)(cond: c.Tree)(x: c.Tree): c.Tree = { import c.universe._
val sc = c.universe.internal.reificationSupport.freshTermName("sc")
def extractIsStatement(tree: Tree): List[c.universe.Tree] = tree match {
- case q"Chisel.is.apply( ..$params )( ..$body )" => List(q"$sc.is( ..$params )( ..$body )")
+ // TODO: remove when Chisel compatibility package is removed
+ case q"Chisel.`package`.is.apply( ..$params )( ..$body )" => List(q"$sc.is( ..$params )( ..$body )")
+ case q"chisel.util.is.apply( ..$params )( ..$body )" => List(q"$sc.is( ..$params )( ..$body )")
case b => throw new Exception(s"Cannot include blocks that do not begin with is() in switch.")
}
val q"..$body" = x
diff --git a/src/main/scala/Chisel/util/Counter.scala b/src/main/scala/chisel/util/Counter.scala
index 872e830a..1c0b0203 100644
--- a/src/main/scala/Chisel/util/Counter.scala
+++ b/src/main/scala/chisel/util/Counter.scala
@@ -1,6 +1,8 @@
// See LICENSE for license details.
-package Chisel
+package chisel.util
+
+import chisel._
/** A counter module
* @param n number of counts before the counter resets (or one more than the
diff --git a/src/main/scala/Chisel/util/Decoupled.scala b/src/main/scala/chisel/util/Decoupled.scala
index 8e045855..89b0e39d 100644
--- a/src/main/scala/Chisel/util/Decoupled.scala
+++ b/src/main/scala/chisel/util/Decoupled.scala
@@ -3,7 +3,9 @@
/** Wrappers for ready-valid (Decoupled) interfaces and associated circuit generators using them.
*/
-package Chisel
+package chisel.util
+
+import chisel._
/** An I/O Bundle with simple handshaking using valid and ready signals for data 'bits'*/
class DecoupledIO[+T <: Data](gen: T) extends Bundle
@@ -108,7 +110,7 @@ class Queue[T <: Data](gen: T, val entries: Int,
extends Module(override_reset=override_reset) {
def this(gen: T, entries: Int, pipe: Boolean, flow: Boolean, _reset: Bool) =
this(gen, entries, pipe, flow, Some(_reset))
-
+
val io = new QueueIO(gen, entries)
val ram = Mem(entries, gen)
diff --git a/src/main/scala/Chisel/util/Enum.scala b/src/main/scala/chisel/util/Enum.scala
index 20057197..8babcd23 100644
--- a/src/main/scala/Chisel/util/Enum.scala
+++ b/src/main/scala/chisel/util/Enum.scala
@@ -3,7 +3,9 @@
/** Enum generators, allowing circuit constants to have more meaningful names.
*/
-package Chisel
+package chisel.util
+
+import chisel._
object Enum {
/** Returns a sequence of Bits subtypes with values from 0 until n. Helper method. */
diff --git a/src/main/scala/Chisel/ImplicitConversions.scala b/src/main/scala/chisel/util/ImplicitConversions.scala
index 6a230022..846c0cbd 100644
--- a/src/main/scala/Chisel/ImplicitConversions.scala
+++ b/src/main/scala/chisel/util/ImplicitConversions.scala
@@ -1,6 +1,8 @@
// See LICENSE for license details.
-package Chisel
+package chisel.util
+
+import chisel._
object ImplicitConversions {
implicit def intToUInt(x: Int): UInt = UInt(x)
diff --git a/src/main/scala/Chisel/util/LFSR.scala b/src/main/scala/chisel/util/LFSR.scala
index 839b1d1f..f70630bf 100644
--- a/src/main/scala/Chisel/util/LFSR.scala
+++ b/src/main/scala/chisel/util/LFSR.scala
@@ -3,7 +3,9 @@
/** LFSRs in all shapes and sizes.
*/
-package Chisel
+package chisel.util
+
+import chisel._
// scalastyle:off magic.number
/** linear feedback shift register
diff --git a/src/main/scala/Chisel/util/Lookup.scala b/src/main/scala/chisel/util/Lookup.scala
index 54922fc4..d32d9aec 100644
--- a/src/main/scala/Chisel/util/Lookup.scala
+++ b/src/main/scala/chisel/util/Lookup.scala
@@ -1,6 +1,8 @@
// See LICENSE for license details.
-package Chisel
+package chisel.util
+
+import chisel._
object ListLookup {
def apply[T <: Data](addr: UInt, default: List[T], mapping: Array[(BitPat, List[T])]): List[T] = {
diff --git a/src/main/scala/Chisel/util/Math.scala b/src/main/scala/chisel/util/Math.scala
index 5f8212d8..69464d15 100644
--- a/src/main/scala/Chisel/util/Math.scala
+++ b/src/main/scala/chisel/util/Math.scala
@@ -3,7 +3,9 @@
/** Scala-land math helper functions, like logs.
*/
-package Chisel
+package chisel.util
+
+import chisel._
/** Compute the log2 rounded up with min value of 1 */
object log2Up {
diff --git a/src/main/scala/Chisel/util/Mux.scala b/src/main/scala/chisel/util/Mux.scala
index 9d92321a..6f074a7e 100644
--- a/src/main/scala/Chisel/util/Mux.scala
+++ b/src/main/scala/chisel/util/Mux.scala
@@ -3,7 +3,10 @@
/** Mux circuit generators.
*/
-package Chisel
+package chisel.util
+
+import chisel._
+import chisel.core.SeqUtils
/** Builds a Mux tree out of the input signal vector using a one hot encoded
select signal. Returns the output of the Mux tree.
diff --git a/src/main/scala/Chisel/util/OneHot.scala b/src/main/scala/chisel/util/OneHot.scala
index 73f27403..ef21c65d 100644
--- a/src/main/scala/Chisel/util/OneHot.scala
+++ b/src/main/scala/chisel/util/OneHot.scala
@@ -3,7 +3,9 @@
/** Circuit generators for working with one-hot representations.
*/
-package Chisel
+package chisel.util
+
+import chisel._
/** Converts from One Hot Encoding to a UInt indicating which bit is active
* This is the inverse of [[Chisel.UIntToOH UIntToOH]]*/
diff --git a/src/main/scala/Chisel/util/Reg.scala b/src/main/scala/chisel/util/Reg.scala
index 6584a4bf..1b40646d 100644
--- a/src/main/scala/Chisel/util/Reg.scala
+++ b/src/main/scala/chisel/util/Reg.scala
@@ -3,7 +3,9 @@
/** Variations and helpers for registers.
*/
-package Chisel
+package chisel.util
+
+import chisel._
object RegNext {
diff --git a/src/main/scala/Chisel/util/TransitName.scala b/src/main/scala/chisel/util/TransitName.scala
index ec5a11cc..04e1995b 100644
--- a/src/main/scala/Chisel/util/TransitName.scala
+++ b/src/main/scala/chisel/util/TransitName.scala
@@ -1,5 +1,6 @@
-package Chisel
+package chisel.util
+import chisel._
import internal.HasId
object TransitName {
diff --git a/src/main/scala/Chisel/util/Valid.scala b/src/main/scala/chisel/util/Valid.scala
index 9e2202bb..56ac9abb 100644
--- a/src/main/scala/Chisel/util/Valid.scala
+++ b/src/main/scala/chisel/util/Valid.scala
@@ -3,7 +3,9 @@
/** Wrappers for valid interfaces and associated circuit generators using them.
*/
-package Chisel
+package chisel.util
+
+import chisel._
/** An I/O Bundle containing data and a signal determining if it is valid */
class ValidIO[+T <: Data](gen2: T) extends Bundle
diff --git a/src/test/scala/chiselTests/Assert.scala b/src/test/scala/chiselTests/Assert.scala
index 24eb8b55..eb8617b2 100644
--- a/src/test/scala/chiselTests/Assert.scala
+++ b/src/test/scala/chiselTests/Assert.scala
@@ -3,8 +3,9 @@
package chiselTests
import org.scalatest._
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
class FailingAssertTester() extends BasicTester {
assert(Bool(false))
diff --git a/src/test/scala/chiselTests/BitwiseOps.scala b/src/test/scala/chiselTests/BitwiseOps.scala
index 19aa956c..0c1d4d74 100644
--- a/src/test/scala/chiselTests/BitwiseOps.scala
+++ b/src/test/scala/chiselTests/BitwiseOps.scala
@@ -2,10 +2,10 @@
package chiselTests
-import Chisel._
+import chisel._
import org.scalatest._
import org.scalatest.prop._
-import Chisel.testers.BasicTester
+import chisel.testers.BasicTester
class BitwiseOpsTester(w: Int, _a: Int, _b: Int) extends BasicTester {
val mask = (1 << w) - 1
diff --git a/src/test/scala/chiselTests/BlackBox.scala b/src/test/scala/chiselTests/BlackBox.scala
index ca94087c..b77550c1 100644
--- a/src/test/scala/chiselTests/BlackBox.scala
+++ b/src/test/scala/chiselTests/BlackBox.scala
@@ -4,8 +4,10 @@ package chiselTests
import java.io.File
import org.scalatest._
-import Chisel._
-import Chisel.testers.BasicTester
+
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
class BlackBoxInverter extends BlackBox {
val io = new Bundle() {
diff --git a/src/test/scala/chiselTests/BundleWire.scala b/src/test/scala/chiselTests/BundleWire.scala
index d2e42fa9..36dbb365 100644
--- a/src/test/scala/chiselTests/BundleWire.scala
+++ b/src/test/scala/chiselTests/BundleWire.scala
@@ -1,10 +1,10 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
+import chisel._
import org.scalatest._
import org.scalatest.prop._
-import Chisel.testers.BasicTester
+import chisel.testers.BasicTester
class Coord extends Bundle {
val x = UInt(width = 32)
diff --git a/src/test/scala/chiselTests/ChiselSpec.scala b/src/test/scala/chiselTests/ChiselSpec.scala
index da68b0cb..9c66b0db 100644
--- a/src/test/scala/chiselTests/ChiselSpec.scala
+++ b/src/test/scala/chiselTests/ChiselSpec.scala
@@ -6,8 +6,8 @@ import java.io.File
import org.scalatest._
import org.scalatest.prop._
import org.scalacheck._
-import Chisel._
-import Chisel.testers._
+import chisel._
+import chisel.testers._
/** Common utility functions for Chisel unit tests. */
trait ChiselRunners extends Assertions {
diff --git a/src/test/scala/chiselTests/ComplexAssign.scala b/src/test/scala/chiselTests/ComplexAssign.scala
index d79a2625..53a6a67d 100644
--- a/src/test/scala/chiselTests/ComplexAssign.scala
+++ b/src/test/scala/chiselTests/ComplexAssign.scala
@@ -1,11 +1,13 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
+
import org.scalatest._
import org.scalatest.prop._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
class Complex[T <: Data](val re: T, val im: T) extends Bundle {
override def cloneType: this.type =
diff --git a/src/test/scala/chiselTests/Counter.scala b/src/test/scala/chiselTests/Counter.scala
index 07a76cdc..963c1c92 100644
--- a/src/test/scala/chiselTests/Counter.scala
+++ b/src/test/scala/chiselTests/Counter.scala
@@ -1,10 +1,13 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
+
import org.scalatest._
import org.scalatest.prop._
-import Chisel.testers.BasicTester
+
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
class CountTester(max: Int) extends BasicTester {
val cnt = Counter(max)
diff --git a/src/test/scala/chiselTests/Decoder.scala b/src/test/scala/chiselTests/Decoder.scala
index e5cdfd07..33980955 100644
--- a/src/test/scala/chiselTests/Decoder.scala
+++ b/src/test/scala/chiselTests/Decoder.scala
@@ -1,11 +1,14 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
+
import org.scalatest._
import org.scalatest.prop._
import org.scalacheck._
-import Chisel.testers.BasicTester
+
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
class Decoder(bitpats: List[String]) extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/DeqIOSpec.scala b/src/test/scala/chiselTests/DeqIOSpec.scala
index 8f7937ab..95160140 100644
--- a/src/test/scala/chiselTests/DeqIOSpec.scala
+++ b/src/test/scala/chiselTests/DeqIOSpec.scala
@@ -2,8 +2,9 @@
package chiselTests
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
/**
* Created by chick on 2/8/16.
diff --git a/src/test/scala/chiselTests/Direction.scala b/src/test/scala/chiselTests/Direction.scala
index dd2f6572..3ed543aa 100644
--- a/src/test/scala/chiselTests/Direction.scala
+++ b/src/test/scala/chiselTests/Direction.scala
@@ -2,10 +2,10 @@
package chiselTests
-import Chisel._
+import chisel._
import org.scalatest._
import org.scalatest.prop._
-import Chisel.testers.BasicTester
+import chisel.testers.BasicTester
class DirectionHaver extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/EnableShiftRegister.scala b/src/test/scala/chiselTests/EnableShiftRegister.scala
index 6600df2a..30fc2486 100644
--- a/src/test/scala/chiselTests/EnableShiftRegister.scala
+++ b/src/test/scala/chiselTests/EnableShiftRegister.scala
@@ -1,8 +1,8 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
class EnableShiftRegister extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/GCD.scala b/src/test/scala/chiselTests/GCD.scala
index a1bfffda..77452db6 100644
--- a/src/test/scala/chiselTests/GCD.scala
+++ b/src/test/scala/chiselTests/GCD.scala
@@ -2,8 +2,8 @@
package chiselTests
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
import org.scalatest._
import org.scalatest.prop._
diff --git a/src/test/scala/chiselTests/Harness.scala b/src/test/scala/chiselTests/Harness.scala
index bc838766..805e2de9 100644
--- a/src/test/scala/chiselTests/Harness.scala
+++ b/src/test/scala/chiselTests/Harness.scala
@@ -1,13 +1,14 @@
// See LICENSE for license details.
package chiselTests
-import Chisel.testers.BasicTester
+
+import chisel.testers.BasicTester
import org.scalatest._
import org.scalatest.prop._
import java.io.File
class HarnessSpec extends ChiselPropSpec
- with Chisel.BackendCompilationUtilities {
+ with chisel.BackendCompilationUtilities {
def makeTrivialVerilog: (File => File) = makeHarness((prefix: String) => s"""
module ${prefix};
diff --git a/src/test/scala/chiselTests/LFSR16.scala b/src/test/scala/chiselTests/LFSR16.scala
index ed76a296..b3e69884 100644
--- a/src/test/scala/chiselTests/LFSR16.scala
+++ b/src/test/scala/chiselTests/LFSR16.scala
@@ -1,8 +1,10 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
-import Chisel.testers.BasicTester
+
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
class LFSR16 extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/MemorySearch.scala b/src/test/scala/chiselTests/MemorySearch.scala
index 55b704a0..b48d2881 100644
--- a/src/test/scala/chiselTests/MemorySearch.scala
+++ b/src/test/scala/chiselTests/MemorySearch.scala
@@ -1,8 +1,9 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
-import Chisel.testers.BasicTester
+
+import chisel._
+import chisel.testers.BasicTester
class MemorySearch extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/Module.scala b/src/test/scala/chiselTests/Module.scala
index 88ba795b..64b00fab 100644
--- a/src/test/scala/chiselTests/Module.scala
+++ b/src/test/scala/chiselTests/Module.scala
@@ -1,7 +1,8 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
+
+import chisel._
class SimpleIO extends Bundle {
val in = UInt(INPUT, 32)
diff --git a/src/test/scala/chiselTests/MulLookup.scala b/src/test/scala/chiselTests/MulLookup.scala
index 49ba13c7..5e223f91 100644
--- a/src/test/scala/chiselTests/MulLookup.scala
+++ b/src/test/scala/chiselTests/MulLookup.scala
@@ -2,10 +2,10 @@
package chiselTests
-import Chisel._
+import chisel._
import org.scalatest._
import org.scalatest.prop._
-import Chisel.testers.BasicTester
+import chisel.testers.BasicTester
class MulLookup(val w: Int) extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/MultiAssign.scala b/src/test/scala/chiselTests/MultiAssign.scala
index 2f464123..152e6723 100644
--- a/src/test/scala/chiselTests/MultiAssign.scala
+++ b/src/test/scala/chiselTests/MultiAssign.scala
@@ -3,8 +3,10 @@
package chiselTests
import org.scalatest._
-import Chisel._
-import Chisel.testers.BasicTester
+
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
class LastAssignTester() extends BasicTester {
val cnt = Counter(2)
diff --git a/src/test/scala/chiselTests/OptionBundle.scala b/src/test/scala/chiselTests/OptionBundle.scala
index c5a347e6..ab3b6860 100644
--- a/src/test/scala/chiselTests/OptionBundle.scala
+++ b/src/test/scala/chiselTests/OptionBundle.scala
@@ -3,8 +3,8 @@
package chiselTests
import org.scalatest._
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
class OptionBundle(hasIn: Boolean) extends Bundle {
val in = if (hasIn) {
diff --git a/src/test/scala/chiselTests/Padding.scala b/src/test/scala/chiselTests/Padding.scala
index 999b7d36..03496649 100644
--- a/src/test/scala/chiselTests/Padding.scala
+++ b/src/test/scala/chiselTests/Padding.scala
@@ -1,7 +1,8 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
+
+import chisel._
class Padder extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/ParameterizedModule.scala b/src/test/scala/chiselTests/ParameterizedModule.scala
index 35e3ba78..e2629224 100644
--- a/src/test/scala/chiselTests/ParameterizedModule.scala
+++ b/src/test/scala/chiselTests/ParameterizedModule.scala
@@ -3,8 +3,8 @@
package chiselTests
import org.scalatest._
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
class ParameterizedModule(invert: Boolean) extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/Printf.scala b/src/test/scala/chiselTests/Printf.scala
index eb8b4b25..b5e1e66e 100644
--- a/src/test/scala/chiselTests/Printf.scala
+++ b/src/test/scala/chiselTests/Printf.scala
@@ -3,8 +3,8 @@
package chiselTests
import org.scalatest._
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
class SinglePrintfTester() extends BasicTester {
val x = UInt(254)
diff --git a/src/test/scala/chiselTests/Reg.scala b/src/test/scala/chiselTests/Reg.scala
index f2620d88..8954c3ef 100644
--- a/src/test/scala/chiselTests/Reg.scala
+++ b/src/test/scala/chiselTests/Reg.scala
@@ -3,8 +3,8 @@
package chiselTests
import org.scalatest._
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
class RegSpec extends ChiselFlatSpec {
"A Reg" should "throw an exception if not given any parameters" in {
diff --git a/src/test/scala/chiselTests/Risc.scala b/src/test/scala/chiselTests/Risc.scala
index 3daa5bd2..741e9896 100644
--- a/src/test/scala/chiselTests/Risc.scala
+++ b/src/test/scala/chiselTests/Risc.scala
@@ -1,7 +1,9 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
+
+import chisel._
+import chisel.util._
class Risc extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/SIntOps.scala b/src/test/scala/chiselTests/SIntOps.scala
index 0835fb4d..07111af6 100644
--- a/src/test/scala/chiselTests/SIntOps.scala
+++ b/src/test/scala/chiselTests/SIntOps.scala
@@ -1,8 +1,9 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
-import Chisel.testers.BasicTester
+
+import chisel._
+import chisel.testers.BasicTester
class SIntOps extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/Stack.scala b/src/test/scala/chiselTests/Stack.scala
index ac799c8a..0ce228de 100644
--- a/src/test/scala/chiselTests/Stack.scala
+++ b/src/test/scala/chiselTests/Stack.scala
@@ -1,8 +1,11 @@
// See LICENSE for license details.
package chiselTests
+
import scala.collection.mutable.Stack
-import Chisel._
+
+import chisel._
+import chisel.util._
class ChiselStack(val depth: Int) extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/Stop.scala b/src/test/scala/chiselTests/Stop.scala
index 878f090c..d57eb7c6 100644
--- a/src/test/scala/chiselTests/Stop.scala
+++ b/src/test/scala/chiselTests/Stop.scala
@@ -3,8 +3,8 @@
package chiselTests
import org.scalatest._
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
class StopTester() extends BasicTester {
stop()
diff --git a/src/test/scala/chiselTests/Tbl.scala b/src/test/scala/chiselTests/Tbl.scala
index c79eb8a4..2049d8bb 100644
--- a/src/test/scala/chiselTests/Tbl.scala
+++ b/src/test/scala/chiselTests/Tbl.scala
@@ -2,10 +2,12 @@
package chiselTests
-import Chisel._
import org.scalatest._
import org.scalatest.prop._
-import Chisel.testers.BasicTester
+
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
class Tbl(w: Int, n: Int) extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/TesterDriverSpec.scala b/src/test/scala/chiselTests/TesterDriverSpec.scala
index 3c57daae..50290fab 100644
--- a/src/test/scala/chiselTests/TesterDriverSpec.scala
+++ b/src/test/scala/chiselTests/TesterDriverSpec.scala
@@ -2,8 +2,9 @@
package chiselTests
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
/** Extend BasicTester with a simple circuit and finish method. TesterDriver will call the
* finish method after the FinishTester's constructor has completed, which will alter the
diff --git a/src/test/scala/chiselTests/UIntOps.scala b/src/test/scala/chiselTests/UIntOps.scala
index bb0b0f06..8b2a31fd 100644
--- a/src/test/scala/chiselTests/UIntOps.scala
+++ b/src/test/scala/chiselTests/UIntOps.scala
@@ -1,9 +1,10 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
+
+import chisel._
import org.scalatest._
-import Chisel.testers.BasicTester
+import chisel.testers.BasicTester
class UIntOps extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/Vec.scala b/src/test/scala/chiselTests/Vec.scala
index 943d9e4b..35a0c8bc 100644
--- a/src/test/scala/chiselTests/Vec.scala
+++ b/src/test/scala/chiselTests/Vec.scala
@@ -2,10 +2,12 @@
package chiselTests
-import Chisel._
import org.scalatest._
import org.scalatest.prop._
-import Chisel.testers.BasicTester
+
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
class ValueTester(w: Int, values: List[Int]) extends BasicTester {
val v = Vec(values.map(UInt(_, width = w))) // TODO: does this need a Wire? Why no error?
diff --git a/src/test/scala/chiselTests/VectorPacketIO.scala b/src/test/scala/chiselTests/VectorPacketIO.scala
index 99ec66a6..a1282071 100644
--- a/src/test/scala/chiselTests/VectorPacketIO.scala
+++ b/src/test/scala/chiselTests/VectorPacketIO.scala
@@ -2,8 +2,9 @@
package chiselTests
-import Chisel._
-import Chisel.testers.BasicTester
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
/**
* This test used to fail when assignment statements were
diff --git a/src/test/scala/chiselTests/VendingMachine.scala b/src/test/scala/chiselTests/VendingMachine.scala
index 012fc493..0d621e6a 100644
--- a/src/test/scala/chiselTests/VendingMachine.scala
+++ b/src/test/scala/chiselTests/VendingMachine.scala
@@ -1,7 +1,9 @@
// See LICENSE for license details.
package chiselTests
-import Chisel._
+
+import chisel._
+import chisel.util._
class VendingMachine extends Module {
val io = new Bundle {
diff --git a/src/test/scala/chiselTests/When.scala b/src/test/scala/chiselTests/When.scala
index a6572706..1c9c3bc5 100644
--- a/src/test/scala/chiselTests/When.scala
+++ b/src/test/scala/chiselTests/When.scala
@@ -3,8 +3,10 @@
package chiselTests
import org.scalatest._
-import Chisel._
-import Chisel.testers.BasicTester
+
+import chisel._
+import chisel.testers.BasicTester
+import chisel.util._
class WhenTester() extends BasicTester {
val cnt = Counter(4)