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