From 0ba4d6008b7d80b87a7507d55fe228ff947e0121 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Mon, 27 Jul 2015 12:59:35 -0700 Subject: Use exceptions, not -1, to signal errors --- src/main/scala/Chisel/Core.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/scala/Chisel/Core.scala b/src/main/scala/Chisel/Core.scala index 94f97468..b1bcf63e 100644 --- a/src/main/scala/Chisel/Core.scala +++ b/src/main/scala/Chisel/Core.scala @@ -333,7 +333,7 @@ abstract class Data(dirArg: Direction) extends Id { def name = getRefForId(cid).name def debugName = mod.debugName + "." + getRefForId(cid).debugName def litArg(): LitArg = null - def litValue(): BigInt = -1 + def litValue(): BigInt = None.get def isLitValue(): Boolean = false def setLitValue(x: LitArg) { } def floLitValue: Float = intBitsToFloat(litValue().toInt) @@ -578,7 +578,7 @@ abstract class Bits(dirArg: Direction, width: Int) extends Element(dirArg, width override def litArg(): LitArg = litValueVar.get override def isLitValue(): Boolean = litValueVar.isDefined - override def litValue(): BigInt = if (isLitValue) litValueVar.get.num else -1 + override def litValue(): BigInt = litValueVar.get.num override def setLitValue(x: LitArg) { litValueVar = Some(x) } override def cloneType : this.type = cloneTypeWidth(width) def fromInt(x: BigInt): this.type = makeLit(x, -1) -- cgit v1.2.3