diff options
| author | Richard Lin | 2016-11-23 16:01:50 -0800 |
|---|---|---|
| committer | GitHub | 2016-11-23 16:01:50 -0800 |
| commit | edb19a0559686a471141c74438f677c1e217a298 (patch) | |
| tree | 8745e2a31ab2e91f42c00999a68057916721bcdc /chiselFrontend | |
| parent | 08b4f68db403d6925fba8c9e943216ef8f38d69e (diff) | |
Simplify Enum API (#385)
Get rid of some cruft exposed in #373
This also allows Bits.fromtInt(...) to be removed. Yay!
All old APIs (with some new restrictions, rocket still works fine) are preserved without deprecation in Chisel._, aside from the non-compile-time-checkable Map[] enum constructor which probably should have been deprecated during chisel2. The Map[] enums have been removed from chisel3._ without deprecation.
The new restriction is that nodeType (legacy API) may only be of UInt type with unspecified width. Note that Bits() creates a UInt, and if you can't control the enum values, it makes little sense to specify a bitwidth.
Diffstat (limited to 'chiselFrontend')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index cab1a82e..035ac213 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -54,8 +54,6 @@ sealed abstract class Bits(width: Width, override val litArg: Option[LitArg]) // Arguments for: self-checking code (can't do arithmetic on bits) // Arguments against: generates down to a FIRRTL UInt anyways - private[chisel3] def fromInt(x: BigInt, w: Int): this.type - private[chisel3] def flatten: IndexedSeq[Bits] = IndexedSeq(this) def cloneType: this.type = cloneTypeWidth(width) @@ -402,9 +400,6 @@ sealed class UInt private[core] (width: Width, lit: Option[ULit] = None) new UInt(w).asInstanceOf[this.type] private[chisel3] def toType = s"UInt$width" - override private[chisel3] def fromInt(value: BigInt, width: Int): this.type = - value.asUInt(width.W).asInstanceOf[this.type] - // TODO: refactor to share documentation with Num or add independent scaladoc final def unary_- (): UInt = macro SourceInfoTransform.noArg final def unary_-% (): UInt = macro SourceInfoTransform.noArg @@ -562,9 +557,6 @@ sealed class SInt private[core] (width: Width, lit: Option[SLit] = None) new SInt(w).asInstanceOf[this.type] private[chisel3] def toType = s"SInt$width" - override private[chisel3] def fromInt(value: BigInt, width: Int): this.type = - value.asSInt(width.W).asInstanceOf[this.type] - final def unary_- (): SInt = macro SourceInfoTransform.noArg final def unary_-% (): SInt = macro SourceInfoTransform.noArg @@ -696,11 +688,6 @@ sealed class Bool(lit: Option[ULit] = None) extends UInt(1.W, lit) { new Bool().asInstanceOf[this.type] } - override private[chisel3] def fromInt(value: BigInt, width: Int): this.type = { - require((value == 0 || value == 1) && width == 1) - (value == 1).asBool.asInstanceOf[this.type] - } - // REVIEW TODO: Why does this need to exist and have different conventions // than Bits? final def & (that: Bool): Bool = macro SourceInfoTransform.thatArg @@ -823,10 +810,6 @@ sealed class FixedPoint private (width: Width, val binaryPoint: BinaryPoint, lit case _ => this badConnect that } - private[chisel3] def fromInt(value: BigInt, width: Int): this.type = { - throwException(s"Don't use $this.fromInt($value, $width): Use literal constructors instead") - } - final def unary_- (): FixedPoint = macro SourceInfoTransform.noArg final def unary_-% (): FixedPoint = macro SourceInfoTransform.noArg |
