diff options
| author | Jack Koenig | 2019-11-30 01:29:55 -0800 |
|---|---|---|
| committer | Jack Koenig | 2020-01-07 18:35:43 -0800 |
| commit | c16ef85cc76d6693045f1ecb84ad02227bab33c0 (patch) | |
| tree | aeaf4599eddc50790d8e58aeea172a471224014b /src/main/scala/firrtl/Utils.scala | |
| parent | df48d61c3e1cb476f51762b1f009ecc9391221c6 (diff) | |
Remove unnecessary $signed casts for PrimOps in Verilog Emitter
[skip formal checks]
Adds new InlineCastsTransform to the VerilogEmitter which removes
Statements that do nothing but cast by inlining the cast Expression
Diffstat (limited to 'src/main/scala/firrtl/Utils.scala')
| -rw-r--r-- | src/main/scala/firrtl/Utils.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/Utils.scala b/src/main/scala/firrtl/Utils.scala index 8a76aca6..6cb309b3 100644 --- a/src/main/scala/firrtl/Utils.scala +++ b/src/main/scala/firrtl/Utils.scala @@ -188,6 +188,17 @@ object Utils extends LazyLogging { case sx => sx } + /** Returns true if PrimOp is a cast, false otherwise */ + def isCast(op: PrimOp): Boolean = op match { + case AsUInt | AsSInt | AsClock | AsAsyncReset | AsFixedPoint => true + case _ => false + } + /** Returns true if Expression is a casting PrimOp, false otherwise */ + def isCast(expr: Expression): Boolean = expr match { + case DoPrim(op, _,_,_) if isCast(op) => true + case _ => false + } + /** Provide a nice name to create a temporary **/ def niceName(e: Expression): String = niceName(1)(e) def niceName(depth: Int)(e: Expression): String = { |
