source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h @ 81

Last change on this file since 81 was 81, checked in by rosiere, 16 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1/*
2 * $Id: test.h 81 2008-04-15 18:40:01Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#ifdef SYSTEMC
9#include "systemc.h"
10#endif
11
12#include <string>
13#include <iostream>
14#include <sys/time.h>
15
16#include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h"
17
18using namespace std;
19using namespace morpheo;
20using namespace morpheo::behavioural;
21using namespace morpheo::behavioural::generic;
22using namespace morpheo::behavioural::generic::registerfile;
23using namespace morpheo::behavioural::generic::registerfile::registerfile_monolithic;
24
25void test   (string name,
26             morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters * param);
27
28class Time
29{
30private : timeval time_begin;
31// private : timeval time_end;
32 
33public  : Time ()
34  {
35    gettimeofday(&time_begin     ,NULL);
36  };
37
38public  : ~Time ()
39  {
40    cout << *this;
41  };
42
43public  : friend ostream& operator<< (ostream& output_stream,
44                                      const Time & x)
45  {
46    timeval time_end;
47   
48    gettimeofday(&time_end       ,NULL);
49   
50    uint32_t nb_cycles = static_cast<uint32_t>(sc_simulation_time());
51
52    double average = static_cast<double>(nb_cycles) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec);
53   
54    output_stream << nb_cycles << "\t(" << average << " cycles / seconds )" << endl;
55
56    return output_stream;
57  }
58};
Note: See TracBrowser for help on using the repository browser.