blob: a2aed3f132f4390d5e4c89e5dde8cd123f9d19eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// See LICENSE for license details.
package firrtl.analyses
import firrtl.annotations.NoTargetAnnotation
import firrtl.{CircuitState, DependencyAPIMigration, Namespace, Transform}
import firrtl.options.PreservesAll
import firrtl.stage.Forms
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 with DependencyAPIMigration with PreservesAll[Transform] {
override def prerequisites = Forms.LowForm
override def optionalPrerequisites = Seq.empty
override def dependents = Forms.LowEmitters
def execute(state: CircuitState): CircuitState = {
val namespace = Namespace(state.circuit)
state.copy(annotations = new ModuleNamespaceAnnotation(namespace) +: state.annotations)
}
}
|