aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/ir/IR.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/firrtl/ir/IR.scala')
-rw-r--r--src/main/scala/firrtl/ir/IR.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/ir/IR.scala b/src/main/scala/firrtl/ir/IR.scala
index 3d65e3b1..f5b80ac6 100644
--- a/src/main/scala/firrtl/ir/IR.scala
+++ b/src/main/scala/firrtl/ir/IR.scala
@@ -127,6 +127,16 @@ case class SIntLiteral(value: BigInt, width: Width) extends Literal {
def mapType(f: Type => Type): Expression = this
def mapWidth(f: Width => Width): Expression = SIntLiteral(value, f(width))
}
+case class FixedLiteral(value: BigInt, width: Width, point: Width) extends Literal {
+ def tpe = FixedType(width, point)
+ def serialize = {
+ val pstring = if(point == UnknownWidth) "" else s"<${point.serialize}>"
+ s"Fixed${width.serialize}$pstring(" + Utils.serialize(value) + ")"
+ }
+ def mapExpr(f: Expression => Expression): Expression = this
+ def mapType(f: Type => Type): Expression = this
+ def mapWidth(f: Width => Width): Expression = FixedLiteral(value, f(width), f(point))
+}
case class DoPrim(op: PrimOp, args: Seq[Expression], consts: Seq[BigInt], tpe: Type) extends Expression {
def serialize: String = op.serialize + "(" +
(args.map(_.serialize) ++ consts.map(_.toString)).mkString(", ") + ")"
@@ -381,6 +391,13 @@ case class SIntType(width: Width) extends GroundType {
def serialize: String = "SInt" + width.serialize
def mapWidth(f: Width => Width): Type = SIntType(f(width))
}
+case class FixedType(width: Width, point: Width) extends GroundType {
+ override def serialize: String = {
+ val pstring = if(point == UnknownWidth) "" else s"<${point.serialize}>"
+ s"Fixed${width.serialize}$pstring"
+ }
+ def mapWidth(f: Width => Width): Type = FixedType(f(width), f(point))
+}
case class BundleType(fields: Seq[Field]) extends AggregateType {
def serialize: String = "{ " + (fields map (_.serialize) mkString ", ") + "}"
def mapType(f: Type => Type): Type =