[78] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Ifetch_queue_genMoore.cpp 132 2009-07-11 16:39:35Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Ifetch_queue/include/Ifetch_queue.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_front_end { |
---|
| 15 | namespace front_end { |
---|
| 16 | namespace ifetch_unit { |
---|
| 17 | namespace ifetch_queue { |
---|
| 18 | |
---|
| 19 | #undef FUNCTION |
---|
| 20 | #define FUNCTION "Ifetch_queue::genMoore" |
---|
| 21 | void Ifetch_queue::genMoore (void) |
---|
| 22 | { |
---|
[132] | 23 | log_begin(Ifetch_queue,FUNCTION); |
---|
| 24 | log_function(Ifetch_queue,FUNCTION,_name.c_str()); |
---|
[78] | 25 | |
---|
[123] | 26 | if (PORT_READ(in_NRESET)) |
---|
| 27 | { |
---|
[78] | 28 | // ========================================================== |
---|
| 29 | // =====[ ADDRESS ]========================================== |
---|
| 30 | // ========================================================== |
---|
[119] | 31 | { |
---|
| 32 | internal_ADDRESS_ACK = (_queue[reg_PTR_WRITE]->_state == IFETCH_QUEUE_STATE_EMPTY); |
---|
[132] | 33 | |
---|
| 34 | log_printf(TRACE,Ifetch_queue,FUNCTION," * ADDRESS_ACK : %d",internal_ADDRESS_ACK); |
---|
| 35 | |
---|
[119] | 36 | if (_param->_have_port_ifetch_queue_ptr) |
---|
| 37 | PORT_WRITE(out_ADDRESS_IFETCH_QUEUE_ID, reg_PTR_WRITE); |
---|
| 38 | } |
---|
[78] | 39 | |
---|
| 40 | // ========================================================== |
---|
| 41 | // =====[ DECOD ]============================================ |
---|
| 42 | // ========================================================== |
---|
[119] | 43 | { |
---|
| 44 | bool ack = (_queue[reg_PTR_READ]->_state == IFETCH_QUEUE_STATE_HAVE_RSP); |
---|
| 45 | |
---|
| 46 | for (uint32_t i=0; i<_param->_nb_instruction; i++) |
---|
| 47 | { |
---|
| 48 | internal_DECOD_VAL [i] = ack and _queue[reg_PTR_READ]->_instruction_enable [i]; |
---|
[132] | 49 | |
---|
| 50 | log_printf(TRACE,Ifetch_queue,FUNCTION," * DECOD_VAL [%d] : %d",i,internal_DECOD_VAL [i]); |
---|
| 51 | |
---|
[119] | 52 | PORT_WRITE(out_DECOD_INSTRUCTION [i], _queue[reg_PTR_READ]->_instruction [i]); |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | PORT_WRITE(out_DECOD_ADDRESS , _queue[reg_PTR_READ]->_address ); |
---|
| 56 | if (_param->_have_port_inst_ifetch_ptr) |
---|
| 57 | PORT_WRITE(out_DECOD_INST_IFETCH_PTR , _queue[reg_PTR_READ]->_inst_ifetch_ptr ); |
---|
| 58 | PORT_WRITE(out_DECOD_BRANCH_STATE , _queue[reg_PTR_READ]->_branch_state ); |
---|
| 59 | if (_param->_have_port_depth) |
---|
| 60 | PORT_WRITE(out_DECOD_BRANCH_UPDATE_PREDICTION_ID, _queue[reg_PTR_READ]->_branch_update_prediction_id); |
---|
| 61 | PORT_WRITE(out_DECOD_EXCEPTION , _queue[reg_PTR_READ]->_exception ); |
---|
| 62 | } |
---|
[123] | 63 | } |
---|
| 64 | else |
---|
| 65 | { |
---|
| 66 | // Reset |
---|
| 67 | internal_ADDRESS_ACK = 0; |
---|
| 68 | for (uint32_t i=0; i<_param->_nb_instruction; i++) |
---|
| 69 | internal_DECOD_VAL [i] = 0; |
---|
| 70 | |
---|
| 71 | } |
---|
[78] | 72 | |
---|
[123] | 73 | // Write Output |
---|
| 74 | PORT_WRITE(out_ADDRESS_ACK , internal_ADDRESS_ACK); |
---|
| 75 | for (uint32_t i=0; i<_param->_nb_instruction; i++) |
---|
| 76 | PORT_WRITE(out_DECOD_VAL [i], internal_DECOD_VAL [i]); |
---|
| 77 | |
---|
[132] | 78 | log_end(Ifetch_queue,FUNCTION); |
---|
[78] | 79 | }; |
---|
| 80 | |
---|
| 81 | }; // end namespace ifetch_queue |
---|
| 82 | }; // end namespace ifetch_unit |
---|
| 83 | }; // end namespace front_end |
---|
| 84 | }; // end namespace multi_front_end |
---|
| 85 | }; // end namespace core |
---|
| 86 | }; // end namespace behavioural |
---|
| 87 | }; // end namespace morpheo |
---|
| 88 | #endif |
---|