From 23b13f098819f1eb7518cff47d83056f657003e0 Mon Sep 17 00:00:00 2001 From: jackbackrack Date: Wed, 29 Apr 2015 08:34:31 -0700 Subject: change arithmetic defaults to wrap --- src/main/scala/Core.scala | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main/scala/Core.scala b/src/main/scala/Core.scala index e85fb12f..7c9ccfde 100644 --- a/src/main/scala/Core.scala +++ b/src/main/scala/Core.scala @@ -584,10 +584,12 @@ abstract class Bits(dirArg: Direction, width: Int) extends Element(dirArg, width } def unary_- = bits_unop(NegOp) - def + (other: Bits) = bits_binop_pad(AddOp, other) + def +e (other: Bits) = bits_binop_pad(AddOp, other) + def + (other: Bits) = this +% other def +% (other: Bits) = bits_binop_pad(AddModOp, other) - def - (other: Bits) = bits_binop_pad(SubOp, other) + def -e (other: Bits) = bits_binop_pad(SubOp, other) def -% (other: Bits) = bits_binop_pad(SubModOp, other) + def - (other: Bits) = this -% other def * (other: Bits) = bits_binop_pad(TimesOp, other) def / (other: Bits) = bits_binop_pad(DivideOp, other) def % (other: Bits) = bits_binop_pad(ModOp, other) @@ -712,9 +714,11 @@ class UInt(dir: Direction, width: Int) extends Bits(dir, width) with Num[UInt] { } override def unary_- = uint_unop(NegOp) - def + (other: UInt) = uint_binop_pad(AddOp, other) + def +e (other: UInt) = uint_binop_pad(AddOp, other) + def + (other: UInt) = this +% other def +% (other: UInt) = uint_binop_pad(AddModOp, other) - def - (other: UInt) = uint_binop_pad(SubOp, other) + def -e (other: UInt) = uint_binop_pad(SubOp, other) + def - (other: UInt) = this -% other def -% (other: UInt) = uint_binop_pad(SubModOp, other) def * (other: UInt) = uint_binop_pad(TimesOp, other) def / (other: UInt) = uint_binop_pad(DivideOp, other) @@ -805,10 +809,10 @@ class SInt(dir: Direction, width: Int) extends Bits(dir, width) with Num[SInt] { } override def unary_- = sint_unop(NegOp) - def + (other: SInt) = sint_binop_pad(AddOp, other) - def +% (other: SInt) = sint_binop_pad(AddModOp, other) - def - (other: SInt) = sint_binop_pad(SubOp, other) - def -% (other: SInt) = sint_binop_pad(SubModOp, other) + def +e (other: SInt) = sint_binop_pad(AddOp, other) + def + (other: SInt) = sint_binop_pad(AddModOp, other) + def -e (other: SInt) = sint_binop_pad(SubOp, other) + def - (other: SInt) = sint_binop_pad(SubModOp, other) def * (other: SInt) = sint_binop_pad(TimesOp, other) def / (other: SInt) = sint_binop_pad(DivideOp, other) def % (other: SInt) = sint_binop_pad(ModOp, other) -- cgit v1.2.3