Index: trunk/platforms/tsar_generic_xbar/top.cpp
===================================================================
--- trunk/platforms/tsar_generic_xbar/top.cpp	(revision 451)
+++ trunk/platforms/tsar_generic_xbar/top.cpp	(revision 464)
@@ -96,9 +96,19 @@
 //      OS
 ///////////////////////////////////////////////////
-#define USE_ALMOS 0
-
-#define almos_bootloader_pathname "bootloader.bin"
-#define almos_kernel_pathname     "kernel-soclib.bin@0xbfc10000:D"
-#define almos_archinfo_pathname   "arch-info.bin@0xBFC08000:D"
+
+//#define USE_ALMOS 
+#define USE_GIET 
+
+#ifdef USE_ALMOS
+#ifdef USE_GIET
+#error "Can't use Two different OS"
+#endif
+#endif
+
+#ifndef USE_ALMOS
+#ifndef USE_GIET
+#error "You need to specify one OS"
+#endif
+#endif
 
 ///////////////////////////////////////////////////
@@ -137,10 +147,17 @@
 #define vci_trdid_width       4
 #define vci_wrplen_width      1
-
 ////////////////////////////////////////////////////////////
 //    Main Hardware Parameters values         
 //////////////////////i/////////////////////////////////////
 
+
+#ifdef USE_ALMOS
+#include "almos/hard_config.h"
+#define PREFIX_OS "almos/"
+#endif
+#ifdef USE_GIET
+#define PREFIX_OS "giet_vm/"
 #include "giet_vm/hard_config.h"
+#endif
 
 ////////////////////////////////////////////////////////////
@@ -162,12 +179,25 @@
 #define L1_DSETS              64
 
+#ifdef USE_ALMOS
+#define FBUF_X_SIZE           512
+#define FBUF_Y_SIZE           512
+#endif
+#ifdef USE_GIET
 #define FBUF_X_SIZE           128
 #define FBUF_Y_SIZE           128
-
+#endif
+
+#ifdef USE_GIET
 #define BDEV_SECTOR_SIZE      512
 #define BDEV_IMAGE_NAME       "giet_vm/display/images.raw"
-
-#define NIC_RX_NAME           "giet_vm/nic/rx_packets.txt"
-#define NIC_TX_NAME           "giet_vm/nic/tx_packets.txt"
+#endif
+#ifdef USE_ALMOS
+#define BDEV_SECTOR_SIZE      4096
+#define BDEV_IMAGE_NAME       PREFIX_OS"hdd-img.bin"
+#endif
+
+
+#define NIC_RX_NAME           PREFIX_OS"nic/rx_packets.txt"
+#define NIC_TX_NAME           PREFIX_OS"nic/tx_packets.txt"
 #define NIC_TIMEOUT           10000
 
@@ -181,5 +211,12 @@
 //////////////////////i/////////////////////////////////////
 
-#define SOFT_NAME        "giet_vm/soft.elf"
+#ifdef USE_ALMOS
+#define soft_name PREFIX_OS"bootloader.bin",\
+                  PREFIX_OS"kernel-soclib.bin@0xbfc10000:D",\
+                  PREFIX_OS"arch-info.bib@0xBFC08000:D"
+#endif
+#ifdef USE_GIET
+#define soft_pathname        PREFIX_OS"soft.elf"
+#endif
 
 ////////////////////////////////////////////////////////////
@@ -203,5 +240,5 @@
 
 #define FBUF_BASE       0x00B2000000      
-#define FBUF_SIZE       FBUF_X_SIZE * FBUF_Y_SIZE
+#define FBUF_SIZE       FBUF_X_SIZE * FBUF_Y_SIZE * 2
 
 #define BDEV_BASE       0x00B3000000      
@@ -247,6 +284,7 @@
    using namespace soclib::common;
 
-
-   char     soft_name[256]   = SOFT_NAME;          // pathname to binary code
+#ifdef USE_GIET
+   char     soft_name[256]   = soft_pathname;          // pathname to binary code
+#endif
    size_t   ncycles          = 1000000000;         // simulated cycles
    char     disk_name[256]   = BDEV_IMAGE_NAME;    // pathname to the disk image
@@ -261,4 +299,6 @@
    uint32_t frozen_cycles    = MAX_FROZEN_CYCLES;  // monitoring frozen processor
    size_t   cluster_io_id    = 0;                  // index of cluster containing IOs
+   struct timeval t1,t2;
+   uint64_t ms1,ms2;
 
    ////////////// command line arguments //////////////////////
@@ -273,5 +313,10 @@
          else if ((strcmp(argv[n],"-SOFT") == 0) && (n+1<argc) )
          {
+#ifdef USE_ALMOS
+            assert( 0 && "Can't define almos soft name" );
+#endif
+#ifdef USE_GIET
             strcpy(soft_name, argv[n+1]);
+#endif
          }
          else if ((strcmp(argv[n],"-DISK") == 0) && (n+1<argc) )
@@ -350,9 +395,8 @@
             "The NB_NIC_CHANNELS parameter must be smaller than 9" );
 
-    assert( (vci_address_width == vci_address_width) and
-            "address widths must be equal on internal & external networks" );
-
+#ifdef USE_GIET
     assert( (vci_address_width == 40) and
             "VCI address width must be 40 bits" );
+#endif
 
     std::cout << std::endl;
@@ -369,5 +413,4 @@
 
     std::cout << std::endl;
-
     // Internal and External VCI parameters definition
     typedef soclib::caba::VciParams<vci_cell_width_int,
@@ -531,11 +574,5 @@
    ////////////////////////////
 
-#if USE_ALMOS
-   soclib::common::Loader loader(almos_bootloader_pathname,
-                                 almos_archinfo_pathname,
-                                 almos_kernel_pathname);
-#else
    soclib::common::Loader loader(soft_name);
-#endif
 
    typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss;
@@ -743,4 +780,10 @@
    signal_resetn = true;
 
+   if (gettimeofday(&t1, NULL) != 0) 
+   {
+      perror("gettimeofday");
+      return EXIT_FAILURE;
+   }
+
    for (size_t n = 1; n < ncycles; n++)
    {
@@ -748,4 +791,25 @@
       //clusters[0][0]->proc[0]->cache_monitor(0x800002c000ULL);
       //clusters[1][0]->memc->copies_monitor(0x800002C000ULL);
+
+      if( (n % 5000000) == 0)
+      {
+
+         if (gettimeofday(&t2, NULL) != 0) 
+         {
+            perror("gettimeofday");
+            return EXIT_FAILURE;
+         }
+
+         ms1 = (uint64_t)t1.tv_sec * 1000ULL + (uint64_t)t1.tv_usec / 1000;
+         ms2 = (uint64_t)t2.tv_sec * 1000ULL + (uint64_t)t2.tv_usec / 1000;
+         std::cerr << "platform clock frequency " << (double)5000000 / (double)(ms2 - ms1) << "Khz" << std::endl;
+
+         if (gettimeofday(&t1, NULL) != 0) 
+         {
+            perror("gettimeofday");
+            return EXIT_FAILURE;
+         }
+      }
+
 
       if (debug_ok and (n > debug_from) and (n % debug_period == 0))
