Ignore:
Timestamp:
Oct 4, 2014, 3:19:32 PM (10 years ago)
Author:
alain
Message:

Introducing fixed format (X_WIDTH / Y_WIDTH / P_WIDTH) for processor index.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/sys_handler.c

    r410 r428  
    3535const void * _syscall_vector[64] =
    3636{
    37     &_get_procid,          /* 0x00 */
     37    &_proc_xyp,            /* 0x00 */
    3838    &_get_proctime,        /* 0x01 */
    3939    &_tty_write,           /* 0x02 */
     
    113113}
    114114
     115//////////////////////////////////////////////////////////////////////////////
     116// This function returns the processor (x,y,p) identifiers.
     117//////////////////////////////////////////////////////////////////////////////
     118void _proc_xyp( unsigned int* x,
     119                unsigned int* y,
     120                unsigned int* p )
     121{
     122    unsigned int gpid = _get_procid();  // global processor index from CPO register
     123
     124    *x = (gpid >> (Y_WIDTH + P_WIDTH)) & ((1<<X_WIDTH)-1);
     125    *y = (gpid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
     126    *p = gpid & ((1<<P_WIDTH)-1);
     127}
    115128////////////////////////////////////////////////////////////////////////////
    116129// Task suicide... after printing a death message.
     
    119132{
    120133    unsigned int date       = _get_proctime();
    121     unsigned int proc_id    = _get_procid();
    122     unsigned int cluster_xy = proc_id / NB_PROCS_MAX;
     134
     135    unsigned int gpid       = _get_procid();
     136    unsigned int cluster_xy = gpid >> P_WIDTH;
    123137    unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
    124138    unsigned int x          = cluster_xy >> Y_WIDTH;
    125     unsigned int lpid       = proc_id % NB_PROCS_MAX;
     139    unsigned int lpid       = gpid & ((1<<P_WIDTH)-1);
     140
    126141    unsigned int task_id    = _get_context_slot(CTX_LTID_ID);
    127142
Note: See TracChangeset for help on using the changeset viewer.