1 | /* |
---|
2 | * $Id: Load_store_unit.cpp 132 2009-07-11 16:39:35Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Load_store_unit.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace core { |
---|
13 | namespace multi_execute_loop { |
---|
14 | namespace execute_loop { |
---|
15 | namespace multi_execute_unit { |
---|
16 | namespace execute_unit { |
---|
17 | namespace load_store_unit { |
---|
18 | |
---|
19 | |
---|
20 | #undef FUNCTION |
---|
21 | #define FUNCTION "Load_store_unit::Load_store_unit" |
---|
22 | Load_store_unit::Load_store_unit |
---|
23 | ( |
---|
24 | #ifdef SYSTEMC |
---|
25 | sc_module_name name, |
---|
26 | #else |
---|
27 | std::string name, |
---|
28 | #endif |
---|
29 | #ifdef STATISTICS |
---|
30 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
31 | #endif |
---|
32 | morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Parameters * param , |
---|
33 | morpheo::behavioural::Tusage_t usage |
---|
34 | ): |
---|
35 | _name (name) |
---|
36 | ,_param (param) |
---|
37 | ,_usage (usage) |
---|
38 | { |
---|
39 | log_printf(FUNC,Load_store_unit,FUNCTION,"Begin"); |
---|
40 | |
---|
41 | // #if DEBUG_Load_store_unit == true |
---|
42 | // log_printf(INFO,Load_store_unit,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
43 | |
---|
44 | // std::cout << *param << std::endl; |
---|
45 | // #endif |
---|
46 | |
---|
47 | #ifdef SYSTEMC |
---|
48 | log_printf(INFO,Load_store_unit,FUNCTION,"Allocation"); |
---|
49 | |
---|
50 | allocation (); |
---|
51 | #endif |
---|
52 | |
---|
53 | #ifdef STATISTICS |
---|
54 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
55 | { |
---|
56 | log_printf(INFO,Load_store_unit,FUNCTION,"Allocation of statistics"); |
---|
57 | |
---|
58 | statistics_allocation(param_statistics); |
---|
59 | } |
---|
60 | #endif |
---|
61 | |
---|
62 | #ifdef VHDL |
---|
63 | if (usage_is_set(_usage,USE_VHDL)) |
---|
64 | { |
---|
65 | // generate the vhdl |
---|
66 | log_printf(INFO,Load_store_unit,FUNCTION,"Generate the vhdl"); |
---|
67 | |
---|
68 | vhdl(); |
---|
69 | } |
---|
70 | #endif |
---|
71 | |
---|
72 | #ifdef SYSTEMC |
---|
73 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
74 | { |
---|
75 | |
---|
76 | // Function pointer |
---|
77 | switch (_param->_speculative_load) |
---|
78 | { |
---|
79 | case SPECULATIVE_LOAD_COMMIT : |
---|
80 | { |
---|
81 | function_transition = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_transition ; |
---|
82 | function_genMoore = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMoore ; |
---|
83 | function_genMealy_dcache = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMealy_dcache; |
---|
84 | function_genMealy_insert = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMealy_insert; |
---|
85 | function_genMealy_retire = &morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::function_speculative_load_commit_genMealy_retire; |
---|
86 | break; |
---|
87 | } |
---|
88 | case NO_SPECULATIVE_LOAD : |
---|
89 | case SPECULATIVE_LOAD_ACCESS : |
---|
90 | //case SPECULATIVE_LOAD_BYPASS : |
---|
91 | default : |
---|
92 | { |
---|
93 | break; |
---|
94 | } |
---|
95 | } |
---|
96 | |
---|
97 | #ifdef SYSTEMCASS_SPECIFIC |
---|
98 | constant(); |
---|
99 | #else |
---|
100 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - constant"); |
---|
101 | |
---|
102 | SC_METHOD (constant); |
---|
103 | // dont_initialize (); |
---|
104 | |
---|
105 | #ifdef SYSTEMCASS_SPECIFIC |
---|
106 | // List dependency information |
---|
107 | #endif |
---|
108 | #endif |
---|
109 | |
---|
110 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - transition"); |
---|
111 | |
---|
112 | SC_METHOD (transition); |
---|
113 | dont_initialize (); |
---|
114 | sensitive << (*(in_CLOCK)).pos(); |
---|
115 | |
---|
116 | #ifdef SYSTEMCASS_SPECIFIC |
---|
117 | // List dependency information |
---|
118 | #endif |
---|
119 | |
---|
120 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMoore"); |
---|
121 | |
---|
122 | SC_METHOD (genMoore); |
---|
123 | dont_initialize (); |
---|
124 | sensitive << (*(in_CLOCK)).neg(); |
---|
125 | |
---|
126 | #ifdef SYSTEMCASS_SPECIFIC |
---|
127 | // List dependency information |
---|
128 | #endif |
---|
129 | |
---|
130 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_insert"); |
---|
131 | |
---|
132 | SC_METHOD (genMealy_insert); |
---|
133 | dont_initialize (); |
---|
134 | sensitive << (*(in_CLOCK)).neg() |
---|
135 | << (*(in_NRESET)); |
---|
136 | for (uint32_t i=0; i<_param->_nb_inst_memory; i++) |
---|
137 | sensitive << (*(in_MEMORY_IN_VAL [i])) |
---|
138 | << (*(in_MEMORY_IN_OPERATION [i])); |
---|
139 | |
---|
140 | #ifdef SYSTEMCASS_SPECIFIC |
---|
141 | // List dependency information |
---|
142 | for (uint32_t i=0; i<_param->_nb_inst_memory; i++) |
---|
143 | // for (uint32_t x=0; x<_param->_nb_inst_memory; x++) |
---|
144 | { |
---|
145 | (*(out_MEMORY_IN_ACK [i])) (*(in_MEMORY_IN_VAL [i])); |
---|
146 | (*(out_MEMORY_IN_ACK [i])) (*(in_MEMORY_IN_OPERATION [i])); |
---|
147 | } |
---|
148 | #endif |
---|
149 | |
---|
150 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_retire"); |
---|
151 | |
---|
152 | SC_METHOD (genMealy_retire); |
---|
153 | dont_initialize (); |
---|
154 | sensitive << (*(in_CLOCK)).neg() |
---|
155 | << (*(in_NRESET)); |
---|
156 | |
---|
157 | #ifdef SYSTEMCASS_SPECIFIC |
---|
158 | // List dependency information |
---|
159 | #endif |
---|
160 | |
---|
161 | log_printf(INFO,Load_store_unit,FUNCTION,"Method - genMealy_dcache"); |
---|
162 | |
---|
163 | SC_METHOD (genMealy_dcache); |
---|
164 | dont_initialize (); |
---|
165 | sensitive << (*(in_CLOCK)).neg() |
---|
166 | << (*(in_NRESET)); |
---|
167 | |
---|
168 | #ifdef SYSTEMCASS_SPECIFIC |
---|
169 | // List dependency information |
---|
170 | #endif |
---|
171 | } |
---|
172 | #endif |
---|
173 | log_printf(FUNC,Load_store_unit,FUNCTION,"End"); |
---|
174 | }; |
---|
175 | |
---|
176 | #undef FUNCTION |
---|
177 | #define FUNCTION "Load_store_unit::~Load_store_unit" |
---|
178 | Load_store_unit::~Load_store_unit (void) |
---|
179 | { |
---|
180 | log_printf(FUNC,Load_store_unit,FUNCTION,"Begin"); |
---|
181 | |
---|
182 | #ifdef STATISTICS |
---|
183 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
184 | statistics_deallocation (); |
---|
185 | #endif |
---|
186 | |
---|
187 | #ifdef SYSTEMC |
---|
188 | log_printf(INFO,Load_store_unit,FUNCTION,"Deallocation"); |
---|
189 | |
---|
190 | deallocation (); |
---|
191 | #endif |
---|
192 | |
---|
193 | log_printf(FUNC,Load_store_unit,FUNCTION,"End"); |
---|
194 | }; |
---|
195 | |
---|
196 | }; // end namespace load_store_unit |
---|
197 | }; // end namespace execute_unit |
---|
198 | }; // end namespace multi_execute_unit |
---|
199 | }; // end namespace execute_loop |
---|
200 | }; // end namespace multi_execute_loop |
---|
201 | }; // end namespace core |
---|
202 | |
---|
203 | }; // end namespace behavioural |
---|
204 | }; // end namespace morpheo |
---|