[88] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Simulation.cpp 124 2009-06-17 12:11:25Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/include/Simulation.h" |
---|
| 10 | #include "Common/include/ErrorMorpheo.h" |
---|
| 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | |
---|
[110] | 15 | static bool simulation_initialized; |
---|
[124] | 16 | bool _simulation_stop_exception; |
---|
[110] | 17 | double _simulation_nb_cycle; |
---|
| 18 | double _simulation_nb_instruction; |
---|
| 19 | std::vector<double> _simulation_nb_instruction_commited; |
---|
[124] | 20 | bool _simulation_file_with_date; |
---|
| 21 | bool _simulation_file_with_pid ; |
---|
| 22 | |
---|
[112] | 23 | Model _model; |
---|
[88] | 24 | |
---|
| 25 | void simulation_init (double nb_cycle, |
---|
[124] | 26 | double debug_nb_cycle, |
---|
| 27 | double nb_instruction, |
---|
| 28 | bool file_with_date, |
---|
| 29 | bool file_with_pid ) |
---|
[88] | 30 | { |
---|
| 31 | if (not simulation_initialized) |
---|
| 32 | { |
---|
[124] | 33 | if (debug_nb_cycle == 0) |
---|
| 34 | { |
---|
| 35 | _simulation_nb_cycle = nb_cycle; |
---|
| 36 | _simulation_stop_exception = false; |
---|
| 37 | } |
---|
| 38 | else |
---|
| 39 | { |
---|
| 40 | _simulation_nb_cycle = (debug_nb_cycle<nb_cycle)?debug_nb_cycle:nb_cycle; |
---|
| 41 | _simulation_stop_exception = (debug_nb_cycle<nb_cycle); |
---|
| 42 | } |
---|
| 43 | |
---|
[110] | 44 | _simulation_nb_instruction = nb_instruction; |
---|
| 45 | // _simulation_nb_instruction_commited = new std::vector<double>; |
---|
[124] | 46 | _simulation_file_with_date = file_with_date; |
---|
| 47 | _simulation_file_with_pid = file_with_pid ; |
---|
[88] | 48 | |
---|
| 49 | simulation_initialized = true; |
---|
| 50 | } |
---|
| 51 | else |
---|
| 52 | { |
---|
| 53 | msg_printf(WARNING,_("Multi instance of Morpheo : stop condition, take the highest.")); |
---|
| 54 | |
---|
[124] | 55 | if (//(_simulation_nb_cycle == 0) or |
---|
| 56 | (_simulation_nb_cycle < debug_nb_cycle)) |
---|
| 57 | { |
---|
| 58 | _simulation_nb_cycle = debug_nb_cycle; |
---|
| 59 | _simulation_stop_exception = true; |
---|
| 60 | } |
---|
[88] | 61 | |
---|
[124] | 62 | if (//(_simulation_nb_cycle == 0) or |
---|
| 63 | (_simulation_nb_cycle < nb_cycle)) |
---|
| 64 | { |
---|
| 65 | _simulation_nb_cycle = nb_cycle; |
---|
| 66 | _simulation_stop_exception = false; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | if (//(_simulation_nb_instruction == 0) or |
---|
| 70 | (_simulation_nb_instruction < nb_instruction)) |
---|
[110] | 71 | _simulation_nb_instruction = nb_instruction; |
---|
[124] | 72 | |
---|
| 73 | _simulation_file_with_date |= file_with_date; |
---|
| 74 | _simulation_file_with_pid |= file_with_pid ; |
---|
[88] | 75 | } |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | }; // end namespace behavioural |
---|
| 79 | }; // end namespace morpheo |
---|
| 80 | |
---|
| 81 | #endif |
---|