aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/ir
diff options
context:
space:
mode:
authorAdam Izraelevitz2017-03-09 12:39:04 -0800
committerGitHub2017-03-09 12:39:04 -0800
commit664d5b33094b7158bb6f8a583a89d83ac69be83e (patch)
tree7a037c49ca64773430afdf2cdf264b8e5c40f1de /src/main/scala/firrtl/ir
parent132d7baa991501e8c07cac7f6f4efc52905a89e7 (diff)
Sint tests and change in serialization (#456)
SInt representation is no longer 2's complement, but instead a positive number (hex or base 10) that is optionally preceded by a sign (-+).
Diffstat (limited to 'src/main/scala/firrtl/ir')
-rw-r--r--src/main/scala/firrtl/ir/IR.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/scala/firrtl/ir/IR.scala b/src/main/scala/firrtl/ir/IR.scala
index 71ad9366..938b5848 100644
--- a/src/main/scala/firrtl/ir/IR.scala
+++ b/src/main/scala/firrtl/ir/IR.scala
@@ -103,14 +103,14 @@ abstract class Literal extends Expression {
}
case class UIntLiteral(value: BigInt, width: Width) extends Literal {
def tpe = UIntType(width)
- def serialize = s"UInt${width.serialize}(" + Utils.serialize(value) + ")"
+ def serialize = s"""UInt${width.serialize}("h""" + value.toString(16)+ """")"""
def mapExpr(f: Expression => Expression): Expression = this
def mapType(f: Type => Type): Expression = this
def mapWidth(f: Width => Width): Expression = UIntLiteral(value, f(width))
}
case class SIntLiteral(value: BigInt, width: Width) extends Literal {
def tpe = SIntType(width)
- def serialize = s"SInt${width.serialize}(" + Utils.serialize(value) + ")"
+ def serialize = s"""SInt${width.serialize}("h""" + value.toString(16)+ """")"""
def mapExpr(f: Expression => Expression): Expression = this
def mapType(f: Type => Type): Expression = this
def mapWidth(f: Width => Width): Expression = SIntLiteral(value, f(width))
@@ -119,7 +119,7 @@ case class FixedLiteral(value: BigInt, width: Width, point: Width) extends Liter
def tpe = FixedType(width, point)
def serialize = {
val pstring = if(point == UnknownWidth) "" else s"<${point.serialize}>"
- s"Fixed${width.serialize}$pstring(" + Utils.serialize(value) + ")"
+ s"""Fixed${width.serialize}$pstring("h${value.toString(16)}")"""
}
def mapExpr(f: Expression => Expression): Expression = this
def mapType(f: Type => Type): Expression = this