[55] | 1 | #ifdef SYSTEMC |
---|
| 2 | //#if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 3 | /* |
---|
| 4 | * $Id: Reservation_station_genMoore.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 5 | * |
---|
| 6 | * [ Description ] |
---|
| 7 | * |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/include/Reservation_station.h" |
---|
| 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | namespace core { |
---|
| 15 | namespace multi_execute_loop { |
---|
| 16 | namespace execute_loop { |
---|
| 17 | namespace multi_read_unit { |
---|
| 18 | namespace read_unit { |
---|
| 19 | namespace reservation_station { |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | #undef FUNCTION |
---|
| 23 | #define FUNCTION "Reservation_station::genMoore" |
---|
| 24 | void Reservation_station::genMoore (void) |
---|
| 25 | { |
---|
[88] | 26 | log_begin(Reservation_station,FUNCTION); |
---|
| 27 | log_function(Reservation_station,FUNCTION,_name.c_str()); |
---|
[55] | 28 | |
---|
[69] | 29 | // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[55] | 30 | |
---|
| 31 | // accept a new instructions when reservation_station is not full |
---|
[69] | 32 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
| 33 | for (internal_INSERT_SLOT=0; (internal_INSERT_SLOT<_param->_size_queue) and (_queue_valid[internal_INSERT_SLOT]==true); internal_INSERT_SLOT++); |
---|
| 34 | internal_INSERT_ACK = (internal_INSERT_SLOT<_param->_size_queue); |
---|
| 35 | #else |
---|
| 36 | internal_INSERT_ACK = not _queue_control->full(); |
---|
| 37 | #endif |
---|
| 38 | PORT_WRITE(out_INSERT_ACK, internal_INSERT_ACK); |
---|
[55] | 39 | |
---|
[69] | 40 | // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[55] | 41 | |
---|
[70] | 42 | uint32_t index_queue=0; |
---|
| 43 | const uint32_t nb_slot_scan = _param->_size_queue-_param->_nb_inst_retire+1; |
---|
[69] | 44 | |
---|
[70] | 45 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
[55] | 46 | { |
---|
[70] | 47 | bool val = false; |
---|
| 48 | uint32_t index_find = 0;; |
---|
| 49 | |
---|
| 50 | for (; ( |
---|
| 51 | #ifndef SYSTEMC_VHDL_COMPATIBILITY |
---|
| 52 | (index_queue<_queue_control->nb_elt()) and |
---|
| 53 | #endif |
---|
| 54 | (index_queue>=i) and |
---|
| 55 | (index_queue<nb_slot_scan+i) and |
---|
| 56 | (val==false)); |
---|
| 57 | index_queue++) |
---|
| 58 | { |
---|
[69] | 59 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
[70] | 60 | index_find = index_queue; |
---|
[69] | 61 | #else |
---|
[70] | 62 | index_find = (*_queue_control)[index_queue]; |
---|
[69] | 63 | #endif |
---|
[70] | 64 | internal_RETIRE_SLOT [i] = index_queue; |
---|
| 65 | |
---|
| 66 | val = |
---|
| 67 | ( |
---|
[69] | 68 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
[70] | 69 | _queue_valid [index_queue] and |
---|
[69] | 70 | #endif |
---|
[70] | 71 | _queue[index_find]._data_ra_val and |
---|
| 72 | _queue[index_find]._data_rb_val and |
---|
| 73 | _queue[index_find]._data_rc_val |
---|
| 74 | ); |
---|
[69] | 75 | |
---|
[70] | 76 | // cout << "========== Moore : " << endl |
---|
| 77 | // << " * i : " << i << endl |
---|
| 78 | // << " * val : " << val << endl |
---|
| 79 | // << " * index_queue : " << index_queue << endl |
---|
| 80 | // << " * index_find : " << index_find << endl; |
---|
[69] | 81 | } |
---|
[55] | 82 | |
---|
[69] | 83 | internal_RETIRE_VAL [i] = val; |
---|
| 84 | PORT_WRITE(out_RETIRE_VAL [i], val); |
---|
| 85 | |
---|
| 86 | if (val) |
---|
| 87 | { |
---|
[70] | 88 | |
---|
| 89 | // #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
| 90 | // index_find = internal_RETIRE_SLOT [i]; |
---|
| 91 | // #else |
---|
| 92 | // index_find = (*_queue_control)[internal_RETIRE_SLOT [i]]; |
---|
| 93 | // #endif |
---|
[69] | 94 | if (_param->_have_port_context_id) |
---|
[70] | 95 | PORT_WRITE(out_RETIRE_CONTEXT_ID [i],_queue[index_find]._context_id); |
---|
[69] | 96 | if (_param->_have_port_front_end_id) |
---|
[70] | 97 | PORT_WRITE(out_RETIRE_FRONT_END_ID [i],_queue[index_find]._front_end_id); |
---|
[69] | 98 | if (_param->_have_port_ooo_engine_id) |
---|
[70] | 99 | PORT_WRITE(out_RETIRE_OOO_ENGINE_ID [i],_queue[index_find]._ooo_engine_id); |
---|
[88] | 100 | if (_param->_have_port_rob_ptr) |
---|
[70] | 101 | PORT_WRITE(out_RETIRE_ROB_ID [i],_queue[index_find]._rob_id); |
---|
| 102 | PORT_WRITE(out_RETIRE_OPERATION [i],_queue[index_find]._operation); |
---|
| 103 | PORT_WRITE(out_RETIRE_TYPE [i],_queue[index_find]._type); |
---|
[76] | 104 | PORT_WRITE(out_RETIRE_STORE_QUEUE_PTR_WRITE [i],_queue[index_find]._store_queue_ptr_write); |
---|
[78] | 105 | if (_param->_have_port_load_queue_ptr) |
---|
[76] | 106 | PORT_WRITE(out_RETIRE_LOAD_QUEUE_PTR_WRITE [i],_queue[index_find]._load_queue_ptr_write ); |
---|
[70] | 107 | PORT_WRITE(out_RETIRE_HAS_IMMEDIAT [i],_queue[index_find]._has_immediat); |
---|
| 108 | PORT_WRITE(out_RETIRE_IMMEDIAT [i],_queue[index_find]._immediat); |
---|
| 109 | PORT_WRITE(out_RETIRE_DATA_RA [i],_queue[index_find]._data_ra); |
---|
| 110 | PORT_WRITE(out_RETIRE_DATA_RB [i],_queue[index_find]._data_rb); |
---|
| 111 | PORT_WRITE(out_RETIRE_DATA_RC [i],_queue[index_find]._data_rc); |
---|
| 112 | PORT_WRITE(out_RETIRE_WRITE_RD [i],_queue[index_find]._write_rd); |
---|
| 113 | PORT_WRITE(out_RETIRE_NUM_REG_RD [i],_queue[index_find]._num_reg_rd); |
---|
| 114 | PORT_WRITE(out_RETIRE_WRITE_RE [i],_queue[index_find]._write_re); |
---|
| 115 | PORT_WRITE(out_RETIRE_NUM_REG_RE [i],_queue[index_find]._num_reg_re); |
---|
[55] | 116 | } |
---|
| 117 | } |
---|
| 118 | |
---|
[88] | 119 | log_end(Reservation_station,FUNCTION); |
---|
[55] | 120 | }; |
---|
| 121 | |
---|
| 122 | }; // end namespace reservation_station |
---|
| 123 | }; // end namespace read_unit |
---|
| 124 | }; // end namespace multi_read_unit |
---|
| 125 | }; // end namespace execute_loop |
---|
| 126 | }; // end namespace multi_execute_loop |
---|
| 127 | }; // end namespace core |
---|
| 128 | |
---|
| 129 | }; // end namespace behavioural |
---|
| 130 | }; // end namespace morpheo |
---|
| 131 | #endif |
---|
| 132 | //#endif |
---|