Skip to content

Check Topology Definitions

bocchino edited this page Mar 18, 2021 · 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.

Component 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 as much as possible. For example, ensure that the types of the port connections match.

  2. Visit all topologies 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. 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.

    2. Resolve pattern specifiers in t to direct specifiers.

    3. For each connection graph name g appearing in t or in an imported topology, determine the set of all connections in g, with multiplicity (two or more connections between the same pairs of unnumbered ports are allowed).

      1. Include all connections directly specified in t, after resolving patterns. Check that all connections are between instances present in t. If not, throw an error.

      2. Include all connections from imported topologies that go between instances present in t.

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

    1. General numbering. This step includes checks that (i) the numbers are in bounds for the ports and (ii) no two connections at the same output port have the same number.

    2. Matched numbering

  5. Check for unused ports in t that are not in the unused port list.

  6. Construct the unique topology symbol s for d.

  7. Map s to t in the component map of a.

  8. Return a as the result.

Clone this wiki locally