1 |
48 |
alirezamon |
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
void topology_connect_all_nodes (void){
|
6 |
|
|
//Connect R0 input ports 0 to T0 output ports 0
|
7 |
|
|
connect_r2e(1,0,0,0);
|
8 |
|
|
//Connect R0 input ports 1 to R14 output ports 3
|
9 |
|
|
conect_r2r(1,0,1,2,6,3);
|
10 |
|
|
//Connect R0 input ports 2 to R13 output ports 3
|
11 |
|
|
conect_r2r(1,0,2,2,5,3);
|
12 |
|
|
//Connect R1 input ports 0 to T1 output ports 0
|
13 |
|
|
connect_r2e(1,1,0,1);
|
14 |
|
|
//Connect R1 input ports 1 to R7 output ports 3
|
15 |
|
|
conect_r2r(1,1,1,2,3,3);
|
16 |
|
|
//Connect R1 input ports 2 to R2 output ports 2
|
17 |
|
|
conect_r2r(1,1,2,1,2,2);
|
18 |
|
|
//Connect R2 input ports 0 to T2 output ports 0
|
19 |
|
|
connect_r2e(1,2,0,2);
|
20 |
|
|
//Connect R2 input ports 1 to R15 output ports 2
|
21 |
|
|
conect_r2r(1,2,1,2,7,2);
|
22 |
|
|
//Connect R2 input ports 2 to R1 output ports 2
|
23 |
|
|
conect_r2r(1,2,2,1,1,2);
|
24 |
|
|
//Connect R3 input ports 0 to T3 output ports 0
|
25 |
|
|
connect_r2e(1,3,0,3);
|
26 |
|
|
//Connect R3 input ports 1 to R15 output ports 3
|
27 |
|
|
conect_r2r(1,3,1,2,7,3);
|
28 |
|
|
//Connect R3 input ports 2 to R4 output ports 2
|
29 |
|
|
conect_r2r(1,3,2,2,0,2);
|
30 |
|
|
//Connect R4 input ports 0 to T4 output ports 0
|
31 |
|
|
connect_r2e(2,0,0,4);
|
32 |
|
|
//Connect R4 input ports 1 to R9 output ports 2
|
33 |
|
|
conect_r2r(2,0,1,3,1,2);
|
34 |
|
|
//Connect R4 input ports 2 to R3 output ports 2
|
35 |
|
|
conect_r2r(2,0,2,1,3,2);
|
36 |
|
|
//Connect R4 input ports 3 to R6 output ports 3
|
37 |
|
|
conect_r2r(2,0,3,2,2,3);
|
38 |
|
|
//Connect R5 input ports 0 to T5 output ports 0
|
39 |
|
|
connect_r2e(2,1,0,5);
|
40 |
|
|
//Connect R5 input ports 1 to R11 output ports 4
|
41 |
|
|
conect_r2r(2,1,1,3,3,4);
|
42 |
|
|
//Connect R5 input ports 2 to R6 output ports 2
|
43 |
|
|
conect_r2r(2,1,2,2,2,2);
|
44 |
|
|
//Connect R5 input ports 3 to R13 output ports 2
|
45 |
|
|
conect_r2r(2,1,3,2,5,2);
|
46 |
|
|
//Connect R6 input ports 0 to T6 output ports 0
|
47 |
|
|
connect_r2e(2,2,0,6);
|
48 |
|
|
//Connect R6 input ports 1 to R9 output ports 3
|
49 |
|
|
conect_r2r(2,2,1,3,1,3);
|
50 |
|
|
//Connect R6 input ports 2 to R5 output ports 2
|
51 |
|
|
conect_r2r(2,2,2,2,1,2);
|
52 |
|
|
//Connect R6 input ports 3 to R4 output ports 3
|
53 |
|
|
conect_r2r(2,2,3,2,0,3);
|
54 |
|
|
//Connect R7 input ports 0 to T7 output ports 0
|
55 |
|
|
connect_r2e(2,3,0,7);
|
56 |
|
|
//Connect R7 input ports 1 to R12 output ports 3
|
57 |
|
|
conect_r2r(2,3,1,2,4,3);
|
58 |
|
|
//Connect R7 input ports 2 to R14 output ports 2
|
59 |
|
|
conect_r2r(2,3,2,2,6,2);
|
60 |
|
|
//Connect R7 input ports 3 to R1 output ports 1
|
61 |
|
|
conect_r2r(2,3,3,1,1,1);
|
62 |
|
|
//Connect R12 input ports 0 to T8 output ports 0
|
63 |
|
|
connect_r2e(2,4,0,8);
|
64 |
|
|
//Connect R12 input ports 1 to R8 output ports 4
|
65 |
|
|
conect_r2r(2,4,1,3,0,4);
|
66 |
|
|
//Connect R12 input ports 2 to R10 output ports 3
|
67 |
|
|
conect_r2r(2,4,2,3,2,3);
|
68 |
|
|
//Connect R12 input ports 3 to R7 output ports 1
|
69 |
|
|
conect_r2r(2,4,3,2,3,1);
|
70 |
|
|
//Connect R13 input ports 0 to T9 output ports 0
|
71 |
|
|
connect_r2e(2,5,0,9);
|
72 |
|
|
//Connect R13 input ports 1 to R8 output ports 2
|
73 |
|
|
conect_r2r(2,5,1,3,0,2);
|
74 |
|
|
//Connect R13 input ports 2 to R5 output ports 3
|
75 |
|
|
conect_r2r(2,5,2,2,1,3);
|
76 |
|
|
//Connect R13 input ports 3 to R0 output ports 2
|
77 |
|
|
conect_r2r(2,5,3,1,0,2);
|
78 |
|
|
//Connect R14 input ports 0 to T10 output ports 0
|
79 |
|
|
connect_r2e(2,6,0,10);
|
80 |
|
|
//Connect R14 input ports 1 to R8 output ports 3
|
81 |
|
|
conect_r2r(2,6,1,3,0,3);
|
82 |
|
|
//Connect R14 input ports 2 to R7 output ports 2
|
83 |
|
|
conect_r2r(2,6,2,2,3,2);
|
84 |
|
|
//Connect R14 input ports 3 to R0 output ports 1
|
85 |
|
|
conect_r2r(2,6,3,1,0,1);
|
86 |
|
|
//Connect R15 input ports 0 to T11 output ports 0
|
87 |
|
|
connect_r2e(2,7,0,11);
|
88 |
|
|
//Connect R15 input ports 1 to R10 output ports 4
|
89 |
|
|
conect_r2r(2,7,1,3,2,4);
|
90 |
|
|
//Connect R15 input ports 2 to R2 output ports 1
|
91 |
|
|
conect_r2r(2,7,2,1,2,1);
|
92 |
|
|
//Connect R15 input ports 3 to R3 output ports 1
|
93 |
|
|
conect_r2r(2,7,3,1,3,1);
|
94 |
|
|
//Connect R8 input ports 0 to T12 output ports 0
|
95 |
|
|
connect_r2e(3,0,0,12);
|
96 |
|
|
//Connect R8 input ports 1 to R11 output ports 1
|
97 |
|
|
conect_r2r(3,0,1,3,3,1);
|
98 |
|
|
//Connect R8 input ports 2 to R13 output ports 1
|
99 |
|
|
conect_r2r(3,0,2,2,5,1);
|
100 |
|
|
//Connect R8 input ports 3 to R14 output ports 1
|
101 |
|
|
conect_r2r(3,0,3,2,6,1);
|
102 |
|
|
//Connect R8 input ports 4 to R12 output ports 1
|
103 |
|
|
conect_r2r(3,0,4,2,4,1);
|
104 |
|
|
//Connect R9 input ports 0 to T13 output ports 0
|
105 |
|
|
connect_r2e(3,1,0,13);
|
106 |
|
|
//Connect R9 input ports 1 to R11 output ports 3
|
107 |
|
|
conect_r2r(3,1,1,3,3,3);
|
108 |
|
|
//Connect R9 input ports 2 to R4 output ports 1
|
109 |
|
|
conect_r2r(3,1,2,2,0,1);
|
110 |
|
|
//Connect R9 input ports 3 to R6 output ports 1
|
111 |
|
|
conect_r2r(3,1,3,2,2,1);
|
112 |
|
|
//Connect R9 input ports 4 to R10 output ports 2
|
113 |
|
|
conect_r2r(3,1,4,3,2,2);
|
114 |
|
|
//Connect R10 input ports 0 to T14 output ports 0
|
115 |
|
|
connect_r2e(3,2,0,14);
|
116 |
|
|
//Connect R10 input ports 1 to R11 output ports 2
|
117 |
|
|
conect_r2r(3,2,1,3,3,2);
|
118 |
|
|
//Connect R10 input ports 2 to R9 output ports 4
|
119 |
|
|
conect_r2r(3,2,2,3,1,4);
|
120 |
|
|
//Connect R10 input ports 3 to R12 output ports 2
|
121 |
|
|
conect_r2r(3,2,3,2,4,2);
|
122 |
|
|
//Connect R10 input ports 4 to R15 output ports 1
|
123 |
|
|
conect_r2r(3,2,4,2,7,1);
|
124 |
|
|
//Connect R11 input ports 0 to T15 output ports 0
|
125 |
|
|
connect_r2e(3,3,0,15);
|
126 |
|
|
//Connect R11 input ports 1 to R8 output ports 1
|
127 |
|
|
conect_r2r(3,3,1,3,0,1);
|
128 |
|
|
//Connect R11 input ports 2 to R10 output ports 1
|
129 |
|
|
conect_r2r(3,3,2,3,2,1);
|
130 |
|
|
//Connect R11 input ports 3 to R9 output ports 1
|
131 |
|
|
conect_r2r(3,3,3,3,1,1);
|
132 |
|
|
//Connect R11 input ports 4 to R5 output ports 1
|
133 |
|
|
conect_r2r(3,3,4,2,1,1);
|
134 |
|
|
|
135 |
|
|
}
|
136 |
|
|
|
137 |
|
|
void topology_init(void){
|
138 |
|
|
router1[0]->current_r_addr=0;
|
139 |
|
|
router1[1]->current_r_addr=1;
|
140 |
|
|
router1[2]->current_r_addr=2;
|
141 |
|
|
router1[3]->current_r_addr=3;
|
142 |
|
|
router2[0]->current_r_addr=4;
|
143 |
|
|
router2[1]->current_r_addr=5;
|
144 |
|
|
router2[2]->current_r_addr=6;
|
145 |
|
|
router2[3]->current_r_addr=7;
|
146 |
|
|
router2[4]->current_r_addr=8;
|
147 |
|
|
router2[5]->current_r_addr=9;
|
148 |
|
|
router2[6]->current_r_addr=10;
|
149 |
|
|
router2[7]->current_r_addr=11;
|
150 |
|
|
router3[0]->current_r_addr=12;
|
151 |
|
|
router3[1]->current_r_addr=13;
|
152 |
|
|
router3[2]->current_r_addr=14;
|
153 |
|
|
router3[3]->current_r_addr=15;
|
154 |
|
|
|
155 |
|
|
}
|