Ignore:
Timestamp:
Dec 19, 2013, 9:36:48 AM (11 years ago)
Author:
alain
Message:

Introducing support for TSAR fixed format cluster index (cluster_xy)
We have now 4 parameters defined in map.xml:

  • X_WIDTH, Y_WIDTH define the fixed format (typically X_WIDTH = 4 / Y_WIDTH = 4)
  • X_SIZE, Y_SIZE define the actual TSAR 2D mesh variable size (from 1 to 16)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/mmc_driver.c

    r258 r263  
    2121#include <giet_config.h>
    2222#include <mmc_driver.h>
     23#include <tty_driver.h>
    2324#include <utils.h>
    2425
    25 #if !defined(NB_CLUSTERS)
    26 # error: You must define NB_CLUSTERS in the hard_config.h file
     26#if !defined(X_SIZE)
     27# error: You must define X_SIZE in the hard_config.h file
    2728#endif
    2829
    29 #if (NB_CLUSTERS > 256)
    30 # error: NB_CLUSTERS cannot be larger than 256!
     30#if !defined(Y_SIZE)
     31# error: You must define X_SIZE in the hard_config.h file
     32#endif
     33
     34#if !defined(X_WIDTH)
     35# error: You must define X_WIDTH in the hard_config.h file
     36#endif
     37
     38#if !defined(Y_WIDTH)
     39# error: You must define X_WIDTH in the hard_config.h file
    3140#endif
    3241
     
    4049                  unsigned int buf_length )
    4150{
    42     unsigned int cluster_id    = (unsigned int)((buf_paddr>>32)/(256/NB_CLUSTERS));
     51    // compute cluster coordinates
     52    unsigned int cluster_xy = (unsigned int)(buf_paddr>>(40-X_WIDTH-Y_WIDTH));
     53    unsigned int x          = cluster_xy >> Y_WIDTH;
     54    unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
     55
     56    // parameters checking
     57    if ( (x >= X_SIZE) || (y >= Y_SIZE) )
     58    {
     59        _puts("\n[GIET ERROR] in _memc_inval() : illegal cluster index[");
     60        _putd( x );
     61        _puts(",");
     62        _putd( y );
     63        _puts("]\n");
     64        _puts("   - paddr      = ");
     65        _putl( buf_paddr );
     66        _puts("\n   - cluster_xy = ");
     67        _putx( cluster_xy );
     68        _puts("\n");
     69        _exit();
     70    }
    4371
    4472    unsigned int* mmc_address = (unsigned int*)((unsigned int)&seg_mmc_base +
    45                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
     73                                (cluster_xy * (unsigned int)&vseg_cluster_increment));
    4674
    4775    // get the hard lock protecting exclusive access to MEMC
     
    6694                 unsigned int buf_length )
    6795{
    68     unsigned int cluster_id    = (unsigned int)((buf_paddr>>32)/(256/NB_CLUSTERS));
     96    // compute cluster coordinates
     97    unsigned int cluster_xy = (unsigned int)(buf_paddr>>(40-X_WIDTH-Y_WIDTH));
     98    unsigned int x          = cluster_xy >> Y_WIDTH;
     99    unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
     100
     101    // parameters checking
     102    if ( (x >= X_SIZE) || (y >= Y_SIZE) )
     103    {
     104        _puts("\n[GIET ERROR] in _memc_sync() : illegal cluster index[");
     105        _putd( x );
     106        _puts(",");
     107        _putd( y );
     108        _puts("]\n");
     109        _puts("   - paddr      = ");
     110        _putl( buf_paddr );
     111        _puts("\n   - cluster_xy = ");
     112        _putx( cluster_xy );
     113        _puts("\n");
     114        _exit();
     115    }
    69116
    70117    unsigned int * mmc_address = (unsigned int *) ((unsigned int)&seg_mmc_base +
    71                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
     118                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
    72119
    73120    // get the hard lock protecting exclusive access to MEMC
Note: See TracChangeset for help on using the changeset viewer.