[82] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Decod_queue_genMealy_decod_out.cpp 82 2008-05-01 16:48:45Z 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); |
---|
| 25 | |
---|
| 26 | Tcontrol_t val [_param->_nb_inst_decod]; |
---|
| 27 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 28 | { |
---|
| 29 | val [i] = 0; |
---|
| 30 | internal_DECOD_OUT_VAL [i] = 0; |
---|
| 31 | internal_DECOD_OUT_ACK [i] = 0; |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | if (not reg_QUEUE->empty()) |
---|
| 35 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 36 | if (reg_QUEUE->front()->_val [i]) |
---|
| 37 | { |
---|
| 38 | log_printf(TRACE,Decod_queue,FUNCTION,_("Queue is not empty, slot [%d] is valid."),i); |
---|
| 39 | |
---|
| 40 | Tcontext_t context = reg_QUEUE->front()->_context_id [i]; |
---|
| 41 | Tdepth_t depth = reg_QUEUE->front()->_depth [i]; |
---|
| 42 | Tdepth_t depth_base = (_param->_have_port_depth)?PORT_READ(in_DEPTH_TAIL [context]):0; |
---|
| 43 | Tdepth_t depth_offset = (_param->_have_port_depth)?PORT_READ(in_DEPTH_NB_BRANCH [context]):0; |
---|
| 44 | Tdepth_t depth_max = depth_base + depth_offset; |
---|
| 45 | |
---|
| 46 | // is a valid instruction ? |
---|
| 47 | // * depth must be lower that depth max |
---|
| 48 | Tcontrol_t is_valid = depth <= ((depth>depth_base)?(depth_max):(depth_max%_param->_nb_branch_speculated [context])); |
---|
| 49 | |
---|
| 50 | log_printf(TRACE,Decod_queue,FUNCTION,_(" * is_valid : %d"),is_valid); |
---|
| 51 | |
---|
| 52 | internal_DECOD_OUT_VAL [i] = 1; // in all case, val is set (entry is not empty, and instruction is valid) |
---|
| 53 | if (is_valid) |
---|
| 54 | { |
---|
| 55 | val [i] = 1; |
---|
| 56 | internal_DECOD_OUT_ACK [i] = PORT_READ(in_DECOD_OUT_ACK [i]); |
---|
| 57 | } |
---|
| 58 | else |
---|
| 59 | { |
---|
| 60 | // Cusume the instruction (to erase) |
---|
| 61 | internal_DECOD_OUT_ACK [i] = 1; |
---|
| 62 | } |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 66 | { |
---|
| 67 | PORT_WRITE(out_DECOD_OUT_VAL [i],val [i]); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | log_end(Decod_queue,FUNCTION); |
---|
| 71 | }; |
---|
| 72 | |
---|
| 73 | }; // end namespace decod_queue |
---|
| 74 | }; // end namespace decod_unit |
---|
| 75 | }; // end namespace front_end |
---|
| 76 | }; // end namespace multi_front_end |
---|
| 77 | }; // end namespace core |
---|
| 78 | |
---|
| 79 | }; // end namespace behavioural |
---|
| 80 | }; // end namespace morpheo |
---|
| 81 | #endif |
---|