Line 35... |
Line 35... |
(*y) = code & masky;
|
(*y) = code & masky;
|
code>>=nyw;
|
code>>=nyw;
|
(*l) = code;
|
(*l) = code;
|
}
|
}
|
|
|
|
void ring_line_addr_sep(unsigned int code, unsigned int *x, unsigned int *l){
|
|
(*x) = code & maskx;
|
|
code>>=nxw;
|
|
(*l) = code;
|
|
}
|
|
|
unsigned int mesh_tori_addr_join(unsigned int x, unsigned int y, unsigned int l){
|
unsigned int mesh_tori_addr_join(unsigned int x, unsigned int y, unsigned int l){
|
|
|
unsigned int addrencode=0;
|
unsigned int addrencode=0;
|
addrencode =(T3==1)? (y<<nxw | x) : (l<<(nxw+nyw)| (y<<nxw) | x);
|
addrencode =(T3==1)? (y<<nxw | x) : (l<<(nxw+nyw)| (y<<nxw) | x);
|
return addrencode;
|
return addrencode;
|
}
|
}
|
|
|
|
unsigned int ring_line_addr_join(unsigned int x, unsigned int l){
|
|
unsigned int addrencode=0;
|
|
addrencode =(T3==1)? x : (l<<nxw) | x;
|
|
return addrencode;
|
|
}
|
|
|
|
|
unsigned int mesh_tori_addrencode (unsigned int id){
|
unsigned int mesh_tori_addrencode (unsigned int id){
|
unsigned int y, x, l;
|
unsigned int y, x, l;
|
mesh_tori_addrencod_sep(id,&x,&y,&l);
|
mesh_tori_addrencod_sep(id,&x,&y,&l);
|
return mesh_tori_addr_join(x,y,l);
|
return mesh_tori_addr_join(x,y,l);
|
}
|
}
|
|
|
|
unsigned int ring_line_addrencode (unsigned int id){
|
|
unsigned int y , x, l;
|
|
mesh_tori_addrencod_sep(id,&x,&y,&l);
|
|
return ring_line_addr_join(x,l);
|
|
}
|
|
|
|
|
void fmesh_addrencod_sep(unsigned int id, unsigned int *x, unsigned int *y, unsigned int *p){
|
void fmesh_addrencod_sep(unsigned int id, unsigned int *x, unsigned int *y, unsigned int *p){
|
unsigned int l, diff,mul,addrencode;
|
unsigned int l, diff,mul,addrencode;
|
mul = T1*T2*T3;
|
mul = T1*T2*T3;
|
if(id < mul) {
|
if(id < mul) {
|
Line 116... |
Line 132... |
mesh_tori_addr_sep(code,&x,&y,&l);
|
mesh_tori_addr_sep(code,&x,&y,&l);
|
//if(code==0x1a) printf("code=%x,x=%u,y=%u,l=%u\n",code,x,y,l);
|
//if(code==0x1a) printf("code=%x,x=%u,y=%u,l=%u\n",code,x,y,l);
|
return ((y*T1)+x)*T3+l;
|
return ((y*T1)+x)*T3+l;
|
}
|
}
|
|
|
|
unsigned int ring_line_endp_addr_decoder (unsigned int code){
|
|
unsigned int x, l;
|
|
ring_line_addr_sep(code,&x,&l);
|
|
//if(code==0x1a) printf("code=%x,x=%u,y=%u,l=%u\n",code,x,y,l);
|
|
return x*T3+l;
|
|
}
|
|
|
|
|
|
|
|
|
unsigned int endp_addr_encoder ( unsigned int id){
|
unsigned int endp_addr_encoder ( unsigned int id){
|
#if defined (IS_MESH) || defined (IS_TORUS) || defined (IS_LINE) || defined (IS_RING )
|
#if defined (IS_MESH) || defined (IS_TORUS)
|
return mesh_tori_addrencode(id);
|
return mesh_tori_addrencode(id);
|
#endif
|
#elif defined (IS_LINE) || defined (IS_RING )
|
|
return ring_line_addrencode(id);
|
|
#else
|
return fmesh_addrencode(id);
|
return fmesh_addrencode(id);
|
|
#endif
|
}
|
}
|
|
|
|
|
unsigned int endp_addr_decoder (unsigned int code){
|
unsigned int endp_addr_decoder (unsigned int code){
|
#if defined (IS_MESH) || defined (IS_TORUS) || defined (IS_LINE) || defined (IS_RING )
|
#if defined (IS_MESH) || defined (IS_TORUS)
|
return mesh_tori_endp_addr_decoder (code);
|
return mesh_tori_endp_addr_decoder (code);
|
|
#elif defined (IS_LINE) || defined (IS_RING )
|
|
return ring_line_endp_addr_decoder (code);
|
#endif
|
#endif
|
return fmesh_endp_addr_decoder (code);
|
return fmesh_endp_addr_decoder (code);
|
}
|
}
|
|
|
|
|