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/icu_driver.c

    r258 r263  
    1616// The virtual base address of the segment associated to the component is:
    1717//
    18 //      seg_icu_base + cluster_id * vseg_cluster_increment
     18//      seg_icu_base + cluster_xy * vseg_cluster_increment
    1919//
    2020// The seg_icu_base and vseg_cluster_increment values must be defined
     
    2424#include <giet_config.h>
    2525#include <icu_driver.h>
     26#include <tty_driver.h>
    2627#include <utils.h>
    2728
    28 #if !defined(NB_CLUSTERS)
    29 # error: You must define NB_CLUSTERS in the hard_config.h file
     29#if !defined(X_SIZE)
     30# error: You must define X_SIZE in the hard_config.h file
    3031#endif
    3132
    32 #if (NB_CLUSTERS > 256)
    33 # error: NB_CLUSTERS cannot be larger than 256!
     33#if !defined(Y_SIZE)
     34# error: You must define X_SIZE in the hard_config.h file
     35#endif
     36
     37#if !defined(X_WIDTH)
     38# error: You must define X_WIDTH in the hard_config.h file
     39#endif
     40
     41#if !defined(Y_WIDTH)
     42# error: You must define X_WIDTH in the hard_config.h file
    3443#endif
    3544
    3645#if !defined(NB_PROCS_MAX)
    3746# error: You must define NB_PROCS_MAX in the hard_config.h file
    38 #endif
    39 
    40 #if (NB_PROCS_MAX > 8)
    41 # error: NB_PROCS_MAX cannot be larger than 8!
    4247#endif
    4348
     
    5358// Returns 0 if success, > 0 if error.
    5459////////////////////////////////////////////////////////////////////////////////
    55 unsigned int _icu_set_mask( unsigned int cluster_id,
     60unsigned int _icu_set_mask( unsigned int cluster_xy,
    5661                            unsigned int proc_id,
    5762                            unsigned int value )
    5863{
    5964    // parameters checking
    60     if (cluster_id >= NB_CLUSTERS) return 1;
    61     if (proc_id >= NB_PROCS_MAX)   return 1;
     65    unsigned int x = cluster_xy >> Y_WIDTH;
     66    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     67    if (x >= X_SIZE)             return 1;
     68    if (y >= Y_SIZE)             return 1;
     69    if (proc_id >= NB_PROCS_MAX) return 1;
    6270
    6371#if USE_XICU
    64     _puts("[GIET ERROR] _icu_set_mask should not be used if USE_XICU is set\n");
     72    _puts("[GIET ERROR] _icu_set_mask() should not be used if USE_XICU is set\n");
    6573    return 1;
    6674#else
    6775    unsigned int * icu_address = (unsigned int *) ((unsigned int)&seg_icu_base +
    68                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
     76                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
    6977    icu_address[proc_id * ICU_SPAN + ICU_MASK_SET] = value;
    7078    return 0;
     
    7886// Returns 0 if success, > 0 if error.
    7987////////////////////////////////////////////////////////////////////////////////
    80 unsigned int _icu_get_index( unsigned int cluster_id,
     88unsigned int _icu_get_index( unsigned int cluster_xy,
    8189                             unsigned int proc_id,
    8290                             unsigned int * buffer)
    8391{
    8492    // parameters checking
    85     if (cluster_id >= NB_CLUSTERS)  return 1;
    86     if (proc_id >= NB_PROCS_MAX)    return 1;
     93    unsigned int x = cluster_xy >> Y_WIDTH;
     94    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     95    if (x >= X_SIZE)             return 1;
     96    if (y >= Y_SIZE)             return 1;
     97    if (proc_id >= NB_PROCS_MAX) return 1;
    8798
    8899#if USE_XICU
    89     _puts("[GIET ERROR] _icu_get_index should not be used if USE_XICU is set\n");
     100    _puts("[GIET ERROR] _icu_get_index() should not be used if USE_XICU is set\n");
    90101    return 1;
    91102#else
    92103    unsigned int* icu_address = (unsigned int *) ((unsigned int)&seg_icu_base +
    93                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
     104                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
    94105    *buffer = icu_address[proc_id * ICU_SPAN + ICU_IT_VECTOR];
    95106    return 0;
Note: See TracChangeset for help on using the changeset viewer.