diff options
| author | Jack Koenig | 2021-03-14 00:03:25 -0800 |
|---|---|---|
| committer | GitHub | 2021-03-14 00:03:25 -0800 |
| commit | 0eb7afd09d488507d776017c5df8f6ec56924927 (patch) | |
| tree | c8f0f82c065134fd082ddb1b803d1ac3dd1cd0c4 /src/main | |
| parent | fd55c51bcef01c2b2919817aa33c67e5a0849d05 (diff) | |
Fix width of constant propagation of SInt with zero (#2120)
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/scala/firrtl/transforms/ConstantPropagation.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/scala/firrtl/transforms/ConstantPropagation.scala b/src/main/scala/firrtl/transforms/ConstantPropagation.scala index 0523082d..7106c699 100644 --- a/src/main/scala/firrtl/transforms/ConstantPropagation.scala +++ b/src/main/scala/firrtl/transforms/ConstantPropagation.scala @@ -230,7 +230,7 @@ class ConstantPropagation extends Transform with DependencyAPIMigration { } def simplify(e: Expression, lhs: Literal, rhs: Expression) = lhs match { case UIntLiteral(v, _) if v == BigInt(0) => rhs - case SIntLiteral(v, _) if v == BigInt(0) => asUInt(rhs, e.tpe) + case SIntLiteral(v, _) if v == BigInt(0) => asUInt(pad(rhs, e.tpe), e.tpe) case UIntLiteral(v, IntWidth(w)) if v == (BigInt(1) << bitWidth(rhs.tpe).toInt) - 1 => lhs case _ => e } |
