Line 81... |
Line 81... |
|
|
//assign current_layer_addr [ROOT_ID] = ROOT_L;
|
//assign current_layer_addr [ROOT_ID] = ROOT_L;
|
//assign current_pos_addr [ROOT_ID] = {LKw{1'b0}};
|
//assign current_pos_addr [ROOT_ID] = {LKw{1'b0}};
|
unsigned int addr = ROOT_L << LKw;
|
unsigned int addr = ROOT_L << LKw;
|
router1[ROOT_ID]->current_r_addr = addr;
|
router1[ROOT_ID]->current_r_addr = addr;
|
|
router1[ROOT_ID]->current_r_id = ROOT_ID;
|
|
|
|
|
unsigned int pos,level;
|
unsigned int pos,level;
|
unsigned int num = 0;
|
unsigned int num = 0;
|
//connect all up connections
|
//connect all up connections
|
for (level = 1; level<L; level=level+1) { // : level_c
|
for (level = 1; level<L; level=level+1) { // : level_c
|
Line 107... |
Line 109... |
|
|
// node_connection('Router[id1][k] to router[id2][pos%k];
|
// node_connection('Router[id1][k] to router[id2][pos%k];
|
//assign router_chan_out [ID1][K] = router_chan_in [ID2][PORT2];
|
//assign router_chan_out [ID1][K] = router_chan_in [ID2][PORT2];
|
//assign router_chan_out [ID2][PORT2]= router_chan_in[ID1][K];
|
//assign router_chan_out [ID2][PORT2]= router_chan_in[ID1][K];
|
//bintree_connect(Ti(ID1),Ri(ID1),port,Ti(ID2),Ri(ID2),PORT2);
|
//bintree_connect(Ti(ID1),Ri(ID1),port,Ti(ID2),Ri(ID2),PORT2);
|
r2r_cnt_all[num] =(r2r_cnt_table_t){.t1=Ti(ID1), .r1=Ri(ID1), .p1=K, .t2=Ti(ID2), .r2=Ri(ID2), .p2=PORT2 };
|
r2r_cnt_all[num] =(r2r_cnt_table_t){.id1=ID1, .t1=Ti(ID1), .r1=Ri(ID1), .p1=K,.id2=ID2, .t2=Ti(ID2), .r2=Ri(ID2), .p2=PORT2 };
|
|
|
|
|
|
|
|
|
unsigned int current_layer_addr = L1;
|
unsigned int current_layer_addr = L1;
|
unsigned int current_pos_addr = ADR_CODE1;
|
unsigned int current_pos_addr = ADR_CODE1;
|
//assign current_r_addr [ID1] = {current_layer_addr [ID1],current_pos_addr[ID1]};
|
//assign current_r_addr [ID1] = {current_layer_addr [ID1],current_pos_addr[ID1]};
|
unsigned int addr = (current_layer_addr << LKw)| current_pos_addr;
|
unsigned int addr = (current_layer_addr << LKw)| current_pos_addr;
|
|
|
router2[Ri(ID1)]->current_r_addr = addr;
|
router2[Ri(ID1)]->current_r_addr = addr;
|
|
router2[Ri(ID1)]->current_r_id = ID1;
|
|
|
//printf( "[%u] =(addr=%x), t1=%u, r1=%u, p1=%u, t2=%u, r2=%u, p2=%u \n", num,addr, r2r_cnt_all[num].t1, r2r_cnt_all[num].r1, r2r_cnt_all[num].p1, r2r_cnt_all[num].t2, r2r_cnt_all[num].r2, r2r_cnt_all[num].p2 );
|
//printf( "[%u] =(addr=%x), t1=%u, r1=%u, p1=%u, t2=%u, r2=%u, p2=%u \n", num,addr, r2r_cnt_all[num].t1, r2r_cnt_all[num].r1, r2r_cnt_all[num].p1, r2r_cnt_all[num].t2, r2r_cnt_all[num].r2, r2r_cnt_all[num].p2 );
|
|
|
|
|
|
|
|
|
Line 131... |
Line 135... |
num++;
|
num++;
|
}// pos
|
}// pos
|
|
|
} //level
|
} //level
|
|
|
|
R2R_TABLE_SIZ=num;
|
|
|
// connect }points
|
// connect }points
|
|
|
for ( pos = 0; pos < NE; pos=pos+1 ) { // : }points
|
for ( pos = 0; pos < NE; pos=pos+1 ) { // : }points
|
// node_connection T[pos] R[rid][pos %k];
|
// node_connection T[pos] R[rid][pos %k];
|
Line 152... |
Line 157... |
} //pos
|
} //pos
|
|
|
}
|
}
|
|
|
|
|
void topology_connect_all_nodes (void){
|
void topology_connect_r2r (int n){
|
unsigned int pos,level;
|
fattree_connect(r2r_cnt_all[n]);
|
unsigned int num=0;
|
}
|
//connect all up connections
|
|
for (level = 1; level<L; level=level+1) { // : level_c
|
|
unsigned int NPOS = powi(K,level); // number of routers in this level
|
|
for ( pos = 0; pos < NPOS; pos=pos+1 ) { // : pos_c
|
|
|
|
fattree_connect(r2r_cnt_all[num]);
|
void topology_connect_r2e (int n){
|
num++;
|
connect_r2e(2,r2e_cnt_all[n].r1,r2e_cnt_all[n].p1,n);
|
|
}
|
|
|
}// pos
|
/*
|
|
void topology_connect_all_nodes (void){
|
|
unsigned int pos,level;
|
|
unsigned int num=0;
|
|
//connect all up connections
|
|
for (level = 1; level<L; level=level+1) { // : level_c
|
|
unsigned int NPOS = powi(K,level); // number of routers in this level
|
|
for ( pos = 0; pos < NPOS; pos=pos+1 ) { // : pos_c
|
|
|
} //level
|
fattree_connect(r2r_cnt_all[num]);
|
|
num++;
|
|
|
|
}// pos
|
|
|
// connect }points
|
} //level
|
|
|
for ( pos = 0; pos < NE; pos=pos+1 ) { // : }points
|
|
|
|
connect_r2e(2,r2e_cnt_all[pos].r1,r2e_cnt_all[pos].p1,pos);
|
// connect }points
|
|
|
|
for ( pos = 0; pos < NE; pos=pos+1 ) { // : }points
|
|
|
|
connect_r2e(2,r2e_cnt_all[pos].r1,r2e_cnt_all[pos].p1,pos);
|
|
|
}
|
|
}
|
|
|
|
|
}
|
|
}
|
|
|
|
*/
|
|
|
unsigned int get_mah_distance ( unsigned int id1, unsigned int id2){
|
unsigned int get_mah_distance ( unsigned int id1, unsigned int id2){
|
|
|
unsigned int k =T1;
|
unsigned int k =T1;
|
unsigned int l =T2;
|
unsigned int l =T2;
|