1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Dcache_Access_genMealy_rsp.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Core/Dcache_Access/include/Dcache_Access.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace dcache_access { |
---|
15 | |
---|
16 | |
---|
17 | #undef FUNCTION |
---|
18 | #define FUNCTION "Dcache_Access::genMealy_rsp" |
---|
19 | void Dcache_Access::genMealy_rsp (void) |
---|
20 | { |
---|
21 | log_begin(Dcache_Access,FUNCTION); |
---|
22 | |
---|
23 | Tcontrol_t lsq_rsp_val [_param->_nb_execute_loop][_param->_max_nb_load_store_unit][_param->_max_nb_cache_access]; |
---|
24 | for (uint32_t i=0; i<_param->_nb_execute_loop; ++i) |
---|
25 | for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j) |
---|
26 | for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k) |
---|
27 | lsq_rsp_val [i][j][k] = 0; |
---|
28 | |
---|
29 | for (uint32_t i=0; i<_param->_nb_dcache_port; ++i) |
---|
30 | { |
---|
31 | Tcontrol_t val = PORT_READ(in_DCACHE_RSP_VAL [i]); |
---|
32 | Tcontrol_t ack; |
---|
33 | |
---|
34 | if (val) |
---|
35 | { |
---|
36 | Tcontext_t thread_id = (_param->_have_port_dcache_thread_id)?PORT_READ(in_DCACHE_RSP_THREAD_ID [i]):0; |
---|
37 | Tcontext_t packet_id = (_param->_have_port_dcache_packet_id)?PORT_READ(in_DCACHE_RSP_PACKET_ID [i]):0; |
---|
38 | |
---|
39 | Tcontext_t execute_loop_id = _param->_translate_thread_to_execute_loop [thread_id]; |
---|
40 | Tcontext_t load_store_unit_id = _param->_translate_thread_to_load_store_unit [thread_id]; |
---|
41 | Tcontext_t context_id = _param->_translate_thread_to_context [thread_id]; |
---|
42 | |
---|
43 | Tpacket_t cache_access_id = (packet_id >> _param->_shift_num_cache_access ) & _param->_mask_num_cache_access; |
---|
44 | Tpacket_t lsq_packet_id = packet_id & _param->_mask_num_lsq_packet; |
---|
45 | |
---|
46 | // log_printf(TRACE,Dcache_Access,FUNCTION,"thread_id : %d",thread_id); |
---|
47 | // log_printf(TRACE,Dcache_Access,FUNCTION,"execute_loop_id : %d",execute_loop_id); |
---|
48 | // log_printf(TRACE,Dcache_Access,FUNCTION,"load_store_unit_id : %d",load_store_unit_id); |
---|
49 | // log_printf(TRACE,Dcache_Access,FUNCTION,"cache_access_id : %d",cache_access_id); |
---|
50 | |
---|
51 | #ifdef DEBUG_TEST |
---|
52 | if (execute_loop_id > _param->_nb_execute_loop) |
---|
53 | throw ERRORMORPHEO(FUNCTION,_("invalid execute_loop_id.\n")); |
---|
54 | |
---|
55 | if (load_store_unit_id > _param->_nb_load_store_unit[execute_loop_id]) |
---|
56 | throw ERRORMORPHEO(FUNCTION,_("invalid load_store_unit_id.\n")); |
---|
57 | |
---|
58 | if (context_id > _param->_nb_context[execute_loop_id][load_store_unit_id]) |
---|
59 | throw ERRORMORPHEO(FUNCTION,_("invalid context_id.\n")); |
---|
60 | |
---|
61 | if (cache_access_id > _param->_nb_cache_access[execute_loop_id][load_store_unit_id]) |
---|
62 | throw ERRORMORPHEO(FUNCTION,_("invalid cache_access_id.\n")); |
---|
63 | |
---|
64 | if (_param->_table_routing [execute_loop_id][load_store_unit_id][cache_access_id] != i) |
---|
65 | throw ERRORMORPHEO(FUNCTION,_("invalid route.\n")); |
---|
66 | #endif |
---|
67 | |
---|
68 | ack = PORT_READ(in_LSQ_RSP_ACK [execute_loop_id][load_store_unit_id][cache_access_id]); |
---|
69 | |
---|
70 | lsq_rsp_val [execute_loop_id][load_store_unit_id][cache_access_id] = 1; |
---|
71 | |
---|
72 | if (_param->_have_port_lsq_thread_id [execute_loop_id][load_store_unit_id]) |
---|
73 | PORT_WRITE(out_LSQ_RSP_THREAD_ID [execute_loop_id][load_store_unit_id][cache_access_id], context_id); |
---|
74 | if (_param->_have_port_lsq_packet_id [execute_loop_id][load_store_unit_id]) |
---|
75 | PORT_WRITE(out_LSQ_RSP_PACKET_ID [execute_loop_id][load_store_unit_id][cache_access_id], lsq_packet_id); |
---|
76 | PORT_WRITE(out_LSQ_RSP_RDATA [execute_loop_id][load_store_unit_id][cache_access_id], PORT_READ(in_DCACHE_RSP_RDATA [i])); |
---|
77 | PORT_WRITE(out_LSQ_RSP_ERROR [execute_loop_id][load_store_unit_id][cache_access_id], PORT_READ(in_DCACHE_RSP_ERROR [i])); |
---|
78 | } |
---|
79 | else |
---|
80 | ack = 0; |
---|
81 | |
---|
82 | PORT_WRITE(out_DCACHE_RSP_ACK [i],ack); |
---|
83 | } |
---|
84 | |
---|
85 | for (uint32_t i=0; i<_param->_nb_execute_loop; ++i) |
---|
86 | for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j) |
---|
87 | for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k) |
---|
88 | PORT_WRITE(out_LSQ_RSP_VAL [i][j][k], lsq_rsp_val [i][j][k]); |
---|
89 | |
---|
90 | log_end(Dcache_Access,FUNCTION); |
---|
91 | }; |
---|
92 | |
---|
93 | }; // end namespace dcache_access |
---|
94 | }; // end namespace core |
---|
95 | |
---|
96 | }; // end namespace behavioural |
---|
97 | }; // end namespace morpheo |
---|
98 | #endif |
---|