Skip to content

Check Topology Definitions

Robert L. Bocchino Jr. edited this page Apr 18, 2024 · 26 revisions

This algorithm traverses the source model and checks topology definitions.

Input

  1. A list tul of translation units.

  2. An analysis data structure a representing the results of analysis so far.

Output

An updated analysis a' with the topology map filled in if the check passes; otherwise an error.

Procedure

Visit each translation unit in tul with input a, yielding either a' or an error.

AST Visitor Methods

Each method accepts an analysis data structure a as input and yields either an updated analysis data structure a' or an error as output.

Translation Units

For each translation unit tu, visit each definition appearing in tu.

Topology Definitions

For each topology definition d that has not yet been resolved:

  1. 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.

  2. Visit all topologies directly imported into t, ensuring that they are resolved.

  3. 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.

    1. 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.

    2. 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.

    3. Check that all directly specified connections are between valid instances.

    4. 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'.

    5. Resolve pattern specifiers and add the resulting connections to t.

  4. Check output port numbers.

    1. Check that the number of connections at each output port is in bounds for the port size.

    2. Check that there are no duplicate numbers at any output ports.

  5. Apply automatic numbering to t. This step fills in missing port numbers, preserving any numbers specified in the model source.

    1. Apply matched numbering. Use the algorithm described in the language spec.

    2. Apply general numbering. Use the algorithm described in the language spec.

  6. Compute the set of unconnected ports.

  7. Construct the unique topology symbol s for d.

  8. Map s to t in the topology map of a.

  9. Return a as the result.