-
Notifications
You must be signed in to change notification settings - Fork 31
Check Component Definitions
This algorithm traverses the source model and checks component 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 component 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 component definition d
-
Create a new component c.
-
Visit each member m of d with input a.
-
If m is a port instance specifier, then
-
Check that the specifier follows the rules. For example,
async
specifiers may not use ports withref
parameters; specifiers that are notasync
may not specify queue behavior. -
Create a new port instance pi
-
Add pi to the port instance map of c. If the name is already in the map, then throw an error.
-
If m is a special port instance specifier, then
-
Add pi to the special port instance map of c.
-
If the kind is already in the map, then throw an error.
-
-
-
If m is an internal port specifier, then create a new internal port instance pi and pi to the port instance map of c. If the name is already in the map, then throw an error.
-
If m is a command specifier, then create a new command cmd and add cmd to the commands of c. Check for duplicate opcodes.
-
If m is a parameter specifier, then
-
Create a new parameter p and add p to the parameters of c. Check for duplicate identifiers.
-
Create the implied get and set commands for p. Add the commands to the commands of c. Check for duplicate opcodes.
-
-
If m is a telemetry channel specifier, then create a new telemetry channel ch and add ch to the telemetry channels of c. Check for duplicate identifiers.
-
If m is an event specifier, then create a new event e and add e to the events of c. Check for duplicate identifiers.
-
-
Check that there are no duplicate names in any of the dictionaries.
-
If the component is passive, check that there is no
async
input
port specifier, internal port specifier, orasync
command specifier. -
If the component is active or queued, check that there is at least one
async
input
port specifier, internal port specifier, orasync
command specifier. -
Check that the component has the ports required by the dictionary specifiers. For example, if there are any commands, then there must be a
command recv
port. -
Construct the unique component symbol s for d.
-
Map s to c in the component map of a.
-
Return a as the result.