summaryrefslogtreecommitdiff
path: root/src/main/scala/Chisel
diff options
context:
space:
mode:
authorAndrew Waterman2015-07-29 15:40:00 -0700
committerAndrew Waterman2015-07-29 15:40:00 -0700
commit24698c5bc1a03103b0ce0e6312c52afd6824f0eb (patch)
tree1d6c7d97bf03852ca067bd5307529179d0bb965f /src/main/scala/Chisel
parent1fcd657529ea9ce6261c6808230ec816290ed5e2 (diff)
Add SInt-by-UInt multiplication operator
Diffstat (limited to 'src/main/scala/Chisel')
-rw-r--r--src/main/scala/Chisel/Core.scala2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/scala/Chisel/Core.scala b/src/main/scala/Chisel/Core.scala
index 9f0b1ce6..7ba4444c 100644
--- a/src/main/scala/Chisel/Core.scala
+++ b/src/main/scala/Chisel/Core.scala
@@ -736,6 +736,7 @@ class UInt(dir: Direction, width: Int, lit: Option[LitArg] = None) extends Bits(
def - (other: UInt): UInt = this -% other
def -% (other: UInt): UInt = binop(SubModOp, other, maxWidth(other, 0))
def * (other: UInt): UInt = binop(TimesOp, other, sumWidth(other, 0))
+ def * (other: SInt): SInt = other * this
def / (other: UInt): UInt = binop(DivideOp, other, sumWidth(0))
def % (other: UInt): UInt = binop(ModOp, other, sumWidth(0))
override def << (other: BigInt): UInt = binop(ShiftLeftOp, other, sumWidth(other))
@@ -815,6 +816,7 @@ class SInt(dir: Direction, width: Int, lit: Option[LitArg] = None) extends Bits(
def -% (other: SInt): SInt = binop(SubModOp, other, maxWidth(other, 0))
def - (other: SInt): SInt = this -% other
def * (other: SInt): SInt = binop(TimesOp, other, sumWidth(other, 0))
+ def * (other: UInt): SInt = binop(TimesOp, other, sumWidth(other, 0))
def / (other: SInt): SInt = binop(DivideOp, other, sumWidth(0))
def % (other: SInt): SInt = binop(ModOp, other, sumWidth(0))
override def << (other: BigInt): SInt = binop(ShiftLeftOp, other, sumWidth(other))