34 using namespace sc_core;
35 using namespace sc_dt;
41 #define MAPPED_ASCII 0x4D617070656420
42 #define RUNNING_ASCII 0x52756E6E696E6720
43 #define CONFIGURING_ASCII 0x436F6E66696720
44 #define QUEUED_ASCII 0x51756575656420
45 #define CONTEXT_SAVE_ASCII 0x4374787420535620
46 #define CONTEXT_LOAD_ASCII 0x43747874204C4420
47 #define IDLE_ASCII 0x49646C65
48 #define WAITING_ASCII 0x57616974696E67
49 #define ACTIVE_ASCII 0x41637469766520
54 #define BEGIN_REQ_ASCII 0x425F524551
55 #define END_REQ_ASCII 0x455F524551
56 #define BEGIN_RESP_ASCII 0x425F52455350
57 #define END_RESP_ASCII 0x455F52455350
58 #define INTERN_ASCII 0x494E5445524E
59 #define UNDEF_ASCII 0x554E444546
60 #define NULL_ASCII 0x4E554c4c
64 #define RESPONSE_OK_ASCII 0x4F4B
65 #define RESPONSE_ERROR_ASCII 0x455252
69 #define COMMAND_R_ASCII 0x52
70 #define COMMAND_W_ASCII 0x57
74 #define ALGORITHM_RUNNING_ASCII RUNNING_ASCII
75 #define ALGORITHM_WAITING_ASCII WAITING_ASCII
79 #define SCHEDULER_ACTIVE_ASCII ACTIVE_ASCII
80 #define ICAP_RECONF_T_ASCII CONFIGURING_ASCII
81 #define RZ_RUNNING_T_ASCII RUNNING_ASCII
82 #define RZ_MAPPED_T_ASCII MAPPED_ASCII
83 #define RZ_BLANK_ASCII 0x424C414E4B
84 #define OFFSET_ASCII 0x4F6666736574
88 #define COM_WAITING_T_ASCII WAITING_ASCII
89 #define COM_TX_T_ASCII 0x5478
102 command = NULL_ASCII;
105 response_status = NULL_ASCII;
108 void update_transaction(tlm_generic_payload* trans);
125 template<
int Ni,
int No>
128 bool trace_configuration_signals;
129 bool trace_debug_signals;
138 sc_dt::uint64 communication_status[No];
140 sc_bigint<TRACE_LV_SIZE> algorithm_execution_mode;
143 trace_configuration_signals =
false;
144 trace_debug_signals =
false;
152 template<
int Ni,
int No>
189 unsigned int nbCallsScheduler;
190 int nb_hw_reconfiguration_units;
191 int nb_sw_reconfiguration_units;
194 bool trace_debug_signals;
197 sc_bigint<TRACE_LV_SIZE>* icap_status;
198 sc_bigint<TRACE_LV_SIZE>* software_loader_status;
199 sc_bigint<TRACE_LV_SIZE> scheduler_status;
200 sc_bigint<TRACE_LV_SIZE>* task_status;
201 sc_bigint<TRACE_LV_SIZE>* rz_status;
204 double* icap_occupation_rate;
205 double* software_loader_occupation_rate;
206 double* rz_occupation_rate;
207 double* rz_running_rate;
208 double* rz_mapped_rate;
209 double* rz_config_rate;
210 double* rz_blank_rate;
213 double fpga_processor_occupation_rate;
214 map<string, double> fpga_resource_occupation_rate;
215 map<string, double>* rz_resource_occupation_rate;
218 vector<Manager_interface *> *modules_table_ptr;
219 vector<RZ *> *rz_table_ptr;
222 sc_bigint<TRACE_LV_SIZE> hyperperiod_status;
224 trace_packet_manager_t(vector<Manager_interface *> *modules_table, vector<RZ *> *rz_table,
int nb_hw_unit,
int nb_sw_unit,
FPGA* fpga) {
226 modules_table_ptr = modules_table;
227 rz_table_ptr = rz_table;
229 nbTasks = modules_table_ptr->size();
230 nbRZs = rz_table_ptr->size();
231 nb_hw_reconfiguration_units = nb_hw_unit;
232 nb_sw_reconfiguration_units = nb_sw_unit;
233 fpga_processor_occupation_rate = 0;
236 task_status =
new sc_bigint<TRACE_LV_SIZE>[nbTasks];
237 rz_status =
new sc_bigint<TRACE_LV_SIZE>[nbRZs];
239 icap_occupation_rate =
new double[nb_hw_unit];
240 icap_status =
new sc_bigint<TRACE_LV_SIZE>[nb_hw_unit];
241 software_loader_occupation_rate =
new double[nb_sw_unit];
242 software_loader_status =
new sc_bigint<TRACE_LV_SIZE>[nb_sw_unit];
243 rz_resource_occupation_rate =
new map<string, double>[nbRZs];
244 rz_occupation_rate =
new double[nbRZs];
245 rz_running_rate =
new double[nbRZs];
246 rz_mapped_rate =
new double[nbRZs];
247 rz_config_rate =
new double[nbRZs];
248 rz_blank_rate =
new double[nbRZs];
251 for(
int i = 0; i < nb_hw_reconfiguration_units; i++) {
252 icap_occupation_rate[i] = 0;
253 icap_status[i] = IDLE_ASCII;
257 for(
int i = 0; i < nb_sw_reconfiguration_units; i++) {
258 software_loader_occupation_rate[i] = 0;
259 software_loader_status[i] = IDLE_ASCII;
263 map<string, int> fpgaResources(fpga->get_resources().getResourceMap());
264 for(map<string, int>::const_iterator it = fpgaResources.begin(); it != fpgaResources.end(); it++) {
265 fpga_resource_occupation_rate[it->first] = 0;
269 for(
int i = 0; i < nbRZs; i++) {
270 rz_occupation_rate[i] = 0;
271 rz_running_rate[i] = 0;
272 rz_mapped_rate[i] = 0;
273 rz_config_rate[i] = 0;
274 rz_blank_rate[i] = 0;
275 rz_status[i] = RZ_BLANK_ASCII;
277 map<string, int> rzResources(rz_table->at(i)->get_resources_ptr()->getResourceMap());
278 for(map<string, int>::const_iterator it = rzResources.begin(); it != rzResources.end(); it++) {
279 rz_resource_occupation_rate[i][it->first] = 0;
284 nbCallsScheduler = 0;
285 scheduler_status = IDLE_ASCII;
286 for(
int i = 0; i < nbTasks; i++) task_status[i] = IDLE_ASCII;
288 trace_debug_signals =
false;
290 hyperperiod_status = OFFSET_ASCII;
294 delete[] task_status;
296 delete[] icap_occupation_rate;
297 delete[] icap_status;
298 delete[] software_loader_occupation_rate;
299 delete[] software_loader_status;
300 delete[] rz_occupation_rate;
301 delete[] rz_resource_occupation_rate;
306 template<
int Ni,
int No>
void sc_trace(sc_trace_file *tf,
const trace_packet_t<Ni, No>& packet,
const string& NAME);
312 void sc_trace(sc_trace_file *tf,
const initiator_packet_t& packet,
const string& NAME);
313 void sc_trace(sc_trace_file *tf,
const target_packet_t& packet,
const string& NAME);
317 sc_dt::uint64 tlm_phase_to_ascii(tlm_phase phase);
320 template<
int Ni,
int No>
323 for(
int i = 0; i < Ni; i++) {
324 sc_trace(tf, packet.address_in[i], NAME +
".address_in_" + Utils::itoa(i));
325 sc_trace(tf, packet.data_in[i], NAME +
".data_in_" + Utils::itoa(i));
326 sc_trace(tf, packet.target_packet[i], NAME +
".target_" + Utils::itoa(i));
329 for(
int i = 0; i < No; i++) {
330 sc_trace(tf, packet.address_out[i], NAME +
".address_out_" + Utils::itoa(i));
331 sc_trace(tf, packet.data_out[i], NAME +
".data_out_" + Utils::itoa(i));
332 sc_trace(tf, packet.initiator_packet[i], NAME +
".initiator_" + Utils::itoa(i));
333 sc_trace(tf, packet.communication_status[i],NAME +
".communication_" + Utils::itoa(i));
336 if(packet.trace_configuration_signals) sc_trace(tf, packet.algorithm_execution_mode, NAME +
".execution_mode");
339 template<
int Ni,
int No>
341 for(
int i = 0; i < Ni; i++) sc_trace(tf, packet.target_packet[i], NAME +
".target_" + Utils::itoa(i));
342 for(
int i = 0; i < No; i++) sc_trace(tf, packet.initiator_packet[i], NAME +
".initiator_" + Utils::itoa(i));
347 for(
int i = 0; i < Ni; i++) sc_trace(tf, packet.target_packet[i], NAME +
".target_" + Utils::itoa(i));
352 for(
int i = 0; i < No; i++) sc_trace(tf, packet.initiator_packet[i], NAME +
".initiator_" + Utils::itoa(i));