diff options
| author | Schuyler Eldridge | 2019-07-17 14:08:33 -0400 |
|---|---|---|
| committer | Schuyler Eldridge | 2019-09-16 17:12:51 -0400 |
| commit | a594ccef986c4567730fee729bdea9ed9aefed38 (patch) | |
| tree | 2512913e054ea7d56867f2c73912ff4be17f1e82 /src/main/scala/firrtl/WIR.scala | |
| parent | 7e39ea8ec948ff1db7ccd0d850923a86d2d8a4e7 (diff) | |
Rename gender to flow
The following names are changed:
- gender -> flow
- Gender -> Flow
- MALE -> SourceFlow
- FEMALE -> SinkFlow
- BIGENDER -> DuplexFlow
- UNKNOWNGENDER -> UnknownFlow
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/main/scala/firrtl/WIR.scala')
| -rw-r--r-- | src/main/scala/firrtl/WIR.scala | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/main/scala/firrtl/WIR.scala b/src/main/scala/firrtl/WIR.scala index c1839a22..4d89c358 100644 --- a/src/main/scala/firrtl/WIR.scala +++ b/src/main/scala/firrtl/WIR.scala @@ -20,13 +20,13 @@ case object MemKind extends Kind case object ExpKind extends Kind case object UnknownKind extends Kind -trait Gender -case object MALE extends Gender -case object FEMALE extends Gender -case object BIGENDER extends Gender -case object UNKNOWNGENDER extends Gender +trait Flow +case object SourceFlow extends Flow +case object SinkFlow extends Flow +case object DuplexFlow extends Flow +case object UnknownFlow extends Flow -case class WRef(name: String, tpe: Type, kind: Kind, gender: Gender) extends Expression { +case class WRef(name: String, tpe: Type, kind: Kind, flow: Flow) extends Expression { def serialize: String = name def mapExpr(f: Expression => Expression): Expression = this def mapType(f: Type => Type): Expression = this.copy(tpe = f(tpe)) @@ -37,21 +37,21 @@ case class WRef(name: String, tpe: Type, kind: Kind, gender: Gender) extends Exp } object WRef { /** Creates a WRef from a Wire */ - def apply(wire: DefWire): WRef = new WRef(wire.name, wire.tpe, WireKind, UNKNOWNGENDER) + def apply(wire: DefWire): WRef = new WRef(wire.name, wire.tpe, WireKind, UnknownFlow) /** Creates a WRef from a Register */ - def apply(reg: DefRegister): WRef = new WRef(reg.name, reg.tpe, RegKind, UNKNOWNGENDER) + def apply(reg: DefRegister): WRef = new WRef(reg.name, reg.tpe, RegKind, UnknownFlow) /** Creates a WRef from a Node */ - def apply(node: DefNode): WRef = new WRef(node.name, node.value.tpe, NodeKind, MALE) + def apply(node: DefNode): WRef = new WRef(node.name, node.value.tpe, NodeKind, SourceFlow) /** Creates a WRef from a Port */ - def apply(port: Port): WRef = new WRef(port.name, port.tpe, PortKind, UNKNOWNGENDER) + def apply(port: Port): WRef = new WRef(port.name, port.tpe, PortKind, UnknownFlow) /** Creates a WRef from a WDefInstance */ - def apply(wi: WDefInstance): WRef = new WRef(wi.name, wi.tpe, InstanceKind, UNKNOWNGENDER) + def apply(wi: WDefInstance): WRef = new WRef(wi.name, wi.tpe, InstanceKind, UnknownFlow) /** Creates a WRef from a DefMemory */ - def apply(mem: DefMemory): WRef = new WRef(mem.name, passes.MemPortUtils.memType(mem), MemKind, UNKNOWNGENDER) + def apply(mem: DefMemory): WRef = new WRef(mem.name, passes.MemPortUtils.memType(mem), MemKind, UnknownFlow) /** 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) + def apply(n: String, t: Type = UnknownType, k: Kind = ExpKind): WRef = new WRef(n, t, k, UnknownFlow) } -case class WSubField(expr: Expression, name: String, tpe: Type, gender: Gender) extends Expression { +case class WSubField(expr: Expression, name: String, tpe: Type, flow: Flow) extends Expression { def serialize: String = s"${expr.serialize}.$name" def mapExpr(f: Expression => Expression): Expression = this.copy(expr = f(expr)) def mapType(f: Type => Type): Expression = this.copy(tpe = f(tpe)) @@ -61,10 +61,10 @@ case class WSubField(expr: Expression, name: String, tpe: Type, gender: Gender) def foreachWidth(f: Width => Unit): Unit = Unit } object WSubField { - def apply(expr: Expression, n: String): WSubField = new WSubField(expr, n, field_type(expr.tpe, n), UNKNOWNGENDER) - def apply(expr: Expression, name: String, tpe: Type): WSubField = new WSubField(expr, name, tpe, UNKNOWNGENDER) + def apply(expr: Expression, n: String): WSubField = new WSubField(expr, n, field_type(expr.tpe, n), UnknownFlow) + def apply(expr: Expression, name: String, tpe: Type): WSubField = new WSubField(expr, name, tpe, UnknownFlow) } -case class WSubIndex(expr: Expression, value: Int, tpe: Type, gender: Gender) extends Expression { +case class WSubIndex(expr: Expression, value: Int, tpe: Type, flow: Flow) extends Expression { def serialize: String = s"${expr.serialize}[$value]" def mapExpr(f: Expression => Expression): Expression = this.copy(expr = f(expr)) def mapType(f: Type => Type): Expression = this.copy(tpe = f(tpe)) @@ -73,7 +73,7 @@ case class WSubIndex(expr: Expression, value: Int, tpe: Type, gender: Gender) ex def foreachType(f: Type => Unit): Unit = f(tpe) def foreachWidth(f: Width => Unit): Unit = Unit } -case class WSubAccess(expr: Expression, index: Expression, tpe: Type, gender: Gender) extends Expression { +case class WSubAccess(expr: Expression, index: Expression, tpe: Type, flow: Flow) extends Expression { def serialize: String = s"${expr.serialize}[${index.serialize}]" def mapExpr(f: Expression => Expression): Expression = this.copy(expr = f(expr), index = f(index)) def mapType(f: Type => Type): Expression = this.copy(tpe = f(tpe)) @@ -264,7 +264,7 @@ class WrappedType(val t: Type) { object WrappedWidth { def eqw(w1: Width, w2: Width): Boolean = new WrappedWidth(w1) == new WrappedWidth(w2) } - + class WrappedWidth (val w: Width) { def ww(w: Width): WrappedWidth = new WrappedWidth(w) override def toString = w match { @@ -285,10 +285,10 @@ class WrappedWidth (val w: Width) { case (w1: MinWidth, w2: MinWidth) => w1.args.size == w2.args.size && (w1.args forall (a1 => w2.args exists (a2 => eqw(a1, a2)))) case (w1: IntWidth, w2: IntWidth) => w1.width == w2.width - case (w1: PlusWidth, w2: PlusWidth) => + case (w1: PlusWidth, w2: PlusWidth) => (ww(w1.arg1) == ww(w2.arg1) && ww(w1.arg2) == ww(w2.arg2)) || (ww(w1.arg1) == ww(w2.arg2) && ww(w1.arg2) == ww(w2.arg1)) - case (w1: MinusWidth,w2: MinusWidth) => + case (w1: MinusWidth,w2: MinusWidth) => (ww(w1.arg1) == ww(w2.arg1) && ww(w1.arg2) == ww(w2.arg2)) || (ww(w1.arg1) == ww(w2.arg2) && ww(w1.arg2) == ww(w2.arg1)) case (w1: ExpWidth, w2: ExpWidth) => ww(w1.arg1) == ww(w2.arg1) @@ -365,4 +365,3 @@ case class CDefMPort(info: Info, def foreachString(f: String => Unit): Unit = f(name) def foreachInfo(f: Info => Unit): Unit = f(info) } - |
