aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/WIR.scala
diff options
context:
space:
mode:
authorJack Koenig2018-08-07 14:21:38 -0700
committerJack Koenig2018-08-07 14:36:06 -0700
commitadf66019948afc46f8818e6883f1bab4d200265d (patch)
tree5a1286c11553d73541ef2b92ea7ee4d88afd1ca7 /src/main/scala/firrtl/WIR.scala
parentb84cb05faba6d787cb599fac4ea687ce4249ef1d (diff)
Make RemoveWires properly include registers in dependency graph
Fixes a bug where registers could be instantiated after nodes that referred to them Also add WRef.apply utility for nodes
Diffstat (limited to 'src/main/scala/firrtl/WIR.scala')
-rw-r--r--src/main/scala/firrtl/WIR.scala2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/WIR.scala b/src/main/scala/firrtl/WIR.scala
index 29a14406..f61fa41e 100644
--- a/src/main/scala/firrtl/WIR.scala
+++ b/src/main/scala/firrtl/WIR.scala
@@ -35,6 +35,8 @@ object WRef {
def apply(wire: DefWire): WRef = new WRef(wire.name, wire.tpe, WireKind, UNKNOWNGENDER)
/** Creates a WRef from a Register */
def apply(reg: DefRegister): WRef = new WRef(reg.name, reg.tpe, RegKind, UNKNOWNGENDER)
+ /** Creates a WRef from a Node */
+ def apply(node: DefNode): WRef = new WRef(node.name, node.value.tpe, NodeKind, MALE)
def apply(n: String, t: Type = UnknownType, k: Kind = ExpKind): WRef = new WRef(n, t, k, UNKNOWNGENDER)
}
case class WSubField(expr: Expression, name: String, tpe: Type, gender: Gender) extends Expression {