aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/passes/InferWidths.scala
diff options
context:
space:
mode:
authorJack Koenig2018-10-31 14:59:40 -0700
committerJack Koenig2018-10-31 15:22:26 -0700
commit9bc2e6daaf3a3a08aefe485aa924c820689de981 (patch)
tree5626a130bc1607e6a4c68eec864b7944f3a322e8 /src/main/scala/firrtl/passes/InferWidths.scala
parent8d599182114306f77d098ba7effa836328b1e802 (diff)
Remove all uses of get_flip and deprecate
It is O(n) and every use is in an O(n) iteration resulting in O(n^2). Same information can be extracted from create_exps which happens to also be called at every use of get_flip.
Diffstat (limited to 'src/main/scala/firrtl/passes/InferWidths.scala')
-rw-r--r--src/main/scala/firrtl/passes/InferWidths.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/scala/firrtl/passes/InferWidths.scala b/src/main/scala/firrtl/passes/InferWidths.scala
index 1e9532c8..26d346bb 100644
--- a/src/main/scala/firrtl/passes/InferWidths.scala
+++ b/src/main/scala/firrtl/passes/InferWidths.scala
@@ -263,12 +263,12 @@ object InferWidths extends Pass {
val n = get_size(s.loc.tpe)
val locs = create_exps(s.loc)
val exps = create_exps(s.expr)
- v ++= ((locs zip exps).zipWithIndex flatMap {case ((locx, expx), i) =>
- get_flip(s.loc.tpe, i, Default) match {
+ v ++= locs.zip(exps).flatMap { case (locx, expx) =>
+ to_flip(gender(locx)) match {
case Default => get_constraints_t(locx.tpe, expx.tpe)//WGeq(getWidth(locx), getWidth(expx))
case Flip => get_constraints_t(expx.tpe, locx.tpe)//WGeq(getWidth(expx), getWidth(locx))
}
- })
+ }
case (s: PartialConnect) =>
val ls = get_valid_points(s.loc.tpe, s.expr.tpe, Default, Default)
val locs = create_exps(s.loc)
@@ -276,7 +276,7 @@ object InferWidths extends Pass {
v ++= (ls flatMap {case (x, y) =>
val locx = locs(x)
val expx = exps(y)
- get_flip(s.loc.tpe, x, Default) match {
+ to_flip(gender(locx)) match {
case Default => get_constraints_t(locx.tpe, expx.tpe)//WGeq(getWidth(locx), getWidth(expx))
case Flip => get_constraints_t(expx.tpe, locx.tpe)//WGeq(getWidth(expx), getWidth(locx))
}