summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/chisel3/util')
-rw-r--r--src/main/scala/chisel3/util/BitPat.scala10
-rw-r--r--src/main/scala/chisel3/util/Decoupled.scala13
-rw-r--r--src/main/scala/chisel3/util/Enum.scala2
-rw-r--r--src/main/scala/chisel3/util/Math.scala7
-rw-r--r--src/main/scala/chisel3/util/Valid.scala5
5 files changed, 27 insertions, 10 deletions
diff --git a/src/main/scala/chisel3/util/BitPat.scala b/src/main/scala/chisel3/util/BitPat.scala
index c962813d..8d6565fb 100644
--- a/src/main/scala/chisel3/util/BitPat.scala
+++ b/src/main/scala/chisel3/util/BitPat.scala
@@ -5,6 +5,7 @@ package chisel3.util
import scala.language.experimental.macros
import chisel3._
import chisel3.core.CompileOptions
+import chisel3.internal.chiselRuntimeDeprecated
import chisel3.internal.sourceinfo.{SourceInfo, SourceInfoTransform}
object BitPat {
@@ -53,6 +54,7 @@ object BitPat {
*/
def dontCare(width: Int): BitPat = BitPat("b" + ("?" * width))
+ @chiselRuntimeDeprecated
@deprecated("Use BitPat.dontCare", "chisel3")
def DC(width: Int): BitPat = dontCare(width) // scalastyle:ignore method.name
@@ -91,9 +93,7 @@ sealed class BitPat(val value: BigInt, val mask: BigInt, width: Int) {
def getWidth: Int = width
def === (that: UInt): Bool = macro SourceInfoTransform.thatArg
def =/= (that: UInt): Bool = macro SourceInfoTransform.thatArg
- @deprecated("Use '=/=', which avoids potential precedence problems", "chisel3")
- def != (that: UInt): Bool = macro SourceInfoTransform.thatArg
-
+
def do_=== (that: UInt) // scalastyle:ignore method.name
(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
value.asUInt === (that & mask.asUInt)
@@ -102,6 +102,10 @@ sealed class BitPat(val value: BigInt, val mask: BigInt, width: Int) {
(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
!(this === that)
}
+
+ def != (that: UInt): Bool = macro SourceInfoTransform.thatArg
+ @chiselRuntimeDeprecated
+ @deprecated("Use '=/=', which avoids potential precedence problems", "chisel3")
def do_!= (that: UInt) // scalastyle:ignore method.name
(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
this =/= that
diff --git a/src/main/scala/chisel3/util/Decoupled.scala b/src/main/scala/chisel3/util/Decoupled.scala
index d35046af..bcd65a1b 100644
--- a/src/main/scala/chisel3/util/Decoupled.scala
+++ b/src/main/scala/chisel3/util/Decoupled.scala
@@ -19,9 +19,16 @@ import chisel3.internal.naming._ // can't use chisel3_ version because of compi
*/
abstract class ReadyValidIO[+T <: Data](gen: T) extends Bundle
{
+ // Compatibility hack for rocket-chip
+ private val genType = (DataMirror.internal.isSynthesizable(gen), chisel3.internal.Builder.currentModule) match {
+ case (true, Some(module: chisel3.core.ImplicitModule))
+ if !module.compileOptions.declaredTypeMustBeUnbound => chiselTypeOf(gen)
+ case _ => gen
+ }
+
val ready = Input(Bool())
val valid = Output(Bool())
- val bits = Output(gen.chiselCloneType)
+ val bits = Output(genType)
}
object ReadyValidIO {
@@ -200,7 +207,7 @@ class Queue[T <: Data](gen: T,
gen
} else {
if (DataMirror.internal.isSynthesizable(gen)) {
- gen.chiselCloneType
+ chiselTypeOf(gen)
} else {
gen
}
@@ -226,7 +233,7 @@ class Queue[T <: Data](gen: T,
when (do_deq) {
deq_ptr.inc()
}
- when (do_enq != do_deq) {
+ when (do_enq =/= do_deq) {
maybe_full := do_enq
}
diff --git a/src/main/scala/chisel3/util/Enum.scala b/src/main/scala/chisel3/util/Enum.scala
index 2fdd1a92..92de56ea 100644
--- a/src/main/scala/chisel3/util/Enum.scala
+++ b/src/main/scala/chisel3/util/Enum.scala
@@ -6,6 +6,7 @@
package chisel3.util
import chisel3._
+import chisel3.internal.chiselRuntimeDeprecated
/** Defines a set of unique UInt constants
*
@@ -39,6 +40,7 @@ trait Enum {
}
object Enum extends Enum {
+ @chiselRuntimeDeprecated
@deprecated("use Enum(n)", "chisel3, will be removed soon")
def apply[T <: Bits](nodeType: T, n: Int): List[T] = {
require(nodeType.isInstanceOf[UInt], "Only UInt supported for enums")
diff --git a/src/main/scala/chisel3/util/Math.scala b/src/main/scala/chisel3/util/Math.scala
index cf75e756..3884ea21 100644
--- a/src/main/scala/chisel3/util/Math.scala
+++ b/src/main/scala/chisel3/util/Math.scala
@@ -6,10 +6,12 @@
package chisel3.util
import chisel3._
+import chisel3.internal.chiselRuntimeDeprecated
/** Compute the log2 rounded up with min value of 1 */
-@deprecated("Use log2Ceil instead", "chisel3")
object log2Up {
+ @chiselRuntimeDeprecated
+ @deprecated("Use log2Ceil instead", "chisel3")
def apply(in: BigInt): Int = Chisel.log2Up(in)
}
@@ -23,8 +25,9 @@ object log2Ceil {
}
/** Compute the log2 rounded down with min value of 1 */
-@deprecated("Use log2Floor instead", "chisel3")
object log2Down {
+ @chiselRuntimeDeprecated
+ @deprecated("Use log2Floor instead", "chisel3")
def apply(in: BigInt): Int = Chisel.log2Down(in)
}
diff --git a/src/main/scala/chisel3/util/Valid.scala b/src/main/scala/chisel3/util/Valid.scala
index 95f0dcea..67a1a362 100644
--- a/src/main/scala/chisel3/util/Valid.scala
+++ b/src/main/scala/chisel3/util/Valid.scala
@@ -7,13 +7,14 @@ package chisel3.util
import chisel3._
import chisel3.core.CompileOptions
+import chisel3.experimental.DataMirror
import chisel3.internal.naming.chiselName // can't use chisel3_ version because of compile order
/** An Bundle containing data and a signal determining if it is valid */
class Valid[+T <: Data](gen: T) extends Bundle
{
val valid = Output(Bool())
- val bits = Output(gen.chiselCloneType)
+ val bits = Output(gen)
def fire(dummy: Int = 0): Bool = valid
override def cloneType: this.type = Valid(gen).asInstanceOf[this.type]
}
@@ -39,7 +40,7 @@ object Pipe
@chiselName
def apply[T <: Data](enqValid: Bool, enqBits: T, latency: Int)(implicit compileOptions: CompileOptions): Valid[T] = {
if (latency == 0) {
- val out = Wire(Valid(enqBits))
+ val out = Wire(Valid(chiselTypeOf(enqBits)))
out.valid := enqValid
out.bits := enqBits
out