Ignore:
Timestamp:
Jan 13, 2014, 5:38:28 PM (10 years ago)
Author:
cfuguet
Message:

Modifications in the tsar_generic_xbar platform to support
new cluster id encoding with X and Y fixed width format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/platforms/tsar_generic_xbar/top.cpp

    r572 r619  
    123123
    124124//  cluster index (computed from x,y coordinates)
    125 #define cluster(x,y)   (y + YMAX * x)
     125#ifdef USE_ALMOS
     126#  define cluster(x,y)   (y + x * Y_MAX)
     127#else
     128#  define cluster(x,y)   (y + (x << Y_WIDTH))
     129#endif
     130
    126131
    127132#define min(x, y) (x < y ? x : y)
     
    173178//////////////////////i/////////////////////////////////////
    174179
    175 #define XMAX                  CLUSTER_X
    176 #define YMAX                  CLUSTER_Y
     180#define XMAX                  X_SIZE
     181#define YMAX                  Y_SIZE
    177182
    178183#define XRAM_LATENCY          0
     
    373378         if ((strcmp(argv[n], "-NCYCLES") == 0) && (n + 1 < argc))
    374379         {
    375             ncycles = atoi(argv[n + 1]);
     380            ncycles = (uint64_t) strtol(argv[n + 1], NULL, 0);
    376381         }
    377382         else if ((strcmp(argv[n], "-SOFT") == 0) && (n + 1 < argc))
     
    391396         {
    392397            debug_ok = true;
    393             debug_from = atoi(argv[n + 1]);
     398            debug_from = (uint32_t) strtol(argv[n + 1], NULL, 0);
    394399         }
    395400         else if ((strcmp(argv[n], "-MEMCID") == 0) && (n + 1 < argc))
    396401         {
    397             debug_memc_id = atoi(argv[n + 1]);
    398             assert((debug_memc_id < (XMAX * YMAX)) &&
     402            debug_memc_id = (size_t) strtol(argv[n + 1], NULL, 0);
     403
     404#ifdef USE_ALMOS
     405            assert((debug_memc_id < (XMAX * YMAX)) &&
    399406                   "debug_memc_id larger than XMAX * YMAX" );
     407#else
     408            size_t x = debug_memc_id >> Y_WIDTH;
     409            size_t y = debug_memc_id & ((1<<Y_WIDTH)-1);
     410
     411            assert( (x <= XMAX) and (y <= YMAX) &&
     412                  "MEMCID parameter refers a not valid memory cache");
     413#endif
    400414         }
    401415         else if ((strcmp(argv[n], "-PROCID") == 0) && (n + 1 < argc))
    402416         {
    403             debug_proc_id = atoi(argv[n + 1]);
     417            debug_proc_id = (size_t) strtol(argv[n + 1], NULL, 0);
     418
     419#ifdef USE_ALMOS
    404420            assert((debug_proc_id < (XMAX * YMAX * NB_PROCS_MAX)) &&
    405421                   "debug_proc_id larger than XMAX * YMAX * NB_PROCS");
     422#else
     423            size_t cluster_xy = debug_proc_id / NB_PROCS_MAX ;
     424            size_t x          = cluster_xy >> Y_WIDTH;
     425            size_t y          = cluster_xy & ((1<<Y_WIDTH)-1);
     426
     427            assert( (x <= XMAX) and (y <= YMAX) &&
     428                  "PROCID parameter refers a not valid processor");
     429#endif
    406430         }
    407431         else if ((strcmp(argv[n], "-THREADS") == 0) && ((n + 1) < argc))
    408432         {
    409             threads_nr = atoi(argv[n + 1]);
     433            threads_nr = (ssize_t) strtol(argv[n + 1], NULL, 0);
    410434            threads_nr = (threads_nr < 1) ? 1 : threads_nr;
    411435         }
    412436         else if ((strcmp(argv[n], "-FROZEN") == 0) && (n + 1 < argc))
    413437         {
    414             frozen_cycles = atoi(argv[n + 1]);
     438            frozen_cycles = (uint32_t) strtol(argv[n + 1], NULL, 0);
    415439         }
    416440         else if ((strcmp(argv[n], "-PERIOD") == 0) && (n + 1 < argc))
    417441         {
    418             debug_period = atoi(argv[n + 1]);
     442            debug_period = (size_t) strtol(argv[n + 1], NULL, 0);
    419443         }
    420444         else
     
    513537#endif
    514538
    515    // Define parameters depending on mesh size
    516    size_t   x_width;
    517    size_t   y_width;
     539#ifdef USE_ALMOS
    518540
    519541   if      (XMAX == 1) x_width = 0;
     
    529551   else                y_width = 4;
    530552
    531 
    532 #ifdef USE_ALMOS
    533    cluster_io_id = 0xbfc00000 >> (vci_address_width - x_width - y_width); // index of cluster containing IOs
    534553#else
    535    cluster_io_id = 0;
    536 #endif
     554
     555   size_t x_width = X_WIDTH;
     556   size_t y_width = Y_WIDTH;
     557
     558   assert( (X_WIDTH <= 4) and (Y_WIDTH <= 4) and
     559           "Up to 256 clusters");
     560
     561   assert( (XMAX <= (1 << X_WIDTH)) and (YMAX <= (1 << Y_WIDTH)) and
     562           "The X_WIDTH and Y_WIDTH parameter are insufficient");
     563
     564#endif
     565
     566
     567   // index of cluster containing IOs
     568   cluster_io_id = 0x00bfc00000ULL >> (vci_address_width - x_width - y_width);
    537569
    538570   /////////////////////
Note: See TracChangeset for help on using the changeset viewer.