diff options
| author | Aditya Naik | 2024-05-29 17:28:22 -0700 |
|---|---|---|
| committer | Aditya Naik | 2024-05-29 17:28:22 -0700 |
| commit | bc92bb62f9f6a090e74392993e4fcfdd1f6b0676 (patch) | |
| tree | 160eb4cc2770eaf0c189fab9442d04b2b00b7919 /core/src/main/scala/chisel3/Num.scala | |
| parent | 878d488a7c8e0d6973de58b3164022c6a102e449 (diff) | |
i got 99 errors but "firrtl not found" aint one
Diffstat (limited to 'core/src/main/scala/chisel3/Num.scala')
| -rw-r--r-- | core/src/main/scala/chisel3/Num.scala | 65 |
1 files changed, 13 insertions, 52 deletions
diff --git a/core/src/main/scala/chisel3/Num.scala b/core/src/main/scala/chisel3/Num.scala index 4a984b5a..59f6db76 100644 --- a/core/src/main/scala/chisel3/Num.scala +++ b/core/src/main/scala/chisel3/Num.scala @@ -4,8 +4,7 @@ package chisel3 import chisel3.internal.firrtl.{BinaryPoint, KnownBinaryPoint} -import scala.language.experimental.macros -import chisel3.internal.sourceinfo.{SourceInfo, SourceInfoTransform} +import chisel3.internal.sourceinfo.SourceInfo // REVIEW TODO: Further discussion needed on what Num actually is. @@ -41,10 +40,7 @@ trait Num[T <: Data] { * $maxWidth * @group Arithmetic */ - final def +(that: T): T = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_+(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T + def +(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T /** Multiplication operator * @@ -54,10 +50,7 @@ trait Num[T <: Data] { * $singleCycleMul * @group Arithmetic */ - final def *(that: T): T = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_*(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T + def *(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T /** Division operator * @@ -67,10 +60,7 @@ trait Num[T <: Data] { * @todo full rules * @group Arithmetic */ - final def /(that: T): T = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_/(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T + def /(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T /** Modulo operator * @@ -79,10 +69,7 @@ trait Num[T <: Data] { * $singleCycleDiv * @group Arithmetic */ - final def %(that: T): T = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_%(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T + def %(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T /** Subtraction operator * @@ -91,10 +78,7 @@ trait Num[T <: Data] { * $maxWidthPlusOne * @group Arithmetic */ - final def -(that: T): T = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_-(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T + def -(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T /** Less than operator * @@ -102,10 +86,7 @@ trait Num[T <: Data] { * @return a hardware [[Bool]] asserted if this $coll is less than `that` * @group Comparison */ - final def <(that: T): Bool = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_<(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool + def <(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool /** Less than or equal to operator * @@ -113,10 +94,7 @@ trait Num[T <: Data] { * @return a hardware [[Bool]] asserted if this $coll is less than or equal to `that` * @group Comparison */ - final def <=(that: T): Bool = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_<=(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool + def <=(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool /** Greater than operator * @@ -124,10 +102,7 @@ trait Num[T <: Data] { * @return a hardware [[Bool]] asserted if this $coll is greater than `that` * @group Comparison */ - final def >(that: T): Bool = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_>(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool + def >(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool /** Greater than or equal to operator * @@ -135,10 +110,7 @@ trait Num[T <: Data] { * @return a hardware [[Bool]] asserted if this $coll is greather than or equal to `that` * @group Comparison */ - final def >=(that: T): Bool = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_>=(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool + def >=(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool /** Absolute value operator * @@ -146,16 +118,11 @@ trait Num[T <: Data] { * $unchangedWidth * @group Arithmetic */ - final def abs: T = macro SourceInfoTransform.noArg - @deprecated( "Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead", "Chisel 3.5" ) - final def abs(dummy: Int*): T = macro SourceInfoTransform.noArgDummy - - /** @group SourceInfoTransformMacro */ - def do_abs(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T + def abs(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T /** Minimum operator * @@ -164,10 +131,7 @@ trait Num[T <: Data] { * $maxWidth * @group Arithmetic */ - final def min(that: T): T = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_min(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = + def min(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = Mux(this < that, this.asInstanceOf[T], that) /** Maximum operator @@ -177,10 +141,7 @@ trait Num[T <: Data] { * $maxWidth * @group Arithmetic */ - final def max(that: T): T = macro SourceInfoTransform.thatArg - - /** @group SourceInfoTransformMacro */ - def do_max(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = + def max(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = Mux(this < that, that, this.asInstanceOf[T]) } |
