aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/passes/InferWidths.scala
diff options
context:
space:
mode:
authorDonggyu Kim2016-08-30 19:01:37 -0700
committerDonggyu Kim2016-09-13 16:58:44 -0700
commit9d6b523e83d3836ade02bb36dcf8b8fc1d2e7234 (patch)
tree2f97a253c84f6ed7c43b6772c3c67907d72c4815 /src/main/scala/firrtl/passes/InferWidths.scala
parent96340374f091d5258ca69ef7fc614910e1c2cbb7 (diff)
type aliases
Diffstat (limited to 'src/main/scala/firrtl/passes/InferWidths.scala')
-rw-r--r--src/main/scala/firrtl/passes/InferWidths.scala15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/main/scala/firrtl/passes/InferWidths.scala b/src/main/scala/firrtl/passes/InferWidths.scala
index 6b2ff6ed..ebec4d80 100644
--- a/src/main/scala/firrtl/passes/InferWidths.scala
+++ b/src/main/scala/firrtl/passes/InferWidths.scala
@@ -28,20 +28,19 @@ MODIFICATIONS.
package firrtl.passes
// Datastructures
-import scala.collection.mutable.{LinkedHashMap, HashMap, HashSet, ArrayBuffer}
+import scala.collection.mutable.ArrayBuffer
import scala.collection.immutable.ListMap
import firrtl._
import firrtl.ir._
import firrtl.Utils._
import firrtl.Mappers._
-import firrtl.PrimOps._
-import firrtl.WrappedExpression._
object InferWidths extends Pass {
def name = "Infer Widths"
+ type ConstraintMap = collection.mutable.LinkedHashMap[String, Width]
- def solve_constraints(l: Seq[WGeq]): LinkedHashMap[String, Width] = {
+ def solve_constraints(l: Seq[WGeq]): ConstraintMap = {
def unique(ls: Seq[Width]) : Seq[Width] =
(ls map (new WrappedWidth(_))).distinct map (_.w)
def make_unique(ls: Seq[WGeq]): ListMap[String,Width] = {
@@ -77,7 +76,7 @@ object InferWidths extends Pass {
case _ => w
}
- def substitute(h: LinkedHashMap[String, Width])(w: Width): Width = {
+ def substitute(h: ConstraintMap)(w: Width): Width = {
//;println-all-debug(["Substituting for [" w "]"])
val wx = simplify(w)
//;println-all-debug(["After Simplify: [" wx "]"])
@@ -98,7 +97,7 @@ object InferWidths extends Pass {
}
}
- def b_sub(h: LinkedHashMap[String, Width])(w: Width): Width = {
+ def b_sub(h: ConstraintMap)(w: Width): Width = {
w map b_sub(h) match {
case w: VarWidth => h getOrElse (w.name, w)
case w => w
@@ -145,7 +144,7 @@ object InferWidths extends Pass {
//for (x <- u) { println(x) }
//println("====================================")
- val f = LinkedHashMap[String, Width]()
+ val f = new ConstraintMap
val o = ArrayBuffer[String]()
for ((n, e) <- u) {
//println("==== SOLUTIONS TABLE ====")
@@ -175,7 +174,7 @@ object InferWidths extends Pass {
//for (x <- f) println(x)
//; Backwards Solve
- val b = LinkedHashMap[String, Width]()
+ val b = new ConstraintMap
for (i <- (o.size - 1) to 0 by -1) {
val n = o(i) // Should visit `o` backward
/*