source: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat_type.h @ 142

Last change on this file since 142 was 138, checked in by rosiere, 14 years ago

1) add counters_t type for interface
2) fix in check load in load_store_unit
3) add parameters (but not yet implemented)
4) change environment and add script (distcc_env.sh ...)
5) add warning if an unser change rename flag with l.mtspr instruction
6) ...

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1#ifdef STATISTICS
2#ifndef morpheo_behavioural_Stat_type_h
3#define morpheo_behavioural_Stat_type_h
4
5#include <string>
6#include <map>
7#include <utility>
8#include <cassert>
9
10namespace morpheo {
11namespace behavioural {
12
13  typedef enum{TYPE_VARIABLE, TYPE_COUNTER} counter_type_t;
14
15  typedef double counter_t ;
16
17  typedef enum{add, sub, mul, div, inc, dec} operator_t;
18
19//typedef std::pair<operator_t, std::string> pair_operator_string_t;
20//typedef std::pair<std::string, operator_t> pair_string_operator_t;
21
22  class counters_t
23  {
24  private : const uint32_t     _nb_counter;
25  private :       counter_t ** _counter;
26
27  public  : counters_t (uint32_t nb_counter):
28    _nb_counter (nb_counter+1)
29    {
30      assert(nb_counter>0);
31
32      _counter = new counter_t * [_nb_counter];
33    }
34
35  // public : counters_t (const counters_t & x):
36  //   _nb_counter (x._nb_counter)
37  //   {
38  //     _counter = new counter_t [_nb_counter];
39     
40  //     for (uint32_t i=0; i<_nb_counter; ++i)
41  //       _counter[i] = x._counter[i];
42  //   }
43   
44  public  : ~counters_t (void)
45    {
46      delete [] _counter;
47    }
48
49  public  : void set_counter (counter_t * counter,
50                              uint32_t    index)
51    {
52      assert((index >= 0) and (index < _nb_counter));
53
54      _counter [index] = counter;
55    }
56
57  // public : friend const counters_t  operator+ (const counters_t & left,
58  //                                              const uint32_t     right)
59  //   {
60  //     assert((right >= 0) and (right <= left._nb_counter));
61     
62  //     counters_t tmp=left;
63     
64  //     tmp._counter[right] ++;
65   
66  //     return tmp;
67  //   }
68
69  public : const counters_t & operator+= (const uint32_t value)
70    {
71      assert((value >= 0) and (value <= _nb_counter));
72     
73      (*_counter[value]) ++;
74     
75      return *this;
76    }
77
78  };
79
80};
81};
82#endif
83#endif
Note: See TracBrowser for help on using the repository browser.