[88] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Dcache_Access_genMealy_req.cpp 117 2009-05-16 14:42: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_req" |
---|
| 19 | void Dcache_Access::genMealy_req (void) |
---|
| 20 | { |
---|
| 21 | log_begin(Dcache_Access,FUNCTION); |
---|
| 22 | |
---|
| 23 | Tcontrol_t dcache_req_val [_param->_nb_dcache_port]; |
---|
| 24 | for (uint32_t i=0; i<_param->_nb_dcache_port; ++i) |
---|
| 25 | { |
---|
| 26 | dcache_req_val [i] = 0; |
---|
| 27 | |
---|
| 28 | #ifdef STATISTICS |
---|
| 29 | _internal_DCACHE_REQ_NB_ACCESS [i] = 0; |
---|
| 30 | _internal_DCACHE_REQ_NB_ACCESS_CONFLIT [i] = 0; |
---|
| 31 | #endif |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | Tcontrol_t lsq_req_ack [_param->_nb_execute_loop][_param->_max_nb_load_store_unit][_param->_max_nb_cache_access]; |
---|
| 35 | for (uint32_t i=0; i<_param->_nb_execute_loop; ++i) |
---|
| 36 | for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j) |
---|
| 37 | for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k) |
---|
| 38 | lsq_req_ack [i][j][k] = 0; |
---|
| 39 | |
---|
| 40 | std::list<generic::priority::select_t> * select = _priority ->select(); |
---|
| 41 | for (std::list<generic::priority::select_t>::iterator it=select ->begin(); |
---|
| 42 | it!=select->end(); |
---|
| 43 | ++it) |
---|
| 44 | { |
---|
| 45 | uint32_t num_execute_loop = it->grp; |
---|
| 46 | uint32_t num_load_store_unit = it->elt; |
---|
| 47 | |
---|
| 48 | for (uint32_t num_cache_access = 0; num_cache_access<_param->_nb_cache_access [num_execute_loop][num_load_store_unit]; ++num_cache_access) |
---|
| 49 | { |
---|
| 50 | if (PORT_READ(in_LSQ_REQ_VAL [num_execute_loop][num_load_store_unit][num_cache_access])) |
---|
| 51 | { |
---|
| 52 | uint32_t num_port = _param->_table_routing[num_execute_loop][num_load_store_unit][num_cache_access]; |
---|
| 53 | Tcontrol_t dcache_req_ack = PORT_READ(in_DCACHE_REQ_ACK [num_port]); |
---|
[117] | 54 | |
---|
| 55 | log_printf(TRACE,Dcache_Access,FUNCTION," * num_port : %d",num_port); |
---|
[88] | 56 | |
---|
| 57 | #ifdef STATISTICS |
---|
| 58 | if (dcache_req_ack) |
---|
| 59 | { |
---|
| 60 | _internal_DCACHE_REQ_NB_ACCESS [num_port] ++; |
---|
| 61 | if (dcache_req_val [num_port]) |
---|
| 62 | _internal_DCACHE_REQ_NB_ACCESS_CONFLIT [num_port] ++; |
---|
| 63 | } |
---|
| 64 | #endif |
---|
| 65 | if (not dcache_req_val [num_port]) |
---|
| 66 | { |
---|
| 67 | dcache_req_val [num_port] = 1; |
---|
| 68 | lsq_req_ack [num_execute_loop][num_load_store_unit][num_cache_access] = dcache_req_ack; |
---|
| 69 | |
---|
[117] | 70 | log_printf(TRACE,Dcache_Access,FUNCTION," * kane - dcache"); |
---|
| 71 | |
---|
[88] | 72 | if (_param->_have_port_dcache_thread_id) |
---|
| 73 | { |
---|
| 74 | Tcontext_t num_context = (_param->_have_port_lsq_thread_id [num_execute_loop][num_load_store_unit])?PORT_READ(in_LSQ_REQ_THREAD_ID [num_execute_loop][num_load_store_unit][num_cache_access]):0; |
---|
[117] | 75 | Tcontext_t num_thread = _param->_translate_load_store_unit_to_thread[num_execute_loop][num_load_store_unit][num_context]; |
---|
| 76 | log_printf(TRACE,Dcache_Access,FUNCTION," * num_context : %d",num_context); |
---|
| 77 | log_printf(TRACE,Dcache_Access,FUNCTION," * num_thread : %d",num_thread ); |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | PORT_WRITE(out_DCACHE_REQ_THREAD_ID [num_port], num_thread); |
---|
[88] | 81 | } |
---|
| 82 | // PORT_WRITE(out_DCACHE_REQ_THREAD_ID [num_port], ((num_execute_loop << _param->_shift_num_execute_loop )+ |
---|
| 83 | // (num_load_store_unit << _param->_shift_num_load_store_unit)+ |
---|
| 84 | // (num_cache_access << _param->_shift_num_cache_access )+ |
---|
| 85 | // num_context)); |
---|
| 86 | if (_param->_have_port_dcache_packet_id) |
---|
| 87 | { |
---|
| 88 | Tpacket_t packet_id = (_param->_have_port_lsq_packet_id [num_execute_loop][num_load_store_unit])?PORT_READ(in_LSQ_REQ_PACKET_ID [num_execute_loop][num_load_store_unit][num_cache_access]):0; |
---|
| 89 | PORT_WRITE(out_DCACHE_REQ_PACKET_ID [num_port], ((num_cache_access << _param->_shift_num_cache_access )+ |
---|
| 90 | packet_id)); |
---|
| 91 | } |
---|
| 92 | PORT_WRITE(out_DCACHE_REQ_ADDRESS [num_port], PORT_READ(in_LSQ_REQ_ADDRESS [num_execute_loop][num_load_store_unit][num_cache_access])); |
---|
| 93 | PORT_WRITE(out_DCACHE_REQ_WDATA [num_port], PORT_READ(in_LSQ_REQ_WDATA [num_execute_loop][num_load_store_unit][num_cache_access])); |
---|
| 94 | PORT_WRITE(out_DCACHE_REQ_TYPE [num_port], PORT_READ(in_LSQ_REQ_TYPE [num_execute_loop][num_load_store_unit][num_cache_access])); |
---|
| 95 | } |
---|
| 96 | } |
---|
| 97 | } |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | for (uint32_t i=0; i<_param->_nb_dcache_port; ++i) |
---|
| 101 | PORT_WRITE(out_DCACHE_REQ_VAL [i], dcache_req_val [i]); |
---|
| 102 | |
---|
| 103 | for (uint32_t i=0; i<_param->_nb_execute_loop; ++i) |
---|
| 104 | for (uint32_t j=0; j<_param->_nb_load_store_unit[i]; ++j) |
---|
| 105 | for (uint32_t k=0; k<_param->_nb_cache_access [i][j]; ++k) |
---|
| 106 | PORT_WRITE(out_LSQ_REQ_ACK [i][j][k], lsq_req_ack [i][j][k]); |
---|
| 107 | |
---|
| 108 | log_end(Dcache_Access,FUNCTION); |
---|
| 109 | }; |
---|
| 110 | |
---|
| 111 | }; // end namespace dcache_access |
---|
| 112 | }; // end namespace core |
---|
| 113 | |
---|
| 114 | }; // end namespace behavioural |
---|
| 115 | }; // end namespace morpheo |
---|
| 116 | #endif |
---|