|
Configuring Multi-Processor Applications |
Top Previous Next |
|
You can find the source code for the example discussed here in the folder:
<3L>Diamond\edition\Sundance\C6000\examples\example-3\
The new configuration file is shown here:
! Hardware configuration processor dsp1 SMT395 root processor dsp2 SMT395 wire ? dsp1[CP:0] dsp2[CP:3]
! Software configuration task driver ins=1 outs=1 data=? task upc ins=1 outs=1 data=20k
! Channel connections connect ? driver[0] upc[0] connect ? upc[0] driver[0]
! Task placement place driver dsp1 place upc dsp2
We are going to run the case-conversion example on a two-processor system with the driver task on the root processor and the upc task on the other processor.
The new hardware must be declared in the configuration file:
processor dsp1 SMT395 root processor dsp2 SMT395 wire ? dsp1[CP:0] dsp2[CP:3]
The second line creates a new processor, dsp2. We must also specify its type and say which of the available DSPs we want it to be.
The next line contains a new statement, WIRE. This declares that there is a physical connection between comport link 0 of dsp1 and comport link 3 of the new processor, dsp2. Obviously, this wire statement must reflect the real hardware configuration.
There must be at least one path of wires from the root node to every processor in a network. This path may pass through any number of intermediate nodes.
If we reconfigured the application with only these changes to the configuration file, dsp2 would be unused because the upc and driver tasks are both placed on dsp1. We can fix this by modifying the PLACE statement for upc:
place upc dsp2
Now the configurer arranges for the code of the upc task to be loaded into the second processor when the complete application is started with the server.
Notice that the CONNECT statements do not need to be changed, as the logical connections between the tasks are the same as before. If CONNECT is used to connect ports of two tasks on the same processor, the channel the configurer binds to the two ports is implemented by a memory copy. If the tasks are on different processors, the channel involves the interprocessor links and Diamond's communication software. As far as the programmer is concerned, these two cases are identical, and exactly the same library functions are used(chan_out_word, chan_in_word and so on).
It's important to understand the difference between the WIRE statement and the CONNECT statement. WIRE specifies the actual hardware connections between processors; CONNECT specifies the logical connections (channels) between tasks. The index values in CONNECT statements refer to elements of the input and output port vectors. If a CONNECT statement requires messages to be transferred to another processor, the communication software makes use of the available wires to do this. The programmer does not need to know which wire, or which hardware link, is used. |