diff options
Diffstat (limited to 'src/main/scala/firrtl/analyses/GetNamespace.scala')
| -rw-r--r-- | src/main/scala/firrtl/analyses/GetNamespace.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/analyses/GetNamespace.scala b/src/main/scala/firrtl/analyses/GetNamespace.scala new file mode 100644 index 00000000..5ab096b7 --- /dev/null +++ b/src/main/scala/firrtl/analyses/GetNamespace.scala @@ -0,0 +1,22 @@ +// See LICENSE for license details. + +package firrtl.analyses + +import firrtl.annotations.NoTargetAnnotation +import firrtl.{CircuitState, LowForm, Namespace, Transform} + +case class ModuleNamespaceAnnotation(namespace: Namespace) extends NoTargetAnnotation + +/** Create a namespace with this circuit + * + * namespace is used by RenameModules to get unique names + */ +class GetNamespace extends Transform { + def inputForm: LowForm.type = LowForm + def outputForm: LowForm.type = LowForm + + def execute(state: CircuitState): CircuitState = { + val namespace = Namespace(state.circuit) + state.copy(annotations = new ModuleNamespaceAnnotation(namespace) +: state.annotations) + } +} |
