Module Hierarchy.In_scope

Support for hierarchically structured Hardcaml designs. We extend the standard Interface.Create_fn pattern so that the create function also takes a Scope.t argument. This allows scoping of signal names and automatic recording of the design in a Circuit_database.t.

The scope argument controls construction of a flat or modular design as required for simulation or syntheis.

Parameters

module I : Interface.S
module O : Interface.S

Signature

val create : scope:Scope.t -> name:Base.string -> create -> Circuit.With_interface(I)(O).create

Create a Hardcaml child design and link it into the parent design. This will not form a hierarchical structure, but the signal naming will still be scoped.

val hierarchical : ?config:Circuit.Config.t -> ?instance:Base.string -> ?attributes:Rtl_attribute.t Base.list -> scope:Scope.t -> name:Base.string -> create -> Circuit.With_interface(I)(O).create

Create a Hardcaml child design hierarchically, depending on the construction mode. In a flat design In_scope.create is called. In a hierarchical design a circuit is constructed, added to a Circuit_database.t and an instantiation inserted into the parent design.

The instance parameter can be used to specify the instantiation and scope name, if provided. Otherwise name is used as the scope name, and the instantiation name is derived automatically. names are mangled so they form unique hierarchical paths to each instantiatiated design.