[comp.sys.transputer] 3L config and C004

bohn%VKPMZC@VKPMZB.Physik.Uni-Mainz.DE (Markus Bohn) (10/15/90)

Dear Hsin chia Fu,

to your question about using the 3L-config for Master-Worker-Applications,
I will post the following example for help:

I don't know any details of the B008-Board and have no experiences with
it, but this example should show the general things to be done.
First thing is, to boot the root-transputer (directly connected to the host)
with an application-programm to program the C004-linkswitch.


/******************************************************************************

This program generates the following configuration of the TOP-Node, Link_2 of
the TOP_HT is hard-wired to the config-link of the C004.

                                +------+
                                | HOST |
                                +------+
                                    |
                                    |
                                    |
                ##########      ####0#####      ##########
                #        #      #        #      #        #
                # SUB1HT 0------1 TOP_HT 3------0 SUB3HT #
                #        #      #        #      #        #
                ##########      ####2#####      ##########
                                    |
                                    |
                                    |
                                    |
                                 ********
                                 * C004 *
                                 ********
******************************************************************************/
#include <chan.h>
#include <timer.h>

#define CONNECT         1               /*      C004 Commands           */
#define REQUEST         2
#define END             3
#define RESET           4

#define HT_L1           10              /*      C004 Linknumbers,       */
#define HT_L3           11              /*      must be adapted         */
#define SUB1_HT         12              /*      to local needs !        */
#define SUB3_HT         14

main(argc, argv, envp, in_ports, ins, out_ports, outs)
int     argc, ins, outs;
char    *argv[], *envp[];
CHAN    *in_ports[], *out_ports[];
{
        int             i;
        char    b, on, link;
        static char msg[512]= {
                                RESET,
                                CONNECT, HT_L1, SUB1_HT,
                                CONNECT, HT_L3, SUB3_HT,
                                END,
                                };

        chan_out_message(strlen(msg), msg, out_ports[2]);

}

/***************************************************************************/

This program must be compiled and linked, then configured with the following
configuration-file:

/**************************************************************************/

processor       host
processor       top_ht
processor       C004    type=PC

wire ?  host[0]         top_ht[0]
wire ?  top_ht[2]       C004[0]

task    afserver                        ins=1 outs=1
task    filter                          ins=2 outs=2    data=10k
task    conftop                         ins=3 outs=3    data=20k
task    linkswitch                      ins=1 outs=1

connect ?       afserver[0]             filter[0]
connect ?       filter[0]               afserver[0]

connect ?       filter[1]               conftop[1]
connect ?       conftop[1]              filter[1]

connect ?       conftop[2]              linkswitch[0]
connect ?       linkswitch[0]           conftop[2]

place afserver          host
place filter            top_ht
place conftop           top_ht
place linkswitch        C004

/*************************************************************************/

You can boot the root transputer with this conftop.app and the C004
should have the desired connections. You have to be sure that there is
no RESET-Signal on the linkswitch while booting the next application,
otherwise this programming will be lost !!!

Now, the main part, the configuring of the master-worker-application:
The Master- and Worker-Tasks can be written, compiled and linked as
discribed in the 3L-Manual. Instead of the 'fconfig'-command, you must
use the 'config' with somthing similar to the following *.cfg file. Most
important thing to notice, is the BIND-statement for the unused channels
and the URGENT attribute for the frouter-task.

The use of the channels of the frouter is described in the 3L-manual,
"data sheet: frouter". Channels no. 0-2 are the "down"-links. They may
be connected either to the "up"-link of a deeper node frouter, or set to
zero by the BIND-statement. Channel 3 is the "up"-link. If this node is
NOT the root, these "up"-ports are connected to a "down"-port of
a router of a higher node and Channel 4 ist bound to zero.
If it IS the root, port 3 is set to zero and channel 4 is attached to the
master-task. Port 5 MUST be connected to the worker-task.

The following *.cfg file was created for use with an 11-transputer-
application, it should be not to difficult to adapt it to your needs.

/***********************************************************************/
processor       host
processor       trpa
processor       trpb
processor       trpc
processor       trpd
processor       trpe
processor       trpf
processor       trpg
processor       trph
processor       trpi
processor       trpj
processor       trpk

