[78] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Decod_transition.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/include/Decod.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_front_end { |
---|
| 15 | namespace front_end { |
---|
| 16 | namespace decod_unit { |
---|
| 17 | namespace decod { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Decod::transition" |
---|
| 22 | void Decod::transition (void) |
---|
| 23 | { |
---|
| 24 | log_printf(FUNC,Decod,FUNCTION,"Begin"); |
---|
| 25 | |
---|
| 26 | if (PORT_READ(in_NRESET) == 0) |
---|
| 27 | { |
---|
| 28 | reg_CONTEXT_PRIORITY = 0; |
---|
| 29 | |
---|
| 30 | for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
| 31 | reg_CONTEXT_ADDRESS_PREVIOUS [i] = 0xfc; // 0x100-4. (0x100 : reset address) |
---|
| 32 | } |
---|
| 33 | else |
---|
| 34 | { |
---|
| 35 | switch (_param->_priority) |
---|
| 36 | { |
---|
| 37 | // case PRIORITY_STATIC : |
---|
| 38 | // { |
---|
| 39 | // reg_CONTEXT_PRIORITY = (reg_CONTEXT_PRIORITY+_param->_nb_context_select)%_param->_nb_context; |
---|
| 40 | // break; |
---|
| 41 | // } |
---|
| 42 | case PRIORITY_ROUND_ROBIN : |
---|
| 43 | { |
---|
| 44 | reg_CONTEXT_PRIORITY = (reg_CONTEXT_PRIORITY+1 )%_param->_nb_context; |
---|
| 45 | break; |
---|
| 46 | } |
---|
| 47 | default: |
---|
| 48 | { |
---|
| 49 | break; |
---|
| 50 | } |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | // flush list |
---|
| 54 | select.clear(); |
---|
| 55 | |
---|
| 56 | // Compute next scan order !!! |
---|
| 57 | switch (_param->_load_balancing) |
---|
| 58 | { |
---|
| 59 | // case LOAD_BALANCING_BALANCE : |
---|
| 60 | // { |
---|
| 61 | // for (uint32_t j=0; j<_param->_max_nb_inst_fetch; j++) |
---|
| 62 | // for (uint32_t i=0; i<_param->_nb_context_select; i++) |
---|
| 63 | // { |
---|
| 64 | // uint32_t x=(reg_CONTEXT_PRIORITY+i)%_param->_nb_context; |
---|
| 65 | |
---|
| 66 | // // Test valid inst_fetch |
---|
| 67 | // if (j < _param->_nb_inst_fetch[x]) |
---|
| 68 | // select.push_back(select_t(x,j)); |
---|
| 69 | // } |
---|
| 70 | |
---|
| 71 | // break; |
---|
| 72 | // } |
---|
| 73 | case LOAD_BALANCING_MAXIMUM_FOR_PRIORITY : |
---|
| 74 | { |
---|
| 75 | |
---|
| 76 | for (uint32_t i=0; i<_param->_nb_context_select; i++) |
---|
| 77 | { |
---|
| 78 | uint32_t x=(reg_CONTEXT_PRIORITY+i)%_param->_nb_context; |
---|
| 79 | |
---|
| 80 | for (uint32_t j=0; j<_param->_nb_inst_fetch[x]; j++) |
---|
| 81 | select.push_back(select_t(x,j)); |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | break; |
---|
| 85 | } |
---|
| 86 | default : |
---|
| 87 | { |
---|
| 88 | break; |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | // Compute "next previous" address |
---|
| 93 | for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
| 94 | if (internal_CONTEXT_HAVE_TRANSACTION[i]) |
---|
| 95 | { |
---|
| 96 | reg_CONTEXT_ADDRESS_PREVIOUS [i] = internal_CONTEXT_ADDRESS_PREVIOUS [i]; |
---|
| 97 | reg_CONTEXT_IS_DELAY_SLOT [i] = internal_CONTEXT_IS_DELAY_SLOT [i]; |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | // for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
| 101 | // log_printf(TRACE,Decod,FUNCTION,"[%d] %.8x %d",i,reg_CONTEXT_ADDRESS_PREVIOUS [i], reg_CONTEXT_IS_DELAY_SLOT [i]); |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 105 | end_cycle (); |
---|
| 106 | #endif |
---|
| 107 | |
---|
| 108 | log_printf(FUNC,Decod,FUNCTION,"End"); |
---|
| 109 | }; |
---|
| 110 | |
---|
| 111 | }; // end namespace decod |
---|
| 112 | }; // end namespace decod_unit |
---|
| 113 | }; // end namespace front_end |
---|
| 114 | }; // end namespace multi_front_end |
---|
| 115 | }; // end namespace core |
---|
| 116 | |
---|
| 117 | }; // end namespace behavioural |
---|
| 118 | }; // end namespace morpheo |
---|
| 119 | #endif |
---|