The CSIM tools allow the user to
guide the paths that messages are routed in the system when multiple
alternate paths exist. This is done by specifying key hardware nodes
(waypoints) that the message must pass through.
The CSIM Data Flow Graph (DFG) Graphical User Interface (GUI) is the tool used to describe the tasks and their mapping on hardware programmable devices. Links between tasks describe the messages that are communicated between the tasks. The CSIM Router tool generates all possible routes or subsets of routes between all devices in the hardware architecture. When there are more than one likely route between devices, the user can specify which route to select by setting an attribute on the DFG link between the two task nodes. When popping up the link attribute window, the user specifies:
Waypoints = waypoints
where waypoints is the list of hardware devices separated by spaces.
The names follow the same rules used in mapping the software nodes to hardware nodes, which are the full device names listed in the 'netinfo' file. Macros may also be used to rename devices or device lists. Any number of waypoints may be used. The CSIM Scheduler converts the device names to device id's as defined by the 'netinfo' file.
Caution: the user should be careful in not specifying waypoints which may cause multiple use of devices in the path and thus cause the system to hang. We may provide a check for this condition later on.
Waypoints must be devices whose DEVICE_CLASS is not defined as either 'nosource' or 'nodest' since the router deletes their paths for file size reduction. If the device is not defined in that manner, it may be used as a waypoint, even though it may not actively be a router which recalculates the route.
Waypoints Code
Implementation Details
To facilitate the coding of devices that will be used in generating or regenerating routes, several functions have been added to the 'subroutines.sim' file.
As a preface, two new fields have been added to the 'message_struct':
int *waypoint_list;
int waypoint_index;
The following function:
void form_waypoints_route(struct message_struct *msg);
is to be used for generating the waypoint_list and route_list by devices that originate the message having a Waypoints attribute. The route_list is based on the waypoint_list and will be the full route from the source to the destination.
The function:
void form_route_list(struct message_struct *msg);
is to be used by devices that may be used as waypoints (routers) that will recalculate the route_list from their node to the final destination.
Devices may check for waypoint_list != NULL before calling the above functions.
For READ_REQ messages, the order of the waypoint_list is reversed from what appears in the Waypoints attribute list. This is because the path is formed at the data destination rather than at the source.
Implementation note detail: When not using waypoints, the route_list is a pointer to an array in the route_table which must not be disturbed. When using waypoints, the route_list points to a dynamically allocated memory which is generated by the above named functions. That memory is now freed as part of the 'free_message_struct' function.
A third function to be used by devices that need to duplicate messages having a waypoint_list is:
int *intdup(int *arrayptr);
It is similar to the 'strdup' function, but is used with integer arrays rather than character arrays. The arrays are assumed to consist of non-negative integers except for the last entry which must be a negative integer to terminate the array.
This function will generally be used by
devices that packetize messages into multiple packets. When messages
having waypoints are duplicated, the waypoint_list and route_list
must also be duplicated. This is done as
part of the 'clone_message_struct'
function.