summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorJim Lawson2016-07-06 09:31:47 -0700
committerJim Lawson2016-07-18 15:49:45 -0700
commit12810b5efe6a8f872fbc1c63cdfb835ca354624f (patch)
tree1fe4d0666e28f15880bbaf164592bd2bba1eff7c /src/main
parentc5f9ea3133ef363ff8944e17d94fea79767b6bed (diff)
Update Chisel -> chisel3 references.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/scala/chisel3/Driver.scala3
-rw-r--r--src/main/scala/chisel3/compatibility/FileSystemUtilities.scala4
-rw-r--r--src/main/scala/chisel3/compatibility/Main.scala4
-rw-r--r--src/main/scala/chisel3/compatibility/throwException.scala4
-rw-r--r--src/main/scala/chisel3/internal/firrtl/Emitter.scala8
-rw-r--r--src/main/scala/chisel3/package.scala82
-rw-r--r--src/main/scala/chisel3/testers/BasicTester.scala4
-rw-r--r--src/main/scala/chisel3/testers/TesterDriver.scala5
-rw-r--r--src/main/scala/chisel3/util/Arbiter.scala4
-rw-r--r--src/main/scala/chisel3/util/BitPat.scala5
-rw-r--r--src/main/scala/chisel3/util/Bitwise.scala5
-rw-r--r--src/main/scala/chisel3/util/Cat.scala5
-rw-r--r--src/main/scala/chisel3/util/CircuitMath.scala4
-rw-r--r--src/main/scala/chisel3/util/Conditional.scala8
-rw-r--r--src/main/scala/chisel3/util/Counter.scala4
-rw-r--r--src/main/scala/chisel3/util/Decoupled.scala4
-rw-r--r--src/main/scala/chisel3/util/Enum.scala4
-rw-r--r--src/main/scala/chisel3/util/ImplicitConversions.scala4
-rw-r--r--src/main/scala/chisel3/util/LFSR.scala4
-rw-r--r--src/main/scala/chisel3/util/Lookup.scala4
-rw-r--r--src/main/scala/chisel3/util/Math.scala4
-rw-r--r--src/main/scala/chisel3/util/Mux.scala9
-rw-r--r--src/main/scala/chisel3/util/OneHot.scala4
-rw-r--r--src/main/scala/chisel3/util/Reg.scala4
-rw-r--r--src/main/scala/chisel3/util/TransitName.scala3
-rw-r--r--src/main/scala/chisel3/util/Valid.scala4
26 files changed, 160 insertions, 37 deletions
diff --git a/src/main/scala/chisel3/Driver.scala b/src/main/scala/chisel3/Driver.scala
index 02204684..0979314f 100644
--- a/src/main/scala/chisel3/Driver.scala
+++ b/src/main/scala/chisel3/Driver.scala
@@ -1,6 +1,6 @@
// See LICENSE for license details.
-package Chisel
+package chisel3
import scala.sys.process._
import java.io._
@@ -71,6 +71,7 @@ trait BackendCompilationUtilities {
"--top-module", topModule,
"+define+TOP_TYPE=V" + dutFile,
s"+define+PRINTF_COND=!$topModule.reset",
+ s"+define+STOP_COND=!$topModule.reset",
"-CFLAGS",
s"""-Wno-undefined-bool-conversion -O2 -DTOP_TYPE=V$dutFile -include V$dutFile.h""",
"-Mdir", dir.toString,
diff --git a/src/main/scala/chisel3/compatibility/FileSystemUtilities.scala b/src/main/scala/chisel3/compatibility/FileSystemUtilities.scala
index 575ae138..cd47c731 100644
--- a/src/main/scala/chisel3/compatibility/FileSystemUtilities.scala
+++ b/src/main/scala/chisel3/compatibility/FileSystemUtilities.scala
@@ -1,6 +1,8 @@
// See LICENSE for license details.
-package Chisel
+package chisel3.compatibility
+
+import chisel3._
@deprecated("FileSystemUtilities doesn't exist in chisel3", "3.0.0")
trait FileSystemUtilities {
diff --git a/src/main/scala/chisel3/compatibility/Main.scala b/src/main/scala/chisel3/compatibility/Main.scala
index a72debc3..a41599a3 100644
--- a/src/main/scala/chisel3/compatibility/Main.scala
+++ b/src/main/scala/chisel3/compatibility/Main.scala
@@ -1,9 +1,11 @@
// See LICENSE for license details.
-package Chisel
+package chisel3.compatibility
import java.io.File
+import chisel3._
+
@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/chisel3/compatibility/throwException.scala b/src/main/scala/chisel3/compatibility/throwException.scala
index 702884aa..3e8b33e6 100644
--- a/src/main/scala/chisel3/compatibility/throwException.scala
+++ b/src/main/scala/chisel3/compatibility/throwException.scala
@@ -1,6 +1,8 @@
// See LICENSE for license details.
-package Chisel
+package chisel3.compatibility
+
+import chisel3._
@deprecated("throwException doesn't exist in Chisel3", "3.0.0")
@throws(classOf[Exception])
diff --git a/src/main/scala/chisel3/internal/firrtl/Emitter.scala b/src/main/scala/chisel3/internal/firrtl/Emitter.scala
index 7ca3268a..08646cf9 100644
--- a/src/main/scala/chisel3/internal/firrtl/Emitter.scala
+++ b/src/main/scala/chisel3/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 chisel3.internal.firrtl
+import chisel3._
+import chisel3.internal.sourceinfo.{NoSourceInfo, SourceLine}
-private[Chisel] object Emitter {
+private[chisel3] object Emitter {
def emit(circuit: Circuit): String = new Emitter(circuit).toString
}
diff --git a/src/main/scala/chisel3/package.scala b/src/main/scala/chisel3/package.scala
index f05e8b5d..35bbd1c4 100644
--- a/src/main/scala/chisel3/package.scala
+++ b/src/main/scala/chisel3/package.scala
@@ -1,12 +1,88 @@
-package object Chisel {
+package object chisel3 {
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())
+
+ import util.BitPat
+
+
+ type Direction = chisel3.core.Direction
+ type Data = chisel3.core.Data
+ val Wire = chisel3.core.Wire
+ val Clock = chisel3.core.Clock
+ type Clock = chisel3.core.Clock
+
+ type Aggregate = chisel3.core.Aggregate
+ val Vec = chisel3.core.Vec
+ type Vec[T <: Data] = chisel3.core.Vec[T]
+ type VecLike[T <: Data] = chisel3.core.VecLike[T]
+ type Bundle = chisel3.core.Bundle
+
+ val assert = chisel3.core.assert
+
+ type Element = chisel3.core.Element
+ type Bits = chisel3.core.Bits
+ val Bits = chisel3.core.Bits
+ type Num[T <: Data] = chisel3.core.Num[T]
+ type UInt = chisel3.core.UInt
+ val UInt = chisel3.core.UInt
+ type SInt = chisel3.core.SInt
+ val SInt = chisel3.core.SInt
+ type Bool = chisel3.core.Bool
+ val Bool = chisel3.core.Bool
+ val Mux = chisel3.core.Mux
+
+ type BlackBox = chisel3.core.BlackBox
+
+ val Mem = chisel3.core.Mem
+ type MemBase[T <: Data] = chisel3.core.MemBase[T]
+ type Mem[T <: Data] = chisel3.core.Mem[T]
+ val SeqMem = chisel3.core.SeqMem
+ type SeqMem[T <: Data] = chisel3.core.SeqMem[T]
+
+ val Module = chisel3.core.Module
+ type Module = chisel3.core.Module
+
+ val printf = chisel3.core.printf
+
+ val Reg = chisel3.core.Reg
+
+ val when = chisel3.core.when
+ type WhenContext = chisel3.core.WhenContext
+
+ /**
+ * These implicit classes allow one to convert scala.Int|scala.BigInt to
+ * Chisel.UInt|Chisel.SInt by calling .asUInt|.asSInt on them, respectively.
+ * The versions .asUInt(width)|.asSInt(width) are also available to explicitly
+ * mark a width for the new literal.
+ *
+ * Also provides .asBool to scala.Boolean and .asUInt to String
+ *
+ * Note that, for stylistic reasons, one hould avoid extracting immediately
+ * after this call using apply, ie. 0.asUInt(1)(0) due to potential for
+ * confusion (the 1 is a bit length and the 0 is a bit extraction position).
+ * Prefer storing the result and then extracting from it.
+ */
+ implicit class addLiteraltoScalaInt(val target: Int) extends AnyVal {
+ def asUInt() = UInt.Lit(target)
+ def asSInt() = SInt.Lit(target)
+ def asUInt(width: Int) = UInt.Lit(target, width)
+ def asSInt(width: Int) = SInt.Lit(target, width)
+
+ // These were recently added to chisel2/3 but are not to be used internally
+ @deprecated("asUInt should be used over U", "gchisel")
+ def U() = UInt.Lit(target)
+ @deprecated("asSInt should be used over S", "gchisel")
+ def S() = SInt.Lit(target)
+ @deprecated("asUInt should be used over U", "gchisel")
+ def U(width: Int) = UInt.Lit(target, width)
+ @deprecated("asSInt should be used over S", "gchisel")
+ def S(width: Int) = SInt.Lit(target, width)
}
implicit class fromIntToLiteral(val x: Int) extends AnyVal {
def U: UInt = UInt(BigInt(x), Width())
@@ -23,7 +99,7 @@ package object Chisel {
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/chisel3/testers/BasicTester.scala b/src/main/scala/chisel3/testers/BasicTester.scala
index b8c1494a..f91536d5 100644
--- a/src/main/scala/chisel3/testers/BasicTester.scala
+++ b/src/main/scala/chisel3/testers/BasicTester.scala
@@ -1,7 +1,7 @@
// See LICENSE for license details.
-package Chisel.testers
-import Chisel._
+package chisel3.testers
+import chisel3._
import scala.language.experimental.macros
diff --git a/src/main/scala/chisel3/testers/TesterDriver.scala b/src/main/scala/chisel3/testers/TesterDriver.scala
index a56bb8b7..586fa780 100644
--- a/src/main/scala/chisel3/testers/TesterDriver.scala
+++ b/src/main/scala/chisel3/testers/TesterDriver.scala
@@ -1,7 +1,8 @@
// See LICENSE for license details.
-package Chisel.testers
-import Chisel._
+package chisel3.testers
+
+import chisel3._
import scala.io.Source
import scala.sys.process._
import java.io._
diff --git a/src/main/scala/chisel3/util/Arbiter.scala b/src/main/scala/chisel3/util/Arbiter.scala
index 16ae9be5..eb541977 100644
--- a/src/main/scala/chisel3/util/Arbiter.scala
+++ b/src/main/scala/chisel3/util/Arbiter.scala
@@ -3,7 +3,9 @@
/** Arbiters in all shapes and sizes.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
/** An I/O bundle for the Arbiter */
class ArbiterIO[T <: Data](gen: T, n: Int) extends Bundle {
diff --git a/src/main/scala/chisel3/util/BitPat.scala b/src/main/scala/chisel3/util/BitPat.scala
index 96206f63..9eb5cf67 100644
--- a/src/main/scala/chisel3/util/BitPat.scala
+++ b/src/main/scala/chisel3/util/BitPat.scala
@@ -1,10 +1,11 @@
// See LICENSE for license details.
-package Chisel
+package chisel3.util
import scala.language.experimental.macros
-import Chisel.internal.sourceinfo.{SourceInfo, SourceInfoTransform}
+import chisel3._
+import chisel3.internal.sourceinfo.{SourceInfo, SourceInfoTransform}
object BitPat {
/** Parses a bit pattern string into (bits, mask, width).
diff --git a/src/main/scala/chisel3/util/Bitwise.scala b/src/main/scala/chisel3/util/Bitwise.scala
index 239a295e..ab1ff550 100644
--- a/src/main/scala/chisel3/util/Bitwise.scala
+++ b/src/main/scala/chisel3/util/Bitwise.scala
@@ -3,7 +3,10 @@
/** Miscellaneous circuit generators operating on bits.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
+import chisel3.core.SeqUtils
object FillInterleaved
{
diff --git a/src/main/scala/chisel3/util/Cat.scala b/src/main/scala/chisel3/util/Cat.scala
index dd706e62..469bf9ab 100644
--- a/src/main/scala/chisel3/util/Cat.scala
+++ b/src/main/scala/chisel3/util/Cat.scala
@@ -1,6 +1,9 @@
// See LICENSE for license details.
-package Chisel
+package chisel3.util
+
+import chisel3._
+import chisel3.core.SeqUtils
object Cat {
/** Combine data elements together
diff --git a/src/main/scala/chisel3/util/CircuitMath.scala b/src/main/scala/chisel3/util/CircuitMath.scala
index 06cab903..1174c71c 100644
--- a/src/main/scala/chisel3/util/CircuitMath.scala
+++ b/src/main/scala/chisel3/util/CircuitMath.scala
@@ -3,7 +3,9 @@
/** Circuit-land math operations.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
/** 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/chisel3/util/Conditional.scala b/src/main/scala/chisel3/util/Conditional.scala
index 9cab25ef..6218feb0 100644
--- a/src/main/scala/chisel3/util/Conditional.scala
+++ b/src/main/scala/chisel3/util/Conditional.scala
@@ -3,13 +3,15 @@
/** Conditional blocks.
*/
-package Chisel
+package chisel3.util
import scala.language.reflectiveCalls
import scala.language.experimental.macros
import scala.reflect.runtime.universe._
import scala.reflect.macros.blackbox._
+import chisel3._
+
/** 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"chisel3.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/chisel3/util/Counter.scala b/src/main/scala/chisel3/util/Counter.scala
index 872e830a..40615769 100644
--- a/src/main/scala/chisel3/util/Counter.scala
+++ b/src/main/scala/chisel3/util/Counter.scala
@@ -1,6 +1,8 @@
// See LICENSE for license details.
-package Chisel
+package chisel3.util
+
+import chisel3._
/** A counter module
* @param n number of counts before the counter resets (or one more than the
diff --git a/src/main/scala/chisel3/util/Decoupled.scala b/src/main/scala/chisel3/util/Decoupled.scala
index 8e045855..339fde7c 100644
--- a/src/main/scala/chisel3/util/Decoupled.scala
+++ b/src/main/scala/chisel3/util/Decoupled.scala
@@ -3,7 +3,9 @@
/** Wrappers for ready-valid (Decoupled) interfaces and associated circuit generators using them.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
/** An I/O Bundle with simple handshaking using valid and ready signals for data 'bits'*/
class DecoupledIO[+T <: Data](gen: T) extends Bundle
diff --git a/src/main/scala/chisel3/util/Enum.scala b/src/main/scala/chisel3/util/Enum.scala
index 20057197..4ecc243b 100644
--- a/src/main/scala/chisel3/util/Enum.scala
+++ b/src/main/scala/chisel3/util/Enum.scala
@@ -3,7 +3,9 @@
/** Enum generators, allowing circuit constants to have more meaningful names.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
object Enum {
/** Returns a sequence of Bits subtypes with values from 0 until n. Helper method. */
diff --git a/src/main/scala/chisel3/util/ImplicitConversions.scala b/src/main/scala/chisel3/util/ImplicitConversions.scala
index 6a230022..4d816a19 100644
--- a/src/main/scala/chisel3/util/ImplicitConversions.scala
+++ b/src/main/scala/chisel3/util/ImplicitConversions.scala
@@ -1,6 +1,8 @@
// See LICENSE for license details.
-package Chisel
+package chisel3.util
+
+import chisel3._
object ImplicitConversions {
implicit def intToUInt(x: Int): UInt = UInt(x)
diff --git a/src/main/scala/chisel3/util/LFSR.scala b/src/main/scala/chisel3/util/LFSR.scala
index 839b1d1f..a30c276f 100644
--- a/src/main/scala/chisel3/util/LFSR.scala
+++ b/src/main/scala/chisel3/util/LFSR.scala
@@ -3,7 +3,9 @@
/** LFSRs in all shapes and sizes.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
// scalastyle:off magic.number
/** linear feedback shift register
diff --git a/src/main/scala/chisel3/util/Lookup.scala b/src/main/scala/chisel3/util/Lookup.scala
index 54922fc4..9e909c0c 100644
--- a/src/main/scala/chisel3/util/Lookup.scala
+++ b/src/main/scala/chisel3/util/Lookup.scala
@@ -1,6 +1,8 @@
// See LICENSE for license details.
-package Chisel
+package chisel3.util
+
+import chisel3._
object ListLookup {
def apply[T <: Data](addr: UInt, default: List[T], mapping: Array[(BitPat, List[T])]): List[T] = {
diff --git a/src/main/scala/chisel3/util/Math.scala b/src/main/scala/chisel3/util/Math.scala
index 5f8212d8..73665f0f 100644
--- a/src/main/scala/chisel3/util/Math.scala
+++ b/src/main/scala/chisel3/util/Math.scala
@@ -3,7 +3,9 @@
/** Scala-land math helper functions, like logs.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
/** Compute the log2 rounded up with min value of 1 */
object log2Up {
diff --git a/src/main/scala/chisel3/util/Mux.scala b/src/main/scala/chisel3/util/Mux.scala
index 9d92321a..9956a7e3 100644
--- a/src/main/scala/chisel3/util/Mux.scala
+++ b/src/main/scala/chisel3/util/Mux.scala
@@ -3,7 +3,10 @@
/** Mux circuit generators.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
+import chisel3.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.
@@ -37,7 +40,7 @@ object MuxLookup {
* @param mapping a sequence to search of keys and values
* @return the value found or the default if not
*/
- def apply[S <: UInt, T <: Bits] (key: S, default: T, mapping: Seq[(S, T)]): T = {
+ def apply[S <: UInt, T <: Data] (key: S, default: T, mapping: Seq[(S, T)]): T = {
var res = default
for ((k, v) <- mapping.reverse)
res = Mux(k === key, v, res)
@@ -51,7 +54,7 @@ object MuxCase {
/** @param default the default value if none are enabled
* @param mapping a set of data values with associated enables
* @return the first value in mapping that is enabled */
- def apply[T <: Bits] (default: T, mapping: Seq[(Bool, T)]): T = {
+ def apply[T <: Data] (default: T, mapping: Seq[(Bool, T)]): T = {
var res = default
for ((t, v) <- mapping.reverse){
res = Mux(t, v, res)
diff --git a/src/main/scala/chisel3/util/OneHot.scala b/src/main/scala/chisel3/util/OneHot.scala
index 73f27403..820c72d6 100644
--- a/src/main/scala/chisel3/util/OneHot.scala
+++ b/src/main/scala/chisel3/util/OneHot.scala
@@ -3,7 +3,9 @@
/** Circuit generators for working with one-hot representations.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
/** 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/chisel3/util/Reg.scala b/src/main/scala/chisel3/util/Reg.scala
index 6584a4bf..81de4754 100644
--- a/src/main/scala/chisel3/util/Reg.scala
+++ b/src/main/scala/chisel3/util/Reg.scala
@@ -3,7 +3,9 @@
/** Variations and helpers for registers.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
object RegNext {
diff --git a/src/main/scala/chisel3/util/TransitName.scala b/src/main/scala/chisel3/util/TransitName.scala
index ec5a11cc..f36f926f 100644
--- a/src/main/scala/chisel3/util/TransitName.scala
+++ b/src/main/scala/chisel3/util/TransitName.scala
@@ -1,5 +1,6 @@
-package Chisel
+package chisel3.util
+import chisel3._
import internal.HasId
object TransitName {
diff --git a/src/main/scala/chisel3/util/Valid.scala b/src/main/scala/chisel3/util/Valid.scala
index 9e2202bb..78187ff6 100644
--- a/src/main/scala/chisel3/util/Valid.scala
+++ b/src/main/scala/chisel3/util/Valid.scala
@@ -3,7 +3,9 @@
/** Wrappers for valid interfaces and associated circuit generators using them.
*/
-package Chisel
+package chisel3.util
+
+import chisel3._
/** An I/O Bundle containing data and a signal determining if it is valid */
class ValidIO[+T <: Data](gen2: T) extends Bundle