From 24698c5bc1a03103b0ce0e6312c52afd6824f0eb Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Wed, 29 Jul 2015 15:40:00 -0700 Subject: Add SInt-by-UInt multiplication operator --- src/main/scala/Chisel/Core.scala | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') 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)) -- cgit v1.2.3