[78] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Rename_select_genMealy.cpp 112 2009-03-18 22:36:26Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Rename_select/include/Rename_select.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_ooo_engine { |
---|
| 15 | namespace ooo_engine { |
---|
| 16 | namespace rename_unit { |
---|
| 17 | namespace rename_select { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Rename_select::genMealy" |
---|
| 22 | void Rename_select::genMealy (void) |
---|
| 23 | { |
---|
[88] | 24 | log_begin(Rename_select,FUNCTION); |
---|
| 25 | log_function(Rename_select,FUNCTION,_name.c_str()); |
---|
[78] | 26 | |
---|
[88] | 27 | Tcontrol_t val [_param->_nb_inst_rename]; |
---|
| 28 | Tcontrol_t ack [_param->_nb_front_end][_param->_max_nb_inst_decod]; |
---|
| 29 | Tcontrol_t previous_transaction [_param->_nb_front_end]; |
---|
| 30 | |
---|
| 31 | for (uint32_t i=0; i<_param->_nb_inst_rename; ++i) |
---|
| 32 | val [i] = false; |
---|
[78] | 33 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
[88] | 34 | { |
---|
| 35 | previous_transaction [i] = true; |
---|
| 36 | for (uint32_t j=0; j<_param->_nb_inst_decod[i]; j++) |
---|
| 37 | ack [i][j] = false; |
---|
| 38 | } |
---|
[78] | 39 | |
---|
[88] | 40 | std::list<generic::priority::select_t> * select = _priority->select(); |
---|
| 41 | std::list<generic::priority::select_t>::iterator it=select->begin(); |
---|
| 42 | |
---|
[78] | 43 | for (uint32_t i=0; i<_param->_nb_inst_rename; i++) |
---|
| 44 | { |
---|
[110] | 45 | log_printf(TRACE,Rename_select,FUNCTION," * RENAME_OUT [%d]",i); |
---|
[78] | 46 | |
---|
[88] | 47 | // Scan all instruction until find |
---|
| 48 | while ((it != select->end()) and (val [i] == false)) |
---|
[78] | 49 | { |
---|
[88] | 50 | Tcontext_t x = it->grp; |
---|
| 51 | uint32_t y = it->elt; |
---|
[78] | 52 | |
---|
[88] | 53 | log_printf(TRACE,Rename_select,FUNCTION," * front_end[%d].inst_decod[%d]",x,y); |
---|
[112] | 54 | log_printf(TRACE,Rename_select,FUNCTION," * in_RENAME_OUT_VAL : %d",PORT_READ(in_RENAME_IN_VAL[x][y])); |
---|
[88] | 55 | log_printf(TRACE,Rename_select,FUNCTION," * previous_transaction : %d",previous_transaction[x]); |
---|
| 56 | |
---|
| 57 | // Test if this instruction is valid and if all previous instruction of this front end is an valid transaction |
---|
| 58 | if (previous_transaction [x] and |
---|
| 59 | PORT_READ(in_RENAME_IN_VAL[x][y])) |
---|
[78] | 60 | { |
---|
| 61 | // Find !!! |
---|
[88] | 62 | val [i] = true; |
---|
[78] | 63 | ack [x][y] = PORT_READ(in_RENAME_OUT_ACK [i]); |
---|
| 64 | |
---|
[112] | 65 | log_printf(TRACE,Rename_select,FUNCTION," * in_RENAME_OUT_ACK : %d",PORT_READ(in_RENAME_OUT_ACK[i])); |
---|
[88] | 66 | |
---|
[110] | 67 | Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RENAME_IN_FRONT_END_ID [x][y]):0; |
---|
| 68 | Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_RENAME_IN_CONTEXT_ID [x][y]):0; |
---|
[108] | 69 | |
---|
[110] | 70 | Tcontrol_t no_execute = (PORT_READ(in_RENAME_IN_NO_EXECUTE [x][y])); |
---|
[111] | 71 | // Tcontrol_t read_ra = (PORT_READ(in_RENAME_IN_READ_RA [x][y])); |
---|
| 72 | // Tcontrol_t read_rb = (PORT_READ(in_RENAME_IN_READ_RB [x][y])); |
---|
| 73 | // Tcontrol_t read_rc = (PORT_READ(in_RENAME_IN_READ_RC [x][y])); |
---|
| 74 | // Tcontrol_t write_rd = (PORT_READ(in_RENAME_IN_WRITE_RD [x][y])); |
---|
| 75 | // Tcontrol_t write_re = (PORT_READ(in_RENAME_IN_WRITE_RE [x][y])); |
---|
[108] | 76 | |
---|
[111] | 77 | // Test if ROB is Flushed |
---|
| 78 | Tevent_state_t event_state = PORT_READ(in_RETIRE_EVENT_STATE [front_end_id][context_id]); |
---|
| 79 | Tcontrol_t can_register_access = (event_state == EVENT_STATE_NO_EVENT); |
---|
[108] | 80 | |
---|
[111] | 81 | Tcontrol_t read_ra = (PORT_READ(in_RENAME_IN_READ_RA [x][y]) and can_register_access); |
---|
| 82 | Tcontrol_t read_rb = (PORT_READ(in_RENAME_IN_READ_RB [x][y]) and can_register_access); |
---|
| 83 | Tcontrol_t read_rc = (PORT_READ(in_RENAME_IN_READ_RC [x][y]) and can_register_access); |
---|
| 84 | Tcontrol_t write_rd = (PORT_READ(in_RENAME_IN_WRITE_RD [x][y]) and can_register_access); |
---|
| 85 | Tcontrol_t write_re = (PORT_READ(in_RENAME_IN_WRITE_RE [x][y]) and can_register_access); |
---|
[108] | 86 | |
---|
[78] | 87 | if (_param->_have_port_front_end_id) |
---|
[108] | 88 | PORT_WRITE(out_RENAME_OUT_FRONT_END_ID [i],front_end_id); |
---|
[78] | 89 | if (_param->_have_port_context_id) |
---|
[108] | 90 | PORT_WRITE(out_RENAME_OUT_CONTEXT_ID [i],context_id); |
---|
[78] | 91 | if (_param->_have_port_depth) |
---|
| 92 | PORT_WRITE(out_RENAME_OUT_DEPTH [i],PORT_READ(in_RENAME_IN_DEPTH [x][y])); |
---|
| 93 | PORT_WRITE(out_RENAME_OUT_TYPE [i],PORT_READ(in_RENAME_IN_TYPE [x][y])); |
---|
| 94 | PORT_WRITE(out_RENAME_OUT_OPERATION [i],PORT_READ(in_RENAME_IN_OPERATION [x][y])); |
---|
[108] | 95 | PORT_WRITE(out_RENAME_OUT_NO_EXECUTE [i],no_execute); |
---|
[88] | 96 | PORT_WRITE(out_RENAME_OUT_IS_DELAY_SLOT[i],PORT_READ(in_RENAME_IN_IS_DELAY_SLOT [x][y])); |
---|
[108] | 97 | #ifdef DEBUG |
---|
| 98 | PORT_WRITE(out_RENAME_OUT_ADDRESS [i],PORT_READ(in_RENAME_IN_ADDRESS [x][y])); |
---|
| 99 | #endif |
---|
[105] | 100 | PORT_WRITE(out_RENAME_OUT_ADDRESS_NEXT [i],PORT_READ(in_RENAME_IN_ADDRESS_NEXT [x][y])); |
---|
[78] | 101 | PORT_WRITE(out_RENAME_OUT_HAS_IMMEDIAT [i],PORT_READ(in_RENAME_IN_HAS_IMMEDIAT [x][y])); |
---|
| 102 | PORT_WRITE(out_RENAME_OUT_IMMEDIAT [i],PORT_READ(in_RENAME_IN_IMMEDIAT [x][y])); |
---|
[108] | 103 | PORT_WRITE(out_RENAME_OUT_READ_RA [i],read_ra); |
---|
[78] | 104 | PORT_WRITE(out_RENAME_OUT_NUM_REG_RA [i],PORT_READ(in_RENAME_IN_NUM_REG_RA [x][y])); |
---|
[108] | 105 | PORT_WRITE(out_RENAME_OUT_READ_RB [i],read_rb); |
---|
[78] | 106 | PORT_WRITE(out_RENAME_OUT_NUM_REG_RB [i],PORT_READ(in_RENAME_IN_NUM_REG_RB [x][y])); |
---|
[108] | 107 | PORT_WRITE(out_RENAME_OUT_READ_RC [i],read_rc); |
---|
[78] | 108 | PORT_WRITE(out_RENAME_OUT_NUM_REG_RC [i],PORT_READ(in_RENAME_IN_NUM_REG_RC [x][y])); |
---|
[108] | 109 | PORT_WRITE(out_RENAME_OUT_WRITE_RD [i],write_rd); |
---|
[78] | 110 | PORT_WRITE(out_RENAME_OUT_NUM_REG_RD [i],PORT_READ(in_RENAME_IN_NUM_REG_RD [x][y])); |
---|
[108] | 111 | PORT_WRITE(out_RENAME_OUT_WRITE_RE [i],write_re); |
---|
[78] | 112 | PORT_WRITE(out_RENAME_OUT_NUM_REG_RE [i],PORT_READ(in_RENAME_IN_NUM_REG_RE [x][y])); |
---|
| 113 | PORT_WRITE(out_RENAME_OUT_EXCEPTION_USE[i],PORT_READ(in_RENAME_IN_EXCEPTION_USE [x][y])); |
---|
[88] | 114 | PORT_WRITE(out_RENAME_OUT_EXCEPTION [i],PORT_READ(in_RENAME_IN_EXCEPTION [x][y])); |
---|
[78] | 115 | } |
---|
| 116 | |
---|
[88] | 117 | // ack = 1 if previous_transaction == true and rename_in_val == true and rename_out == true |
---|
| 118 | previous_transaction [x] = ack [x][y]; |
---|
| 119 | |
---|
[78] | 120 | it ++; |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | } |
---|
| 124 | |
---|
[88] | 125 | for (uint32_t i=0; i<_param->_nb_inst_rename; ++i) |
---|
| 126 | PORT_WRITE(out_RENAME_OUT_VAL [i], val [i]); |
---|
| 127 | |
---|
[78] | 128 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 129 | for (uint32_t j=0; j<_param->_nb_inst_decod[i]; j++) |
---|
| 130 | PORT_WRITE(out_RENAME_IN_ACK [i][j], ack [i][j]); |
---|
| 131 | |
---|
[88] | 132 | log_end(Rename_select,FUNCTION); |
---|
[78] | 133 | }; |
---|
| 134 | |
---|
| 135 | }; // end namespace rename_select |
---|
| 136 | }; // end namespace rename_unit |
---|
| 137 | }; // end namespace ooo_engine |
---|
| 138 | }; // end namespace multi_ooo_engine |
---|
| 139 | }; // end namespace core |
---|
| 140 | |
---|
| 141 | }; // end namespace behavioural |
---|
| 142 | }; // end namespace morpheo |
---|
| 143 | #endif |
---|