[82] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Decod_queue_genMealy_decod_out.cpp 88 2008-12-10 18:31:39Z 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++) |
---|
| 37 | if (reg_QUEUE->front()->_val [i]) |
---|
| 38 | { |
---|
[88] | 39 | log_printf(TRACE,Decod_queue,FUNCTION,_(" * Queue is not empty, slot [%d] is valid."),i); |
---|
[82] | 40 | |
---|
| 41 | Tcontext_t context = reg_QUEUE->front()->_context_id [i]; |
---|
| 42 | Tdepth_t depth = reg_QUEUE->front()->_depth [i]; |
---|
[88] | 43 | Tdepth_t depth_min = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [context]):0; |
---|
| 44 | Tdepth_t depth_max = PORT_READ(in_DEPTH_MAX[context]); |
---|
[82] | 45 | |
---|
| 46 | // is a valid instruction ? |
---|
[88] | 47 | // If DEPTH_CURRENT : |
---|
| 48 | // equal at DEPTH_MIN -> not speculative |
---|
| 49 | // not include ]DEPTH_MIN:DEPTH_MAX[ -> previous branch miss |
---|
| 50 | // include ]DEPTH_MIN:DEPTH_MAX[ -> speculative |
---|
[82] | 51 | |
---|
[88] | 52 | // All case |
---|
| 53 | // ....... min ...X... max ....... OK |
---|
| 54 | // ....... min ....... max ...X... KO |
---|
| 55 | // ...X... min ....... max ....... KO |
---|
| 56 | // ....... max ....... min ...X... OK |
---|
| 57 | // ...X... max ....... min ....... OK |
---|
| 58 | // ....... max ...X... min ....... KO |
---|
[82] | 59 | |
---|
[88] | 60 | Tcontrol_t is_valid = ((depth == depth_min) or |
---|
| 61 | ((depth_min < depth_max)? |
---|
| 62 | (depth<depth_max): |
---|
| 63 | ((depth > depth_min) or (depth < depth_max)))); |
---|
| 64 | // Tcontrol_t is_valid = depth <= depth_max; |
---|
| 65 | |
---|
| 66 | log_printf(TRACE,Decod_queue,FUNCTION,_(" * is_valid : %d"),is_valid); |
---|
| 67 | |
---|
[82] | 68 | internal_DECOD_OUT_VAL [i] = 1; // in all case, val is set (entry is not empty, and instruction is valid) |
---|
| 69 | if (is_valid) |
---|
| 70 | { |
---|
| 71 | val [i] = 1; |
---|
| 72 | internal_DECOD_OUT_ACK [i] = PORT_READ(in_DECOD_OUT_ACK [i]); |
---|
| 73 | } |
---|
| 74 | else |
---|
| 75 | { |
---|
| 76 | // Cusume the instruction (to erase) |
---|
| 77 | internal_DECOD_OUT_ACK [i] = 1; |
---|
| 78 | } |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 82 | { |
---|
[88] | 83 | log_printf(TRACE,Decod_queue,FUNCTION,_(" * DECOD_OUT_VAL : %d"),val [i]); |
---|
| 84 | |
---|
[82] | 85 | PORT_WRITE(out_DECOD_OUT_VAL [i],val [i]); |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | log_end(Decod_queue,FUNCTION); |
---|
| 89 | }; |
---|
| 90 | |
---|
| 91 | }; // end namespace decod_queue |
---|
| 92 | }; // end namespace decod_unit |
---|
| 93 | }; // end namespace front_end |
---|
| 94 | }; // end namespace multi_front_end |
---|
| 95 | }; // end namespace core |
---|
| 96 | |
---|
| 97 | }; // end namespace behavioural |
---|
| 98 | }; // end namespace morpheo |
---|
| 99 | #endif |
---|