diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/chisel3/compatibility.scala | 3 | ||||
| -rw-r--r-- | src/main/scala/chisel3/package.scala | 18 | ||||
| -rw-r--r-- | src/main/scala/chisel3/util/BitPat.scala | 4 |
3 files changed, 16 insertions, 9 deletions
diff --git a/src/main/scala/chisel3/compatibility.scala b/src/main/scala/chisel3/compatibility.scala index 0212aca9..1d0c0ff7 100644 --- a/src/main/scala/chisel3/compatibility.scala +++ b/src/main/scala/chisel3/compatibility.scala @@ -120,15 +120,18 @@ package object Chisel { // scalastyle:ignore package.object.name apply(Seq.fill(n)(gen)) def apply[T <: Data](elts: Seq[T]): Vec[T] = macro VecTransform.apply_elts + /** @group SourceInfoTransformMacro */ def do_apply[T <: Data](elts: Seq[T])(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] = chisel3.core.VecInit(elts) def apply[T <: Data](elt0: T, elts: T*): Vec[T] = macro VecTransform.apply_elt0 + /** @group SourceInfoTransformMacro */ def do_apply[T <: Data](elt0: T, elts: T*) (implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] = chisel3.core.VecInit(elt0 +: elts.toSeq) def tabulate[T <: Data](n: Int)(gen: (Int) => T): Vec[T] = macro VecTransform.tabulate + /** @group SourceInfoTransformMacro */ def do_tabulate[T <: Data](n: Int)(gen: (Int) => T) (implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] = chisel3.core.VecInit.tabulate(n)(gen) diff --git a/src/main/scala/chisel3/package.scala b/src/main/scala/chisel3/package.scala index 7f1ad040..b7c39bad 100644 --- a/src/main/scala/chisel3/package.scala +++ b/src/main/scala/chisel3/package.scala @@ -50,11 +50,11 @@ package object chisel3 { // scalastyle:ignore package.object.name @chiselRuntimeDeprecated @deprecated("Input(Data) should be used over Data.asInput", "chisel3") def asInput: T = Input(target) - + @chiselRuntimeDeprecated @deprecated("Output(Data) should be used over Data.asOutput", "chisel3") def asOutput: T = Output(target) - + @chiselRuntimeDeprecated @deprecated("Flipped(Data) should be used over Data.flip", "chisel3") def flip(): T = Flipped(target) @@ -152,7 +152,7 @@ package object chisel3 { // scalastyle:ignore package.object.name @chiselRuntimeDeprecated @deprecated("use n.U", "chisel3, will be removed by end of 2017") def apply(n: String): UInt = n.asUInt - + /** Create a UInt literal with fixed width. */ @chiselRuntimeDeprecated @deprecated("use n.U(width.W)", "chisel3, will be removed by end of 2017") @@ -192,7 +192,7 @@ package object chisel3 { // scalastyle:ignore package.object.name @chiselRuntimeDeprecated @deprecated("use SInt(width.W)", "chisel3, will be removed by end of 2017") def width(width: Int): SInt = apply(width.W) - + /** Create an SInt type with specified width. */ @chiselRuntimeDeprecated @deprecated("use SInt(width)", "chisel3, will be removed by end of 2017") @@ -202,7 +202,7 @@ package object chisel3 { // scalastyle:ignore package.object.name @chiselRuntimeDeprecated @deprecated("use value.S", "chisel3, will be removed by end of 2017") def apply(value: BigInt): SInt = value.asSInt - + /** Create an SInt literal with fixed width. */ @chiselRuntimeDeprecated @deprecated("use value.S(width.W)", "chisel3, will be removed by end of 2017") @@ -257,7 +257,7 @@ package object chisel3 { // scalastyle:ignore package.object.name val SeqMem = chisel3.core.SyncReadMem @deprecated("Use 'SyncReadMem'", "chisel3") type SeqMem[T <: Data] = chisel3.core.SyncReadMem[T] - + val Module = chisel3.core.Module type Module = chisel3.core.LegacyModule @@ -367,18 +367,20 @@ package object chisel3 { // scalastyle:ignore package.object.name implicit class fromIntToWidth(x: Int) extends chisel3.core.fromIntToWidth(x) implicit class fromIntToBinaryPoint(x: Int) extends chisel3.core.fromIntToBinaryPoint(x) - implicit class fromUIntToBitPatComparable(x: UInt) { + implicit class fromUIntToBitPatComparable(x: UInt) extends chisel3.SourceInfoDoc { import scala.language.experimental.macros import internal.sourceinfo.{SourceInfo, SourceInfoTransform} final def === (that: BitPat): Bool = macro SourceInfoTransform.thatArg final def =/= (that: BitPat): Bool = macro SourceInfoTransform.thatArg + /** @group SourceInfoTransformMacro */ def do_=== (that: BitPat) // scalastyle:ignore method.name (implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = that === x + /** @group SourceInfoTransformMacro */ def do_=/= (that: BitPat) // scalastyle:ignore method.name (implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = that =/= x - + final def != (that: BitPat): Bool = macro SourceInfoTransform.thatArg @chiselRuntimeDeprecated @deprecated("Use '=/=', which avoids potential precedence problems", "chisel3") diff --git a/src/main/scala/chisel3/util/BitPat.scala b/src/main/scala/chisel3/util/BitPat.scala index 6ff08bea..6cba497e 100644 --- a/src/main/scala/chisel3/util/BitPat.scala +++ b/src/main/scala/chisel3/util/BitPat.scala @@ -88,15 +88,17 @@ object BitPat { * "b10001".U === BitPat("b101??") // evaluates to false.B * }}} */ -sealed class BitPat(val value: BigInt, val mask: BigInt, width: Int) { +sealed class BitPat(val value: BigInt, val mask: BigInt, width: Int) extends SourceInfoDoc { def getWidth: Int = width def === (that: UInt): Bool = macro SourceInfoTransform.thatArg def =/= (that: UInt): Bool = macro SourceInfoTransform.thatArg + /** @group SourceInfoTransformMacro */ def do_=== (that: UInt) // scalastyle:ignore method.name (implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = { value.asUInt === (that & mask.asUInt) } + /** @group SourceInfoTransformMacro */ def do_=/= (that: UInt) // scalastyle:ignore method.name (implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = { !(this === that) |