wire ? host[0]  trpa[0]
wire ? trpa[3]  trpb[0]
wire ? trpb[1]  trpc[0]
wire ? trpb[2]  trpd[0]
wire ? trpa[2]  trpe[0]
wire ? trpe[1]  trpf[0]
wire ? trpe[3]  trpg[0]
wire ? trpf[1]  trph[0]
wire ? trpf[3]  trpi[0]
wire ? trpg[1]  trpj[0]
wire ? trpg[3]  trpk[0]

task afserver   ins=1 outs=1
task filter     ins=2 outs=2 data=10k
task master     ins=2 outs=2 data=500k

task worker1    file="worker.b4"        ins=1 outs=1 data=50k
task frouter1   file="frouter.b4"       ins=6 outs=6 data=11k urgent
task worker2    file="worker.b4"        ins=1 outs=1 data=50k
task frouter2   file="frouter.b4"       ins=6 outs=6 data=11k urgent
task worker3    file="worker.b4"        ins=1 outs=1 data=50k
task frouter3   file="frouter.b4"       ins=6 outs=6 data=11k urgent
task worker4    file="worker.b4"        ins=1 outs=1 data=50k
task frouter4   file="frouter.b4"       ins=6 outs=6 data=11k urgent
task worker5    file="worker.b4"        ins=1 outs=1 data=50k
task frouter5   file="frouter.b4"       ins=6 outs=6 data=11k urgent
task worker6    file="worker.b4"        ins=1 outs=1 data=50k
task frouter6   file="frouter.b4"       ins=6 outs=6 data=11k urgent
task worker7    file="worker.b4"        ins=1 outs=1 data=50k
task frouter7   file="frouter.b4"       ins=6 outs=6 data=11k urgent
task worker8    file="worker.b4"        ins=1 outs=1 data=50k
task frouter8   file="frouter.b4"       ins=6 outs=6 data=11k urgent
task worker9    file="worker.b4"        ins=1 outs=1 data=50k
task frouter9   file="frouter.b4"       ins=6 outs=6 data=11k urgent
task worker10   file="worker.b4"        ins=1 outs=1 data=50k
task frouter10  file="frouter.b4"       ins=6 outs=6 data=11k urgent
task worker11   file="worker.b4"        ins=1 outs=1 data=50k
task frouter11  file="frouter.b4"       ins=6 outs=6 data=11k urgent

connect ? afserver[0]   filter[0]
connect ? filter[0]     afserver[0]

connect ? filter[1]     master[1]
connect ? master[1]     filter[1]

connect ? master[0]     frouter1[4]
connect ? frouter1[4]   master[0]

connect ? frouter1[5]   worker1[0]
connect ? frouter2[5]   worker2[0]
connect ? frouter3[5]   worker3[0]
connect ? frouter4[5]   worker4[0]
connect ? frouter5[5]   worker5[0]
connect ? frouter6[5]   worker6[0]
connect ? frouter7[5]   worker7[0]
connect ? frouter8[5]   worker8[0]
connect ? frouter9[5]   worker9[0]
connect ? frouter10[5]  worker10[0]
connect ? frouter11[5]  worker11[0]

connect ? worker1[0]    frouter1[5]
connect ? worker2[0]    frouter2[5]
connect ? worker3[0]    frouter3[5]
connect ? worker4[0]    frouter4[5]
connect ? worker5[0]    frouter5[5]
connect ? worker6[0]    frouter6[5]
connect ? worker7[0]    frouter7[5]
connect ? worker8[0]    frouter8[5]
connect ? worker9[0]    frouter9[5]
connect ? worker10[0]   frouter10[5]
connect ? worker11[0]   frouter11[5]

connect ? frouter1[0]   frouter2[3]
connect ? frouter2[3]   frouter1[0]

connect ? frouter2[0]   frouter3[3]
connect ? frouter3[3]   frouter2[0]

connect ? frouter2[1]   frouter4[3]
connect ? frouter4[3]   frouter2[1]

connect ? frouter1[1]   frouter5[3]
connect ? frouter5[3]   frouter1[1]

