1 | /* |
---|
2 | * $Id: Execute_loop_Glue.cpp 136 2009-10-20 18:52:15Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Execute_loop_Glue/include/Execute_loop_Glue.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace core { |
---|
13 | namespace multi_execute_loop { |
---|
14 | namespace execute_loop { |
---|
15 | namespace execute_loop_glue { |
---|
16 | |
---|
17 | |
---|
18 | #undef FUNCTION |
---|
19 | #define FUNCTION "Execute_loop_Glue::Execute_loop_Glue" |
---|
20 | Execute_loop_Glue::Execute_loop_Glue |
---|
21 | ( |
---|
22 | #ifdef SYSTEMC |
---|
23 | sc_module_name name, |
---|
24 | #else |
---|
25 | string name, |
---|
26 | #endif |
---|
27 | #ifdef STATISTICS |
---|
28 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
29 | #endif |
---|
30 | morpheo::behavioural::core::multi_execute_loop::execute_loop::execute_loop_glue::Parameters * param, |
---|
31 | morpheo::behavioural::Tusage_t usage |
---|
32 | ): |
---|
33 | _name (name) |
---|
34 | ,_param (param) |
---|
35 | ,_usage (usage) |
---|
36 | { |
---|
37 | log_begin(Execute_loop_Glue,FUNCTION); |
---|
38 | |
---|
39 | usage_environment(_usage); |
---|
40 | |
---|
41 | // #if DEBUG_Execute_loop_Glue == true |
---|
42 | // log_printf(INFO,Execute_loop_Glue,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
43 | |
---|
44 | // std::cout << *param << std::endl; |
---|
45 | // #endif |
---|
46 | |
---|
47 | log_printf(INFO,Execute_loop_Glue,FUNCTION,_("<%s> : Allocation"),_name.c_str()); |
---|
48 | |
---|
49 | allocation ( |
---|
50 | #ifdef STATISTICS |
---|
51 | param_statistics |
---|
52 | #endif |
---|
53 | ); |
---|
54 | |
---|
55 | #ifdef STATISTICS |
---|
56 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
57 | { |
---|
58 | log_printf(INFO,Execute_loop_Glue,FUNCTION,_("<%s> : Allocation of statistics"),_name.c_str()); |
---|
59 | |
---|
60 | statistics_allocation(param_statistics); |
---|
61 | } |
---|
62 | #endif |
---|
63 | |
---|
64 | #ifdef VHDL |
---|
65 | if (usage_is_set(_usage,USE_VHDL)) |
---|
66 | { |
---|
67 | // generate the vhdl |
---|
68 | log_printf(INFO,Execute_loop_Glue,FUNCTION,_("<%s> : Generate the vhdl"),_name.c_str()); |
---|
69 | |
---|
70 | vhdl(); |
---|
71 | } |
---|
72 | #endif |
---|
73 | |
---|
74 | #ifdef SYSTEMC |
---|
75 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
76 | { |
---|
77 | log_printf(INFO,Execute_loop_Glue,FUNCTION,_("<%s> : Method - transition"),_name.c_str()); |
---|
78 | |
---|
79 | SC_METHOD (transition); |
---|
80 | dont_initialize (); |
---|
81 | sensitive << (*(in_CLOCK)).pos(); |
---|
82 | |
---|
83 | # ifdef SYSTEMCASS_SPECIFIC |
---|
84 | // List dependency information |
---|
85 | # endif |
---|
86 | |
---|
87 | // log_printf(INFO,Execute_loop_Glue,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str()); |
---|
88 | |
---|
89 | // SC_METHOD (genMoore); |
---|
90 | // dont_initialize (); |
---|
91 | // sensitive << (*(in_CLOCK)).neg(); // need internal register |
---|
92 | |
---|
93 | // # ifdef SYSTEMCASS_SPECIFIC |
---|
94 | // // List dependency information |
---|
95 | // # endif |
---|
96 | |
---|
97 | log_printf(INFO,Execute_loop_Glue,FUNCTION,_("<%s> : Method - genMealy_gpr_write"),_name.c_str()); |
---|
98 | |
---|
99 | SC_METHOD (genMealy_gpr_write); |
---|
100 | dont_initialize (); |
---|
101 | // sensitive << (*(in_CLOCK)).neg(); // don't internal register |
---|
102 | sensitive << (*(in_NRESET)); |
---|
103 | |
---|
104 | for (uint32_t i=0; i<_param->_nb_gpr_write; i++) |
---|
105 | { |
---|
106 | sensitive <<(*(in_GPR_WRITE_WRITE_UNIT_VAL [i])) |
---|
107 | <<(*(in_GPR_WRITE_WRITE_UNIT_NUM_REG [i])) |
---|
108 | <<(*(in_GPR_WRITE_WRITE_UNIT_DATA [i])) |
---|
109 | <<(*(in_GPR_WRITE_REGISTER_FILE_ACK [i])); |
---|
110 | if (_param->_have_port_ooo_engine_id) |
---|
111 | sensitive <<(*(in_GPR_WRITE_WRITE_UNIT_OOO_ENGINE_ID [i])); |
---|
112 | } |
---|
113 | |
---|
114 | # ifdef SYSTEMCASS_SPECIFIC |
---|
115 | // List dependency information |
---|
116 | for (uint32_t i=0; i<_param->_nb_gpr_write; i++) |
---|
117 | { |
---|
118 | (*(out_GPR_WRITE_WRITE_UNIT_ACK [i])) (*( in_GPR_WRITE_REGISTER_FILE_ACK [i])); |
---|
119 | (*(out_GPR_WRITE_REGISTER_FILE_VAL [i])) (*( in_GPR_WRITE_WRITE_UNIT_VAL [i])); |
---|
120 | if (_param->_have_port_ooo_engine_id) |
---|
121 | (*(out_GPR_WRITE_REGISTER_FILE_OOO_ENGINE_ID [i])) (*( in_GPR_WRITE_WRITE_UNIT_OOO_ENGINE_ID [i])); |
---|
122 | (*(out_GPR_WRITE_REGISTER_FILE_NUM_REG [i])) (*( in_GPR_WRITE_WRITE_UNIT_NUM_REG [i])); |
---|
123 | (*(out_GPR_WRITE_REGISTER_FILE_DATA [i])) (*( in_GPR_WRITE_WRITE_UNIT_DATA [i])); |
---|
124 | (*(out_GPR_WRITE_READ_UNIT_VAL [i])) (*( in_GPR_WRITE_WRITE_UNIT_VAL [i])); |
---|
125 | (*(out_GPR_WRITE_READ_UNIT_VAL [i])) (*( in_GPR_WRITE_REGISTER_FILE_ACK [i])); |
---|
126 | if (_param->_have_port_ooo_engine_id) |
---|
127 | (*(out_GPR_WRITE_READ_UNIT_OOO_ENGINE_ID [i])) (*( in_GPR_WRITE_WRITE_UNIT_OOO_ENGINE_ID [i])); |
---|
128 | (*(out_GPR_WRITE_READ_UNIT_NUM_REG [i])) (*( in_GPR_WRITE_WRITE_UNIT_NUM_REG [i])); |
---|
129 | (*(out_GPR_WRITE_READ_UNIT_DATA [i])) (*( in_GPR_WRITE_WRITE_UNIT_DATA [i])); |
---|
130 | } |
---|
131 | # endif |
---|
132 | |
---|
133 | log_printf(INFO,Execute_loop_Glue,FUNCTION,_("<%s> : Method - genMealy_spr_write"),_name.c_str()); |
---|
134 | |
---|
135 | SC_METHOD (genMealy_spr_write); |
---|
136 | dont_initialize (); |
---|
137 | // sensitive << (*(in_CLOCK)).neg(); // don't internal register |
---|
138 | sensitive << (*(in_NRESET)); |
---|
139 | |
---|
140 | for (uint32_t i=0; i<_param->_nb_spr_write; i++) |
---|
141 | { |
---|
142 | sensitive <<(*(in_SPR_WRITE_WRITE_UNIT_VAL [i])) |
---|
143 | <<(*(in_SPR_WRITE_WRITE_UNIT_NUM_REG [i])) |
---|
144 | <<(*(in_SPR_WRITE_WRITE_UNIT_DATA [i])) |
---|
145 | <<(*(in_SPR_WRITE_REGISTER_FILE_ACK [i])); |
---|
146 | if (_param->_have_port_ooo_engine_id) |
---|
147 | sensitive <<(*(in_SPR_WRITE_WRITE_UNIT_OOO_ENGINE_ID [i])); |
---|
148 | } |
---|
149 | |
---|
150 | # ifdef SYSTEMCASS_SPECIFIC |
---|
151 | // List dependency information |
---|
152 | for (uint32_t i=0; i<_param->_nb_spr_write; i++) |
---|
153 | { |
---|
154 | (*(out_SPR_WRITE_WRITE_UNIT_ACK [i])) (*( in_SPR_WRITE_REGISTER_FILE_ACK [i])); |
---|
155 | (*(out_SPR_WRITE_REGISTER_FILE_VAL [i])) (*( in_SPR_WRITE_WRITE_UNIT_VAL [i])); |
---|
156 | if (_param->_have_port_ooo_engine_id) |
---|
157 | (*(out_SPR_WRITE_REGISTER_FILE_OOO_ENGINE_ID [i])) (*( in_SPR_WRITE_WRITE_UNIT_OOO_ENGINE_ID [i])); |
---|
158 | (*(out_SPR_WRITE_REGISTER_FILE_NUM_REG [i])) (*( in_SPR_WRITE_WRITE_UNIT_NUM_REG [i])); |
---|
159 | (*(out_SPR_WRITE_REGISTER_FILE_DATA [i])) (*( in_SPR_WRITE_WRITE_UNIT_DATA [i])); |
---|
160 | (*(out_SPR_WRITE_READ_UNIT_VAL [i])) (*( in_SPR_WRITE_WRITE_UNIT_VAL [i])); |
---|
161 | (*(out_SPR_WRITE_READ_UNIT_VAL [i])) (*( in_SPR_WRITE_REGISTER_FILE_ACK [i])); |
---|
162 | if (_param->_have_port_ooo_engine_id) |
---|
163 | (*(out_SPR_WRITE_READ_UNIT_OOO_ENGINE_ID [i])) (*( in_SPR_WRITE_WRITE_UNIT_OOO_ENGINE_ID [i])); |
---|
164 | (*(out_SPR_WRITE_READ_UNIT_NUM_REG [i])) (*( in_SPR_WRITE_WRITE_UNIT_NUM_REG [i])); |
---|
165 | (*(out_SPR_WRITE_READ_UNIT_DATA [i])) (*( in_SPR_WRITE_WRITE_UNIT_DATA [i])); |
---|
166 | } |
---|
167 | # endif |
---|
168 | |
---|
169 | log_printf(INFO,Execute_loop_Glue,FUNCTION,_("<%s> : Method - genMealy_issue"),_name.c_str()); |
---|
170 | |
---|
171 | SC_METHOD (genMealy_issue); |
---|
172 | dont_initialize (); |
---|
173 | // sensitive << (*(in_CLOCK)).neg();// don't need internal register |
---|
174 | for (uint32_t i=0; i<_param->_nb_inst_issue; ++i) |
---|
175 | sensitive << (*(in_ISSUE_VAL [i])) |
---|
176 | << (*(in_ISSUE_READ_UNIT_ACK [i])) |
---|
177 | << (*(in_ISSUE_REGISTER_UNIT_ACK [i])); |
---|
178 | |
---|
179 | # ifdef SYSTEMCASS_SPECIFIC |
---|
180 | // List dependency information |
---|
181 | # endif |
---|
182 | |
---|
183 | #endif |
---|
184 | } |
---|
185 | log_end(Execute_loop_Glue,FUNCTION); |
---|
186 | }; |
---|
187 | |
---|
188 | #undef FUNCTION |
---|
189 | #define FUNCTION "Execute_loop_Glue::~Execute_loop_Glue" |
---|
190 | Execute_loop_Glue::~Execute_loop_Glue (void) |
---|
191 | { |
---|
192 | log_begin(Execute_loop_Glue,FUNCTION); |
---|
193 | |
---|
194 | #ifdef STATISTICS |
---|
195 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
196 | { |
---|
197 | statistics_deallocation(); |
---|
198 | } |
---|
199 | #endif |
---|
200 | |
---|
201 | log_printf(INFO,Execute_loop_Glue,FUNCTION,_("<%s> : Deallocation"),_name.c_str()); |
---|
202 | deallocation (); |
---|
203 | |
---|
204 | log_end(Execute_loop_Glue,FUNCTION); |
---|
205 | }; |
---|
206 | |
---|
207 | }; // end namespace execute_loop_glue |
---|
208 | }; // end namespace execute_loop |
---|
209 | }; // end namespace multi_execute_loop |
---|
210 | }; // end namespace core |
---|
211 | |
---|
212 | }; // end namespace behavioural |
---|
213 | }; // end namespace morpheo |
---|