-
Notifications
You must be signed in to change notification settings - Fork 31
Check Topology Definitions
This algorithm traverses the source model and checks topology definitions.
-
A list tul of translation units.
-
An analysis data structure a representing the results of analysis so far.
An updated analysis a' with the topology map filled in if the check passes; otherwise an error.
Visit each translation unit in tul with input a, yielding either a' or an error.
Each method accepts an analysis data structure a as input and yields either an updated analysis data structure a' or an error as output.
For each topology definition d that has not yet been resolved:
-
Visit each member m of d with input a, building up a topology data structure t. Check each member for semantic validity. For example, ensure that the types of the port connections match. Check that (i) user-specified port numbers are in bounds for their ports and (ii) no two connections at the same output port have the same number. If not, throw an error. Don’t check pattern validity yet, except to resolve uses.
-
Visit all topologies directly imported into t, ensuring that they are resolved.
-
Resolve t to a partially numbered topology consisting of (a) a list of instances and (b) a mapping between connection graph names and lists of connections. The connection end points have port numbers if and only if those numbers are present in the model source.
-
For each topology t' that is directly imported into t, let s' be the set of transitively imported topologies of t'. Add t' and s' to the set of transitively imported topologies of t.
-
Determine the set of all instances in t, consisting of (a) all instances specified in t and (b) public instances specified in topologies imported into t.
-
Check that all directly specified connections are between valid instances.
-
Resolve imported connections. Include connections from transitively imported topologies t' that (a) go between instances present in t and (b) were specified directly or by pattern (and not by import) in t'.
-
Resolve pattern specifiers and add the resulting connections to t.
-
-
Check output port numbers.
-
Check that the number of connections at each output port is in bounds for the port size.
-
Check that there are no duplicate numbers at any output ports.
-
-
Apply automatic numbering to t. This step fills in missing port numbers, preserving any numbers specified in the model source.
-
Apply matched numbering. Use the algorithm described in the language spec.
-
Apply general numbering. Use the algorithm described in the language spec.
-
-
Compute the set of unconnected ports.
-
Construct the unique topology symbol s for d.
-
Map s to t in the topology map of a.
-
Return a as the result.