Module Hierarchy.In_scope
Support for hierarchically structured Hardcaml designs. We extend the standard Interface.Create_fn pattern so that the creation function also takes a Scope.t argument. This allows scoping of signal naming and automatic recording of the design in a Circuit_database.t. Top level options allow construction of a flat or modular design as required for simulation or syntheis.
Parameters
Signature
type create= Hardcaml.Scope.t -> Hardcaml.Signal.t Hardcaml.Interface.Create_fn(I)(O).t
val create : scope:Hardcaml.Scope.t -> name:Hardcaml__.Import.string -> create -> Hardcaml.Circuit.With_interface(I)(O).createCreate 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 : (?port_checks:Hardcaml.Circuit.Port_checks.t -> ?add_phantom_inputs:Hardcaml__.Import.bool -> ?instance:Hardcaml__.Import.string -> scope:Hardcaml.Scope.t -> name:Hardcaml__.Import.string -> create -> Hardcaml.Circuit.With_interface(I)(O).create) Hardcaml.Circuit.with_create_optionsCreate a Hardcaml child design hierarchically, depending on the construction mode. In a flat design
In_scope.createis called. In a hierarchical design a circuit is constructed, added to aCircuit_database.tand an instantiation inserted into the parent design.The
instanceparameter can be used to specify the instantiation and scope name, if provided. Otherwisenameis used as the scope name, and the instantiation name is derived automatically.