RecoSim  1.0
 All Classes Files Functions Variables Enumerations
scheduler_interface.h
Go to the documentation of this file.
1 
21 #ifndef SCHEDULER_INTERFACE_H
22 #define SCHEDULER_INTERFACE_H
23 
24 #include <vector>
25 #include <ostream>
26 #include "task_implementation.h"
27 #include "reconfigurable_zone.h"
28 #include "scheduler_request.h"
29 #include "application_interface.h"
30 
31 /* Macro to define User Mapping/Scheduling Algo */
32 #define MAPPING_ALGORITHM(nom) Return_mapping_information waiting_queue_handler_mapping_ ## nom ## (Scheduler_interface &scheduler)
33 #define SCHEDULING_ALGORITHM(nom) void waiting_queue_handler_scheduling_ ## nom ## (Scheduler_interface &scheduler)
34 
35 #define DEFAULT_MAPPING_ALGORITHM(nom) Return_mapping_information waiting_queue_handler_mapping_ ## nom ## (Scheduler_interface &scheduler) { \
36  return waiting_queue_handler_mapping_default_algo(scheduler); \
37  }
38 
39 #define DEFAULT_SCHEDULING_ALGORITHM(nom) void waiting_queue_handler_scheduling_ ## nom ## (Scheduler_interface &scheduler) { \
40  waiting_queue_handler_scheduling_default_algo(scheduler); \
41  }
42 
43 /* Macro only for Generation */
44 #define WAITING_QUEUE_HANDLER(nom) void waiting_queue_handler_## nom ##(Scheduler_interface &scheduler)
45 #define WAITING_QUEUE_HANDLER_REF(nom) waiting_queue_handler_## nom
46 #define CALL_WAITING_QUEUE_HANDLER(nom) waiting_queue_handler_## nom ##(scheduler)
47 #define CALL_MAPPING_ALGORITHM(nom) waiting_queue_handler_mapping_ ## nom ## (scheduler)
48 #define CALL_SCHEDULING_ALGORITHM(nom) waiting_queue_handler_scheduling_ ## nom ## (scheduler)
49 
50 
51 /* For User : Return information from Mapping Algorithm */
53 
54  bool rz_found;
55  bool exit_mapping_algo;
56  RZ* implementation_RZ;
57  int implementation_ID;
58  Config_fct_point* cfgFctPt;
59 
60 public:
62  rz_found = false;
63  exit_mapping_algo = true;
64  cfgFctPt = NULL;
65  }
66 
67  Return_mapping_information(RZ* _implementation_RZ, int _implementation_ID) {
68  rz_found = true;
69  exit_mapping_algo = true;
70  implementation_RZ = _implementation_RZ;
71  implementation_ID = _implementation_ID;
72  cfgFctPt = NULL;
73  }
74 
75  Return_mapping_information(RZ* _implementation_RZ, int _implementation_ID, Config_fct_point* _cfgFctPt) {
76  rz_found = true;
77  exit_mapping_algo = true;
78  implementation_RZ = _implementation_RZ;
79  implementation_ID = _implementation_ID;
80  cfgFctPt = _cfgFctPt;
81  }
82 
83  Return_mapping_information(RZ* _implementation_RZ, int _implementation_ID, bool exit_mapping_algorithm) {
84  rz_found = true;
85  exit_mapping_algo = exit_mapping_algorithm;
86  implementation_RZ = _implementation_RZ;
87  implementation_ID = _implementation_ID;
88  cfgFctPt = NULL;
89  }
90 
91  Return_mapping_information(RZ* _implementation_RZ, int _implementation_ID, Config_fct_point* _cfgFctPt, bool exit_mapping_algorithm) {
92  rz_found = true;
93  exit_mapping_algo = exit_mapping_algorithm;
94  implementation_RZ = _implementation_RZ;
95  implementation_ID = _implementation_ID;
96  cfgFctPt = _cfgFctPt;
97  }
98 
100  rz_found = other.rz_found;
101  implementation_RZ = other.implementation_RZ;
102  implementation_ID = other.implementation_ID;
103  cfgFctPt = other.cfgFctPt;
104  }
105 
106  bool RZ_found() {
107  return rz_found;
108  }
109 
110 
111  bool hasCfgTcfPt() {
112  return cfgFctPt != NULL;
113  }
114 
115  bool exit_mapping_algorithm() {
116  return exit_mapping_algo;
117  }
118 
119  void set_exit_mapping_algo(bool exit_mapping_algorithm) {
120  exit_mapping_algo = exit_mapping_algorithm;
121  }
122 
123  RZ* get_implementation_RZ() {
124  return implementation_RZ;
125  }
126 
127  int get_implementation_ID() {
128  return implementation_ID;
129  }
130 
131  Config_fct_point* getConfigFctPoint() {
132  return cfgFctPt;
133  }
134 };
135 
136 
137 
138 class Scheduler_interface : public sc_interface {
139 
140 public:
141 
142  //
143  // ======= Waiting queue =======
144  //
145 
150  virtual bool Scheduler_are_tasks_waiting(void) const = 0;
151 
156  //virtual SchedulerRequest Scheduler_get_top_request(void) = 0;
157 
163 
167  //virtual void Scheduler_pop_request(void) = 0;
168 
173  virtual int Scheduler_get_waiting_queue_size(void) = 0;
174 
179  virtual int Scheduler_position_of_current_element(void) = 0;
180 
186  virtual SchedulerRequest& Scheduler_get_element(int position) = 0;
187 
191  virtual void Scheduler_update_queue(void) = 0;
192 
197 
201  virtual bool Scheduler_last_task_waiting(void) const = 0;
202 
206  virtual void Scheduler_erase_current_task_waiting() = 0;
207 
212 
217 
218 
219  //
220  // ======= RZ & tasks =======
221  //
222 
228  virtual vector<RZ *> Scheduler_get_compatible_rz_vector(int task_id) = 0;
229 
235  virtual sc_time Scheduler_get_task_running_time(int task_id) = 0;
236 
241  virtual vector<RZ *> Scheduler_get_all_rz_vector(void) = 0;
242 
248  virtual int Scheduler_get_current_module_ID(RZ* rz) = 0;
249 
255  virtual bool Scheduler_is_RZ_blank(RZ *rz) = 0;
256 
262  virtual int Scheduler_get_module_ID(SchedulerRequest& req) = 0;
263 
264 
269  virtual int Scheduler_get_application_number(void) = 0;
270 
276 
282  virtual bool Scheduler_exist_rz_properties(string inst_name) = 0;
283 
289  virtual bool Scheduler_exist_rz_properties(RZ *rz) = 0;
290 
296  virtual RZ_config& Scheduler_get_rz_properties(string inst_name) = 0;
297 
303  virtual RZ_config& Scheduler_get_rz_properties(RZ *rz) = 0;
304 
311 
312 
313  //
314  // ======= Scheduler execution =======
315  //
316 
320  virtual void Scheduler_emulate_scheduler_behavior(void) = 0;
321 
326  virtual void Scheduler_set_scheduler_active(int taskid) = 0;
327 
328 
329  //
330  // ======= Requests and owners =======
331  //
332 
339  virtual bool Scheduler_has_task_already_requested_mapping(int task_to_map, int request_owner) = 0;
340 
346  virtual void Scheduler_add_finished_precedence(int task_mapped, int precedence) = 0;
347 
354  virtual void Scheduler_notify_request_owner_module_ready(int owner, int ready) = 0;
355 
360  virtual void Scheduler_print_finished_precedence_vector(int task_id) = 0;
361 
366  virtual void Scheduler_send_update_parameters_to_module(RZ* rz) = 0;
367 
368 
369  //
370  // ======= Task configuration =======
371  //
372 
380  virtual void Scheduler_configure_task(RZ* rz, int id, int implID, int requestOwner) = 0;
381 
386  virtual void Scheduler_rerun_task(SchedulerRequest& req) = 0;
387 
393  virtual void Scheduler_set_current_task(RZ *rz, int task_id) = 0;
394 
395 
396  //
397  // ======= Task/RZ state =======
398  //
399 
405  virtual Task_state Scheduler_get_task_state(int task_id) = 0;
406 
412  virtual Task_state Scheduler_get_task_state(RZ *rz) = 0;
413 
414 
420  virtual bool Scheduler_set_blank(int hosting_rz_id) = 0;
421 
427  virtual bool Scheduler_set_blank(RZ *rz) = 0;
428 
429 
430 
431  //
432  // ======= Preemption =======
433  //
434 
439  virtual bool Scheduler_is_task_preempted(int taskid) const = 0;
440 
441 
442  //
443  // ======= Scheduler effort =======
444  //
445 
450  virtual double Scheduler_get_performance_effort(void) const = 0;
451 
456  virtual double Scheduler_get_power_effort(void) const = 0;
457 
462  virtual double Scheduler_get_area_effort(void) const = 0;
463 
464 
465  //
466  // ======= Misc =======
467  //
468 
473  virtual const char* Scheduler_get_name(void) const = 0;
474 
479  virtual ostream& Scheduler_get_output_stream(void) = 0;
480 
484  virtual void Scheduler_display_task_state_table(void) const = 0;
485 
489  virtual void Scheduler_display_rz_current_module_table(void) const = 0;
490 
494  virtual void Scheduler_display_waiting_queue(void) const = 0;
495 
496 };
497 
498 /* Default */
499 WAITING_QUEUE_HANDLER(default_algo);
500 MAPPING_ALGORITHM(default_algo);
501 SCHEDULING_ALGORITHM(default_algo);
502 
503 /* Mapping/Sheduling Algorithm : AMAP_EDF */
504 WAITING_QUEUE_HANDLER(AMAP_EDF);
505 MAPPING_ALGORITHM(AMAP_EDF);
506 SCHEDULING_ALGORITHM(AMAP_EDF);
507 
508 #endif
virtual void Scheduler_print_finished_precedence_vector(int task_id)=0
Prints the list of finished predecessors for a task.
virtual int Scheduler_get_module_ID(SchedulerRequest &req)=0
Retrieve task ID associated with shceduler request.
virtual sc_time Scheduler_get_task_running_time(int task_id)=0
Get running time of the task since the last idle state.
virtual void Scheduler_set_current_task(RZ *rz, int task_id)=0
Set current task hosted by a reconfigurable zone.
virtual int Scheduler_get_application_number(void)=0
Get the number of applications.
virtual void Scheduler_emulate_scheduler_behavior(void)=0
Emulate scheduler behaviour in terms of execution time and energy consumption.
virtual bool Scheduler_are_tasks_waiting(void) const =0
Check if there are tasks waiting in the queue.
virtual SchedulerRequest & Scheduler_get_element(int position)=0
Get a reference to an element in the queue.
Definition: task_to_schedule_interface.h:28
virtual int Scheduler_get_current_module_ID(RZ *rz)=0
Get ID of task currently instantiated on a reconfigurable zone.
virtual RZ_config & Scheduler_get_rz_properties(string inst_name)=0
Get the RZ properties of the instance (Processor or Hw RZ)
virtual Application_interface * Scheduler_get_application_interface(int index)=0
Get the application interface from an index.
virtual SchedulerRequest & Scheduler_current_task_waiting()=0
Get request with the current task in waiting queue.
virtual Task_to_schedule_interface * Scheduler_get_task_to_schedule_ptr(int taskID)=0
Get pointer to the task 'taskID'.
virtual bool Scheduler_has_task_already_requested_mapping(int task_to_map, int request_owner)=0
Check if a task placement has already been demanded by the same predecessor.
virtual int Scheduler_get_waiting_queue_size(void)=0
Get waiting queue size.
virtual Task_state Scheduler_get_task_state(int task_id)=0
Get task state.
virtual void Scheduler_display_rz_current_module_table(void) const =0
Displays RZ occupation on the standard output.
Definition: config_fct_point.h:31
Definition: reconfigurable_zone.h:62
virtual void Scheduler_set_scheduler_active(int taskid)=0
Set scheduler active for task 'taskid'.
virtual vector< RZ * > Scheduler_get_compatible_rz_vector(int task_id)=0
Get the list of reconfigurable zones that fit task 'task_id'.
virtual ostream & Scheduler_get_output_stream(void)=0
Get output stream.
virtual void Scheduler_display_task_state_table(void) const =0
Display task state table on the standard output.
WAITING_QUEUE_HANDLER(default_algo)
Definition: scheduling.cpp:176
Definition: rz_config.h:36
virtual void Scheduler_display_waiting_queue(void) const =0
Display waiting queue.
virtual void Scheduler_rerun_task(SchedulerRequest &req)=0
Changes a task from MAPPED to RUNNING state.
virtual bool Scheduler_is_task_preempted(int taskid) const =0
Check if task is preempted.
virtual double Scheduler_get_power_effort(void) const =0
Get scheduler power effort.
virtual double Scheduler_get_area_effort(void) const =0
Get scheduler area effort.
virtual double Scheduler_get_performance_effort(void) const =0
Get scheduler performance effort.
virtual const char * Scheduler_get_name(void) const =0
Get scheduler instance name.
virtual Config_fct_point & Scheduler_get_current_fct_point(RZ *rz)=0
Get the current fct. point of the RZ (Processor or Hw RZ)
Definition: application_interface.h:29
Definition: scheduler_request.h:47
virtual bool Scheduler_last_task_waiting(void) const =0
Reserved.
virtual SchedulerRequest Scheduler_next_task_waiting()=0
Reserved.
Task_state
Definition: task_implementation.h:40
virtual bool Scheduler_set_blank(int hosting_rz_id)=0
Set blank a reconfigurable zone.
Definition: scheduler_interface.h:52
virtual bool Scheduler_is_RZ_blank(RZ *rz)=0
Check if RZ is blank or used by a task.
virtual vector< RZ * > Scheduler_get_all_rz_vector(void)=0
Get the list of all reconfigurable zones used in the architecture.
Definition: scheduler_interface.h:138
virtual void Scheduler_update_queue(void)=0
Update priority queue after changes (e.g. priority change)
virtual void Scheduler_reset_current_position_in_waiting_queue()=0
Reserved.
virtual bool Scheduler_exist_rz_properties(string inst_name)=0
test if the RZ properties of the instance exists (Processor or Hw RZ)
virtual void Scheduler_notify_request_owner_module_ready(int owner, int ready)=0
Notify the owner of a request that it has been granted (i.e. the module is instantiated on the FPGA a...
virtual void Scheduler_send_update_parameters_to_module(RZ *rz)=0
Send parameters to update algorithms.
virtual void Scheduler_erase_current_task_waiting()=0
Reserved.
virtual void Scheduler_configure_task(RZ *rz, int id, int implID, int requestOwner)=0
Launch task configuration through either HW of SW reconfiguration unit.
virtual void Scheduler_add_finished_precedence(int task_mapped, int precedence)=0
Add a new finished precedence to a task.
virtual int Scheduler_position_of_current_element(void)=0
Get position of the current waiting queue element.