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