aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/WIR.scala
diff options
context:
space:
mode:
authorAlbert Magyar2018-12-21 11:57:23 -0800
committerGitHub2018-12-21 11:57:23 -0800
commit1d1798cfd03f23896b7ea6203a1569da9532a939 (patch)
treea35af58e87be7f48ae592d50b52e078d6f507458 /src/main/scala/firrtl/WIR.scala
parent3433f8f8a82c3b129456e9512dd2cf442a6042f6 (diff)
Small convenience tweaks to IR/WIR APIs (#961)
* Seal Direction trait * Add WRef factories for ports and instances
Diffstat (limited to 'src/main/scala/firrtl/WIR.scala')
-rw-r--r--src/main/scala/firrtl/WIR.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/WIR.scala b/src/main/scala/firrtl/WIR.scala
index b96cd253..a5d2571d 100644
--- a/src/main/scala/firrtl/WIR.scala
+++ b/src/main/scala/firrtl/WIR.scala
@@ -40,6 +40,11 @@ object WRef {
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)
+ /** Creates a WRef from a Port */
+ def apply(port: Port): WRef = new WRef(port.name, port.tpe, PortKind, UNKNOWNGENDER)
+ /** Creates a WRef from a WDefInstance */
+ def apply(wi: WDefInstance): WRef = new WRef(wi.name, wi.tpe, InstanceKind, UNKNOWNGENDER)
+ /** Creates a WRef from an arbitrary string name */
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 {