| 1 | #ifdef SYSTEMC
|
|---|
| 2 | #ifndef morpheo_behavioural_Simulation_h
|
|---|
| 3 | #define morpheo_behavioural_Simulation_h
|
|---|
| 4 |
|
|---|
| 5 | /*
|
|---|
| 6 | * $Id: Simulation.h 138 2010-05-12 17:34:01Z rosiere $
|
|---|
| 7 | *
|
|---|
| 8 | * [ Description ]
|
|---|
| 9 | *
|
|---|
| 10 | */
|
|---|
| 11 |
|
|---|
| 12 | #include "Common/include/Debug.h"
|
|---|
| 13 | #include "Behavioural/include/Model.h"
|
|---|
| 14 | #include <stdint.h>
|
|---|
| 15 | #include <systemc.h>
|
|---|
| 16 | #include <vector>
|
|---|
| 17 |
|
|---|
| 18 | namespace morpheo {
|
|---|
| 19 | namespace behavioural {
|
|---|
| 20 |
|
|---|
| 21 | typedef enum
|
|---|
| 22 | {
|
|---|
| 23 | ALL_THREAD,
|
|---|
| 24 | EACH_THREAD_AND_CONTINUE,
|
|---|
| 25 | EACH_THREAD_AND_STOP
|
|---|
| 26 | } stop_type_t;
|
|---|
| 27 |
|
|---|
| 28 | extern bool _simulation_stop_exception;
|
|---|
| 29 | extern double _simulation_nb_cycle;
|
|---|
| 30 | extern double _simulation_nb_instruction;
|
|---|
| 31 | extern std::vector<double> _simulation_nb_instruction_commited;
|
|---|
| 32 | extern stop_type_t _simulation_stop_type;
|
|---|
| 33 | extern bool _simulation_file_with_date;
|
|---|
| 34 | extern bool _simulation_file_with_pid ;
|
|---|
| 35 |
|
|---|
| 36 | extern Model _model;
|
|---|
| 37 |
|
|---|
| 38 | bool simulation_test_end (void);
|
|---|
| 39 | void simulation_init (double nb_cycle,
|
|---|
| 40 | double denug_nb_cycle,
|
|---|
| 41 | double nb_instruction,
|
|---|
| 42 | stop_type_t stop_type,
|
|---|
| 43 | bool file_with_date,
|
|---|
| 44 | bool file_with_pid);
|
|---|
| 45 | }; // end namespace behavioural
|
|---|
| 46 |
|
|---|
| 47 | template<> inline std::string toString<morpheo::behavioural::stop_type_t>(const morpheo::behavioural::stop_type_t& x)
|
|---|
| 48 | {
|
|---|
| 49 | switch (x)
|
|---|
| 50 | {
|
|---|
| 51 | case morpheo::behavioural::ALL_THREAD : return "all_thread"; break;
|
|---|
| 52 | case morpheo::behavioural::EACH_THREAD_AND_CONTINUE : return "each_thread_and_continue"; break;
|
|---|
| 53 | case morpheo::behavioural::EACH_THREAD_AND_STOP : return "each_thread_and_stop"; break;
|
|---|
| 54 | default : return ""; break;
|
|---|
| 55 | }
|
|---|
| 56 | };
|
|---|
| 57 |
|
|---|
| 58 | template<> inline morpheo::behavioural::stop_type_t fromString<morpheo::behavioural::stop_type_t>(const std::string& x)
|
|---|
| 59 | {
|
|---|
| 60 | if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::ALL_THREAD))) == 0) or
|
|---|
| 61 | (x.compare(toString( morpheo::behavioural::ALL_THREAD )) == 0))
|
|---|
| 62 | return morpheo::behavioural::ALL_THREAD;
|
|---|
| 63 |
|
|---|
| 64 | if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::EACH_THREAD_AND_CONTINUE))) == 0) or
|
|---|
| 65 | (x.compare(toString( morpheo::behavioural::EACH_THREAD_AND_CONTINUE )) == 0))
|
|---|
| 66 | return morpheo::behavioural::EACH_THREAD_AND_CONTINUE;
|
|---|
| 67 |
|
|---|
| 68 | if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::EACH_THREAD_AND_STOP))) == 0) or
|
|---|
| 69 | (x.compare(toString( morpheo::behavioural::EACH_THREAD_AND_STOP )) == 0))
|
|---|
| 70 | return morpheo::behavioural::EACH_THREAD_AND_STOP;
|
|---|
| 71 |
|
|---|
| 72 | throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\""));
|
|---|
| 73 | };
|
|---|
| 74 |
|
|---|
| 75 | }; // end namespace morpheo
|
|---|
| 76 |
|
|---|
| 77 | #endif
|
|---|
| 78 | #endif
|
|---|