[78] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Rename_select_genMealy.cpp 115 2009-04-20 21:29:17Z 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])); |
---|
[110] | 66 | Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RENAME_IN_FRONT_END_ID [x][y]):0; |
---|
| 67 | Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_RENAME_IN_CONTEXT_ID [x][y]):0; |
---|
[115] | 68 | |
---|
| 69 | log_printf(TRACE,Rename_select,FUNCTION," * front_end_id : %d",front_end_id); |
---|
| 70 | log_printf(TRACE,Rename_select,FUNCTION," * context_id : %d",context_id); |
---|
[108] | 71 | |
---|
[111] | 72 | // Test if ROB is Flushed |
---|
[115] | 73 | Tevent_state_t event_state = PORT_READ(in_RETIRE_EVENT_STATE [x][context_id]); |
---|
| 74 | Tcontrol_t have_event = (event_state != EVENT_STATE_NO_EVENT); |
---|
| 75 | Tcontrol_t can_register_access = not have_event; |
---|
| 76 | Tcontrol_t no_execute = (PORT_READ(in_RENAME_IN_NO_EXECUTE [x][y]) or have_event); |
---|
| 77 | Tcontrol_t read_ra = (PORT_READ(in_RENAME_IN_READ_RA [x][y]) and can_register_access); |
---|
| 78 | Tcontrol_t read_rb = (PORT_READ(in_RENAME_IN_READ_RB [x][y]) and can_register_access); |
---|
| 79 | Tcontrol_t read_rc = (PORT_READ(in_RENAME_IN_READ_RC [x][y]) and can_register_access); |
---|
| 80 | Tcontrol_t write_rd = (PORT_READ(in_RENAME_IN_WRITE_RD [x][y]) and can_register_access); |
---|
| 81 | Tcontrol_t write_re = (PORT_READ(in_RENAME_IN_WRITE_RE [x][y]) and can_register_access); |
---|
| 82 | // Tcontrol_t read_ra = (PORT_READ(in_RENAME_IN_READ_RA [x][y])); |
---|
| 83 | // Tcontrol_t read_rb = (PORT_READ(in_RENAME_IN_READ_RB [x][y])); |
---|
| 84 | // Tcontrol_t read_rc = (PORT_READ(in_RENAME_IN_READ_RC [x][y])); |
---|
| 85 | // Tcontrol_t write_rd = (PORT_READ(in_RENAME_IN_WRITE_RD [x][y])); |
---|
| 86 | // Tcontrol_t write_re = (PORT_READ(in_RENAME_IN_WRITE_RE [x][y])); |
---|
[108] | 87 | |
---|
[115] | 88 | log_printf(TRACE,Rename_select,FUNCTION," * event_state : %d",event_state); |
---|
| 89 | log_printf(TRACE,Rename_select,FUNCTION," * no_execute (before) : %d",PORT_READ(in_RENAME_IN_NO_EXECUTE [x][y])); |
---|
| 90 | log_printf(TRACE,Rename_select,FUNCTION," * no_execute (after) : %d",no_execute); |
---|
| 91 | |
---|
[78] | 92 | if (_param->_have_port_front_end_id) |
---|
[108] | 93 | PORT_WRITE(out_RENAME_OUT_FRONT_END_ID [i],front_end_id); |
---|
[78] | 94 | if (_param->_have_port_context_id) |
---|
[108] | 95 | PORT_WRITE(out_RENAME_OUT_CONTEXT_ID [i],context_id); |
---|
[78] | 96 | if (_param->_have_port_depth) |
---|
| 97 | PORT_WRITE(out_RENAME_OUT_DEPTH [i],PORT_READ(in_RENAME_IN_DEPTH [x][y])); |
---|
| 98 | PORT_WRITE(out_RENAME_OUT_TYPE [i],PORT_READ(in_RENAME_IN_TYPE [x][y])); |
---|
| 99 | PORT_WRITE(out_RENAME_OUT_OPERATION [i],PORT_READ(in_RENAME_IN_OPERATION [x][y])); |
---|
[108] | 100 | PORT_WRITE(out_RENAME_OUT_NO_EXECUTE [i],no_execute); |
---|
[88] | 101 | PORT_WRITE(out_RENAME_OUT_IS_DELAY_SLOT[i],PORT_READ(in_RENAME_IN_IS_DELAY_SLOT [x][y])); |
---|
[108] | 102 | #ifdef DEBUG |
---|
| 103 | PORT_WRITE(out_RENAME_OUT_ADDRESS [i],PORT_READ(in_RENAME_IN_ADDRESS [x][y])); |
---|
| 104 | #endif |
---|
[105] | 105 | PORT_WRITE(out_RENAME_OUT_ADDRESS_NEXT [i],PORT_READ(in_RENAME_IN_ADDRESS_NEXT [x][y])); |
---|
[78] | 106 | PORT_WRITE(out_RENAME_OUT_HAS_IMMEDIAT [i],PORT_READ(in_RENAME_IN_HAS_IMMEDIAT [x][y])); |
---|
| 107 | PORT_WRITE(out_RENAME_OUT_IMMEDIAT [i],PORT_READ(in_RENAME_IN_IMMEDIAT [x][y])); |
---|
[108] | 108 | PORT_WRITE(out_RENAME_OUT_READ_RA [i],read_ra); |
---|
[78] | 109 | PORT_WRITE(out_RENAME_OUT_NUM_REG_RA [i],PORT_READ(in_RENAME_IN_NUM_REG_RA [x][y])); |
---|
[108] | 110 | PORT_WRITE(out_RENAME_OUT_READ_RB [i],read_rb); |
---|
[78] | 111 | PORT_WRITE(out_RENAME_OUT_NUM_REG_RB [i],PORT_READ(in_RENAME_IN_NUM_REG_RB [x][y])); |
---|
[108] | 112 | PORT_WRITE(out_RENAME_OUT_READ_RC [i],read_rc); |
---|
[78] | 113 | PORT_WRITE(out_RENAME_OUT_NUM_REG_RC [i],PORT_READ(in_RENAME_IN_NUM_REG_RC [x][y])); |
---|
[108] | 114 | PORT_WRITE(out_RENAME_OUT_WRITE_RD [i],write_rd); |
---|
[78] | 115 | PORT_WRITE(out_RENAME_OUT_NUM_REG_RD [i],PORT_READ(in_RENAME_IN_NUM_REG_RD [x][y])); |
---|
[108] | 116 | PORT_WRITE(out_RENAME_OUT_WRITE_RE [i],write_re); |
---|
[78] | 117 | PORT_WRITE(out_RENAME_OUT_NUM_REG_RE [i],PORT_READ(in_RENAME_IN_NUM_REG_RE [x][y])); |
---|
| 118 | PORT_WRITE(out_RENAME_OUT_EXCEPTION_USE[i],PORT_READ(in_RENAME_IN_EXCEPTION_USE [x][y])); |
---|
[88] | 119 | PORT_WRITE(out_RENAME_OUT_EXCEPTION [i],PORT_READ(in_RENAME_IN_EXCEPTION [x][y])); |
---|
[78] | 120 | } |
---|
| 121 | |
---|
[88] | 122 | // ack = 1 if previous_transaction == true and rename_in_val == true and rename_out == true |
---|
| 123 | previous_transaction [x] = ack [x][y]; |
---|
| 124 | |
---|
[78] | 125 | it ++; |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | } |
---|
| 129 | |
---|
[88] | 130 | for (uint32_t i=0; i<_param->_nb_inst_rename; ++i) |
---|
| 131 | PORT_WRITE(out_RENAME_OUT_VAL [i], val [i]); |
---|
| 132 | |
---|
[78] | 133 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 134 | for (uint32_t j=0; j<_param->_nb_inst_decod[i]; j++) |
---|
| 135 | PORT_WRITE(out_RENAME_IN_ACK [i][j], ack [i][j]); |
---|
| 136 | |
---|
[88] | 137 | log_end(Rename_select,FUNCTION); |
---|
[78] | 138 | }; |
---|
| 139 | |
---|
| 140 | }; // end namespace rename_select |
---|
| 141 | }; // end namespace rename_unit |
---|
| 142 | }; // end namespace ooo_engine |
---|
| 143 | }; // end namespace multi_ooo_engine |
---|
| 144 | }; // end namespace core |
---|
| 145 | |
---|
| 146 | }; // end namespace behavioural |
---|
| 147 | }; // end namespace morpheo |
---|
| 148 | #endif |
---|