RecoSim  1.0
 All Classes Files Functions Variables Enumerations
utils.h
Go to the documentation of this file.
1 
21 #ifndef UTILS_H
22 #define UTILS_H
23 
24 #define RECOSIM_PART
25 
26 #include <systemc>
27 #include "tlm.h"
28 
29 #define IS_VERBOSE_MODE() (Utils::VERBOSE_MODE)
30 
31 #include "config.h"
32 #include "user_parameters.h"
33 
34 //#define DEBUG
35 
36 //#define GENERATE_LOG_FILE
37 
38 bool generate_logfile(void);
39 
40 enum ManagerToModuleCommands{MANAGER_COMMAND_SCHEDULING, MANAGER_UPDATE_PARAMETER_COMMAND_SCHEDULING};
41 enum ModuleToManagerCommands{MANAGER_UPLINK_TASK_PREEMPTION, MANAGER_UPLINK_TASK_END_COMPUTATION, MANAGER_UPLINK_TASK_CHECK_SOCKET, MANAGER_UPLINK_ALGO_STATE_UPDATE};
42 enum TestbenchToManagerCommands{TB_TO_MANAGER_CHECK_SOCKET, TB_TO_MANAGER_ALGORITHM_COMMAND};
43 
44 // ERRCODES
45 const int RECOSIM_SIMULATION_SUCCESS = 0; /*< Simulation success */
46 const int RECOSIM_SIMULATION_FAILED_ERRCODE = 1; /*< QoS or consumption failure */
47 const int RECOSIM_NOT_ALL_TASKS_HOSTED_ERRCODE = 2; /*< Bad RZ/processor subset */
48 const int RECOSIM_INTERNAL_ERROR_ERRCODE = 3; /*< Internal error, should not happen (error with RecoSim configuration/init) */
49 const int RECOSIM_TESTBENCH_CHECK_FAILED = 4; /*< Testbench check failed (e.g. data received different than what was expected) */
50 
51 class Utils {
52 
53 public:
54  static bool VERBOSE_MODE;
55 
56  static int atoi(std::string);
57  static double atod(std::string);
58  static std::string itoa(int);
59  static std::string ftoa(float val);
60  static void check_transaction(tlm::tlm_generic_payload& trans);
61  static sc_dt::sc_bigint<TRACE_LV_SIZE> string_to_ascii(std::string str);
62  static sc_core::sc_time maxTime(sc_core::sc_time a, sc_core::sc_time b);
63 };
64 
65 #endif
Definition: utils.h:51