connect ? frouter5[0]   frouter6[3]
connect ? frouter6[3]   frouter5[0]

connect ? frouter5[1]   frouter7[3]
connect ? frouter7[3]   frouter5[1]

connect ? frouter6[0]   frouter8[3]
connect ? frouter8[3]   frouter6[0]

connect ? frouter6[1]   frouter9[3]
connect ? frouter9[3]   frouter6[1]

connect ? frouter7[0]   frouter10[3]
connect ? frouter10[3]  frouter7[0]

connect ? frouter7[1]   frouter11[3]
connect ? frouter11[3]  frouter7[1]

bind input frouter1[2] value=0
bind input frouter1[3] value=0
bind output frouter1[2] value=0
bind output frouter1[3] value=0

bind input frouter2[4] value=0
bind input frouter2[2] value=0
bind output frouter2[4] value=0
bind output frouter2[2] value=0

bind input frouter3[0] value=0
bind input frouter3[1] value=0
bind input frouter3[2] value=0
bind input frouter3[4] value=0
bind output frouter3[0] value=0
bind output frouter3[1] value=0
bind output frouter3[2] value=0
bind output frouter3[4] value=0

bind input frouter4[0] value=0
bind input frouter4[1] value=0
bind input frouter4[2] value=0
bind input frouter4[4] value=0
bind output frouter4[0] value=0
bind output frouter4[1] value=0
bind output frouter4[2] value=0
bind output frouter4[4] value=0

bind input frouter5[4] value=0
bind input frouter5[2] value=0
bind output frouter5[4] value=0
bind output frouter5[2] value=0

bind input frouter6[2] value=0
bind input frouter6[4] value=0
bind output frouter6[2] value=0
bind output frouter6[4] value=0

bind input frouter7[2] value=0
bind input frouter7[4] value=0
bind output frouter7[2] value=0
bind output frouter7[4] value=0

bind input frouter8[0] value=0
bind input frouter8[1] value=0
bind input frouter8[2] value=0
bind input frouter8[4] value=0
bind output frouter8[0] value=0
bind output frouter8[1] value=0
bind output frouter8[2] value=0
bind output frouter8[4] value=0

bind input frouter9[0] value=0
bind input frouter9[1] value=0
bind input frouter9[2] value=0
bind input frouter9[4] value=0
bind output frouter9[0] value=0
bind output frouter9[1] value=0
bind output frouter9[2] value=0
bind output frouter9[4] value=0

bind input frouter10[0] value=0
bind input frouter10[1] value=0
bind input frouter10[2] value=0
bind input frouter10[4] value=0
bind output frouter10[0] value=0
bind output frouter10[1] value=0
bind output frouter10[2] value=0
bind output frouter10[4] value=0

bind input frouter11[0] value=0
bind input frouter11[1] value=0
bind input frouter11[2] value=0
bind input frouter11[4] value=0
bind output frouter11[0] value=0
bind output frouter11[1] value=0
bind output frouter11[2] value=0
bind output frouter11[4] value=0

place afserver  host
place filter    trpa
place master    trpa
place worker1   trpa
place frouter1  trpa
place worker2   trpb
place frouter2  trpb
place worker3   trpc
place frouter3  trpc
place worker4   trpd
place frouter4  trpd
place worker5   trpe
place frouter5  trpe
place worker6   trpf
place frouter6  trpf
place worker7   trpg
place frouter7  trpg
place worker8   trph
place frouter8  trph
place worker9   trpi
place frouter9  trpi
place worker10  trpj
place frouter10 trpj
place worker11  trpk
place frouter11 trpk

/**************************************************************************/

Last, a usefull hint: try a smaller configuration first to get familiar with
this "unfrendly"-concept, it took me several days to find all out, but it
works !!!

Hope this will help you,
Greetings,

Markus Bohn

###########################################################################
#                                                                         #
# Markus Bohn                        bohn@dmznat51.bitnet                 #
# Inst. f. Kernphysik                                                     #
# Univ. Mainz                                                             #
# D-6500 Mainz                                                            #
# Germany                                                                 #
#                                                                         #
###########################################################################