Ignore:
Timestamp:
Jul 22, 2013, 11:56:26 AM (11 years ago)
Author:
lambert
Message:

Improving platform for ALMOS support:

  • Introducing USE_GIET define

Adding platform frequency display

File:
1 edited

Legend:

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

    r438 r464  
    9696//      OS
    9797///////////////////////////////////////////////////
    98 #define USE_ALMOS 0
    99 
    100 #define almos_bootloader_pathname "bootloader.bin"
    101 #define almos_kernel_pathname     "kernel-soclib.bin@0xbfc10000:D"
    102 #define almos_archinfo_pathname   "arch-info.bin@0xBFC08000:D"
     98
     99//#define USE_ALMOS
     100#define USE_GIET
     101
     102#ifdef USE_ALMOS
     103#ifdef USE_GIET
     104#error "Can't use Two different OS"
     105#endif
     106#endif
     107
     108#ifndef USE_ALMOS
     109#ifndef USE_GIET
     110#error "You need to specify one OS"
     111#endif
     112#endif
    103113
    104114///////////////////////////////////////////////////
     
    137147#define vci_trdid_width       4
    138148#define vci_wrplen_width      1
    139 
    140149////////////////////////////////////////////////////////////
    141150//    Main Hardware Parameters values         
    142151//////////////////////i/////////////////////////////////////
    143152
     153
     154#ifdef USE_ALMOS
     155#include "almos/hard_config.h"
     156#define PREFIX_OS "almos/"
     157#endif
     158#ifdef USE_GIET
     159#define PREFIX_OS "giet_vm/"
    144160#include "giet_vm/hard_config.h"
     161#endif
    145162
    146163////////////////////////////////////////////////////////////
     
    162179#define L1_DSETS              64
    163180
     181#ifdef USE_ALMOS
     182#define FBUF_X_SIZE           512
     183#define FBUF_Y_SIZE           512
     184#endif
     185#ifdef USE_GIET
    164186#define FBUF_X_SIZE           128
    165187#define FBUF_Y_SIZE           128
    166 
     188#endif
     189
     190#ifdef USE_GIET
    167191#define BDEV_SECTOR_SIZE      512
    168192#define BDEV_IMAGE_NAME       "giet_vm/display/images.raw"
    169 
    170 #define NIC_RX_NAME           "giet_vm/nic/rx_packets.txt"
    171 #define NIC_TX_NAME           "giet_vm/nic/tx_packets.txt"
     193#endif
     194#ifdef USE_ALMOS
     195#define BDEV_SECTOR_SIZE      4096
     196#define BDEV_IMAGE_NAME       PREFIX_OS"hdd-img.bin"
     197#endif
     198
     199
     200#define NIC_RX_NAME           PREFIX_OS"nic/rx_packets.txt"
     201#define NIC_TX_NAME           PREFIX_OS"nic/tx_packets.txt"
    172202#define NIC_TIMEOUT           10000
    173203
     
    181211//////////////////////i/////////////////////////////////////
    182212
    183 #define SOFT_NAME        "giet_vm/soft.elf"
     213#ifdef USE_ALMOS
     214#define soft_name PREFIX_OS"bootloader.bin",\
     215                  PREFIX_OS"kernel-soclib.bin@0xbfc10000:D",\
     216                  PREFIX_OS"arch-info.bib@0xBFC08000:D"
     217#endif
     218#ifdef USE_GIET
     219#define soft_pathname        PREFIX_OS"soft.elf"
     220#endif
    184221
    185222////////////////////////////////////////////////////////////
     
    203240
    204241#define FBUF_BASE       0x00B2000000     
    205 #define FBUF_SIZE       FBUF_X_SIZE * FBUF_Y_SIZE
     242#define FBUF_SIZE       FBUF_X_SIZE * FBUF_Y_SIZE * 2
    206243
    207244#define BDEV_BASE       0x00B3000000     
     
    247284   using namespace soclib::common;
    248285
    249 
    250    char     soft_name[256]   = SOFT_NAME;          // pathname to binary code
     286#ifdef USE_GIET
     287   char     soft_name[256]   = soft_pathname;          // pathname to binary code
     288#endif
    251289   size_t   ncycles          = 1000000000;         // simulated cycles
    252290   char     disk_name[256]   = BDEV_IMAGE_NAME;    // pathname to the disk image
     
    261299   uint32_t frozen_cycles    = MAX_FROZEN_CYCLES;  // monitoring frozen processor
    262300   size_t   cluster_io_id    = 0;                  // index of cluster containing IOs
     301   struct timeval t1,t2;
     302   uint64_t ms1,ms2;
    263303
    264304   ////////////// command line arguments //////////////////////
     
    273313         else if ((strcmp(argv[n],"-SOFT") == 0) && (n+1<argc) )
    274314         {
     315#ifdef USE_ALMOS
     316            assert( 0 && "Can't define almos soft name" );
     317#endif
     318#ifdef USE_GIET
    275319            strcpy(soft_name, argv[n+1]);
     320#endif
    276321         }
    277322         else if ((strcmp(argv[n],"-DISK") == 0) && (n+1<argc) )
     
    350395            "The NB_NIC_CHANNELS parameter must be smaller than 9" );
    351396
    352     assert( (vci_address_width == vci_address_width) and
    353             "address widths must be equal on internal & external networks" );
    354 
     397#ifdef USE_GIET
    355398    assert( (vci_address_width == 40) and
    356399            "VCI address width must be 40 bits" );
     400#endif
    357401
    358402    std::cout << std::endl;
     
    369413
    370414    std::cout << std::endl;
    371 
    372415    // Internal and External VCI parameters definition
    373416    typedef soclib::caba::VciParams<vci_cell_width_int,
     
    531574   ////////////////////////////
    532575
    533 #if USE_ALMOS
    534    soclib::common::Loader loader(almos_bootloader_pathname,
    535                                  almos_archinfo_pathname,
    536                                  almos_kernel_pathname);
    537 #else
    538576   soclib::common::Loader loader(soft_name);
    539 #endif
    540577
    541578   typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss;
     
    743780   signal_resetn = true;
    744781
     782   if (gettimeofday(&t1, NULL) != 0)
     783   {
     784      perror("gettimeofday");
     785      return EXIT_FAILURE;
     786   }
     787
    745788   for (size_t n = 1; n < ncycles; n++)
    746789   {
     
    748791      //clusters[0][0]->proc[0]->cache_monitor(0x800002c000ULL);
    749792      //clusters[1][0]->memc->copies_monitor(0x800002C000ULL);
     793
     794      if( (n % 5000000) == 0)
     795      {
     796
     797         if (gettimeofday(&t2, NULL) != 0)
     798         {
     799            perror("gettimeofday");
     800            return EXIT_FAILURE;
     801         }
     802
     803         ms1 = (uint64_t)t1.tv_sec * 1000ULL + (uint64_t)t1.tv_usec / 1000;
     804         ms2 = (uint64_t)t2.tv_sec * 1000ULL + (uint64_t)t2.tv_usec / 1000;
     805         std::cerr << "platform clock frequency " << (double)5000000 / (double)(ms2 - ms1) << "Khz" << std::endl;
     806
     807         if (gettimeofday(&t1, NULL) != 0)
     808         {
     809            perror("gettimeofday");
     810            return EXIT_FAILURE;
     811         }
     812      }
     813
    750814
    751815      if (debug_ok and (n > debug_from) and (n % debug_period == 0))
Note: See TracChangeset for help on using the changeset viewer.