[88] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Icache_Access_genMealy_rsp.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Icache_Access/include/Icache_Access.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace icache_access { |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | #undef FUNCTION |
---|
| 18 | #define FUNCTION "Icache_Access::genMealy_rsp" |
---|
| 19 | void Icache_Access::genMealy_rsp (void) |
---|
| 20 | { |
---|
| 21 | log_begin(Icache_Access,FUNCTION); |
---|
| 22 | |
---|
| 23 | Tcontrol_t context_rsp_val [_param->_nb_front_end][_param->_max_nb_context]; |
---|
| 24 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
| 25 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
| 26 | context_rsp_val [i][j] = 0; |
---|
| 27 | |
---|
| 28 | for (uint32_t i=0; i<_param->_nb_icache_port; ++i) |
---|
| 29 | { |
---|
| 30 | Tcontrol_t val = PORT_READ(in_ICACHE_RSP_VAL [i]); |
---|
| 31 | Tcontrol_t ack; |
---|
| 32 | |
---|
| 33 | Tcontext_t thread_id = (_param->_have_port_icache_thread_id)?PORT_READ(in_ICACHE_RSP_THREAD_ID [i]):0; |
---|
| 34 | |
---|
| 35 | #ifdef DEBUG_TEST |
---|
| 36 | if (thread_id > _param->_nb_thread) |
---|
| 37 | throw ERRORMORPHEO(FUNCTION,_("invalid thread_id.\n")); |
---|
| 38 | #endif |
---|
| 39 | |
---|
| 40 | if (val) |
---|
| 41 | { |
---|
| 42 | Tcontext_t front_end_id = _param->_translate_thread_to_context [thread_id]; |
---|
| 43 | Tcontext_t context_id = _param->_translate_thread_to_front_end[thread_id]; |
---|
| 44 | |
---|
| 45 | // log_printf(TRACE,Icache_Access,FUNCTION,"thread_id : %d",thread_id); |
---|
| 46 | // log_printf(TRACE,Icache_Access,FUNCTION,"front_end_id : %d",front_end_id); |
---|
| 47 | // log_printf(TRACE,Icache_Access,FUNCTION,"context_id : %d",context_id); |
---|
| 48 | |
---|
| 49 | #ifdef DEBUG_TEST |
---|
| 50 | if (front_end_id > _param->_nb_front_end) |
---|
| 51 | throw ERRORMORPHEO(FUNCTION,_("invalid front_end_id.\n")); |
---|
| 52 | |
---|
| 53 | if (context_id > _param->_nb_context[front_end_id]) |
---|
| 54 | throw ERRORMORPHEO(FUNCTION,_("invalid context_id.\n")); |
---|
| 55 | |
---|
| 56 | if (_param->_table_routing [front_end_id][context_id] != i) |
---|
| 57 | throw ERRORMORPHEO(FUNCTION,_("invalid route.\n")); |
---|
| 58 | #endif |
---|
| 59 | |
---|
| 60 | ack = PORT_READ(in_CONTEXT_RSP_ACK [front_end_id][context_id]); |
---|
| 61 | |
---|
| 62 | context_rsp_val [front_end_id][context_id] = 1; |
---|
| 63 | // if (_param->_have_port_icache_packet_id) |
---|
| 64 | if (_param->_have_port_packet_id [front_end_id][context_id]) |
---|
| 65 | PORT_WRITE(out_CONTEXT_RSP_PACKET_ID [front_end_id][context_id], PORT_READ(in_ICACHE_RSP_PACKET_ID [i])); |
---|
| 66 | PORT_WRITE(out_CONTEXT_RSP_ERROR [front_end_id][context_id], PORT_READ(in_ICACHE_RSP_ERROR [i])); |
---|
| 67 | |
---|
| 68 | for (uint32_t j=0; j<_param->_nb_instruction [front_end_id][context_id]; ++j) |
---|
| 69 | PORT_WRITE(out_CONTEXT_RSP_INSTRUCTION [front_end_id][context_id][j], PORT_READ(in_ICACHE_RSP_INSTRUCTION [i][j])); |
---|
| 70 | } |
---|
| 71 | else |
---|
| 72 | ack = 0; |
---|
| 73 | |
---|
| 74 | PORT_WRITE(out_ICACHE_RSP_ACK [i],ack); |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
| 78 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
| 79 | PORT_WRITE(out_CONTEXT_RSP_VAL [i][j], context_rsp_val [i][j]); |
---|
| 80 | |
---|
| 81 | log_end(Icache_Access,FUNCTION); |
---|
| 82 | }; |
---|
| 83 | |
---|
| 84 | }; // end namespace icache_access |
---|
| 85 | }; // end namespace core |
---|
| 86 | |
---|
| 87 | }; // end namespace behavioural |
---|
| 88 | }; // end namespace morpheo |
---|
| 89 | #endif |
---|