/************ ** ** Old arpha-net protocol simulator ** ** compile with: pcc -o arpanet.par -sync mpc arpanet.pc -lm ** Adapted for PARSEC on 10-9-97 by Monnica Terwilliger ** **************/ #include #include #define N 10 #define MAX_CLOCK "1000" #define MAX_DELAY 10000 #define LOAD 20 #define SEND_TABLE 300 #define MAXINT 2147483647 #define INPUT_FILE "alpha.input" message Ready {}; message Address {ename router[N];}; message Send_table {}; message Table_info {int source; int delay[N];}; message Packet {int time; int so; int dest; int hops; int time_sent;}; message Start {}; message Source {ename comp;}; entity router (int, int[N][N], ename); entity computer (int, ename, ename); int expo(int, unsigned short []); int urand (int, int, unsigned short []); struct table { int router[N]; int send_to[N]; int delay[N]; }; entity driver (int argc, char **argv) { int i, j, input; int so, de, time; FILE *fp; int map[N][N], endsim; ename routers[N], comps[N]; if (argc == 2) setmaxclock( atoi(argv[1])); else setmaxclock( atoi(MAX_CLOCK)); if ((fp = fopen (INPUT_FILE, "r")) == NULL) fputs("error opening the input file\n",stderr); /* read in the network topology */ for (i=0; i