source: trunk/IPs/systemC/processor/Morpheo/Common/include/Time.h @ 78

Last change on this file since 78 was 78, checked in by rosiere, 16 years ago

Add :

  • Execute_loop (must be test systemC)
  • Prediction
    • Direction : predifined scheme
    • Branch Target Buffer
  • iFetch_unit
    • ifetch_queue
    • pc management
  • Decod_unit
    • coming soon : support for custom operation
  • Rename_unit
    • RAT
    • Free_list
    • Dependence RAW check
    • Load store unit pointer
  • New Environnement (hierarchy_memory will remove in a next version)


Modif :

  • Manage Custom Operation
  • All component in execute_loop to use the new statistics management

Not Finish :

  • Return Address Stack
  • Environnement
File size: 845 bytes
Line 
1#ifndef TIME_H
2#define TIME_H
3
4#ifdef SYSTEMC
5#include "systemc.h"
6#endif
7
8#include <string>
9#include <iostream>
10#include <sys/time.h>
11
12class Time
13{
14private : timeval time_begin;
15// private : timeval time_end;
16 
17public  : Time ()
18  {
19    gettimeofday(&time_begin     ,NULL);
20  };
21
22public  : ~Time ()
23  {
24    std::cout << *this;
25  };
26
27public  : friend std::ostream& operator<< (std::ostream& output_stream,
28                                           const Time & x)
29  {
30    timeval time_end;
31   
32    gettimeofday(&time_end       ,NULL);
33   
34    uint32_t nb_cycles = static_cast<uint32_t>(sc_simulation_time());
35
36    double average = static_cast<double>(nb_cycles) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec+1);
37   
38    output_stream << "Timing : " << nb_cycles << " cycles \t(" << average << " cycles/s)" << std::endl;
39
40    return output_stream;
41  }
42};
43
44#endif
Note: See TracBrowser for help on using the repository browser.