aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDonggyu Kim2016-08-30 16:10:26 -0700
committerDonggyu Kim2016-09-07 11:54:15 -0700
commit8bb62b613956cff472cc89b28013b3f4af254224 (patch)
treed2e9786ddc1aabc2b7e4627b8dd0be4b21b4771f /src
parentb0d28b951ac2d443570135c4788e785756aeb457 (diff)
remove Utils.ONE
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/firrtl/PrimOps.scala38
-rw-r--r--src/main/scala/firrtl/Utils.scala1
-rw-r--r--src/main/scala/firrtl/passes/Passes.scala12
3 files changed, 25 insertions, 26 deletions
diff --git a/src/main/scala/firrtl/PrimOps.scala b/src/main/scala/firrtl/PrimOps.scala
index 1bf8947a..8b705b29 100644
--- a/src/main/scala/firrtl/PrimOps.scala
+++ b/src/main/scala/firrtl/PrimOps.scala
@@ -146,20 +146,20 @@ object PrimOps extends LazyLogging {
o match {
case Add => {
val t = (t1(),t2()) match {
- case (t1:UIntType, t2:UIntType) => UIntType(PLUS(MAX(w1(),w2()),Utils.ONE))
- case (t1:UIntType, t2:SIntType) => SIntType(PLUS(MAX(w1(),w2()),Utils.ONE))
- case (t1:SIntType, t2:UIntType) => SIntType(PLUS(MAX(w1(),w2()),Utils.ONE))
- case (t1:SIntType, t2:SIntType) => SIntType(PLUS(MAX(w1(),w2()),Utils.ONE))
+ case (t1:UIntType, t2:UIntType) => UIntType(PLUS(MAX(w1(),w2()),IntWidth(1)))
+ case (t1:UIntType, t2:SIntType) => SIntType(PLUS(MAX(w1(),w2()),IntWidth(1)))
+ case (t1:SIntType, t2:UIntType) => SIntType(PLUS(MAX(w1(),w2()),IntWidth(1)))
+ case (t1:SIntType, t2:SIntType) => SIntType(PLUS(MAX(w1(),w2()),IntWidth(1)))
case (t1, t2) => UnknownType
}
DoPrim(o,a,c,t)
}
case Sub => {
val t = (t1(),t2()) match {
- case (t1:UIntType, t2:UIntType) => SIntType(PLUS(MAX(w1(),w2()),Utils.ONE))
- case (t1:UIntType, t2:SIntType) => SIntType(PLUS(MAX(w1(),w2()),Utils.ONE))
- case (t1:SIntType, t2:UIntType) => SIntType(PLUS(MAX(w1(),w2()),Utils.ONE))
- case (t1:SIntType, t2:SIntType) => SIntType(PLUS(MAX(w1(),w2()),Utils.ONE))
+ case (t1:UIntType, t2:UIntType) => SIntType(PLUS(MAX(w1(),w2()),IntWidth(1)))
+ case (t1:UIntType, t2:SIntType) => SIntType(PLUS(MAX(w1(),w2()),IntWidth(1)))
+ case (t1:SIntType, t2:UIntType) => SIntType(PLUS(MAX(w1(),w2()),IntWidth(1)))
+ case (t1:SIntType, t2:SIntType) => SIntType(PLUS(MAX(w1(),w2()),IntWidth(1)))
case (t1, t2) => UnknownType
}
DoPrim(o,a,c,t)
@@ -177,9 +177,9 @@ object PrimOps extends LazyLogging {
case Div => {
val t = (t1(),t2()) match {
case (t1:UIntType, t2:UIntType) => UIntType(w1())
- case (t1:UIntType, t2:SIntType) => SIntType(PLUS(w1(),Utils.ONE))
+ case (t1:UIntType, t2:SIntType) => SIntType(PLUS(w1(),IntWidth(1)))
case (t1:SIntType, t2:UIntType) => SIntType(w1())
- case (t1:SIntType, t2:SIntType) => SIntType(PLUS(w1(),Utils.ONE))
+ case (t1:SIntType, t2:SIntType) => SIntType(PLUS(w1(),IntWidth(1)))
case (t1, t2) => UnknownType
}
DoPrim(o,a,c,t)
@@ -188,7 +188,7 @@ object PrimOps extends LazyLogging {
val t = (t1(),t2()) match {
case (t1:UIntType, t2:UIntType) => UIntType(MIN(w1(),w2()))
case (t1:UIntType, t2:SIntType) => UIntType(MIN(w1(),w2()))
- case (t1:SIntType, t2:UIntType) => SIntType(MIN(w1(),PLUS(w2(),Utils.ONE)))
+ case (t1:SIntType, t2:UIntType) => SIntType(MIN(w1(),PLUS(w2(),IntWidth(1))))
case (t1:SIntType, t2:SIntType) => SIntType(MIN(w1(),w2()))
case (t1, t2) => UnknownType
}
@@ -266,7 +266,7 @@ object PrimOps extends LazyLogging {
val t = (t1()) match {
case (t1:UIntType) => UIntType(w1())
case (t1:SIntType) => UIntType(w1())
- case ClockType => UIntType(Utils.ONE)
+ case ClockType => UIntType(IntWidth(1))
case (t1) => UnknownType
}
DoPrim(o,a,c,t)
@@ -275,7 +275,7 @@ object PrimOps extends LazyLogging {
val t = (t1()) match {
case (t1:UIntType) => SIntType(w1())
case (t1:SIntType) => SIntType(w1())
- case ClockType => SIntType(Utils.ONE)
+ case ClockType => SIntType(IntWidth(1))
case (t1) => UnknownType
}
DoPrim(o,a,c,t)
@@ -299,8 +299,8 @@ object PrimOps extends LazyLogging {
}
case Shr => {
val t = (t1()) match {
- case (t1:UIntType) => UIntType(MAX(MINUS(w1(),c1()),Utils.ONE))
- case (t1:SIntType) => SIntType(MAX(MINUS(w1(),c1()),Utils.ONE))
+ case (t1:UIntType) => UIntType(MAX(MINUS(w1(),c1()),IntWidth(1)))
+ case (t1:SIntType) => SIntType(MAX(MINUS(w1(),c1()),IntWidth(1)))
case (t1) => UnknownType
}
DoPrim(o,a,c,t)
@@ -323,7 +323,7 @@ object PrimOps extends LazyLogging {
}
case Cvt => {
val t = (t1()) match {
- case (t1:UIntType) => SIntType(PLUS(w1(),Utils.ONE))
+ case (t1:UIntType) => SIntType(PLUS(w1(),IntWidth(1)))
case (t1:SIntType) => SIntType(w1())
case (t1) => UnknownType
}
@@ -331,8 +331,8 @@ object PrimOps extends LazyLogging {
}
case Neg => {
val t = (t1()) match {
- case (t1:UIntType) => SIntType(PLUS(w1(),Utils.ONE))
- case (t1:SIntType) => SIntType(PLUS(w1(),Utils.ONE))
+ case (t1:UIntType) => SIntType(PLUS(w1(),IntWidth(1)))
+ case (t1:SIntType) => SIntType(PLUS(w1(),IntWidth(1)))
case (t1) => UnknownType
}
DoPrim(o,a,c,t)
@@ -396,7 +396,7 @@ object PrimOps extends LazyLogging {
}
case Bits => {
val t = (t1()) match {
- case (_:UIntType|_:SIntType) => UIntType(PLUS(MINUS(c1(),c2()),Utils.ONE))
+ case (_:UIntType|_:SIntType) => UIntType(PLUS(MINUS(c1(),c2()),IntWidth(1)))
case (t1) => UnknownType
}
DoPrim(o,a,c,t)
diff --git a/src/main/scala/firrtl/Utils.scala b/src/main/scala/firrtl/Utils.scala
index ca2577b6..5854fb95 100644
--- a/src/main/scala/firrtl/Utils.scala
+++ b/src/main/scala/firrtl/Utils.scala
@@ -642,7 +642,6 @@ object Utils extends LazyLogging {
def apply_s (s:Statement) : Statement = s map (apply_s) map (apply_e) map (apply_t)
apply_s(s)
}
- val ONE = IntWidth(1)
//def digits (s:String) : Boolean {
// val digits = "0123456789"
// var yes:Boolean = true
diff --git a/src/main/scala/firrtl/passes/Passes.scala b/src/main/scala/firrtl/passes/Passes.scala
index ae3d722a..6b6dc811 100644
--- a/src/main/scala/firrtl/passes/Passes.scala
+++ b/src/main/scala/firrtl/passes/Passes.scala
@@ -549,8 +549,8 @@ object InferWidths extends Pass {
def get_constraints_e (e:Expression) : Expression = {
(e map (get_constraints_e)) match {
case (e:Mux) => {
- constrain(width_BANG(e.cond),ONE)
- constrain(ONE,width_BANG(e.cond))
+ constrain(width_BANG(e.cond),IntWidth(1))
+ constrain(IntWidth(1),width_BANG(e.cond))
e }
case (e) => e }}
def get_constraints (s:Statement) : Statement = {
@@ -576,13 +576,13 @@ object InferWidths extends Pass {
case Flip => constrain(width_BANG(expx),width_BANG(locx)) }}
s }
case (s:DefRegister) => {
- constrain(width_BANG(s.reset),ONE)
- constrain(ONE,width_BANG(s.reset))
+ constrain(width_BANG(s.reset),IntWidth(1))
+ constrain(IntWidth(1),width_BANG(s.reset))
get_constraints_t(s.tpe,s.init.tpe,Default)
s }
case (s:Conditionally) => {
- v += WGeq(width_BANG(s.pred),ONE)
- v += WGeq(ONE,width_BANG(s.pred))
+ v += WGeq(width_BANG(s.pred),IntWidth(1))
+ v += WGeq(IntWidth(1),width_BANG(s.pred))
s map (get_constraints) }
case (s) => s map (get_constraints) }}