diff options
| author | Schuyler Eldridge | 2019-08-01 16:26:08 -0400 |
|---|---|---|
| committer | GitHub | 2019-08-01 16:26:08 -0400 |
| commit | b2a1bd7a10977d3331fee3022ec490a1aa1e0e17 (patch) | |
| tree | 059f29769a09d423b1f4e274ecce56ce570c0467 /src | |
| parent | ad396ea1a9c06abbe29c52802adbc6c087db0401 (diff) | |
| parent | 6c65a28756b8bb615479b1bcc420b28994419700 (diff) | |
Merge pull request #1139 from freechipsproject/deprecations-are-serious-business
Remove Deprecations since before 3.2
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/chisel3/compatibility.scala | 86 | ||||
| -rw-r--r-- | src/main/scala/chisel3/util/BitPat.scala | 8 | ||||
| -rw-r--r-- | src/main/scala/chisel3/util/Decoupled.scala | 10 | ||||
| -rw-r--r-- | src/main/scala/chisel3/util/Enum.scala | 10 | ||||
| -rw-r--r-- | src/main/scala/chisel3/util/LFSR.scala | 8 |
5 files changed, 88 insertions, 34 deletions
diff --git a/src/main/scala/chisel3/compatibility.scala b/src/main/scala/chisel3/compatibility.scala index 6267bd62..24556461 100644 --- a/src/main/scala/chisel3/compatibility.scala +++ b/src/main/scala/chisel3/compatibility.scala @@ -150,7 +150,7 @@ package object Chisel { // scalastyle:ignore package.object.name number.of.t /** This contains literal constructor factory methods that are deprecated as of Chisel3. */ - trait UIntFactory extends chisel3.UIntFactoryBase { + trait UIntFactory extends chisel3.UIntFactory { /** Create a UInt literal with inferred width. */ def apply(n: String): UInt = n.asUInt /** Create a UInt literal with fixed width. */ @@ -190,7 +190,7 @@ package object Chisel { // scalastyle:ignore package.object.name number.of.t /** This contains literal constructor factory methods that are deprecated as of Chisel3. */ - trait SIntFactory extends chisel3.SIntFactoryBase { + trait SIntFactory extends chisel3.SIntFactory { /** Create a SInt type or port with fixed width. */ def width(width: Int): SInt = apply(width.W) /** Create an SInt type with specified width. */ @@ -225,7 +225,7 @@ package object Chisel { // scalastyle:ignore package.object.name number.of.t /** This contains literal constructor factory methods that are deprecated as of Chisel3. */ - trait BoolFactory extends chisel3.BoolFactoryBase { + trait BoolFactory extends chisel3.BoolFactory { /** Creates Bool literal. */ def apply(x: Boolean): Bool = x.B @@ -266,12 +266,38 @@ package object Chisel { // scalastyle:ignore package.object.name number.of.t } } } - val Mem = chisel3.Mem + type MemBase[T <: Data] = chisel3.MemBase[T] + + val Mem = chisel3.Mem type Mem[T <: Data] = chisel3.Mem[T] + + implicit class MemCompatibility(a: Mem.type) { + import chisel3.internal.sourceinfo.UnlocatableSourceInfo + + def apply[T <: Data](t: T, size: BigInt)(implicit compileOptions: CompileOptions): Mem[T] = + a.do_apply(size, t)(UnlocatableSourceInfo, compileOptions) + + def apply[T <: Data](t: T, size: Int)(implicit compileOptions: CompileOptions): Mem[T] = + a.do_apply(size, t)(UnlocatableSourceInfo, compileOptions) + + } + val SeqMem = chisel3.SyncReadMem type SeqMem[T <: Data] = chisel3.SyncReadMem[T] + implicit class SeqMemCompatibility(a: SeqMem.type) { + import chisel3.internal.sourceinfo.SourceInfo + + def apply[T <: Data](t: T, size: BigInt) + (implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SyncReadMem[T] = + a.do_apply(size, t) + + def apply[T <: Data](t: T, size: Int) + (implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SyncReadMem[T] = + a.do_apply(size, t) + } + import chisel3.CompileOptions abstract class CompatibilityModule(implicit moduleCompileOptions: CompileOptions) extends chisel3.experimental.LegacyModule { @@ -426,6 +452,10 @@ package object Chisel { // scalastyle:ignore package.object.name number.of.t val BitPat = chisel3.util.BitPat type BitPat = chisel3.util.BitPat + implicit class BitsObjectCompatibility(a: BitPat.type) { + def DC(width: Int): BitPat = a.dontCare(width) + } + type ArbiterIO[T <: Data] = chisel3.util.ArbiterIO[T] type LockingArbiterLike[T <: Data] = chisel3.util.LockingArbiterLike[T] type LockingRRArbiter[T <: Data] = chisel3.util.LockingRRArbiter[T] @@ -454,8 +484,25 @@ package object Chisel { // scalastyle:ignore package.object.name number.of.t val DecoupledIO = chisel3.util.Decoupled val Decoupled = chisel3.util.Decoupled type QueueIO[T <: Data] = chisel3.util.QueueIO[T] - type Queue[T <: Data] = chisel3.util.Queue[T] + val Queue = chisel3.util.Queue + type Queue[T <: Data] = QueueCompatibility[T] + + sealed class QueueCompatibility[T <: Data](gen: T, entries: Int, pipe: Boolean = false, flow: Boolean = false) + (implicit compileOptions: chisel3.CompileOptions) + extends chisel3.util.Queue[T](gen, entries, pipe, flow)(compileOptions) { + + def this(gen: T, entries: Int, pipe: Boolean, flow: Boolean, override_reset: Option[Bool]) = { + this(gen, entries, pipe, flow) + this.override_reset = override_reset + } + + def this(gen: T, entries: Int, pipe: Boolean, flow: Boolean, _reset: Bool) = { + this(gen, entries, pipe, flow) + this.override_reset = Some(_reset) + } + + } object Enum extends chisel3.util.Enum { /** Returns n unique values of the specified type. Can be used with unpacking to define enums. @@ -550,4 +597,33 @@ package object Chisel { // scalastyle:ignore package.object.name number.of.t class treedump extends chisel3.internal.naming.treedump // scalastyle:ignore class.name class chiselName extends chisel3.internal.naming.chiselName // scalastyle:ignore class.name } + + implicit class DataCompatibility(a: Data) { + import chisel3.internal.sourceinfo.DeprecatedSourceInfo + + def toBits(implicit compileOptions: CompileOptions): UInt = a.do_asUInt(DeprecatedSourceInfo, compileOptions) + + } + + implicit class VecLikeCompatibility[T <: Data](a: VecLike[T]) { + import chisel3.internal.sourceinfo.DeprecatedSourceInfo + + def read(idx: UInt)(implicit compileOptions: CompileOptions): T = a.do_apply(idx)(compileOptions) + + def write(idx: UInt, data: T)(implicit compileOptions: CompileOptions): Unit = + a.do_apply(idx)(compileOptions).:=(data)(DeprecatedSourceInfo, compileOptions) + + } + + implicit class BitsCompatibility(a: Bits) { + import chisel3.internal.sourceinfo.DeprecatedSourceInfo + + final def asBits(implicit compileOptions: CompileOptions): Bits = a.do_asUInt(DeprecatedSourceInfo, compileOptions) + + final def toSInt(implicit compileOptions: CompileOptions): SInt = a.do_asSInt(DeprecatedSourceInfo, compileOptions) + + final def toUInt(implicit compileOptions: CompileOptions): UInt = a.do_asUInt(DeprecatedSourceInfo, compileOptions) + + } + } diff --git a/src/main/scala/chisel3/util/BitPat.scala b/src/main/scala/chisel3/util/BitPat.scala index b8a239d0..83475d1b 100644 --- a/src/main/scala/chisel3/util/BitPat.scala +++ b/src/main/scala/chisel3/util/BitPat.scala @@ -54,10 +54,6 @@ 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 - /** Allows BitPats to be used where a UInt is expected. * * @note the BitPat must not have don't care bits (will error out otherwise) @@ -95,7 +91,7 @@ object BitPat { final def != (that: BitPat): Bool = macro SourceInfoTransform.thatArg @chiselRuntimeDeprecated - @deprecated("Use '=/=', which avoids potential precedence problems", "chisel3") + @deprecated("Use '=/=', which avoids potential precedence problems", "3.0") def do_!= (that: BitPat) // scalastyle:ignore method.name (implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = that != x } @@ -128,7 +124,7 @@ sealed class BitPat(val value: BigInt, val mask: BigInt, width: Int) extends Sou def != (that: UInt): Bool = macro SourceInfoTransform.thatArg @chiselRuntimeDeprecated - @deprecated("Use '=/=', which avoids potential precedence problems", "chisel3") + @deprecated("Use '=/=', which avoids potential precedence problems", "3.0") 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 0aa72e81..36892c11 100644 --- a/src/main/scala/chisel3/util/Decoupled.scala +++ b/src/main/scala/chisel3/util/Decoupled.scala @@ -191,16 +191,6 @@ class Queue[T <: Data](gen: T, flow: Boolean = false) (implicit compileOptions: chisel3.CompileOptions) extends Module() { - @deprecated("Module constructor with override _reset deprecated, use withReset", "chisel3") - def this(gen: T, entries: Int, pipe: Boolean, flow: Boolean, override_reset: Option[Bool]) = { - this(gen, entries, pipe, flow) - this.override_reset = override_reset - } - @deprecated("Module constructor with override _reset deprecated, use withReset", "chisel3") - def this(gen: T, entries: Int, pipe: Boolean, flow: Boolean, _reset: Bool) = { - this(gen, entries, pipe, flow) - this.override_reset = Some(_reset) - } val genType = if (compileOptions.declaredTypeMustBeUnbound) { requireIsChiselType(gen) diff --git a/src/main/scala/chisel3/util/Enum.scala b/src/main/scala/chisel3/util/Enum.scala index eaec3c04..3fb9f9e4 100644 --- a/src/main/scala/chisel3/util/Enum.scala +++ b/src/main/scala/chisel3/util/Enum.scala @@ -39,12 +39,4 @@ trait Enum { def apply(n: Int): List[UInt] = createValues(n).toList } -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") - require(!nodeType.widthKnown, "Bit width may no longer be specified for enums") - apply(n).asInstanceOf[List[T]] - } -} +object Enum extends Enum diff --git a/src/main/scala/chisel3/util/LFSR.scala b/src/main/scala/chisel3/util/LFSR.scala index 0458bd90..5fc778fb 100644 --- a/src/main/scala/chisel3/util/LFSR.scala +++ b/src/main/scala/chisel3/util/LFSR.scala @@ -36,10 +36,10 @@ object LFSR16 { @deprecated("Use chisel3.util.random.LFSR(16) for a 16-bit LFSR", "3.2") @chiselName def apply(increment: Bool = true.B): UInt = - Vec( FibonacciLFSR - .maxPeriod(16, increment, seed = Some(BigInt(1) << 15)) - .asBools - .reverse ) + VecInit( FibonacciLFSR + .maxPeriod(16, increment, seed = Some(BigInt(1) << 15)) + .asBools + .reverse ) .asUInt } |
