[82] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Decod_queue_genMealy_decod_out.cpp 108 2009-02-12 11:55:06Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/include/Decod_queue.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_queue { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Decod_queue::genMealy_decod_out" |
---|
| 22 | void Decod_queue::genMealy_decod_out (void) |
---|
| 23 | { |
---|
| 24 | log_begin(Decod_queue,FUNCTION); |
---|
[88] | 25 | log_function(Decod_queue,FUNCTION,_name.c_str()); |
---|
[82] | 26 | |
---|
| 27 | Tcontrol_t val [_param->_nb_inst_decod]; |
---|
| 28 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 29 | { |
---|
| 30 | val [i] = 0; |
---|
| 31 | internal_DECOD_OUT_VAL [i] = 0; |
---|
| 32 | internal_DECOD_OUT_ACK [i] = 0; |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | if (not reg_QUEUE->empty()) |
---|
| 36 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
[108] | 37 | { |
---|
| 38 | uint32_t index = reg_LAST_SLOT + i; |
---|
[82] | 39 | |
---|
[108] | 40 | // Stop |
---|
| 41 | if (index >= _param->_nb_inst_decod) |
---|
| 42 | break; |
---|
[82] | 43 | |
---|
[108] | 44 | if (reg_QUEUE->front()->_val [index]) |
---|
| 45 | { |
---|
| 46 | log_printf(TRACE,Decod_queue,FUNCTION,_(" * Queue is not empty, slot [%d] is valid."),i); |
---|
| 47 | |
---|
| 48 | Tcontext_t context = reg_QUEUE->front()->_context_id [index]; |
---|
| 49 | Tdepth_t depth = reg_QUEUE->front()->_depth [index]; |
---|
| 50 | Tdepth_t depth_min = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [context]):0; |
---|
| 51 | Tdepth_t depth_max = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MAX [context]):0; |
---|
| 52 | Tcontrol_t depth_full = PORT_READ(in_DEPTH_FULL[context]); |
---|
[82] | 53 | |
---|
[108] | 54 | // is a valid instruction ? |
---|
| 55 | // If DEPTH_CURRENT : |
---|
| 56 | // equal at DEPTH_MIN -> not speculative |
---|
| 57 | // not include ]DEPTH_MIN:DEPTH_MAX] -> previous branch miss |
---|
| 58 | // include ]DEPTH_MIN:DEPTH_MAX] -> speculative |
---|
| 59 | |
---|
| 60 | // All case |
---|
| 61 | // ....... min ...X... max ....... OK |
---|
| 62 | // ....... min ....... max ...X... KO |
---|
| 63 | // ...X... min ....... max ....... KO |
---|
| 64 | // ....... max ....... min ...X... OK |
---|
| 65 | // ...X... max ....... min ....... OK |
---|
| 66 | // ....... max ...X... min ....... KO |
---|
| 67 | |
---|
| 68 | Tcontrol_t is_valid = ((depth == depth_min) or |
---|
| 69 | depth_full or |
---|
| 70 | ((depth_min <= depth_max)? |
---|
| 71 | ((depth >= depth_min) and (depth <=depth_max)): |
---|
| 72 | ((depth >= depth_min) or (depth <=depth_max)))); |
---|
| 73 | //Tcontrol_t is_valid = ((depth == depth_min) or |
---|
| 74 | // ((depth_min < depth_max)? |
---|
| 75 | // (depth<=depth_max): |
---|
| 76 | // ((depth > depth_min) or (depth <= depth_max)))); |
---|
| 77 | //Tcontrol_t is_valid = depth <= depth_max; |
---|
[82] | 78 | |
---|
[108] | 79 | log_printf(TRACE,Decod_queue,FUNCTION," * is_valid : %d",is_valid); |
---|
| 80 | log_printf(TRACE,Decod_queue,FUNCTION," * context : %d",context); |
---|
| 81 | log_printf(TRACE,Decod_queue,FUNCTION," * depth : %d",depth); |
---|
| 82 | log_printf(TRACE,Decod_queue,FUNCTION," * depth_min : %d",depth_min); |
---|
| 83 | log_printf(TRACE,Decod_queue,FUNCTION," * depth_max : %d",depth_max); |
---|
| 84 | log_printf(TRACE,Decod_queue,FUNCTION," * depth_full : %d",depth_full); |
---|
| 85 | #ifdef DEBUG |
---|
| 86 | log_printf(TRACE,Decod_queue,FUNCTION," * address : 0x%x (0x%x)",reg_QUEUE->front()->_address [index],reg_QUEUE->front()->_address [index]<<2); |
---|
| 87 | #endif |
---|
| 88 | log_printf(TRACE,Decod_queue,FUNCTION," * address_next : 0x%x (0x%x)",reg_QUEUE->front()->_address_next[index],reg_QUEUE->front()->_address_next[index]<<2); |
---|
| 89 | internal_DECOD_OUT_VAL [index] = 1; // in all case, val is set (entry is not empty, and instruction is valid) |
---|
| 90 | if (is_valid) |
---|
| 91 | { |
---|
| 92 | val [i] = 1; |
---|
| 93 | internal_DECOD_OUT_ACK [index] = PORT_READ(in_DECOD_OUT_ACK [i]); |
---|
| 94 | } |
---|
| 95 | else |
---|
| 96 | { |
---|
| 97 | // Consume the instruction (to erase) |
---|
| 98 | internal_DECOD_OUT_ACK [index] = 1; |
---|
| 99 | } |
---|
| 100 | } |
---|
| 101 | } |
---|
[88] | 102 | |
---|
[82] | 103 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 104 | { |
---|
[101] | 105 | log_printf(TRACE,Decod_queue,FUNCTION," * DECOD_OUT_VAL : %d",val [i]); |
---|
[108] | 106 | |
---|
| 107 | PORT_WRITE(out_DECOD_OUT_VAL [i],val [i]); |
---|
[82] | 108 | } |
---|
| 109 | |
---|
| 110 | log_end(Decod_queue,FUNCTION); |
---|
| 111 | }; |
---|
| 112 | |
---|
| 113 | }; // end namespace decod_queue |
---|
| 114 | }; // end namespace decod_unit |
---|
| 115 | }; // end namespace front_end |
---|
| 116 | }; // end namespace multi_front_end |
---|
| 117 | }; // end namespace core |
---|
| 118 | |
---|
| 119 | }; // end namespace behavioural |
---|
| 120 | }; // end namespace morpheo |
---|
| 121 | #endif |
---|