[77] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Read_unit_to_Execution_unit_genMealy.cpp 136 2009-10-20 18:52:15Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Network/Read_unit_to_Execution_unit/include/Read_unit_to_Execution_unit.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_execute_loop { |
---|
| 15 | namespace execute_loop { |
---|
| 16 | namespace network { |
---|
| 17 | namespace read_unit_to_execution_unit { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Read_unit_to_Execution_unit::genMealy" |
---|
| 22 | void Read_unit_to_Execution_unit::genMealy (void) |
---|
| 23 | { |
---|
[117] | 24 | log_begin(Read_unit_to_Execution_unit,FUNCTION); |
---|
| 25 | log_function(Read_unit_to_Execution_unit,FUNCTION,_name.c_str()); |
---|
[77] | 26 | |
---|
[123] | 27 | if (PORT_READ(in_NRESET)) |
---|
| 28 | { |
---|
[88] | 29 | bool execute_unit_use [_param->_nb_execute_unit][_param->_max_nb_execute_unit_port]; |
---|
[77] | 30 | |
---|
| 31 | for (uint32_t i=0; i<_param->_nb_execute_unit; i++) |
---|
[88] | 32 | for (uint32_t j=0; j<_param->_nb_execute_unit_port[i]; j++) |
---|
| 33 | execute_unit_use[i][j] = false; |
---|
[77] | 34 | |
---|
| 35 | for (uint32_t i=0; i<_param->_nb_read_unit; i++) |
---|
[88] | 36 | for (uint32_t j=0; j<_param->_nb_read_unit_port[i]; j++) |
---|
| 37 | { |
---|
| 38 | bool ack = false; |
---|
| 39 | |
---|
[117] | 40 | log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," * Test Read_unit[%d][%d]",i,j); |
---|
[88] | 41 | |
---|
| 42 | if (PORT_READ(in_READ_UNIT_OUT_VAL [i][j]) == true) |
---|
| 43 | { |
---|
[117] | 44 | log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," * have a valid entry."); |
---|
[88] | 45 | |
---|
| 46 | Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_READ_UNIT_OUT_CONTEXT_ID [i][j]):0; |
---|
| 47 | Tcontext_t front_end_id = (_param->_have_port_front_end_id )?PORT_READ(in_READ_UNIT_OUT_FRONT_END_ID [i][j]):0; |
---|
| 48 | Tcontext_t ooo_engine_id = (_param->_have_port_ooo_engine_id)?PORT_READ(in_READ_UNIT_OUT_OOO_ENGINE_ID [i][j]):0; |
---|
| 49 | Tcontext_t num_thread = get_num_thread(context_id , _param->_size_context_id , |
---|
| 50 | front_end_id , _param->_size_front_end_id , |
---|
| 51 | ooo_engine_id, _param->_size_ooo_engine_id); |
---|
| 52 | Ttype_t type = PORT_READ(in_READ_UNIT_OUT_TYPE [i][j]); |
---|
| 53 | |
---|
[77] | 54 | #ifdef DEBUG_TEST |
---|
[88] | 55 | if (_destination[i][num_thread][type].empty()) |
---|
[117] | 56 | throw ERRORMORPHEO(FUNCTION,toString(_("Invalid Operation : They have no execute_unit to receive a operation from the read_unit [%d], thread [%d] and a operation's type [%s]."),i,num_thread,toString(type).c_str())); |
---|
[77] | 57 | #endif |
---|
[88] | 58 | |
---|
| 59 | // find a free execute_unit |
---|
| 60 | for (std::list<destination_t>::iterator it=_destination[i][num_thread][type].begin(); |
---|
| 61 | (it != _destination[i][num_thread][type].end()) and (ack == false); |
---|
| 62 | it++) |
---|
| 63 | { |
---|
| 64 | uint32_t dest = (*it).grp; |
---|
| 65 | uint32_t port = (*it).elt; |
---|
| 66 | |
---|
[117] | 67 | log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," * Test destination [%d][%d].",dest,port); |
---|
[88] | 68 | |
---|
| 69 | if (execute_unit_use [dest][port] == false) |
---|
| 70 | { |
---|
[117] | 71 | log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," * Is ok! Link."); |
---|
[88] | 72 | |
---|
| 73 | // have find !!! |
---|
| 74 | ack = PORT_READ(in_EXECUTE_UNIT_IN_ACK [dest][port]); |
---|
| 75 | execute_unit_use [dest][port] = true; |
---|
[77] | 76 | |
---|
[88] | 77 | if (_param->_have_port_context_id) |
---|
| 78 | PORT_WRITE(out_EXECUTE_UNIT_IN_CONTEXT_ID [dest][port], PORT_READ(in_READ_UNIT_OUT_CONTEXT_ID [i][j])); |
---|
| 79 | if (_param->_have_port_front_end_id) |
---|
| 80 | PORT_WRITE(out_EXECUTE_UNIT_IN_FRONT_END_ID [dest][port], PORT_READ(in_READ_UNIT_OUT_FRONT_END_ID [i][j])); |
---|
| 81 | if (_param->_have_port_ooo_engine_id) |
---|
| 82 | PORT_WRITE(out_EXECUTE_UNIT_IN_OOO_ENGINE_ID [dest][port], PORT_READ(in_READ_UNIT_OUT_OOO_ENGINE_ID [i][j])); |
---|
| 83 | if (_param->_have_port_rob_ptr ) |
---|
| 84 | PORT_WRITE(out_EXECUTE_UNIT_IN_PACKET_ID [dest][port], PORT_READ(in_READ_UNIT_OUT_PACKET_ID [i][j])); |
---|
| 85 | PORT_WRITE(out_EXECUTE_UNIT_IN_OPERATION [dest][port], PORT_READ(in_READ_UNIT_OUT_OPERATION [i][j])); |
---|
[136] | 86 | PORT_WRITE(out_EXECUTE_UNIT_IN_CANCEL [dest][port], PORT_READ(in_READ_UNIT_OUT_CANCEL [i][j])); |
---|
[88] | 87 | PORT_WRITE(out_EXECUTE_UNIT_IN_TYPE [dest][port], PORT_READ(in_READ_UNIT_OUT_TYPE [i][j])); |
---|
| 88 | PORT_WRITE(out_EXECUTE_UNIT_IN_HAS_IMMEDIAT [dest][port], PORT_READ(in_READ_UNIT_OUT_HAS_IMMEDIAT [i][j])); |
---|
| 89 | PORT_WRITE(out_EXECUTE_UNIT_IN_DATA_RC [dest][port], PORT_READ(in_READ_UNIT_OUT_DATA_RC [i][j])); |
---|
| 90 | PORT_WRITE(out_EXECUTE_UNIT_IN_WRITE_RD [dest][port], PORT_READ(in_READ_UNIT_OUT_WRITE_RD [i][j])); |
---|
| 91 | PORT_WRITE(out_EXECUTE_UNIT_IN_WRITE_RE [dest][port], PORT_READ(in_READ_UNIT_OUT_WRITE_RE [i][j])); |
---|
| 92 | PORT_WRITE(out_EXECUTE_UNIT_IN_NUM_REG_RE [dest][port], PORT_READ(in_READ_UNIT_OUT_NUM_REG_RE [i][j])); |
---|
| 93 | PORT_WRITE(out_EXECUTE_UNIT_IN_STORE_QUEUE_PTR_WRITE [dest][port], PORT_READ(in_READ_UNIT_OUT_STORE_QUEUE_PTR_WRITE [i][j])); |
---|
[122] | 94 | PORT_WRITE(out_EXECUTE_UNIT_IN_STORE_QUEUE_PTR_READ [dest][port], PORT_READ(in_READ_UNIT_OUT_STORE_QUEUE_PTR_READ [i][j])); |
---|
| 95 | PORT_WRITE(out_EXECUTE_UNIT_IN_STORE_QUEUE_EMPTY [dest][port], PORT_READ(in_READ_UNIT_OUT_STORE_QUEUE_EMPTY [i][j])); |
---|
[88] | 96 | if (_param->_have_port_load_queue_ptr) |
---|
| 97 | PORT_WRITE(out_EXECUTE_UNIT_IN_LOAD_QUEUE_PTR_WRITE [dest][port], PORT_READ(in_READ_UNIT_OUT_LOAD_QUEUE_PTR_WRITE [i][j])); |
---|
| 98 | PORT_WRITE(out_EXECUTE_UNIT_IN_IMMEDIAT [dest][port], PORT_READ(in_READ_UNIT_OUT_IMMEDIAT [i][j])); |
---|
| 99 | PORT_WRITE(out_EXECUTE_UNIT_IN_DATA_RA [dest][port], PORT_READ(in_READ_UNIT_OUT_DATA_RA [i][j])); |
---|
| 100 | PORT_WRITE(out_EXECUTE_UNIT_IN_DATA_RB [dest][port], PORT_READ(in_READ_UNIT_OUT_DATA_RB [i][j])); |
---|
| 101 | PORT_WRITE(out_EXECUTE_UNIT_IN_NUM_REG_RD [dest][port], PORT_READ(in_READ_UNIT_OUT_NUM_REG_RD [i][j])); |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | } |
---|
| 105 | PORT_WRITE(out_READ_UNIT_OUT_ACK [i][j], ack); |
---|
| 106 | } |
---|
[77] | 107 | |
---|
| 108 | for (uint32_t i=0; i<_param->_nb_execute_unit; i++) |
---|
[88] | 109 | for (uint32_t j=0; j<_param->_nb_execute_unit_port[i]; j++) |
---|
| 110 | PORT_WRITE(out_EXECUTE_UNIT_IN_VAL[i][j], execute_unit_use[i][j]); |
---|
[123] | 111 | } |
---|
| 112 | else |
---|
| 113 | { |
---|
[77] | 114 | |
---|
[123] | 115 | for (uint32_t i=0; i<_param->_nb_read_unit; i++) |
---|
| 116 | for (uint32_t j=0; j<_param->_nb_read_unit_port[i]; j++) |
---|
| 117 | PORT_WRITE(out_READ_UNIT_OUT_ACK [i][j], 0); |
---|
| 118 | |
---|
| 119 | for (uint32_t i=0; i<_param->_nb_execute_unit; i++) |
---|
| 120 | for (uint32_t j=0; j<_param->_nb_execute_unit_port[i]; j++) |
---|
| 121 | PORT_WRITE(out_EXECUTE_UNIT_IN_VAL[i][j], 0); |
---|
| 122 | |
---|
| 123 | } |
---|
| 124 | |
---|
[117] | 125 | log_end(Read_unit_to_Execution_unit,FUNCTION); |
---|
[77] | 126 | }; |
---|
| 127 | |
---|
| 128 | }; // end namespace read_unit_to_execution_unit |
---|
| 129 | }; // end namespace network |
---|
| 130 | }; // end namespace execute_loop |
---|
| 131 | }; // end namespace multi_execute_loop |
---|
| 132 | }; // end namespace core |
---|
| 133 | |
---|
| 134 | }; // end namespace behavioural |
---|
| 135 | }; // end namespace morpheo |
---|
| 136 | #endif |
---|