1 | /* |
---|
2 | * $Id: Configuration.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Configuration/include/Configuration.h" |
---|
9 | #include "Behavioural/include/Simulation.h" |
---|
10 | #include "Common/include/Environment.h" |
---|
11 | |
---|
12 | namespace morpheo { |
---|
13 | namespace behavioural { |
---|
14 | namespace configuration { |
---|
15 | |
---|
16 | #undef FUNCTION |
---|
17 | #define FUNCTION "Configuration::Configuration" |
---|
18 | Configuration::Configuration (std::string filename_simulator, |
---|
19 | std::string filename_generator, |
---|
20 | std::string filename_instance , |
---|
21 | behavioural::custom::custom_information_t (*get_custom_information) (void)) |
---|
22 | { |
---|
23 | log_begin(Configuration,FUNCTION); |
---|
24 | |
---|
25 | _simulator = new Simulator (filename_simulator); |
---|
26 | _generator = new Generator (filename_generator); |
---|
27 | _instance = new Instance (filename_instance , |
---|
28 | _generator, |
---|
29 | get_custom_information); |
---|
30 | |
---|
31 | //-------------------------------------------------- |
---|
32 | // Name |
---|
33 | //-------------------------------------------------- |
---|
34 | _name = _instance->getName(); |
---|
35 | |
---|
36 | //-------------------------------------------------- |
---|
37 | // Parameters |
---|
38 | //-------------------------------------------------- |
---|
39 | _param = _instance->_param; |
---|
40 | |
---|
41 | //-------------------------------------------------- |
---|
42 | // Usage |
---|
43 | //-------------------------------------------------- |
---|
44 | _usage = USE_NONE; |
---|
45 | |
---|
46 | if (fromString<bool>(_simulator->getParam("use_systemc"))) |
---|
47 | _usage = usage_set(_usage, USE_SYSTEMC); |
---|
48 | if (fromString<bool>(_simulator->getParam("use_vhdl"))) |
---|
49 | _usage = usage_set(_usage, USE_VHDL); |
---|
50 | if (fromString<bool>(_simulator->getParam("use_vhdl_testbench"))) |
---|
51 | _usage = usage_set(_usage, USE_VHDL_TESTBENCH); |
---|
52 | if (fromString<bool>(_simulator->getParam("use_vhdl_testbench_assert"))) |
---|
53 | _usage = usage_set(_usage, USE_VHDL_TESTBENCH_ASSERT); |
---|
54 | if (fromString<bool>(_simulator->getParam("use_position"))) |
---|
55 | _usage = usage_set(_usage, USE_POSITION); |
---|
56 | if (fromString<bool>(_simulator->getParam("use_statistics"))) |
---|
57 | _usage = usage_set(_usage, USE_STATISTICS); |
---|
58 | if (fromString<bool>(_simulator->getParam("use_information"))) |
---|
59 | _usage = usage_set(_usage, USE_INFORMATION); |
---|
60 | if (fromString<bool>(_simulator->getParam("use_header"))) |
---|
61 | _usage = usage_set(_usage, USE_HEADER); |
---|
62 | |
---|
63 | usage_environment (_usage); |
---|
64 | |
---|
65 | //-------------------------------------------------- |
---|
66 | // Parameters_Statistics |
---|
67 | //-------------------------------------------------- |
---|
68 | _param_statistics = new Parameters_Statistics (fromString<uint64_t>(_simulator->getParam("nb_cycle_before_begin")), |
---|
69 | fromString<uint64_t>(_simulator->getParam("period_save"))); |
---|
70 | |
---|
71 | //-------------------------------------------------- |
---|
72 | // Simulation condition stop |
---|
73 | //-------------------------------------------------- |
---|
74 | simulation_init (fromString<double>(_simulator->getParam("simulation_nb_cycle")), |
---|
75 | fromString<double>(_simulator->getParam("simulation_nb_instruction"))); |
---|
76 | |
---|
77 | //-------------------------------------------------- |
---|
78 | // Directory |
---|
79 | //-------------------------------------------------- |
---|
80 | directory_init (_simulator->getParam("directory_statistics"), |
---|
81 | _simulator->getParam("directory_vhdl" ), |
---|
82 | _simulator->getParam("directory_position" ), |
---|
83 | _simulator->getParam("directory_log" )); |
---|
84 | |
---|
85 | log_end(Configuration,FUNCTION); |
---|
86 | }; |
---|
87 | |
---|
88 | #undef FUNCTION |
---|
89 | #define FUNCTION "Configuration::~Configuration" |
---|
90 | Configuration::~Configuration () |
---|
91 | { |
---|
92 | log_begin(Configuration,FUNCTION); |
---|
93 | |
---|
94 | delete _simulator; |
---|
95 | delete _generator; |
---|
96 | delete _instance; |
---|
97 | delete _param_statistics; |
---|
98 | |
---|
99 | log_end(Configuration,FUNCTION); |
---|
100 | }; |
---|
101 | |
---|
102 | }; // end namespace configuration |
---|
103 | }; // end namespace behavioural |
---|
104 | }; // end namespace morpheo |
---|