diff options
| author | Leway Colin | 2019-04-11 04:27:42 +0800 |
|---|---|---|
| committer | Jack Koenig | 2019-04-10 13:27:42 -0700 |
| commit | 4549a4556dfe491901079a81ceca29f2483073cc (patch) | |
| tree | 91d53f95bd3f88af78367605a5fb2c3a77777ba6 | |
| parent | 9535e03020c6e654dae3ce7e95f4d8649405ce3d (diff) | |
Remove redundant code (#1069)
Use getWidth function if it is suitable.
| -rw-r--r-- | src/main/scala/firrtl/Visitor.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/scala/firrtl/Visitor.scala b/src/main/scala/firrtl/Visitor.scala index cd42207c..28312440 100644 --- a/src/main/scala/firrtl/Visitor.scala +++ b/src/main/scala/firrtl/Visitor.scala @@ -117,9 +117,9 @@ class Visitor(infoMode: InfoMode) extends FIRRTLBaseVisitor[FirrtlNode] { ctx.getChild(0) match { case term: TerminalNode => term.getText match { - case "UInt" => if (ctx.getChildCount > 1) UIntType(IntWidth(string2BigInt(ctx.intLit(0).getText))) + case "UInt" => if (ctx.getChildCount > 1) UIntType(getWidth(ctx.intLit(0))) else UIntType(UnknownWidth) - case "SInt" => if (ctx.getChildCount > 1) SIntType(IntWidth(string2BigInt(ctx.intLit(0).getText))) + case "SInt" => if (ctx.getChildCount > 1) SIntType(getWidth(ctx.intLit(0))) else SIntType(UnknownWidth) case "Fixed" => ctx.intLit.size match { case 0 => FixedType(UnknownWidth, UnknownWidth) @@ -131,7 +131,7 @@ class Visitor(infoMode: InfoMode) extends FIRRTLBaseVisitor[FirrtlNode] { } case "Clock" => ClockType case "AsyncReset" => AsyncResetType - case "Analog" => if (ctx.getChildCount > 1) AnalogType(IntWidth(string2BigInt(ctx.intLit(0).getText))) + case "Analog" => if (ctx.getChildCount > 1) AnalogType(getWidth(ctx.intLit(0))) else AnalogType(UnknownWidth) case "{" => BundleType(ctx.field.asScala.map(visitField)) } |
