[55] | 1 | #ifdef SYSTEMC |
---|
| 2 | //#if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 3 | /* |
---|
| 4 | * $Id: Reservation_station_genMoore.cpp 123 2009-06-08 20:43:30Z rosiere $ |
---|
| 5 | * |
---|
[110] | 6 | * [ Description ] |
---|
[55] | 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 | |
---|
[123] | 29 | if (PORT_READ(in_NRESET)) |
---|
| 30 | { |
---|
[110] | 31 | // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[55] | 32 | |
---|
| 33 | // accept a new instructions when reservation_station is not full |
---|
[69] | 34 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
| 35 | for (internal_INSERT_SLOT=0; (internal_INSERT_SLOT<_param->_size_queue) and (_queue_valid[internal_INSERT_SLOT]==true); internal_INSERT_SLOT++); |
---|
| 36 | internal_INSERT_ACK = (internal_INSERT_SLOT<_param->_size_queue); |
---|
| 37 | #else |
---|
| 38 | internal_INSERT_ACK = not _queue_control->full(); |
---|
| 39 | #endif |
---|
[55] | 40 | |
---|
[110] | 41 | // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[55] | 42 | |
---|
[70] | 43 | uint32_t index_queue=0; |
---|
| 44 | const uint32_t nb_slot_scan = _param->_size_queue-_param->_nb_inst_retire+1; |
---|
[69] | 45 | |
---|
[70] | 46 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
[55] | 47 | { |
---|
[70] | 48 | bool val = false; |
---|
[110] | 49 | uint32_t index_find = 0; |
---|
[70] | 50 | |
---|
[110] | 51 | log_printf(TRACE,Reservation_station,FUNCTION," * RETIRE [%d]",i); |
---|
| 52 | |
---|
[70] | 53 | for (; ( |
---|
| 54 | #ifndef SYSTEMC_VHDL_COMPATIBILITY |
---|
| 55 | (index_queue<_queue_control->nb_elt()) and |
---|
| 56 | #endif |
---|
| 57 | (index_queue>=i) and |
---|
| 58 | (index_queue<nb_slot_scan+i) and |
---|
| 59 | (val==false)); |
---|
| 60 | index_queue++) |
---|
| 61 | { |
---|
[69] | 62 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
[70] | 63 | index_find = index_queue; |
---|
[69] | 64 | #else |
---|
[70] | 65 | index_find = (*_queue_control)[index_queue]; |
---|
[69] | 66 | #endif |
---|
[70] | 67 | internal_RETIRE_SLOT [i] = index_queue; |
---|
| 68 | |
---|
| 69 | val = |
---|
| 70 | ( |
---|
[69] | 71 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
[110] | 72 | _queue_valid [index_queue] and |
---|
[69] | 73 | #endif |
---|
[70] | 74 | _queue[index_find]._data_ra_val and |
---|
| 75 | _queue[index_find]._data_rb_val and |
---|
| 76 | _queue[index_find]._data_rc_val |
---|
| 77 | ); |
---|
[69] | 78 | |
---|
[110] | 79 | log_printf( |
---|
| 80 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
| 81 | TRACE,Reservation_station,FUNCTION," [%d] valid : %d, data ra %d, rb %d, rc %d - %d", |
---|
| 82 | index_find, |
---|
| 83 | _queue_valid [index_queue], |
---|
| 84 | #else |
---|
| 85 | TRACE,Reservation_station,FUNCTION," [%d] data ra %d, rb %d, rc %d - %d", |
---|
| 86 | index_find, |
---|
| 87 | #endif |
---|
| 88 | _queue[index_find]._data_ra_val, |
---|
| 89 | _queue[index_find]._data_rb_val, |
---|
| 90 | _queue[index_find]._data_rc_val, |
---|
| 91 | val); |
---|
[69] | 92 | } |
---|
[55] | 93 | |
---|
[69] | 94 | internal_RETIRE_VAL [i] = val; |
---|
| 95 | |
---|
| 96 | if (val) |
---|
| 97 | { |
---|
[70] | 98 | |
---|
| 99 | // #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
| 100 | // index_find = internal_RETIRE_SLOT [i]; |
---|
| 101 | // #else |
---|
| 102 | // index_find = (*_queue_control)[internal_RETIRE_SLOT [i]]; |
---|
| 103 | // #endif |
---|
[69] | 104 | if (_param->_have_port_context_id) |
---|
[70] | 105 | PORT_WRITE(out_RETIRE_CONTEXT_ID [i],_queue[index_find]._context_id); |
---|
[69] | 106 | if (_param->_have_port_front_end_id) |
---|
[70] | 107 | PORT_WRITE(out_RETIRE_FRONT_END_ID [i],_queue[index_find]._front_end_id); |
---|
[69] | 108 | if (_param->_have_port_ooo_engine_id) |
---|
[70] | 109 | PORT_WRITE(out_RETIRE_OOO_ENGINE_ID [i],_queue[index_find]._ooo_engine_id); |
---|
[88] | 110 | if (_param->_have_port_rob_ptr) |
---|
[70] | 111 | PORT_WRITE(out_RETIRE_ROB_ID [i],_queue[index_find]._rob_id); |
---|
| 112 | PORT_WRITE(out_RETIRE_OPERATION [i],_queue[index_find]._operation); |
---|
| 113 | PORT_WRITE(out_RETIRE_TYPE [i],_queue[index_find]._type); |
---|
[76] | 114 | PORT_WRITE(out_RETIRE_STORE_QUEUE_PTR_WRITE [i],_queue[index_find]._store_queue_ptr_write); |
---|
[122] | 115 | PORT_WRITE(out_RETIRE_STORE_QUEUE_PTR_READ [i],_queue[index_find]._store_queue_ptr_read ); |
---|
| 116 | PORT_WRITE(out_RETIRE_STORE_QUEUE_EMPTY [i],_queue[index_find]._store_queue_empty ); |
---|
[78] | 117 | if (_param->_have_port_load_queue_ptr) |
---|
[76] | 118 | PORT_WRITE(out_RETIRE_LOAD_QUEUE_PTR_WRITE [i],_queue[index_find]._load_queue_ptr_write ); |
---|
[70] | 119 | PORT_WRITE(out_RETIRE_HAS_IMMEDIAT [i],_queue[index_find]._has_immediat); |
---|
| 120 | PORT_WRITE(out_RETIRE_IMMEDIAT [i],_queue[index_find]._immediat); |
---|
| 121 | PORT_WRITE(out_RETIRE_DATA_RA [i],_queue[index_find]._data_ra); |
---|
| 122 | PORT_WRITE(out_RETIRE_DATA_RB [i],_queue[index_find]._data_rb); |
---|
| 123 | PORT_WRITE(out_RETIRE_DATA_RC [i],_queue[index_find]._data_rc); |
---|
| 124 | PORT_WRITE(out_RETIRE_WRITE_RD [i],_queue[index_find]._write_rd); |
---|
| 125 | PORT_WRITE(out_RETIRE_NUM_REG_RD [i],_queue[index_find]._num_reg_rd); |
---|
| 126 | PORT_WRITE(out_RETIRE_WRITE_RE [i],_queue[index_find]._write_re); |
---|
| 127 | PORT_WRITE(out_RETIRE_NUM_REG_RE [i],_queue[index_find]._num_reg_re); |
---|
[55] | 128 | } |
---|
| 129 | } |
---|
[123] | 130 | } |
---|
| 131 | else |
---|
| 132 | { |
---|
| 133 | // Reset |
---|
| 134 | internal_INSERT_ACK = 0; |
---|
| 135 | // internal_INSERT_SLOT |
---|
| 136 | |
---|
| 137 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 138 | { |
---|
| 139 | internal_RETIRE_VAL [i] = 0; |
---|
| 140 | // internal_RETIRE_SLOT [i]; |
---|
| 141 | } |
---|
| 142 | } |
---|
[55] | 143 | |
---|
[123] | 144 | // Write Output |
---|
| 145 | PORT_WRITE(out_INSERT_ACK , internal_INSERT_ACK); |
---|
| 146 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 147 | PORT_WRITE(out_RETIRE_VAL [i], internal_RETIRE_VAL [i]); |
---|
| 148 | |
---|
[88] | 149 | log_end(Reservation_station,FUNCTION); |
---|
[55] | 150 | }; |
---|
| 151 | |
---|
| 152 | }; // end namespace reservation_station |
---|
| 153 | }; // end namespace read_unit |
---|
| 154 | }; // end namespace multi_read_unit |
---|
| 155 | }; // end namespace execute_loop |
---|
| 156 | }; // end namespace multi_execute_loop |
---|
| 157 | }; // end namespace core |
---|
| 158 | |
---|
| 159 | }; // end namespace behavioural |
---|
| 160 | }; // end namespace morpheo |
---|
| 161 | #endif |
---|
| 162 | //#endif |
---|