[77] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Read_unit_to_Execution_unit_transition.cpp 88 2008-12-10 18:31:39Z 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++) |
---|
[88] | 36 | for (uint32_t x=0; x<_param->_nb_execute_unit; x++) |
---|
| 37 | for (uint32_t y=0; y<_param->_nb_execute_unit_port[x]; y++) |
---|
| 38 | // Test if link between src and dest |
---|
| 39 | if (_param->_table_routing [i][x][y]) |
---|
| 40 | // Test the thread accepted by the execute_unit |
---|
| 41 | for (uint32_t k=0; k<_param->_nb_thread; k++) |
---|
| 42 | if (_param->_table_execute_thread[x][k]) |
---|
| 43 | // Test the type accepted by the execute_unit |
---|
| 44 | for (uint32_t l=0; l<_param->_nb_type; l++) |
---|
| 45 | if (_param->_table_execute_type [x][l]) |
---|
| 46 | // push_back == minor have a better priority |
---|
| 47 | _destination [i][k][l].push_back(destination_t(x,y)); |
---|
[77] | 48 | } |
---|
| 49 | else |
---|
| 50 | { |
---|
| 51 | if (_param->_priority == PRIORITY_ROUND_ROBIN) |
---|
| 52 | for (uint32_t i=0; i<_param->_nb_read_unit; i++) |
---|
| 53 | for (uint32_t j=0; j<_param->_nb_thread; j++) |
---|
| 54 | for (uint32_t k=0; k<_param->_nb_type; k++) |
---|
| 55 | if (_destination [i][j][k].size() > 1) |
---|
| 56 | { |
---|
| 57 | // Head queue became the Tail queue |
---|
| 58 | _destination [i][j][k].push_back(_destination [i][j][k].front()); |
---|
| 59 | _destination [i][j][k].pop_front(); |
---|
| 60 | } |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | #if (DEBUG >= DEBUG_TRACE) |
---|
| 65 | // // Print |
---|
| 66 | // log_printf(TRACE,Read_unit_to_Execution_unit,FUNCTION,"Routing Table"); |
---|
| 67 | // for (uint32_t i=0; i<_param->_nb_read_unit; i++) |
---|
| 68 | // for (uint32_t j=0; j<_param->_nb_thread; j++) |
---|
| 69 | // for (uint32_t k=0; k<_param->_nb_type; k++) |
---|
| 70 | // for (std::list<uint32_t>::iterator l=_destination[i][j][k].begin(); |
---|
| 71 | // l != _destination[i][j][k].end(); |
---|
| 72 | // l++) |
---|
| 73 | // 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()); |
---|
| 74 | #endif |
---|
| 75 | |
---|
| 76 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 77 | end_cycle (); |
---|
| 78 | #endif |
---|
| 79 | |
---|
| 80 | log_printf(FUNC,Read_unit_to_Execution_unit,FUNCTION,"End"); |
---|
| 81 | }; |
---|
| 82 | |
---|
| 83 | }; // end namespace read_unit_to_execution_unit |
---|
| 84 | }; // end namespace network |
---|
| 85 | }; // end namespace execute_loop |
---|
| 86 | }; // end namespace multi_execute_loop |
---|
| 87 | }; // end namespace core |
---|
| 88 | |
---|
| 89 | }; // end namespace behavioural |
---|
| 90 | }; // end namespace morpheo |
---|
| 91 | #endif |
---|