Ignore:
Timestamp:
Feb 8, 2015, 12:55:35 PM (9 years ago)
Author:
alain
Message:

Introduce quad tree for distributed locks and barriers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_common/utils.c

    r490 r495  
    814814
    815815
     816/////////////////////////////////////////////
     817void _get_sqt_footprint( unsigned int* width,
     818                         unsigned int* heigth,
     819                         unsigned int* levels )
     820{
     821    mapping_header_t*   header  = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
     822    mapping_cluster_t*  cluster = _get_cluster_base(header);
     823
     824    unsigned int x;
     825    unsigned int y;
     826    unsigned int cid;
     827    unsigned int w = 0;
     828    unsigned int h = 0;
     829
     830    // scan all clusters to compute SQT footprint (w,h)
     831    for ( x = 0 ; x < X_SIZE ; x++ )
     832    {
     833        for ( y = 0 ; y < Y_SIZE ; y++ )
     834        {
     835            cid = x * Y_SIZE + y;
     836            if ( cluster[cid].procs )  // cluster contains processors
     837            {
     838                if ( x > w ) w = x;
     839                if ( y > h ) h = y;
     840            }
     841        }
     842    }           
     843    *width  = w + 1;
     844    *heigth = h + 1;
     845   
     846    // compute SQT levels
     847    unsigned int z = (h > w) ? h : w;
     848    *levels = (z < 1) ? 1 : (z < 2) ? 2 : (z < 4) ? 3 : (z < 8) ? 4 : 5;
     849}
     850     
     851
     852
    816853///////////////////////////////////////////////////////////////////////////////////
    817854//   Required by GCC
Note: See TracChangeset for help on using the changeset viewer.