diff options
| author | Jim Lawson | 2016-09-29 13:13:57 -0700 |
|---|---|---|
| committer | Jim Lawson | 2016-09-29 13:13:57 -0700 |
| commit | c4e114f0064a867341a44406f242c60e50e2ce56 (patch) | |
| tree | 240946280d5ace05a98af8a9f6b5da43d7155e62 /src/main/scala/firrtl/PrimOps.scala | |
| parent | db0a5e55bdfc1e35ed728b32fee0741573a165bf (diff) | |
| parent | b28acc9915cd4ddf16681fd4d48462ebdd53894a (diff) | |
Merge branch 'master' into fix_infer_mdir
Diffstat (limited to 'src/main/scala/firrtl/PrimOps.scala')
| -rw-r--r-- | src/main/scala/firrtl/PrimOps.scala | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/main/scala/firrtl/PrimOps.scala b/src/main/scala/firrtl/PrimOps.scala index 09cae392..e3dd11c0 100644 --- a/src/main/scala/firrtl/PrimOps.scala +++ b/src/main/scala/firrtl/PrimOps.scala @@ -102,7 +102,7 @@ object PrimOps extends LazyLogging { private lazy val builtinPrimOps: Seq[PrimOp] = Seq(Add, Sub, Mul, Div, Rem, Lt, Leq, Gt, Geq, Eq, Neq, Pad, AsUInt, AsSInt, AsClock, Shl, Shr, Dshl, Dshr, Neg, Cvt, Not, And, Or, Xor, Andr, Orr, Xorr, Cat, Bits, Head, Tail) - private lazy val strToPrimOp: Map[String, PrimOp] = builtinPrimOps map (op => op.toString -> op) toMap + private lazy val strToPrimOp: Map[String, PrimOp] = builtinPrimOps.map { case op : PrimOp=> op.toString -> op }.toMap /** Seq of String representations of [[ir.PrimOp]]s */ lazy val listing: Seq[String] = builtinPrimOps map (_.toString) @@ -139,7 +139,7 @@ object PrimOps extends LazyLogging { def w2 = passes.getWidth(e.args(1).tpe) def c1 = IntWidth(e.consts.head) def c2 = IntWidth(e.consts(1)) - e copy (tpe = (e.op match { + e copy (tpe = e.op match { case Add => (t1, t2) match { case (_: UIntType, _: UIntType) => UIntType(PLUS(MAX(w1, w2), IntWidth(1))) case (_: UIntType, _: SIntType) => SIntType(PLUS(MAX(w1, MINUS(w2, IntWidth(1))), IntWidth(2))) @@ -244,18 +244,18 @@ object PrimOps extends LazyLogging { case _ => UnknownType } case Shl => t1 match { - case _: UIntType => UIntType(PLUS(w1,c1)) - case _: SIntType => SIntType(PLUS(w1,c1)) + case _: UIntType => UIntType(PLUS(w1, c1)) + case _: SIntType => SIntType(PLUS(w1, c1)) case _ => UnknownType } case Shr => t1 match { - case _: UIntType => UIntType(MAX(MINUS(w1,c1),IntWidth(1))) - case _: SIntType => SIntType(MAX(MINUS(w1,c1),IntWidth(1))) + case _: UIntType => UIntType(MAX(MINUS(w1, c1), IntWidth(1))) + case _: SIntType => SIntType(MAX(MINUS(w1, c1), IntWidth(1))) case _ => UnknownType } case Dshl => t1 match { - case _: UIntType => UIntType(PLUS(w1,POW(w2))) - case _: SIntType => SIntType(PLUS(w1,POW(w2))) + case _: UIntType => UIntType(PLUS(w1, POW(w2))) + case _: SIntType => SIntType(PLUS(w1, POW(w2))) case _ => UnknownType } case Dshr => t1 match { @@ -264,13 +264,13 @@ object PrimOps extends LazyLogging { case _ => UnknownType } case Cvt => t1 match { - case _: UIntType => SIntType(PLUS(w1,IntWidth(1))) + case _: UIntType => SIntType(PLUS(w1, IntWidth(1))) case _: SIntType => SIntType(w1) case _ => UnknownType } case Neg => t1 match { - case _: UIntType => SIntType(PLUS(w1,IntWidth(1))) - case _: SIntType => SIntType(PLUS(w1,IntWidth(1))) + case _: UIntType => SIntType(PLUS(w1, IntWidth(1))) + case _: SIntType => SIntType(PLUS(w1, IntWidth(1))) case _ => UnknownType } case Not => t1 match { @@ -307,7 +307,7 @@ object PrimOps extends LazyLogging { case (t1, t2) => UnknownType } case Bits => t1 match { - case (_: UIntType | _: SIntType) => UIntType(PLUS(MINUS(c1,c2),IntWidth(1))) + case (_: UIntType | _: SIntType) => UIntType(PLUS(MINUS(c1, c2), IntWidth(1))) case _ => UnknownType } case Head => t1 match { @@ -315,9 +315,9 @@ object PrimOps extends LazyLogging { case _ => UnknownType } case Tail => t1 match { - case (_: UIntType | _: SIntType) => UIntType(MINUS(w1,c1)) + case (_: UIntType | _: SIntType) => UIntType(MINUS(w1, c1)) case _ => UnknownType } - })) + }) } } |
