diff options
| author | Jack | 2015-10-12 16:45:21 -0700 |
|---|---|---|
| committer | Jack | 2015-10-12 16:45:21 -0700 |
| commit | 0c288c48382f1b31fbfb1c202867fb444e46136c (patch) | |
| tree | 6b3498b1ebae1cbd3f7298165cae631a7f6c6bd1 /src/main/scala/firrtl/Utils.scala | |
| parent | d1295b29d89e07645c3a4e08f2f923455a868482 (diff) | |
Added support for no width to mean unknown, and print nothing instead of <?> for unknown width. Also added test to check this
Diffstat (limited to 'src/main/scala/firrtl/Utils.scala')
| -rw-r--r-- | src/main/scala/firrtl/Utils.scala | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/scala/firrtl/Utils.scala b/src/main/scala/firrtl/Utils.scala index 37cdcc71..8a7a5b0d 100644 --- a/src/main/scala/firrtl/Utils.scala +++ b/src/main/scala/firrtl/Utils.scala @@ -62,8 +62,8 @@ object Utils { implicit class ExpUtils(exp: Exp) { def serialize(): String = exp match { - case v: UIntValue => s"UInt<${v.width}>(${v.value.serialize})" - case v: SIntValue => s"SInt<${v.width}>(${v.value.serialize})" + case v: UIntValue => s"UInt${v.width.serialize}(${v.value.serialize})" + case v: SIntValue => s"SInt${v.width.serialize}(${v.value.serialize})" case r: Ref => r.name case s: Subfield => s"${s.exp.serialize}.${s.name}" case s: Subindex => s"${s.exp.serialize}[${s.value}]" @@ -163,8 +163,8 @@ object Utils { implicit class WidthUtils(w: Width) { def serialize(): String = w match { - case UnknownWidth => "?" - case w: IntWidth => w.width.toString + case UnknownWidth => "" + case w: IntWidth => s"<${w.width.toString}>" } } @@ -187,8 +187,8 @@ object Utils { t match { case ClockType => "Clock" case UnknownType => "UnknownType" - case t: UIntType => s"UInt<${t.width.serialize}>" - case t: SIntType => s"SInt<${t.width.serialize}>" + case t: UIntType => s"UInt${t.width.serialize}" + case t: SIntType => s"SInt${t.width.serialize}" case t: BundleType => s"{ ${t.fields.map(_.serialize).mkString(commas)} }" case t: VectorType => s"${t.tpe.serialize}[${t.size}]" } |
