RecoSim  1.0
 All Classes Files Functions Variables Enumerations
task_implementation.h
Go to the documentation of this file.
1 
22 #ifndef TASK_IMPLEMENTATION_H
23 #define TASK_IMPLEMENTATION_H
24 
25 #define SC_INCLUDE_DYNAMIC_PROCESSES
26 
27 #include <iostream>
28 #include <string>
29 #include <map>
30 #include <systemc.h>
31 
32 using namespace std;
33 
35 const int NB_RZ_STATES = 5;
36 enum RZState {RZ_BLANK, RZ_RECONFIG, RZ_MAPPED, RZ_ACTIVE, RZ_RUNNING}; // Running must be declared last for result display convenience
37 const string RZState_string[NB_RZ_STATES] = {"Blank", "Reconfiguring", "Mapped", "Active", "Running"};
38 
40 enum Task_state {INACTIVE, QUEUED, CONFIG, MAPPED, RUNNING, PREEMPTED_MAPPED, PREEMPTED_INACTIVE, WAITING, IDLE, STATIC, CONTEXT_SAVE, CONTEXT_RESTORE};
41 const string Task_state_string[12] = {"INACTIVE", "QUEUED", "CONFIG", "MAPPED", "RUNNING", "PREEMPTED_MAPPED", "PREEMPTED_INACTIVE", "WAITING", "IDLE", "STATIC", "CONTEXT_SAVE", "CONTEXT_RESTORE"};
42 
43 //const string Task_state_string[12] = {"INACTIVE", "QUEUED", "", "", "", "", "", "", "", "", "", ""};
44 
45 
47 
48 private:
49  string full_name;
50  string implementation_name;
51  string task_name;
52  string netlist_name;
53  string algorithm_name;
54 
55  sc_time compressedReconfigurationTime;
56  sc_time preloadReconfigurationTime;
57  sc_time contextSwitchTime;
58 
59  map<RZState, sc_time> occupationTimes;
60 
61  bool valid;
62 
63  // Mod impl stuff
64  sc_time worst_case_execution_time;
65  sc_time best_case_execution_time;
66  double energy_consumption; // à enlever
67 
68  // Hw Only
69  double frequency;
70  double p_idle;
71  double p_run;
72 
73 public:
74  TaskImplementation(string n, int comp, int preload, int switchTime) {
75 
76  full_name = n;
77  compressedReconfigurationTime = sc_time(comp, SC_NS);
78  preloadReconfigurationTime = sc_time(preload, SC_NS);
79  contextSwitchTime = sc_time(switchTime, SC_NS);
80  netlist_name = "";
81  algorithm_name = "";
82 
83  // Retrieve implementation and task name
84  size_t position(full_name.find_last_of("."));
85  implementation_name = full_name.substr(position + 1, full_name.size());
86  task_name = full_name.substr(0, position);
87 
88  // Init table
89  occupationTimes[RZ_RUNNING] = SC_ZERO_TIME;
90  occupationTimes[RZ_ACTIVE] = SC_ZERO_TIME;
91 
92  valid = true;
93  }
94 
95  TaskImplementation(void) {
96  valid = false;
97  };
98 
99  bool isValid(void);
100  string getFullName(void);
101  string getTaskName(void);
102  string getImplementationName(void);
103  string getNetlistName(void);
104  string getAlgorithmName(void);
105  bool hasSameNetlist(TaskImplementation &) const;
106  sc_time getCompressedReconfigurationTime(void);
107  sc_time getPreloadReconfigurationTime(void);
108  sc_time getContextSwitchTime(void);
109  void addOccupationTime(RZState state, sc_time t);
110  sc_time getOccupationTime(RZState state);
111 
112  sc_time getWorstCaseExecutionTime(void) const;
113  sc_time getBestCaseExecutionTime(void) const;
114  double getFrequency(void) const;
115  double getEnergyConsumption(void) const;
116  double getPidle(void) const;
117  double getPrun(void) const;
118 
119  void setWorstCaseExecutionTime(sc_time);
120  void setBestCaseExecutionTime(sc_time);
121  void setFrequency(double);
122  void setEnergyConsumption(double);
123  void setPidle(double);
124  void setPrun(double);
125  void setNetlistName(string);
126  void setAlgorithmName(string);
127 
128 };
129 
130 #endif
const int NB_RZ_STATES
Definition: task_implementation.h:35
Task_state
Definition: task_implementation.h:40
Definition: task_implementation.h:46