[77] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Read_unit_to_Execution_unit_transition.cpp 81 2008-04-15 18:40:01Z 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::transition" |
---|
| 22 | void Read_unit_to_Execution_unit::transition (void) |
---|
| 23 | { |
---|
| 24 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"Begin"); |
---|
| 25 | |
---|
| 26 | if (PORT_READ(in_NRESET) == 0) |
---|
| 27 | { |
---|
| 28 | // Flush routing_table |
---|
| 29 | for (uint32_t i=0; i<_param->_nb_read_unit; i++) |
---|
| 30 | for (uint32_t j=0; j<_param->_nb_thread; j++) |
---|
| 31 | for (uint32_t k=0; k<_param->_nb_type; k++) |
---|
| 32 | _destination [i][j][k].clear(); |
---|
| 33 | |
---|
| 34 | // Fill routing table |
---|
| 35 | for (uint32_t i=0; i<_param->_nb_read_unit; i++) |
---|
| 36 | for (uint32_t j=0; j<_param->_nb_execute_unit; j++) |
---|
| 37 | // Test if link between src and dest |
---|
| 38 | if (_param->_table_routing [i][j]) |
---|
| 39 | // Test the thread accepted by the execute_unit |
---|
| 40 | for (uint32_t k=0; k<_param->_nb_thread; k++) |
---|
| 41 | if (_param->_table_execute_thread[j][k]) |
---|
| 42 | // Test the type accepted by the execute_unit |
---|
| 43 | for (uint32_t l=0; l<_param->_nb_type; l++) |
---|
| 44 | if (_param->_table_execute_type [j][l]) |
---|
| 45 | // push_back == minor have a better priority |
---|
| 46 | _destination [i][k][l].push_back(j); |
---|
| 47 | } |
---|
| 48 | else |
---|
| 49 | { |
---|
| 50 | if (_param->_priority == PRIORITY_ROUND_ROBIN) |
---|
| 51 | for (uint32_t i=0; i<_param->_nb_read_unit; i++) |
---|
| 52 | for (uint32_t j=0; j<_param->_nb_thread; j++) |
---|
| 53 | for (uint32_t k=0; k<_param->_nb_type; k++) |
---|
| 54 | if (_destination [i][j][k].size() > 1) |
---|
| 55 | { |
---|
| 56 | // Head queue became the Tail queue |
---|
| 57 | _destination [i][j][k].push_back(_destination [i][j][k].front()); |
---|
| 58 | _destination [i][j][k].pop_front(); |
---|
| 59 | } |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | #if (DEBUG >= DEBUG_TRACE) |
---|
| 64 | // // Print |
---|
| 65 | // log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION,"Routing Table"); |
---|
| 66 | // for (uint32_t i=0; i<_param->_nb_read_unit; i++) |
---|
| 67 | // for (uint32_t j=0; j<_param->_nb_thread; j++) |
---|
| 68 | // for (uint32_t k=0; k<_param->_nb_type; k++) |
---|
| 69 | // for (std::list<uint32_t>::iterator l=_destination[i][j][k].begin(); |
---|
| 70 | // l != _destination[i][j][k].end(); |
---|
| 71 | // l++) |
---|
| 72 | // log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION," * Read_unit [%d], send at the execution_unit [%d], the operation of thread [%d] with the type [%s].",i,*l,j,toString_type(k).c_str()); |
---|
| 73 | #endif |
---|
| 74 | |
---|
| 75 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 76 | end_cycle (); |
---|
| 77 | #endif |
---|
| 78 | |
---|
| 79 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"End"); |
---|
| 80 | }; |
---|
| 81 | |
---|
| 82 | }; // end namespace read_unit_to_execution_unit |
---|
| 83 | }; // end namespace network |
---|
| 84 | }; // end namespace execute_loop |
---|
| 85 | }; // end namespace multi_execute_loop |
---|
| 86 | }; // end namespace core |
---|
| 87 | |
---|
| 88 | }; // end namespace behavioural |
---|
| 89 | }; // end namespace morpheo |
---|
| 90 | #endif |
---|