summaryrefslogtreecommitdiff
path: root/core/src/main/scala/chisel3/internal
diff options
context:
space:
mode:
authorJack Koenig2021-06-28 14:07:03 -0700
committerJack Koenig2021-06-28 14:08:21 -0700
commitb87107ad41e948de9da9c349505de414b1a9db7f (patch)
treec34ccf144e5ff3926a2e8a9316ff3444a3508f17 /core/src/main/scala/chisel3/internal
parentd3e13ce24956871d2f0fd01ca3a7d89317e3db68 (diff)
Set refs for ModuleClone and ClonePorts in less hacky way
Diffstat (limited to 'core/src/main/scala/chisel3/internal')
-rw-r--r--core/src/main/scala/chisel3/internal/firrtl/IR.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/src/main/scala/chisel3/internal/firrtl/IR.scala b/core/src/main/scala/chisel3/internal/firrtl/IR.scala
index 1d77802b..a4f6d26d 100644
--- a/core/src/main/scala/chisel3/internal/firrtl/IR.scala
+++ b/core/src/main/scala/chisel3/internal/firrtl/IR.scala
@@ -161,15 +161,21 @@ case class IntervalLit(n: BigInt, w: Width, binaryPoint: BinaryPoint) extends Li
}
case class Ref(name: String) extends Arg
+/** Arg for ports of Modules
+ * @param mod the module this port belongs to
+ * @param name the name of the port
+ */
case class ModuleIO(mod: BaseModule, name: String) extends Arg {
override def fullName(ctx: Component): String =
if (mod eq ctx.id) name else s"${mod.getRef.name}.$name"
}
-// For use with CloneModuleAsRecord
-// Note that `name` is the name of the module instance whereas in ModuleIO it's the name of the port
-// The names of ports inside of a ModuleCloneIO are the names of the Slots
+/** Ports of cloned modules (CloneModuleAsRecord)
+ * @param mod The original module for which these ports are a clone
+ * @param name the name of the module instance
+ */
case class ModuleCloneIO(mod: BaseModule, name: String) extends Arg {
override def fullName(ctx: Component): String =
+ // NOTE: mod eq ctx.id only occurs in Target and Named-related APIs
if (mod eq ctx.id) "" else name
}
case class Slot(imm: Node, name: String) extends Arg {