aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/Utils.scala
diff options
context:
space:
mode:
authorjackkoenig2015-12-03 18:03:31 -0800
committerjackkoenig2015-12-03 18:03:31 -0800
commitbff84efaa56ca8f21e58557a50d2c496d3c1bec0 (patch)
treeb206e7be3af8009f3dffe28b8f8dca16536f8e9b /src/main/scala/firrtl/Utils.scala
parent8e050ba48063d7f33551abcbb5c924b5d484aab7 (diff)
Changing simwrapper to group ports that go to different places, not quite there yet. Will allow simple bulk connecting at top-level
Diffstat (limited to 'src/main/scala/firrtl/Utils.scala')
-rw-r--r--src/main/scala/firrtl/Utils.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/Utils.scala b/src/main/scala/firrtl/Utils.scala
index 4220e07f..73799765 100644
--- a/src/main/scala/firrtl/Utils.scala
+++ b/src/main/scala/firrtl/Utils.scala
@@ -196,6 +196,12 @@ object Utils {
}
s + debug(dir)
}
+ def toPortDir(): PortDir = {
+ dir match {
+ case Default => Output
+ case Reverse => Input
+ }
+ }
}
implicit class FieldUtils(field: Field) {
@@ -203,6 +209,7 @@ object Utils {
s"${field.dir.serialize} ${field.name} : ${field.tpe.serialize}" + debug(field)
def getType(): Type = field.tpe
+ def toPort(): Port = Port(NoInfo, field.name, field.dir.toPortDir, field.tpe)
}
implicit class TypeUtils(t: Type) {
@@ -242,12 +249,19 @@ object Utils {
}
s + debug(p)
}
+ def toFieldDir(): FieldDir = {
+ p match {
+ case Input => Reverse
+ case Output => Default
+ }
+ }
}
implicit class PortUtils(p: Port) {
def serialize(implicit flags: FlagMap = FlagMap): String =
s"${p.dir.serialize} ${p.name} : ${p.tpe.serialize}" + debug(p)
def getType(): Type = p.tpe
+ def toField(): Field = Field(p.name, p.dir.toFieldDir, p.tpe)
}
implicit class ModuleUtils(m: Module) {