RecoSim  1.0
 All Classes Files Functions Variables Enumerations
module_implementation.h
Go to the documentation of this file.
1 
23 #ifndef MODULE_IMPLEMENTATION_H
24 #define MODULE_IMPLEMENTATION_H
25 
26 #include <systemc.h>
27 #include <string>
28 #include <set>
29 #include <map>
30 #include "pe_implementation.h"
32 
33 using namespace std;
34 
35 typedef void (*algorithm_thread_type)(void *);
36 
38 
39  string name;
40  string netlist_name;
41  string algorithm_name;
42  PEImplementation implementation_type;
43  sc_time worst_case_execution_time;
44  sc_time best_case_execution_time;
45 
46  double energy_consumption; // à virer
47  bool enable_implementation;
48  int nb_preemption_points;
49  bool use_context_switch;
50 
51  // Only HwImpl
52  double frequency;
53  double p_idle;
54  double p_run;
55 
56 
57  map<string, int> physical_channels;
58 
59  // Pointer to the thread associated with the implementation
60  algorithm_thread_type algorithm_thread_ptr;
61 
62  ModuleImplementation(string _name, PEImplementation impl, algorithm_thread_type algo, sc_time wcet, sc_time bcet = SC_ZERO_TIME, double freq = 0, double pidle = 0, double prun = 0)
63  : name(_name), implementation_type(impl), algorithm_thread_ptr(algo), worst_case_execution_time(wcet), best_case_execution_time(bcet), frequency(freq), p_idle(pidle), p_run(prun) {
64  // Enable implementation by default
65  enable_implementation = true;
66  if(bcet == SC_ZERO_TIME) best_case_execution_time = worst_case_execution_time;
67  nb_preemption_points = 0;
68  use_context_switch = false;
69  energy_consumption = 0;
70  }
71 
72  ModuleImplementation(string _name, PEImplementation impl, algorithm_thread_type algo) : name(_name), implementation_type(impl), algorithm_thread_ptr(algo) {
73  // Enable implementation by default
74  enable_implementation = true;
75  best_case_execution_time = SC_ZERO_TIME;
76  worst_case_execution_time = SC_ZERO_TIME;
77  frequency = 0;
78  energy_consumption = 0;
79  nb_preemption_points = 0;
80  use_context_switch = false;
81  p_idle = 0;
82  p_run = 0;
83  }
84 
85  string get_name(void);
86  PEImplementation get_implementation_type(void);
87  sc_time get_worst_case_execution_time(void) const;
88  sc_time get_best_case_execution_time(void) const;
89  double get_frequency(void) const;
90  //double get_energy_consumption(void) const;
91  double get_p_idle(void) const;
92  double get_p_run(void) const;
93  string get_netlist_name(void) const;
94  string get_algorithm_name(void) const;
95 
96  void activate_implementation(void);
97  void deactivate_implementation(void);
98  bool is_implementation_enabled(void) const;
99 
100  void info(ostream &st) const;
101 
102  void add_physical_channels(string connection, int n = 1);
103  map<string, int> get_physical_channel_map(void);
104 
105  // Setters
106  void set_worst_case_execution_time(sc_time t);
107  void set_best_case_execution_time(sc_time t);
108  void set_frequency(double f);
109  //void set_energy_consumption(double e);
110  void set_p_idle(double e);
111  void set_p_run(double e);
112  void set_netlist_name(string n);
113  void set_algorithm_name(string n);
114 
115  algorithm_thread_type get_algorithm_thread_ptr(void);
116 
117  void set_nb_preemption_points(int n);
118  int get_nb_preemption_points(void);
119 
120  void set_use_context_switch_mode(bool);
121  bool use_context_switch_mode(void);
122 
123 };
124 
125 #endif
Definition: module_implementation.h:37