Changeset 100 for trunk/IPs/systemC/processor/Morpheo/Behavioural
- Timestamp:
- Jan 8, 2009, 2:06:27 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 53 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:ignore
set to
Makefile.flags
Makefile.tools
Makefile.tools_path
-
Property
svn:ignore
set to
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Configuration/src/Configuration.cpp
r97 r100 40 40 // Debug & Log File 41 41 //-------------------------------------------------- 42 debug_init (fromString<debug_verbosity_t>(_simulator->getParam("debug_level"))); 42 debug_init (fromString<debug_verbosity_t>(_simulator->getParam("debug_level")), 43 fromString<double> (_simulator->getParam("debug_cycle_start")), 44 fromString<double> (_simulator->getParam("debug_cycle_stop"))); 43 45 44 46 log_init(fromString<bool>(_simulator->getParam("debug_have_log_file")), … … 79 81 // Parameters_Statistics 80 82 //-------------------------------------------------- 81 _param_statistics = new Parameters_Statistics (fromString<uint64_t>(_simulator->getParam(" nb_cycle_before_begin")),82 fromString<uint64_t>(_simulator->getParam(" period_save")));83 _param_statistics = new Parameters_Statistics (fromString<uint64_t>(_simulator->getParam("statistics_cycle_start")), 84 fromString<uint64_t>(_simulator->getParam("statistics_period"))); 83 85 84 86 //-------------------------------------------------- -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/Operation/src/Operation.cpp
r98 r100 255 255 // Result 256 256 op->_timing = param->_timing[op->_type][op->_operation]; 257 op->_data_rd = imm ;257 op->_data_rd = imm<<2; // add "00" 258 258 //op->_data_re = 0; 259 259 op->_exception = EXCEPTION_ALU_NONE; 260 260 op->_no_sequence = 1; 261 op->_address = gpr ;261 op->_address = gpr>>2; // del "00" 262 262 }; 263 263 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/SelfTest/src/test.cpp
r97 r100 279 279 280 280 281 transaction_in.push_back(execute_transaction(_param,0,0,0, 31,OPERATION_BRANCH_L_JALR ,TYPE_BRANCH,0,0xdeadbeef,0x0 ,0x12345678,0 ,0,63,0xdeadbeef,0,15,FLAG_CY ,EXCEPTION_NONE ,1,0x12345678 )); // jr282 transaction_in.push_back(execute_transaction(_param,0,0,0, 32,OPERATION_BRANCH_L_JALR ,TYPE_BRANCH,1,0xdeadbeef,0x0 ,0x12345678,0 ,1,63,0xdeadbeef ,0,15,FLAG_CY ,EXCEPTION_NONE ,1,0x12345678)); // jal283 transaction_in.push_back(execute_transaction(_param,0,0,0, 33,OPERATION_BRANCH_L_JALR ,TYPE_BRANCH,1,0xdeadbeef,0x0 ,0x12345678,0 ,1,63,0xdeadbeef ,0,15,FLAG_CY ,EXCEPTION_NONE ,1,0x12345678)); // jalr281 transaction_in.push_back(execute_transaction(_param,0,0,0, 31,OPERATION_BRANCH_L_JALR ,TYPE_BRANCH,0,0xdeadbeef,0x0 ,0x12345678,0 ,0,63,0xdeadbeef,0,15,FLAG_CY ,EXCEPTION_NONE ,1,0x12345678>>2)); // jr 282 transaction_in.push_back(execute_transaction(_param,0,0,0, 32,OPERATION_BRANCH_L_JALR ,TYPE_BRANCH,1,0xdeadbeef,0x0 ,0x12345678,0 ,1,63,0xdeadbeef<<2,0,15,FLAG_CY ,EXCEPTION_NONE ,1,0x12345678>>2)); // jal 283 transaction_in.push_back(execute_transaction(_param,0,0,0, 33,OPERATION_BRANCH_L_JALR ,TYPE_BRANCH,1,0xdeadbeef,0x0 ,0x12345678,0 ,1,63,0xdeadbeef<<2,0,15,FLAG_CY ,EXCEPTION_NONE ,1,0x12345678>>2)); // jalr 284 284 285 285 transaction_in.push_back(execute_transaction(_param,0,0,0, 34,OPERATION_EXTEND_L_EXTEND_S,TYPE_EXTEND,1,8 ,0x12345678,0x0 ,0 ,1,63,0x00000078,0,15,FLAG_CY ,EXCEPTION_NONE ,0)); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/src/Functionnal_unit_transition.cpp
r98 r100 138 138 log_printf(TRACE,Functionnal_unit,FUNCTION," * exception : %d" ,_execute_operation_in->_exception ); 139 139 log_printf(TRACE,Functionnal_unit,FUNCTION," * no_sequence : %d" ,_execute_operation_in->_no_sequence); 140 log_printf(TRACE,Functionnal_unit,FUNCTION," * address : %.8x ",_execute_operation_in->_address);140 log_printf(TRACE,Functionnal_unit,FUNCTION," * address : %.8x (%.8x)",_execute_operation_in->_address,_execute_operation_in->_address<<2); 141 141 142 142 #ifdef STATISTICS -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Read_queue/src/Read_queue_vhdl.cpp
r98 r100 32 32 param_queue = new morpheo::behavioural::generic::queue::Parameters 33 33 (_param->_size_queue, 34 _param->_size_internal_queue 34 _param->_size_internal_queue, 35 0 35 36 ); 36 37 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue/src/Execute_queue_vhdl.cpp
r98 r100 34 34 param_queue = new morpheo::behavioural::generic::queue::Parameters 35 35 (_param->_size_queue, 36 _param->_size_internal_queue 36 _param->_size_internal_queue, 37 0 37 38 ); 38 39 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/Instruction/src/Instruction.cpp
r97 r100 903 903 inst->_type = instruction_information(INSTRUCTION_L_JALR)._type ; //TYPE_BRANCH; 904 904 inst->_operation = instruction_information(INSTRUCTION_L_JALR)._operation; //OPERATION_BRANCH_L_JALR; 905 inst->_has_immediat = 0;906 inst->_immediat = 0; // unnecessary905 inst->_has_immediat = 1; 906 inst->_immediat = inst->_address_next+1; 907 907 inst->_read_ra = 0; 908 908 inst->_num_reg_ra = 0; //unnecessary -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Prediction_unit_Glue/SelfTest/config_mono_context.cfg
r82 r100 3 3 1 1 *4 # nb_decod_unit 4 4 30 30 +32 # size_address 5 1 1 *4# nb_instruction [0] [nb_context]5 1 4 *2 # nb_instruction [0] [nb_context] 6 6 1 1 *4 # size_depth [0] [nb_context] 7 7 4 4 *4 # nb_inst_decod [0] [nb_decod_unit] -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Prediction_unit_Glue/SelfTest/src/test.cpp
r88 r100 362 362 363 363 // Initialisation 364 const bool test1 = false; 365 const bool test2 = true ; 366 const bool test3 = false; 367 const bool test4 = false; 364 368 365 369 const uint32_t seed = 0; … … 402 406 LABEL("Iteration %d",iteration); 403 407 408 if (test1) 404 409 { 405 410 LABEL("Test sequential"); … … 481 486 } 482 487 488 if (test2) 483 489 { 484 490 LABEL("Test no sequential - L.J"); … … 489 495 for (uint32_t i=0; i<_param->_nb_instruction [context]; i++) 490 496 { 491 Taddress_t addr = (1<<(_param->_nb_instruction[context]+4)); 492 Taddress_t addr_src = addr+i; 497 Taddress_t pc_current = (1<<(_param->_nb_instruction[context]+3)); 498 Taddress_t pc_previous = pc_current-1; 499 Taddress_t addr_src = pc_current+i; 493 500 Taddress_t addr_dest = 0xdeadbeef; 494 495 in_PREDICT_PC_PREVIOUS [context]->write(0); 496 in_PREDICT_PC_CURRENT [context]->write(addr); 497 in_PREDICT_PC_CURRENT_IS_DS_TAKE [context]->write(0); 501 Tcontrol_t is_ds_take= rand()%2; 502 503 in_PREDICT_PC_PREVIOUS [context]->write(pc_previous); 504 in_PREDICT_PC_CURRENT [context]->write(pc_current); 505 in_PREDICT_PC_CURRENT_IS_DS_TAKE [context]->write(is_ds_take); 498 506 499 507 bool find = false; … … 515 523 LABEL(" * BTB address : 0x%x",out_PREDICT_BTB_ADDRESS [port]->read()); 516 524 if ((out_PREDICT_BTB_CONTEXT_ID [port]->read() == context) and 517 (out_PREDICT_BTB_ADDRESS [port]->read() == addr))525 (out_PREDICT_BTB_ADDRESS [port]->read() == (is_ds_take)?pc_previous:pc_current )) 518 526 { 519 527 in_PREDICT_BTB_ACK [port]->write((rand()%100)<percent_transaction_predict); … … 531 539 SC_START(0); 532 540 541 LABEL ("PREDICT_VAL : %d", in_PREDICT_VAL[context]->read()); 542 LABEL ("PREDICT_ACK : %d",out_PREDICT_ACK[context]->read()); 543 533 544 if (in_PREDICT_VAL[context]->read() and out_PREDICT_ACK[context]->read()) 534 545 { 535 546 LABEL ("PREDICT [%d] - Transaction accepted",context); 547 LABEL (" * pc_previous: 0x%x",pc_previous ); 548 LABEL (" * pc_current : 0x%x",pc_current ); 549 LABEL (" * addr_src : 0x%x",addr_src ); 550 LABEL (" * addr_dest : 0x%x",addr_dest ); 551 LABEL (" * is_ds_take : %d" ,is_ds_take); 552 536 553 find = true; 537 538 TEST(Taddress_t ,out_PREDICT_PC_NEXT [context]->read(),addr_dest); 539 TEST(Tcontrol_t ,out_PREDICT_PC_NEXT_IS_DS_TAKE [context]->read(),i==(_param->_nb_instruction [context]-1)); 554 555 Tcontrol_t next_is_ds_take = (not is_ds_take and (i==(_param->_nb_instruction [context]-1))); 556 557 TEST(Tcontrol_t ,out_PREDICT_PC_NEXT_IS_DS_TAKE [context]->read(), next_is_ds_take); 558 TEST(Taddress_t ,out_PREDICT_PC_NEXT [context]->read(),(next_is_ds_take)?(addr_src+1):addr_dest); 540 559 TEST(Tinst_ifetch_ptr_t,out_PREDICT_INST_IFETCH_PTR [context]->read(),i); 541 TEST(Tbranch_state_t ,out_PREDICT_BRANCH_STATE [context]->read(),BRANCH_STATE_NSPEC_TAKE);560 TEST(Tbranch_state_t ,out_PREDICT_BRANCH_STATE [context]->read(),(next_is_ds_take)?BRANCH_STATE_NONE:BRANCH_STATE_NSPEC_TAKE); 542 561 // TEST(Tprediction_ptr_t ,out_PREDICT_BRANCH_UPDATE_PREDICTION_ID [context]->read(),0); 543 562 544 uint32_t k=((addr_src%_param->_nb_instruction[context])==_param->_nb_instruction[context]-1)?_param->_nb_instruction[context]:((addr_src%_param->_nb_instruction[context])+2); 563 uint32_t k=((is_ds_take)?1:((next_is_ds_take)?_param->_nb_instruction[context]:((addr_src%_param->_nb_instruction [context])+2))); 564 565 566 // ((addr_src%_param->_nb_instruction[context])==_param->_nb_instruction[context]-1)?_param->_nb_instruction[context]:((addr_src%_param->_nb_instruction[context])+2); 567 545 568 LABEL("instruction enable : "); 546 569 LABEL(" [0:%d[ = 1",k); 547 LABEL(" [%d:%d[ = 1",k,_param->_nb_instruction[context]);570 LABEL(" [%d:%d[ = 0",k,_param->_nb_instruction[context]); 548 571 for (uint32_t j=0; j<k; j++) 549 572 TEST(Tcontrol_t ,out_PREDICT_INSTRUCTION_ENABLE [context][j]->read(),1); 550 573 for (uint32_t j=k; j<_param->_nb_instruction[context]; j++) 551 574 TEST(Tcontrol_t ,out_PREDICT_INSTRUCTION_ENABLE [context][j]->read(),0); 552 575 553 576 TEST(Tcontrol_t ,out_PREDICT_BTB_VAL [port]->read(),1); 554 577 TEST(Tcontext_t ,out_PREDICT_BTB_CONTEXT_ID [port]->read(),context); 555 TEST(Taddress_t ,out_PREDICT_BTB_ADDRESS [port]->read(), addr);578 TEST(Taddress_t ,out_PREDICT_BTB_ADDRESS [port]->read(),(is_ds_take)?pc_previous:pc_current); 556 579 } 557 580 … … 571 594 } 572 595 } 573 596 597 if (test3) 574 598 { 575 599 LABEL("Decod - Ok"); … … 618 642 } 619 643 644 if (test4) 620 645 { 621 646 LABEL("Decod - Ko"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Prediction_unit_Glue/src/Prediction_unit_Glue_genMealy_predict.cpp
r98 r100 27 27 if (PORT_READ(in_NRESET)) 28 28 { 29 30 29 // Init 31 30 Tcontrol_t ack [_param->_nb_context]; … … 36 35 { 37 36 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * PREDICT [%d]",i); 38 37 38 // No access 39 39 Tcontrol_t btb_val = false; 40 40 Tcontrol_t dir_val = false; … … 42 42 Tcontrol_t upt_val = false; 43 43 44 // Get ack 44 45 Tcontrol_t btb_ack = PORT_READ(in_PREDICT_BTB_ACK [i]); 45 46 Tcontrol_t dir_ack = PORT_READ(in_PREDICT_DIR_ACK [i]); … … 47 48 Tcontrol_t upt_ack = PORT_READ(in_PREDICT_UPT_ACK [i]); 48 49 50 // Read context_id 49 51 Tcontext_t context = (reg_PREDICT_PRIORITY+i)%_param->_nb_context; // priority 50 52 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * context : %d",context); 51 53 54 // Now : ack transaction 52 55 ack [context] = 1; 53 56 54 57 if (PORT_READ(in_PREDICT_VAL[context]) == 0) 55 58 { 59 // Nothing 56 60 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * not valid ..."); 57 61 … … 63 67 else 64 68 { 69 // Have transaction 65 70 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * valid ..."); 66 71 72 // Read information (PC) 67 73 Taddress_t pc_previous = PORT_READ(in_PREDICT_PC_PREVIOUS [context]); 68 74 Taddress_t pc_current = PORT_READ(in_PREDICT_PC_CURRENT [context]); 69 75 Tcontrol_t pc_current_is_ds_take = PORT_READ(in_PREDICT_PC_CURRENT_IS_DS_TAKE [context]); 70 76 71 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * pc_previous : 0x%.8x ",pc_previous);72 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * pc_current : 0x%.8x ",pc_current);77 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * pc_previous : 0x%.8x (0x%.8x)",pc_previous,pc_previous<<2); 78 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * pc_current : 0x%.8x (0x%.8x)",pc_current ,pc_current <<2); 73 79 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * pc_current_is_ds_take : %d" ,pc_current_is_ds_take); 74 80 … … 80 86 81 87 // STEP (1) - Compute the address source 82 // if pc_current is a ds take, then pc_previous is a branchement 88 // -> if pc_current is a ds take, then pc_previous is a branchement 89 // get branchement address to send at the BTB 83 90 Taddress_t address = (pc_current_is_ds_take)?pc_previous:pc_current; 91 // Address_lsb = position in fetch packet 84 92 Taddress_t address_lsb = pc_current%_param->_nb_instruction [context]; //if pc_current_is_ds_take, then pc_current%_param->_nb_instruction [context] == 0 85 93 Taddress_t address_msb; 86 94 87 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address : 0x%.8x ",address);95 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address : 0x%.8x (0x%.8x)",address,address<<2); 88 96 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address_lsb : %d" ,address_lsb); 89 97 90 98 // STEP (2) - Test if branch (access at branch_target_buffer) 99 // Access at the btb 91 100 btb_val = true; 92 101 102 // Create the request 93 103 if (_param->_have_port_context_id) 94 104 PORT_WRITE(out_PREDICT_BTB_CONTEXT_ID [i],context); 95 105 PORT_WRITE(out_PREDICT_BTB_ADDRESS [i],address); 96 106 107 // Transaction can be ack if btb is not busy 97 108 ack [context] &= btb_ack; 98 109 99 110 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * btb_ack : %d" ,btb_ack); 100 111 101 // BTB_ack = 0 ? 112 // BTB_ack = 0 ? else can continue 102 113 if (not btb_ack) 103 114 continue; 104 115 105 // special case :106 // if pc_current _is_ds, then pc_previous have branch, also hit must be set.107 // else : a another branchhave eject this branch : can't accurate116 // Test a special case : 117 // if pc_current is a delay slot, then pc_previous is a branchement instruction, also hit must be set. 118 // else : an another branch instruction have eject this branch : can't accurate 108 119 Tcontrol_t hit = PORT_READ(in_PREDICT_BTB_HIT[i]); 109 120 Tcontrol_t is_accurate = PORT_READ(in_PREDICT_BTB_IS_ACCURATE [i]) and not (pc_current_is_ds_take and not hit); … … 112 123 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * is_accurate : %d" ,is_accurate); 113 124 114 // STEP (3) : Test if have branchin the packet125 // STEP (3) : Test if BTB find a branch instruction in the packet 115 126 if (hit == 1) 116 127 { 128 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * BTB hit : no sequential order"); 129 117 130 // STEP (3a) : branch - test condition 118 131 bool use_dir = false; 119 132 bool use_ras = false; 120 133 bool use_upt = false; 121 122 Tbranch_condition_t condition = PORT_READ(in_PREDICT_BTB_CONDITION [i]); 123 Taddress_t address_src = PORT_READ(in_PREDICT_BTB_ADDRESS_SRC [i]); 124 Taddress_t address_dest = PORT_READ(in_PREDICT_BTB_ADDRESS_DEST [i]); 125 Tcontrol_t push ; 126 Tcontrol_t direction; 127 128 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * condition : %s" ,toString(condition).c_str()); 129 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address_src : 0x%.8x",address_src); 130 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address_dest : 0x%.8x",address_dest); 131 132 switch (condition) 133 { 134 case BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK : // l.j 135 { 136 // use none unit (dir, upt and ras) 137 direction = true; 138 pc_next = address_dest; 139 branch_state = BRANCH_STATE_NSPEC_TAKE; 140 break; 141 } 142 case BRANCH_CONDITION_NONE_WITH_WRITE_STACK : // l.jal 143 { 144 use_upt = true; 145 use_ras = true; 146 push = true; 147 direction = true; 148 pc_next = address_dest; 149 branch_state = BRANCH_STATE_NSPEC_TAKE; 150 break; 151 } 152 case BRANCH_CONDITION_FLAG_UNSET : // l.bnf 153 case BRANCH_CONDITION_FLAG_SET : // l.bf 154 { 155 use_upt = true; 156 use_dir = true; 157 // Test direction 158 direction = PORT_READ(in_PREDICT_DIR_DIRECTION [i]); // Direction is not the "flag predict" ... also flag_unset and flag_set is the same 159 if (direction = 1) 160 { 161 branch_state = BRANCH_STATE_SPEC_TAKE; 162 pc_next = address_dest; 163 } 164 else 165 { 166 branch_state = BRANCH_STATE_SPEC_NTAKE; 167 pc_next = address_src+2; // +1 = delay slot 168 } 169 break; 170 } 171 case BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK : // l.jr (rb!=9) 172 { 173 use_upt = true; 174 use_ras = true; 175 push = true; 176 direction = true; 177 pc_next = address_dest; 178 branch_state = BRANCH_STATE_SPEC_TAKE; 179 break; 180 } 181 case BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK : // l.jalr 182 { 183 use_upt = true; 184 use_ras = true; 185 push = true; 186 direction = true; 187 pc_next = address_dest; 188 branch_state = BRANCH_STATE_NSPEC_TAKE; 189 break; 190 } 191 case BRANCH_CONDITION_READ_STACK : // l.jr (rb==9) 192 { 193 use_upt = true; 194 use_ras = true; 195 push = false; 196 direction = true; 197 pc_next = PORT_READ(in_PREDICT_RAS_ADDRESS_POP [i]); 198 branch_state = BRANCH_STATE_SPEC_TAKE; 199 break; 200 } 201 default : 202 { 203 ERRORMORPHEO(FUNCTION,"Unknow Condition"); 204 break; 205 } 206 } 207 208 if (use_dir) 209 { 210 ack[context] &= dir_ack; 211 PORT_WRITE(out_PREDICT_DIR_ADDRESS_SRC [i], address_src); 212 PORT_WRITE(out_PREDICT_DIR_STATIC [i], address_dest<address_src); // if destination is previous : the static direction is take 213 // PORT_WRITE(out_PREDICT_DIR_LAST_TAKE [i], PORT_READ(in_PREDICT_BTB_LAST_TAKE [i])); 214 } 215 216 if (use_ras) 217 { 218 ack[context] &= ras_ack; 219 if (_param->_have_port_context_id) 220 PORT_WRITE(out_PREDICT_RAS_CONTEXT_ID [i], context); 221 PORT_WRITE(out_PREDICT_RAS_PUSH [i], push); 222 PORT_WRITE(out_PREDICT_RAS_ADDRESS_PUSH [i], address_src+2); 223 224 is_accurate &= PORT_READ(in_PREDICT_RAS_HIT [i]); // if miss - prediction is not accurate 225 } 226 227 if (use_upt) 228 { 229 ack[context] &= upt_ack; 230 231 if (_param->_have_port_context_id) 232 PORT_WRITE(out_PREDICT_UPT_CONTEXT_ID [i],context); 233 PORT_WRITE(out_PREDICT_UPT_BTB_ADDRESS_SRC [i],address_src); 234 PORT_WRITE(out_PREDICT_UPT_BTB_ADDRESS_DEST [i],address_dest); 235 PORT_WRITE(out_PREDICT_UPT_BTB_CONDITION [i],condition); 236 PORT_WRITE(out_PREDICT_UPT_BTB_LAST_TAKE [i],direction); 237 PORT_WRITE(out_PREDICT_UPT_BTB_IS_ACCURATE [i],is_accurate); 238 // PORT_WRITE(out_PREDICT_UPT_DIR_HISTORY [i],PORT_READ(in_PREDICT_DIR_HISTORY [i])); 239 PORT_WRITE(out_PREDICT_UPT_RAS_ADDRESS [i],PORT_READ(in_PREDICT_RAS_ADDRESS_POP [i])); 240 // PORT_WRITE(out_PREDICT_UPT_RAS_INDEX [i],PORT_READ(in_PREDICT_RAS_INDEX [i])); 241 } 242 243 // ack = 1 if : 244 // * btb_ack 245 // * use_dir and dir_ack 246 // * use_ras and ras_ack 247 // * use_upt and upt_ack 248 // ack [context] = (btb_ack and 249 // (use_dir and dir_ack) and 250 // (use_ras and ras_ack) and 251 // (use_upt and upt_ack)); 252 253 dir_val = (btb_ack and 254 use_dir and 255 // use_ras and 256 // use_upt and 257 // (not use_dir or (use_dir and dir_ack)) and 258 (not use_ras or (use_ras and ras_ack)) and 259 (not use_upt or (use_upt and upt_ack))); 260 261 ras_val = (btb_ack and 262 // use_dir and 263 use_ras and 264 // use_upt and 265 (not use_dir or (use_dir and dir_ack)) and 266 // (not use_ras or (use_ras and ras_ack)) and 267 (not use_upt or (use_upt and upt_ack))); 268 269 upt_val = (btb_ack and 270 // use_dir and 271 // use_ras and 272 use_upt and 273 (not use_dir or (use_dir and dir_ack)) and 274 (not use_ras or (use_ras and ras_ack))// and 275 // (not use_upt or (use_upt and upt_ack)) 276 ); 277 278 // pc_next - is previously computed 279 // branch_state - is previously computed 280 281 Taddress_t address_src_lsb = address_src%_param->_nb_instruction [context]; 282 283 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address_src : 0x%x",address_src); 134 135 Taddress_t address_src = PORT_READ(in_PREDICT_BTB_ADDRESS_SRC [i]); 136 Taddress_t address_src_lsb = address_src%_param->_nb_instruction [context]; 137 138 inst_ifetch_ptr = address_src_lsb; 139 140 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address_src : 0x%.8x (0x%.8x)",address_src,address_src<<2); 284 141 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address_src_lsb : %d",address_src_lsb); 285 142 286 if (address_src_lsb == (_param->_nb_instruction [context]-1)) 143 // Special case : 144 // * BTB hit and the branchement is the PC current and it's the last slot. 145 // -> next pc must be the delay slot 146 if ((not pc_current_is_ds_take) and // if pc_current is ds_take, alors pc_next is the destination of branchement 147 (address_src_lsb == (_param->_nb_instruction [context]-1))) 287 148 { 288 149 // branch is in the last slot of the packet 289 150 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * branch is in the last slot of the packet"); 290 151 152 // Branch is the last slot : next paquet is the delay slot 153 pc_next = address_src+1; // sequencial 154 pc_next_is_ds_take = 1; 291 155 address_msb = _param->_nb_instruction [context]; // == (address_src_lsb+1) 292 pc_next_is_ds_take = 1;156 branch_state = BRANCH_STATE_NONE; 293 157 } 294 158 else 295 159 { 160 Tbranch_condition_t condition = PORT_READ(in_PREDICT_BTB_CONDITION [i]); 161 Taddress_t address_dest = PORT_READ(in_PREDICT_BTB_ADDRESS_DEST [i]); 162 Tcontrol_t push ; 163 Tcontrol_t direction; 164 165 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * condition : %s" ,toString(condition).c_str()); 166 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address_src : 0x%.8x (0x%.8x)",address_src ,address_src <<2); 167 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address_dest : 0x%.8x (0x%.8x)",address_dest,address_dest<<2); 168 169 switch (condition) 170 { 171 case BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK : // l.j 172 { 173 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK"); 174 175 // use none unit (dir, upt and ras) 176 direction = true; 177 pc_next = address_dest; 178 branch_state = BRANCH_STATE_NSPEC_TAKE; 179 break; 180 } 181 case BRANCH_CONDITION_NONE_WITH_WRITE_STACK : // l.jal 182 { 183 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * BRANCH_CONDITION_NONE_WITH_WRITE_STACK"); 184 185 use_upt = true; 186 use_ras = true; 187 push = true; 188 direction = true; 189 pc_next = address_dest; 190 branch_state = BRANCH_STATE_NSPEC_TAKE; 191 break; 192 } 193 case BRANCH_CONDITION_FLAG_UNSET : // l.bnf 194 case BRANCH_CONDITION_FLAG_SET : // l.bf 195 { 196 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * BRANCH_CONDITION_FLAG"); 197 198 use_upt = true; 199 use_dir = true; 200 // Test direction 201 direction = PORT_READ(in_PREDICT_DIR_DIRECTION [i]); // Direction is not the "flag predict" ... also flag_unset and flag_set is the same 202 if (direction = 1) 203 { 204 branch_state = BRANCH_STATE_SPEC_TAKE; 205 pc_next = address_dest; 206 } 207 else 208 { 209 branch_state = BRANCH_STATE_SPEC_NTAKE; 210 pc_next = address_src+2; // +1 = delay slot 211 } 212 break; 213 } 214 case BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK : // l.jr (rb!=9) 215 { 216 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK"); 217 218 use_upt = true; 219 use_ras = true; 220 push = true; 221 direction = true; 222 pc_next = address_dest; 223 branch_state = BRANCH_STATE_SPEC_TAKE; 224 break; 225 } 226 case BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK : // l.jalr 227 { 228 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK"); 229 230 use_upt = true; 231 use_ras = true; 232 push = true; 233 direction = true; 234 pc_next = address_dest; 235 branch_state = BRANCH_STATE_NSPEC_TAKE; 236 break; 237 } 238 case BRANCH_CONDITION_READ_STACK : // l.jr (rb==9) 239 { 240 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * BRANCH_CONDITION_READ_STACK"); 241 use_upt = true; 242 use_ras = true; 243 push = false; 244 direction = true; 245 pc_next = PORT_READ(in_PREDICT_RAS_ADDRESS_POP [i]); 246 branch_state = BRANCH_STATE_SPEC_TAKE; 247 break; 248 } 249 default : 250 { 251 ERRORMORPHEO(FUNCTION,"Unknow Condition"); 252 break; 253 } 254 } 255 256 if (use_dir) 257 { 258 ack[context] &= dir_ack; 259 PORT_WRITE(out_PREDICT_DIR_ADDRESS_SRC [i], address_src); 260 PORT_WRITE(out_PREDICT_DIR_STATIC [i], address_dest<address_src); // if destination is previous : the static direction is take 261 // PORT_WRITE(out_PREDICT_DIR_LAST_TAKE [i], PORT_READ(in_PREDICT_BTB_LAST_TAKE [i])); 262 } 263 264 if (use_ras) 265 { 266 ack[context] &= ras_ack; 267 if (_param->_have_port_context_id) 268 PORT_WRITE(out_PREDICT_RAS_CONTEXT_ID [i], context); 269 PORT_WRITE(out_PREDICT_RAS_PUSH [i], push); 270 PORT_WRITE(out_PREDICT_RAS_ADDRESS_PUSH [i], address_src+2); 271 272 is_accurate &= PORT_READ(in_PREDICT_RAS_HIT [i]); // if miss - prediction is not accurate 273 } 274 275 if (use_upt) 276 { 277 ack[context] &= upt_ack; 278 279 if (_param->_have_port_context_id) 280 PORT_WRITE(out_PREDICT_UPT_CONTEXT_ID [i],context); 281 PORT_WRITE(out_PREDICT_UPT_BTB_ADDRESS_SRC [i],address_src); 282 PORT_WRITE(out_PREDICT_UPT_BTB_ADDRESS_DEST [i],address_dest); 283 PORT_WRITE(out_PREDICT_UPT_BTB_CONDITION [i],condition); 284 PORT_WRITE(out_PREDICT_UPT_BTB_LAST_TAKE [i],direction); 285 PORT_WRITE(out_PREDICT_UPT_BTB_IS_ACCURATE [i],is_accurate); 286 // PORT_WRITE(out_PREDICT_UPT_DIR_HISTORY [i],PORT_READ(in_PREDICT_DIR_HISTORY [i])); 287 PORT_WRITE(out_PREDICT_UPT_RAS_ADDRESS [i],PORT_READ(in_PREDICT_RAS_ADDRESS_POP [i])); 288 // PORT_WRITE(out_PREDICT_UPT_RAS_INDEX [i],PORT_READ(in_PREDICT_RAS_INDEX [i])); 289 } 290 291 // ack = 1 if : 292 // * btb_ack 293 // * use_dir and dir_ack 294 // * use_ras and ras_ack 295 // * use_upt and upt_ack 296 // ack [context] = (btb_ack and 297 // (use_dir and dir_ack) and 298 // (use_ras and ras_ack) and 299 // (use_upt and upt_ack)); 300 301 dir_val = (btb_ack and 302 use_dir and 303 // use_ras and 304 // use_upt and 305 // (not use_dir or (use_dir and dir_ack)) and 306 (not use_ras or (use_ras and ras_ack)) and 307 (not use_upt or (use_upt and upt_ack))); 308 309 ras_val = (btb_ack and 310 // use_dir and 311 use_ras and 312 // use_upt and 313 (not use_dir or (use_dir and dir_ack)) and 314 // (not use_ras or (use_ras and ras_ack)) and 315 (not use_upt or (use_upt and upt_ack))); 316 317 upt_val = (btb_ack and 318 // use_dir and 319 // use_ras and 320 use_upt and 321 (not use_dir or (use_dir and dir_ack)) and 322 (not use_ras or (use_ras and ras_ack))// and 323 // (not use_upt or (use_upt and upt_ack)) 324 ); 325 326 // pc_next - is previously computed 327 // branch_state - is previously computed 328 329 296 330 // branch is in the last slot of the packet 297 331 address_msb = (address_src_lsb+2); // +1 == delayed slot 298 332 pc_next_is_ds_take = 0; 299 333 } 300 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address_msb : %d",address_msb); 301 302 inst_ifetch_ptr = address_src_lsb; 334 303 335 // branch_update_prediction_id = (_param->_have_port_depth)?((PORT_READ(in_DEPTH_UPT_TAIL[context])+PORT_READ(in_DEPTH_UPT_NB_BRANCH [context]))%_param->_array_size_depth[context]):0; 304 336 } … … 308 340 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * BTB miss : sequential order"); 309 341 310 pc_next = address-address_lsb+_param->_nb_instruction [context]; // sequencial 342 // Take the address packet base and add new packet 343 pc_next = pc_current-address_lsb+_param->_nb_instruction [context]; // sequencial 311 344 pc_next_is_ds_take = 0; // no branch, also no delay slot 312 345 inst_ifetch_ptr = 0; … … 316 349 address_msb = _param->_nb_instruction [context]; 317 350 } 318 319 PORT_WRITE(out_PREDICT_PC_NEXT [context] , pc_next ); 320 PORT_WRITE(out_PREDICT_PC_NEXT_IS_DS_TAKE [context] , pc_next_is_ds_take ); 321 322 Taddress_t address_limit_min = address_lsb; 323 Taddress_t address_limit_max = ((pc_current_is_ds_take)?(address_lsb+1):address_msb); 324 325 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * instruction enable :"); 326 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * nb_inst : %d",_param->_nb_instruction [context]); 327 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * [0:%d[ = 0" ,address_limit_min); 328 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * [%d:%d[ = 1",address_limit_min,address_limit_max); 329 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * [%d:%d[ = 0",address_limit_max,_param->_nb_instruction [context]); 330 331 for (uint32_t j=0; j<address_limit_min; j++) 332 PORT_WRITE(out_PREDICT_INSTRUCTION_ENABLE [context][j], 0); // Before the address : not valid 333 for (uint32_t j=address_limit_min; j<address_limit_max; j++) 334 PORT_WRITE(out_PREDICT_INSTRUCTION_ENABLE [context][j], 1); // Vald packet 335 for (uint32_t j=address_limit_max; j<_param->_nb_instruction [context]; j++) 336 PORT_WRITE(out_PREDICT_INSTRUCTION_ENABLE [context][j], 0); // After last address (branch) : not valid 337 if (_param->_have_port_inst_ifetch_ptr) 338 PORT_WRITE(out_PREDICT_INST_IFETCH_PTR [context] , inst_ifetch_ptr ); 339 PORT_WRITE(out_PREDICT_BRANCH_STATE [context] , branch_state ); 340 if (_param->_have_port_depth) 341 PORT_WRITE(out_PREDICT_BRANCH_UPDATE_PREDICTION_ID [context] , PORT_READ(in_PREDICT_UPT_BRANCH_UPDATE_PREDICTION_ID [i])); 351 352 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * address_msb : %d",address_msb); 353 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * pc_next : 0x%.8x (0x%.8x)",pc_next,pc_next<<2); 354 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * pc_next_is_ds_take : %d" ,pc_next_is_ds_take); 355 356 // Write Output 357 PORT_WRITE(out_PREDICT_PC_NEXT [context] , pc_next ); 358 PORT_WRITE(out_PREDICT_PC_NEXT_IS_DS_TAKE [context] , pc_next_is_ds_take ); 359 360 // Create enable mask 361 Taddress_t address_limit_min = address_lsb; 362 Taddress_t address_limit_max = ((pc_current_is_ds_take)?(address_lsb+1):address_msb); 363 364 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * instruction enable :"); 365 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * nb_inst : %d",_param->_nb_instruction [context]); 366 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * [0:%d[ = 0" ,address_limit_min); 367 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * [%d:%d[ = 1",address_limit_min,address_limit_max); 368 log_printf(TRACE,Prediction_unit_Glue,FUNCTION," * [%d:%d[ = 0",address_limit_max,_param->_nb_instruction [context]); 369 370 for (uint32_t j=0; j<address_limit_min; j++) 371 PORT_WRITE(out_PREDICT_INSTRUCTION_ENABLE [context][j], 0); // Before the address : not valid 372 for (uint32_t j=address_limit_min; j<address_limit_max; j++) 373 PORT_WRITE(out_PREDICT_INSTRUCTION_ENABLE [context][j], 1); // Valid packet 374 for (uint32_t j=address_limit_max; j<_param->_nb_instruction [context]; j++) 375 PORT_WRITE(out_PREDICT_INSTRUCTION_ENABLE [context][j], 0); // After last address (branch) : not valid 376 377 if (_param->_have_port_inst_ifetch_ptr) 378 PORT_WRITE(out_PREDICT_INST_IFETCH_PTR [context] , inst_ifetch_ptr ); 379 PORT_WRITE(out_PREDICT_BRANCH_STATE [context] , branch_state ); 380 if (_param->_have_port_depth) 381 PORT_WRITE(out_PREDICT_BRANCH_UPDATE_PREDICTION_ID [context] , PORT_READ(in_PREDICT_UPT_BRANCH_UPDATE_PREDICTION_ID [i])); 342 382 } 343 383 … … 348 388 PORT_WRITE(out_PREDICT_UPT_VAL [i], upt_val); 349 389 } 350 390 391 // Write output 351 392 for (uint32_t i=0; i<_param->_nb_context; i++) 352 393 PORT_WRITE(out_PREDICT_ACK[i],ack[i]); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/SelfTest/src/test.cpp
r95 r100 125 125 126 126 // Initialisation 127 127 const bool test1 = true; 128 const bool test2 = true; 129 const bool test3 = true; 130 const bool test4 = true; 131 128 132 const uint32_t seed = 0; 129 133 //const uint32_t seed = static_cast<uint32_t>(time(NULL)); … … 144 148 { 145 149 LABEL("Iteration %d",iteration); 146 147 if ( 1)150 151 if (test1) 148 152 { 149 uint32_t port = rand()%_param->_nb_inst_predict; 150 151 LABEL("PREDICT - PUSH"); 153 uint32_t port = rand()%_param->_nb_inst_predict; 154 155 LABEL("PREDICT - PUSH"); 156 157 in_PREDICT_VAL [port]->write(1); 158 in_PREDICT_PUSH [port]->write(1); 159 160 for (uint32_t i=0; i<_param->_nb_context; i++) 161 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 162 { 163 in_PREDICT_CONTEXT_ID [port]->write(i); 164 in_PREDICT_ADDRESS_PUSH [port]->write(0xdeadbeef+j); 165 166 SC_START(0); 167 168 TEST(Tcontrol_t, out_PREDICT_ACK [port]->read(), 1); 169 TEST(Tptr_t , out_PREDICT_INDEX[port]->read(),(j+1)%_param->_size_queue[i]); 170 171 SC_START(1); 172 173 } 174 in_PREDICT_VAL [port]->write(0); 175 176 SC_START(1); 177 178 in_PREDICT_VAL [port]->write(1); 179 in_PREDICT_PUSH [port]->write(1); 180 for (uint32_t i=0; i<_param->_nb_context; i++) 181 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 182 { 183 in_PREDICT_CONTEXT_ID [port]->write(i); 184 in_PREDICT_ADDRESS_PUSH [port]->write(0x21071981+j); 185 186 SC_START(0); 187 188 TEST(Tcontrol_t, out_PREDICT_ACK [port]->read(), 1); 189 TEST(Tptr_t , out_PREDICT_INDEX [port]->read(),(j+1)%_param->_size_queue[i]); 190 TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port]->read(),0xdeadbeef+j); 191 192 SC_START(1); 193 } 194 in_PREDICT_VAL [port]->write(0); 195 196 LABEL("PREDICT - POP"); 197 198 in_PREDICT_VAL [port]->write(1); 199 in_PREDICT_PUSH [port]->write(0); 200 for (uint32_t i=0; i<_param->_nb_context; i++) 201 for (uint32_t j=0; j< _param->_size_queue[i]; j++) 202 { 203 in_PREDICT_CONTEXT_ID [port]->write(i); 204 in_PREDICT_ADDRESS_PUSH [port]->write(0xbabedead); 205 206 SC_START(0); 207 208 TEST(Tcontrol_t, out_PREDICT_ACK [port]->read(), 1); 209 TEST(Tcontrol_t, out_PREDICT_HIT [port]->read(), 1); 210 uint32_t k=(_param->_size_queue[i]-j)%_param->_size_queue[i]; 211 TEST(Tptr_t , out_PREDICT_INDEX [port]->read(), k); 212 TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port]->read(),(0x21071981+((k==0)?(_param->_size_queue[i]-1):(k-1)))); 213 214 SC_START(1); 215 } 216 in_PREDICT_VAL [port]->write(0); 217 218 // Now, the stack is empty 219 } 220 221 if (test2) 222 { 223 uint32_t port = rand()%_param->_nb_inst_decod; 224 225 LABEL("DECOD - without predict"); 226 227 LABEL("DECOD - PUSH"); 228 229 in_DECOD_VAL [port]->write(1); 230 in_DECOD_PUSH [port]->write(1); 231 in_DECOD_MISS_PREDICTION [port]->write(0); 232 233 for (uint32_t i=0; i<_param->_nb_context; i++) 234 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 235 { 236 in_DECOD_CONTEXT_ID [port]->write(i); 237 in_DECOD_ADDRESS_PUSH [port]->write(0xbeefcaca+j); 238 239 SC_START(0); 240 241 TEST(Tcontrol_t, out_DECOD_ACK [port]->read(), 1); 242 TEST(Tptr_t , out_DECOD_INDEX[port]->read(),(j+1)%_param->_size_queue[i]); 243 244 SC_START(1); 245 246 } 247 in_DECOD_VAL [port]->write(0); 152 248 153 in_PREDICT_VAL [port]->write(1); 154 in_PREDICT_PUSH [port]->write(1); 155 for (uint32_t i=0; i<_param->_nb_context; i++) 156 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 157 { 158 in_PREDICT_CONTEXT_ID [port]->write(i); 159 in_PREDICT_ADDRESS_PUSH [port]->write(0xdeadbeef+j); 160 161 SC_START(0); 162 163 TEST(Tcontrol_t, out_PREDICT_ACK [port]->read(), 1); 164 TEST(Tptr_t , out_PREDICT_INDEX[port]->read(),(j+1)%_param->_size_queue[i]); 165 166 SC_START(1); 167 168 } 169 in_PREDICT_VAL [port]->write(0); 170 171 SC_START(1); 172 173 in_PREDICT_VAL [port]->write(1); 174 in_PREDICT_PUSH [port]->write(1); 175 for (uint32_t i=0; i<_param->_nb_context; i++) 176 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 177 { 178 in_PREDICT_CONTEXT_ID [port]->write(i); 179 in_PREDICT_ADDRESS_PUSH [port]->write(0x21071981+j); 180 181 SC_START(0); 182 183 TEST(Tcontrol_t, out_PREDICT_ACK [port]->read(), 1); 184 TEST(Tptr_t , out_PREDICT_INDEX [port]->read(),(j+1)%_param->_size_queue[i]); 185 TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port]->read(),0xdeadbeef+j); 186 187 SC_START(1); 188 } 189 in_PREDICT_VAL [port]->write(0); 190 191 LABEL("PREDICT - POP"); 192 193 in_PREDICT_VAL [port]->write(1); 194 in_PREDICT_PUSH [port]->write(0); 195 for (uint32_t i=0; i<_param->_nb_context; i++) 196 for (uint32_t j=0; j< _param->_size_queue[i]; j++) 197 { 198 in_PREDICT_CONTEXT_ID [port]->write(i); 199 in_PREDICT_ADDRESS_PUSH [port]->write(0xbabedead); 200 201 SC_START(0); 202 203 TEST(Tcontrol_t, out_PREDICT_ACK [port]->read(), 1); 204 TEST(Tcontrol_t, out_PREDICT_HIT [port]->read(), 1); 205 uint32_t k=(_param->_size_queue[i]-j)%_param->_size_queue[i]; 206 TEST(Tptr_t , out_PREDICT_INDEX [port]->read(), k); 207 TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port]->read(),(0x21071981+((k==0)?(_param->_size_queue[i]-1):(k-1)))); 208 209 SC_START(1); 210 } 211 in_PREDICT_VAL [port]->write(0); 212 } 213 214 // Now, the stack is empty 215 216 if (1) 217 { 218 uint32_t port1 = rand()%_param->_nb_inst_decod; 219 uint32_t port2 = rand()%_param->_nb_inst_predict; 220 221 LABEL("DECOD - without predict"); 222 223 LABEL("DECOD - PUSH"); 224 225 in_DECOD_VAL [port1]->write(1); 226 in_DECOD_PUSH [port1]->write(1); 227 in_DECOD_MISS_PREDICTION [port1]->write(0); 228 229 for (uint32_t i=0; i<_param->_nb_context; i++) 230 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 231 { 232 in_DECOD_CONTEXT_ID [port1]->write(i); 233 in_DECOD_ADDRESS_PUSH [port1]->write(0xbeefcaca+j); 234 235 SC_START(0); 236 237 TEST(Tcontrol_t, out_DECOD_ACK [port1]->read(), 1); 238 TEST(Tptr_t , out_DECOD_INDEX[port1]->read(),(j+1)%_param->_size_queue[i]); 239 240 SC_START(1); 241 242 } 243 in_DECOD_VAL [port1]->write(0); 244 245 SC_START(1); 246 247 in_DECOD_VAL [port1]->write(1); 248 in_DECOD_PUSH [port1]->write(1); 249 for (uint32_t i=0; i<_param->_nb_context; i++) 250 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 251 { 252 in_DECOD_CONTEXT_ID [port1]->write(i); 253 in_DECOD_ADDRESS_PUSH [port1]->write(0x21071981+j); 254 255 SC_START(0); 256 257 TEST(Tcontrol_t, out_DECOD_ACK [port1]->read(), 1); 258 TEST(Tptr_t , out_DECOD_INDEX [port1]->read(),(j+1)%_param->_size_queue[i]); 259 TEST(Taddress_t, out_DECOD_ADDRESS_POP[port1]->read(),0xbeefcaca+j); 260 261 SC_START(1); 262 } 263 in_DECOD_VAL [port1]->write(0); 264 265 LABEL("DECOD - POP"); 266 267 in_DECOD_VAL [port1]->write(1); 268 in_DECOD_PUSH [port1]->write(0); 269 for (uint32_t i=0; i<_param->_nb_context; i++) 270 for (uint32_t j=0; j< _param->_size_queue[i]; j++) 271 { 272 in_DECOD_CONTEXT_ID [port1]->write(i); 273 in_DECOD_ADDRESS_PUSH [port1]->write(0xbabedead); 274 275 SC_START(0); 276 277 TEST(Tcontrol_t, out_DECOD_ACK [port1]->read(), 1); 278 TEST(Tcontrol_t, out_DECOD_HIT [port1]->read(), 1); 279 uint32_t k=(_param->_size_queue[i]-j)%_param->_size_queue[i]; 280 TEST(Tptr_t , out_DECOD_INDEX [port1]->read(), k); 281 TEST(Taddress_t, out_DECOD_ADDRESS_POP[port1]->read(),(0x21071981+((k==0)?(_param->_size_queue[i]-1):(k-1)))); 282 283 SC_START(1); 284 } 285 in_DECOD_VAL [port1]->write(0); 286 287 LABEL("DECOD - with predict"); 288 289 LABEL("DECOD - PUSH (size_queue/2)"); 290 291 in_DECOD_VAL [port1]->write(1); 292 in_DECOD_PUSH [port1]->write(1); 293 in_DECOD_MISS_PREDICTION [port1]->write(1); 294 295 for (uint32_t i=0; i<_param->_nb_context; i++) 296 for (uint32_t j=0; j<_param->_size_queue[i]/2;j++) 297 { 298 in_DECOD_CONTEXT_ID [port1]->write(i); 299 in_DECOD_ADDRESS_PUSH [port1]->write(0x01234567+j); 300 301 SC_START(0); 302 303 TEST(Tcontrol_t, out_DECOD_ACK [port1]->read(), 1); 304 TEST(Tptr_t , out_DECOD_INDEX[port1]->read(),(j+1)%_param->_size_queue[i]); 305 306 SC_START(1); 307 308 } 309 in_DECOD_VAL [port1]->write(0); 310 311 LABEL("PREDICT - PUSH (size_queue/2)"); 312 313 in_PREDICT_VAL [port2]->write(1); 314 in_PREDICT_PUSH [port2]->write(1); 315 316 for (uint32_t i=0; i<_param->_nb_context; i++) 317 for (uint32_t j=0; j<_param->_size_queue[i]/2;j++) 318 { 319 in_PREDICT_CONTEXT_ID [port2]->write(i); 320 in_PREDICT_ADDRESS_PUSH [port2]->write((0x89abcdef+j)+(_param->_size_queue[i]/2)); 321 322 SC_START(0); 323 324 TEST(Tcontrol_t, out_PREDICT_ACK [port2]->read(), 1); 325 TEST(Tptr_t , out_PREDICT_INDEX[port2]->read(),(j+1+(_param->_size_queue[i]/2))%_param->_size_queue[i]); 326 327 SC_START(1); 328 } 329 330 in_PREDICT_VAL [port2]->write(0); 331 332 LABEL("PREDICT - POP (size_queue/2)"); 333 334 in_PREDICT_VAL [port2]->write(1); 335 in_PREDICT_PUSH [port2]->write(0); 336 for (uint32_t i=0; i<_param->_nb_context; i++) 337 { 338 for (uint32_t j=0; j< _param->_size_queue[i]/2; j++) 339 { 340 in_PREDICT_CONTEXT_ID [port2]->write(i); 341 in_PREDICT_ADDRESS_PUSH [port2]->write(0xbabedead); 342 343 SC_START(0); 344 345 TEST(Tcontrol_t, out_PREDICT_ACK [port2]->read(), 1); 346 TEST(Tcontrol_t, out_PREDICT_HIT [port2]->read(), 1); 347 uint32_t k= (_param->_size_queue[i]-j)%_param->_size_queue[i]; 348 TEST(Tptr_t , out_PREDICT_INDEX [port2]->read(), k); 349 350 Taddress_t res = (0x89abcdef+((k==0)?(_param->_size_queue[i]-1):(k-1))); 351 LABEL("k : %d",k); 352 LABEL("res : %x",res); 353 LABEL("@_pop : %x",out_PREDICT_ADDRESS_POP[port2]->read()); 354 355 TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port2]->read(),res); 356 357 SC_START(1); 358 } 359 360 for (uint32_t j=0; j< _param->_size_queue[i]/2; j++) 361 { 362 in_PREDICT_CONTEXT_ID [port2]->write(i); 363 in_PREDICT_ADDRESS_PUSH [port2]->write(0xbabedead); 364 365 SC_START(0); 366 367 TEST(Tcontrol_t, out_PREDICT_ACK [port2]->read(), 1); 368 TEST(Tcontrol_t, out_PREDICT_HIT [port2]->read(), 1); 369 uint32_t k=(_param->_size_queue[i]/2-j)%_param->_size_queue[i]; 370 TEST(Tptr_t , out_PREDICT_INDEX [port2]->read(), k); 371 372 Taddress_t res = (0x01234567+((k==0)?(_param->_size_queue[i]/2-1):(k-1))); 373 374 LABEL("k : %d",k); 375 LABEL("res : %x",res); 376 LABEL("@_pop : %x",out_PREDICT_ADDRESS_POP[port2]->read()); 377 378 TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port2]->read(),res); 379 380 SC_START(1); 381 } 382 } 383 384 in_PREDICT_VAL [port2]->write(0); 385 386 in_DECOD_VAL [port1]->write(1); 387 in_DECOD_PUSH [port1]->write(0); 388 in_DECOD_MISS_PREDICTION [port1]->write(0); 389 390 for (uint32_t i=0; i<_param->_nb_context; i++) 391 { 392 for (uint32_t j=0; j< _param->_size_queue[i]/2; j++) 393 { 394 in_DECOD_CONTEXT_ID [port1]->write(i); 395 in_DECOD_ADDRESS_PUSH [port1]->write(0xbabedead); 396 397 SC_START(0); 398 399 TEST(Tcontrol_t, out_DECOD_ACK [port1]->read(), 1); 400 TEST(Tcontrol_t, out_DECOD_HIT [port1]->read(), 1); 401 uint32_t k=(_param->_size_queue[i]/2-j)%_param->_size_queue[i]; 402 TEST(Tptr_t , out_DECOD_INDEX [port1]->read(), k); 403 404 Taddress_t res = (0x01234567+((k==0)?(_param->_size_queue[i]/2-1):(k-1))); 405 406 LABEL("k : %d",k); 407 LABEL("res : %x",res); 408 LABEL("@_pop : %x",out_DECOD_ADDRESS_POP[port1]->read()); 409 410 TEST(Taddress_t, out_DECOD_ADDRESS_POP[port1]->read(),res); 411 412 SC_START(1); 413 } 414 } 415 416 in_DECOD_VAL [port1]->write(0); 249 SC_START(1); 250 251 in_DECOD_VAL [port]->write(1); 252 in_DECOD_PUSH [port]->write(1); 253 for (uint32_t i=0; i<_param->_nb_context; i++) 254 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 255 { 256 in_DECOD_CONTEXT_ID [port]->write(i); 257 in_DECOD_ADDRESS_PUSH [port]->write(0x21071981+j); 258 259 SC_START(0); 260 261 TEST(Tcontrol_t, out_DECOD_ACK [port]->read(), 1); 262 TEST(Tptr_t , out_DECOD_INDEX [port]->read(),(j+1)%_param->_size_queue[i]); 263 TEST(Taddress_t, out_DECOD_ADDRESS_POP[port]->read(),0xbeefcaca+j); 264 265 SC_START(1); 266 } 267 in_DECOD_VAL [port]->write(0); 268 269 LABEL("DECOD - POP"); 270 271 in_DECOD_VAL [port]->write(1); 272 in_DECOD_PUSH [port]->write(0); 273 for (uint32_t i=0; i<_param->_nb_context; i++) 274 for (uint32_t j=0; j< _param->_size_queue[i]; j++) 275 { 276 in_DECOD_CONTEXT_ID [port]->write(i); 277 in_DECOD_ADDRESS_PUSH [port]->write(0xbabedead); 278 279 SC_START(0); 280 281 TEST(Tcontrol_t, out_DECOD_ACK [port]->read(), 1); 282 TEST(Tcontrol_t, out_DECOD_HIT [port]->read(), 1); 283 uint32_t k=(_param->_size_queue[i]-j)%_param->_size_queue[i]; 284 TEST(Tptr_t , out_DECOD_INDEX [port]->read(), k); 285 TEST(Taddress_t, out_DECOD_ADDRESS_POP[port]->read(),(0x21071981+((k==0)?(_param->_size_queue[i]-1):(k-1)))); 286 287 SC_START(1); 288 } 289 in_DECOD_VAL [port]->write(0); 290 // Now, the stack is empty 291 } 292 293 if (test3) 294 { 295 uint32_t port1 = rand()%_param->_nb_inst_predict; 296 uint32_t port2 = rand()%_param->_nb_inst_decod; 297 uint32_t port3 = rand()%_param->_nb_inst_update; 298 299 LABEL("Test UPDATE"); 300 301 LABEL("Predict"); 302 in_PREDICT_VAL [port1]->write(1); 303 in_PREDICT_PUSH [port1]->write(1); 304 for (uint32_t i=0; i<_param->_nb_context; i++) 305 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 306 { 307 in_PREDICT_CONTEXT_ID [port1]->write(i); 308 in_PREDICT_ADDRESS_PUSH [port1]->write(0x25071959+j); 309 310 SC_START(0); 311 312 TEST(Tcontrol_t, out_PREDICT_ACK [port1]->read(), 1); 313 TEST(Tptr_t , out_PREDICT_INDEX [port1]->read(),(j+1)%_param->_size_queue[i]); 314 // TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port1]->read(),0xdeadbeef+j); 315 316 SC_START(1); 317 } 318 in_PREDICT_VAL [port1]->write(0); 319 320 LABEL("Decod"); 321 in_DECOD_VAL [port2]->write(1); 322 in_DECOD_PUSH [port2]->write(1); 323 for (uint32_t i=0; i<_param->_nb_context; i++) 324 for (uint32_t j=0; j<_param->_size_queue[i]/2; j++) 325 { 326 in_DECOD_CONTEXT_ID [port2]->write(i); 327 in_DECOD_ADDRESS_PUSH [port2]->write(0x25071959+j); 328 in_DECOD_MISS_PREDICTION [port2]->write(0); 329 330 SC_START(0); 331 332 TEST(Tcontrol_t, out_DECOD_ACK [port2]->read(), 1); 333 TEST(Tptr_t , out_DECOD_INDEX [port2]->read(),(j+1)%_param->_size_queue[i]); 334 TEST(Taddress_t, out_DECOD_ADDRESS_POP[port2]->read(),0x25071959+j); 335 336 SC_START(1); 337 } 338 in_DECOD_VAL [port2]->write(0); 339 340 LABEL("Update Decod OK"); 341 in_UPDATE_VAL [port3]->write(1); 342 in_UPDATE_PUSH [port3]->write(1); 343 in_UPDATE_FLUSH[port3]->write(0); 344 for (uint32_t i=0; i<_param->_nb_context; i++) 345 for (uint32_t j=0; j<_param->_size_queue[i]/2; j++) 346 { 347 uint32_t x=(_param->_size_queue[i]/2)-1; 348 in_UPDATE_CONTEXT_ID [port3]->write(i); 349 in_UPDATE_MISS_PREDICTION [port3]->write(0); 350 in_UPDATE_PREDICTION_IFETCH [port3]->write(0); 351 in_UPDATE_INDEX [port3]->write((x+1)%_param->_size_queue[i]); 352 in_UPDATE_ADDRESS [port3]->write(0x25071959+x); 353 354 SC_START(0); 355 356 TEST(Tcontrol_t, out_UPDATE_ACK [port3]->read(), 1); 357 358 SC_START(1); 359 } 360 in_UPDATE_VAL [port3]->write(0); 361 362 LABEL("Update FLUSH"); 363 in_UPDATE_VAL [port3]->write(1); 364 in_UPDATE_FLUSH[port3]->write(1); 365 for (uint32_t i=0; i<_param->_nb_context; i++) 366 for (uint32_t j=0; j<_param->_size_queue[i]/2; j++) 367 { 368 in_UPDATE_CONTEXT_ID [port3]->write(i); 369 SC_START(1); 370 TEST(Tcontrol_t, out_UPDATE_ACK [port3]->read(), 1); 371 } 372 in_UPDATE_VAL [port3]->write(0); 373 374 375 // Tcontrol_t, in_UPDATE_VAL 376 // Tcontrol_t,out_UPDATE_ACK 377 // Tcontext_t, in_UPDATE_CONTEXT_ID 378 // Tcontrol_t, in_UPDATE_PUSH 379 // Tcontrol_t, in_UPDATE_FLUSH 380 // Tptr_t , in_UPDATE_INDEX 381 // Taddress_t, in_UPDATE_ADDRESS 382 // Tcontrol_t, in_UPDATE_MISS_PREDICTION 383 // Tcontrol_t, in_UPDATE_PREDICTION_IFETCH 384 385 386 } 387 388 if (test4) 389 { 390 uint32_t port1 = rand()%_param->_nb_inst_predict; 391 uint32_t port2 = rand()%_param->_nb_inst_decod; 392 uint32_t port3 = rand()%_param->_nb_inst_update; 393 394 LABEL("Test UPDATE"); 395 396 LABEL("Predict"); 397 in_PREDICT_VAL [port1]->write(1); 398 in_PREDICT_PUSH [port1]->write(1); 399 for (uint32_t i=0; i<_param->_nb_context; i++) 400 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 401 { 402 in_PREDICT_CONTEXT_ID [port1]->write(i); 403 in_PREDICT_ADDRESS_PUSH [port1]->write(0x14011959+j); 404 405 SC_START(0); 406 407 TEST(Tcontrol_t, out_PREDICT_ACK [port1]->read(), 1); 408 TEST(Tptr_t , out_PREDICT_INDEX [port1]->read(),(j+1)%_param->_size_queue[i]); 409 // TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port1]->read(),0xdeadbeef+j); 410 411 SC_START(1); 412 } 413 in_PREDICT_VAL [port1]->write(0); 414 415 LABEL("Decod"); 416 in_DECOD_VAL [port2]->write(1); 417 in_DECOD_PUSH [port2]->write(1); 418 for (uint32_t i=0; i<_param->_nb_context; i++) 419 for (uint32_t j=0; j<_param->_size_queue[i]/2; j++) 420 { 421 in_DECOD_CONTEXT_ID [port2]->write(i); 422 in_DECOD_ADDRESS_PUSH [port2]->write(0x14011959+j); 423 in_DECOD_MISS_PREDICTION [port2]->write(0); 424 425 SC_START(0); 426 427 TEST(Tcontrol_t, out_DECOD_ACK [port2]->read(), 1); 428 TEST(Tptr_t , out_DECOD_INDEX [port2]->read(),(j+1)%_param->_size_queue[i]); 429 TEST(Taddress_t, out_DECOD_ADDRESS_POP[port2]->read(),0x14011959+j); 430 431 SC_START(1); 432 } 433 in_DECOD_VAL [port2]->write(0); 434 435 LABEL("Update Decod KO"); 436 in_UPDATE_VAL [port3]->write(1); 437 in_UPDATE_PUSH [port3]->write(1); 438 in_UPDATE_FLUSH[port3]->write(0); 439 for (uint32_t i=0; i<_param->_nb_context; i++) 440 for (uint32_t j=0; j<_param->_size_queue[i]/2; j++) 441 { 442 uint32_t x=(_param->_size_queue[i]/2); 443 in_UPDATE_CONTEXT_ID [port3]->write(i); 444 in_UPDATE_MISS_PREDICTION [port3]->write(1); 445 in_UPDATE_PREDICTION_IFETCH [port3]->write(0); 446 in_UPDATE_INDEX [port3]->write((x-j)%_param->_size_queue[i]); 447 in_UPDATE_ADDRESS [port3]->write(0xffffffff+x); 448 449 SC_START(0); 450 451 TEST(Tcontrol_t, out_UPDATE_ACK [port3]->read(), 1); 452 453 SC_START(1); 454 } 455 in_UPDATE_VAL [port3]->write(0); 456 457 LABEL("Decod"); 458 in_DECOD_VAL [port2]->write(1); 459 in_DECOD_PUSH [port2]->write(1); 460 for (uint32_t i=0; i<_param->_nb_context; i++) 461 for (uint32_t j=0; j<_param->_size_queue[i]/2; j++) 462 { 463 in_DECOD_CONTEXT_ID [port2]->write(i); 464 in_DECOD_ADDRESS_PUSH [port2]->write(0x14011959+j); 465 in_DECOD_MISS_PREDICTION [port2]->write(0); 466 467 SC_START(0); 468 469 TEST(Tcontrol_t, out_DECOD_ACK [port2]->read(), 1); 470 TEST(Tptr_t , out_DECOD_INDEX [port2]->read(),(j+1)%_param->_size_queue[i]); 471 TEST(Taddress_t, out_DECOD_ADDRESS_POP[port2]->read(),0x14011959+j); 472 473 SC_START(1); 474 } 475 in_DECOD_VAL [port2]->write(0); 476 477 478 LABEL("Update Decod KO"); 479 in_UPDATE_VAL [port3]->write(1); 480 in_UPDATE_PUSH [port3]->write(1); 481 in_UPDATE_FLUSH[port3]->write(0); 482 for (uint32_t i=0; i<_param->_nb_context; i++) 483 for (uint32_t j=0; j<_param->_size_queue[i]/2; j++) 484 { 485 uint32_t x=(_param->_size_queue[i]/2); 486 in_UPDATE_CONTEXT_ID [port3]->write(i); 487 in_UPDATE_MISS_PREDICTION [port3]->write(1); 488 in_UPDATE_PREDICTION_IFETCH [port3]->write(0); 489 in_UPDATE_INDEX [port3]->write((x-j)%_param->_size_queue[i]); 490 in_UPDATE_ADDRESS [port3]->write(0xffffffff+x); 491 492 SC_START(0); 493 494 TEST(Tcontrol_t, out_UPDATE_ACK [port3]->read(), 1); 495 496 SC_START(1); 497 } 498 in_UPDATE_VAL [port3]->write(0); 499 500 LABEL("Update Predict KO"); 501 in_UPDATE_VAL [port3]->write(1); 502 in_UPDATE_PUSH [port3]->write(1); 503 in_UPDATE_FLUSH[port3]->write(0); 504 for (uint32_t i=0; i<_param->_nb_context; i++) 505 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 506 { 507 uint32_t x=(_param->_size_queue[i]); 508 in_UPDATE_CONTEXT_ID [port3]->write(i); 509 in_UPDATE_MISS_PREDICTION [port3]->write(1); 510 in_UPDATE_PREDICTION_IFETCH [port3]->write(1); 511 in_UPDATE_INDEX [port3]->write((x-j)%_param->_size_queue[i]); 512 in_UPDATE_ADDRESS [port3]->write(0xffffffff+x); 513 514 SC_START(0); 515 516 TEST(Tcontrol_t, out_UPDATE_ACK [port3]->read(), 1); 517 518 SC_START(1); 519 } 520 in_UPDATE_VAL [port3]->write(0); 521 522 LABEL("Predict"); 523 in_PREDICT_VAL [port1]->write(1); 524 in_PREDICT_PUSH [port1]->write(1); 525 for (uint32_t i=0; i<_param->_nb_context; i++) 526 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 527 { 528 in_PREDICT_CONTEXT_ID [port1]->write(i); 529 in_PREDICT_ADDRESS_PUSH [port1]->write(0x14011959+j); 530 531 SC_START(0); 532 533 TEST(Tcontrol_t, out_PREDICT_ACK [port1]->read(), 1); 534 TEST(Tptr_t , out_PREDICT_INDEX [port1]->read(),(j+1)%_param->_size_queue[i]); 535 TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port1]->read(),0x14011959+j); 536 537 SC_START(1); 538 } 539 in_PREDICT_VAL [port1]->write(0); 540 541 LABEL("Update Predict KO"); 542 in_UPDATE_VAL [port3]->write(1); 543 in_UPDATE_PUSH [port3]->write(0); 544 in_UPDATE_FLUSH[port3]->write(0); 545 for (uint32_t i=0; i<_param->_nb_context; i++) 546 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 547 { 548 uint32_t x=(_param->_size_queue[i]); 549 in_UPDATE_CONTEXT_ID [port3]->write(i); 550 in_UPDATE_MISS_PREDICTION [port3]->write(1); 551 in_UPDATE_PREDICTION_IFETCH [port3]->write(1); 552 in_UPDATE_INDEX [port3]->write((x+j+1)%_param->_size_queue[i]); 553 in_UPDATE_ADDRESS [port3]->write(0x87654321+j); 554 555 SC_START(0); 556 557 TEST(Tcontrol_t, out_UPDATE_ACK [port3]->read(), 1); 558 559 SC_START(1); 560 } 561 in_UPDATE_VAL [port3]->write(0); 562 563 LABEL("Predict"); 564 in_PREDICT_VAL [port1]->write(1); 565 in_PREDICT_PUSH [port1]->write(1); 566 for (uint32_t i=0; i<_param->_nb_context; i++) 567 for (uint32_t j=0; j<_param->_size_queue[i]; j++) 568 { 569 in_PREDICT_CONTEXT_ID [port1]->write(i); 570 in_PREDICT_ADDRESS_PUSH [port1]->write(0x14011959+j); 571 572 SC_START(0); 573 574 TEST(Tcontrol_t, out_PREDICT_ACK [port1]->read(), 1); 575 TEST(Tptr_t , out_PREDICT_INDEX [port1]->read(),(j+1)%_param->_size_queue[i]); 576 TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port1]->read(),0x87654321+j); 577 578 SC_START(1); 579 } 580 in_PREDICT_VAL [port1]->write(0); 581 582 LABEL("Update FLUSH"); 583 in_UPDATE_VAL [port3]->write(1); 584 in_UPDATE_FLUSH[port3]->write(1); 585 for (uint32_t i=0; i<_param->_nb_context; i++) 586 for (uint32_t j=0; j<_param->_size_queue[i]/2; j++) 587 { 588 in_UPDATE_CONTEXT_ID [port3]->write(i); 589 SC_START(1); 590 TEST(Tcontrol_t, out_UPDATE_ACK [port3]->read(), 1); 591 } 592 in_UPDATE_VAL [port3]->write(0); 417 593 } 418 594 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/include/Return_Address_Stack.h
r95 r100 88 88 public : SC_IN (Tcontext_t) ** in_UPDATE_CONTEXT_ID ; //[nb_inst_update] 89 89 public : SC_IN (Tcontrol_t) ** in_UPDATE_PUSH ; //[nb_inst_update] 1 = push, else pop 90 public : SC_IN (Tcontrol_t) ** in_UPDATE_FLUSH ; //[nb_inst_update] 1 = push, else pop90 public : SC_IN (Tcontrol_t) ** in_UPDATE_FLUSH ; //[nb_inst_update] 91 91 public : SC_IN (Taddress_t) ** in_UPDATE_ADDRESS ; //[nb_inst_update] 92 92 public : SC_IN (Tptr_t ) ** in_UPDATE_INDEX ; //[nb_inst_update] … … 99 99 private : ras_entry_t ** reg_stack ; //[nb_context][size_queue] 100 100 private : Tptr_t * reg_TOP ; //[nb_context] 101 101 //private : Tptr_t * reg_BOTTOM ; //[nb_context] 102 102 private : Tptr_t * reg_NB_ELT ; //[nb_context] 103 103 private : Tptr_t * reg_PREDICT_TOP ; //[nb_context] 104 104 //private : Tptr_t * reg_PREDICT_BOTTOM; //[nb_context] 105 105 private : Tptr_t * reg_PREDICT_NB_ELT; //[nb_context] 106 106 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/include/Types.h
r81 r100 21 21 class ras_entry_t 22 22 { 23 24 25 23 //public : bool _val ; 24 //public : bool _predict; 25 //public : bool _miss ; 26 26 public : Taddress_t _address; 27 27 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_allocation.cpp
r95 r100 107 107 108 108 reg_TOP = new Tptr_t [_param->_nb_context]; 109 109 // reg_BOTTOM = new Tptr_t [_param->_nb_context]; 110 110 reg_NB_ELT = new Tptr_t [_param->_nb_context]; 111 111 112 112 reg_PREDICT_TOP = new Tptr_t [_param->_nb_context]; 113 113 // reg_PREDICT_BOTTOM = new Tptr_t [_param->_nb_context]; 114 114 reg_PREDICT_NB_ELT = new Tptr_t [_param->_nb_context]; 115 115 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_deallocation.cpp
r95 r100 64 64 delete [] reg_stack; 65 65 delete [] reg_TOP; 66 66 // delete [] reg_BOTTOM; 67 67 delete [] reg_NB_ELT; 68 68 delete [] reg_PREDICT_TOP; 69 69 // delete [] reg_PREDICT_BOTTOM; 70 70 delete [] reg_PREDICT_NB_ELT; 71 71 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_genMealy_decod.cpp
r81 r100 22 22 void Return_Address_Stack::genMealy_decod (void) 23 23 { 24 log_printf(FUNC,Return_Address_Stack,FUNCTION,"Begin"); 24 log_begin(Return_Address_Stack,FUNCTION); 25 log_function(Return_Address_Stack,FUNCTION,_name.c_str()); 25 26 26 27 #ifdef DEBUG_TEST 28 // just to test if have many transaction on a same context 27 29 bool context_valid [_param->_nb_context]; 28 30 for (uint32_t i=0; i<_param->_nb_context; i++) … … 32 34 for (uint32_t i=0; i<_param->_nb_inst_decod; i++) 33 35 { 36 // Read context number 34 37 Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_DECOD_CONTEXT_ID [i]):0; 35 38 … … 49 52 // if pop : val and not miss 50 53 // when the predictor : if hit = 0, wait (is not accurate) 51 internal_DECOD_HIT [i] = (push or (reg_ stack[context][top]._val and not reg_stack[context][top]._miss and (reg_NB_ELT[context]>0)));54 internal_DECOD_HIT [i] = (push or (reg_NB_ELT[context]>0)); 52 55 PORT_WRITE(out_DECOD_HIT [i], internal_DECOD_HIT [i]); 53 56 … … 61 64 } 62 65 63 log_ printf(FUNC,Return_Address_Stack,FUNCTION,"End");66 log_end(Return_Address_Stack,FUNCTION); 64 67 }; 65 68 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_genMealy_predict.cpp
r81 r100 22 22 void Return_Address_Stack::genMealy_predict (void) 23 23 { 24 log_printf(FUNC,Return_Address_Stack,FUNCTION,"Begin"); 24 log_begin(Return_Address_Stack,FUNCTION); 25 log_function(Return_Address_Stack,FUNCTION,_name.c_str()); 25 26 26 27 #ifdef DEBUG_TEST 28 // just to test if have many transaction on a same context 27 29 bool context_valid [_param->_nb_context]; 28 30 for (uint32_t i=0; i<_param->_nb_context; i++) … … 32 34 for (uint32_t i=0; i<_param->_nb_inst_predict; i++) 33 35 { 36 // Read context number 34 37 Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_PREDICT_CONTEXT_ID [i]):0; 35 38 36 39 #ifdef DEBUG_TEST 37 40 if (PORT_READ(in_PREDICT_VAL [i])) … … 42 45 } 43 46 #endif 44 47 48 // Get top 45 49 Tptr_t top = reg_PREDICT_TOP[context]; 46 50 Tcontrol_t push = PORT_READ(in_PREDICT_PUSH [i]); 47 51 48 // if push : value is hit 49 // if pop : val and not miss 50 internal_PREDICT_HIT [i] = (push or (reg_stack[context][top]._val and not reg_stack[context][top]._miss and (reg_PREDICT_NB_ELT[context]>0))); 52 // Hit : 53 // * if push : value is hit 54 // * if pop : no empty 55 internal_PREDICT_HIT [i] = (push or (reg_PREDICT_NB_ELT[context]>0)); 56 51 57 PORT_WRITE(out_PREDICT_HIT [i], internal_PREDICT_HIT [i]); 52 58 53 59 // if pop : address_pop = stack [top] 54 // if push : stock [top+1] = address_push; also st ock [top+1] is erase ! give the old value atthe update table60 // if push : stock [top+1] = address_push; also stack [top+1] is erase ! save the old value in the update table 55 61 if (push) 56 62 top = (top+1)%_param->_size_queue[context]; … … 60 66 } 61 67 62 log_ printf(FUNC,Return_Address_Stack,FUNCTION,"End");68 log_end(Return_Address_Stack,FUNCTION); 63 69 }; 64 70 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_transition.cpp
r95 r100 22 22 void Return_Address_Stack::transition (void) 23 23 { 24 log_printf(FUNC,Return_Address_Stack,FUNCTION,"Begin"); 24 log_begin(Return_Address_Stack,FUNCTION); 25 log_function(Return_Address_Stack,FUNCTION,_name.c_str()); 25 26 26 27 if (PORT_READ(in_NRESET)==0) 27 28 { 29 // Reset all structure 28 30 for (uint32_t i=0; i<_param->_nb_context; i++) 29 31 { 30 32 reg_TOP [i] = 0; 31 reg_BOTTOM [i] = 0;33 // reg_BOTTOM [i] = 0; 32 34 reg_NB_ELT [i] = 0; 33 35 34 36 reg_PREDICT_TOP [i] = 0; 35 reg_PREDICT_BOTTOM [i] = 0;37 // reg_PREDICT_BOTTOM [i] = 0; 36 38 reg_PREDICT_NB_ELT [i] = 0; 37 38 for (uint32_t j=0; j<_param->_size_queue [i]; j++)39 {40 reg_stack[i][j]._val = false;41 reg_stack[i][j]._predict = false;42 reg_stack[i][j]._miss = false;43 }44 39 } 45 40 } … … 52 47 if (PORT_READ(in_PREDICT_VAL [i]) and internal_PREDICT_ACK [i]) 53 48 { 54 log_printf(TRACE,Return_Address_Stack,FUNCTION,"PREDICT[%d] : Transaction",i); 49 log_printf(TRACE,Return_Address_Stack,FUNCTION," * PREDICT [%d] : Transaction",i); 50 51 // Read information and pointer 55 52 Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_PREDICT_CONTEXT_ID [i]):0; 56 53 Tcontrol_t push = PORT_READ(in_PREDICT_PUSH [i]); 54 57 55 Tptr_t top_old = reg_PREDICT_TOP [context]; 58 56 Tptr_t top_new = top_old; 59 Tptr_t bottom_old = reg_PREDICT_BOTTOM [context]; 60 61 log_printf(TRACE,Return_Address_Stack,FUNCTION," * context : %d",context); 62 63 // Hit : push or (val and not miss and not empty) 57 // Tptr_t bottom_old = reg_PREDICT_BOTTOM [context]; 58 // Tptr_t bottom_new = bottom_old; 59 Tptr_t nb_elt_old = reg_PREDICT_NB_ELT [context]; 60 Tptr_t nb_elt_new = nb_elt_old; 61 62 log_printf(TRACE,Return_Address_Stack,FUNCTION," * context : %d",context); 63 64 // Hit : push or not empty 64 65 // Miss : ifetch is stall, no update 66 67 // Test if hit 65 68 if (internal_PREDICT_HIT [i]) 66 69 { 67 log_printf(TRACE,Return_Address_Stack,FUNCTION," * before"); 68 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_top : %d",reg_PREDICT_TOP [context]); 69 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_bottom : %d",reg_PREDICT_BOTTOM [context]); 70 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_nb_elt : %d",reg_PREDICT_NB_ELT [context]); 71 70 log_printf(TRACE,Return_Address_Stack,FUNCTION," * before"); 71 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_top : %d",top_old); 72 // log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_bottom : %d",bottom_old); 73 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_nb_elt : %d",nb_elt_old); 74 75 // Test if push 72 76 if (push) 73 77 { 78 log_printf(TRACE,Return_Address_Stack,FUNCTION," * push (call procedure)"); 79 74 80 // push : increase the top (circular) 75 81 top_new = (top_old+1)%_param->_size_queue[context]; 76 77 reg_stack [context][top_new]._val = true; // New addr 78 reg_stack [context][top_new]._predict = true; // Is speculative (erase a old addr (or not)) 79 //reg_stack [context][top_new]._miss = ; 82 83 // Write new value in Queue 80 84 reg_stack [context][top_new]._address = PORT_READ(in_PREDICT_ADDRESS_PUSH [i]); 81 85 82 // the stack is full, erase the most old stack83 84 86 // Test if full 85 if (reg_PREDICT_NB_ELT[context]==_param->_size_queue[context]) 86 reg_PREDICT_BOTTOM [context] = (bottom_old+1)%_param->_size_queue[context]; 87 // A new data is write : the stack is not empty 88 if (reg_PREDICT_NB_ELT[context]< _param->_size_queue[context]) 89 reg_PREDICT_NB_ELT[context]++; 87 // -> is full, the push erase the oldest value in stack, also nb_elt is the same 88 // -> is not full, increase nb_elt 89 // if (nb_elt_old==_param->_size_queue[context]) 90 // bottom_new = (bottom_old+1)%_param->_size_queue[context]; 91 // else 92 // nb_elt_new ++; 93 if (nb_elt_old!=_param->_size_queue[context]) 94 nb_elt_new ++; 90 95 } 91 96 else 92 97 { 93 98 // pop 94 // top_new = (top_old==0)?(_param->_size_queue[context]-1):(top_old-1); 95 96 //reg_stack [context][top_new]._val = ; 97 //reg_stack [context][top_new]._predict = ; 98 //reg_stack [context][top_new]._miss = ; 99 //reg_stack [context][top_new]._address = ; 100 101 // the stack is empty 102 if (reg_PREDICT_NB_ELT[context]>0) 99 log_printf(TRACE,Return_Address_Stack,FUNCTION," * pop (return procedure)"); 100 101 // Test if the stack is empty 102 if (nb_elt_old>0) 103 103 { 104 104 top_new = (top_old==0)?(_param->_size_queue[context]-1):(top_old-1); 105 reg_PREDICT_NB_ELT[context]--;105 nb_elt_new --; 106 106 } 107 // no else : can't pop 107 108 } 108 109 109 reg_PREDICT_TOP [context] = top_new; 110 111 log_printf(TRACE,Return_Address_Stack,FUNCTION," * after"); 112 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_top : %d",reg_PREDICT_TOP [context]); 113 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_bottom : %d",reg_PREDICT_BOTTOM [context]); 114 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_nb_elt : %d",reg_PREDICT_NB_ELT [context]); 115 } 116 } 110 // Write new pointer 111 reg_PREDICT_TOP [context] = top_new; 112 // reg_PREDICT_BOTTOM [context] = bottom_new; 113 reg_PREDICT_NB_ELT [context] = nb_elt_new; 114 115 log_printf(TRACE,Return_Address_Stack,FUNCTION," * after"); 116 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_top : %d",top_new); 117 // log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_bottom : %d",bottom_new); 118 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_nb_elt : %d",nb_elt_new); 119 } 120 } 117 121 118 122 // =================================================================== … … 122 126 if (PORT_READ(in_DECOD_VAL [i]) and internal_DECOD_ACK [i]) 123 127 { 124 log_printf(TRACE,Return_Address_Stack,FUNCTION,"DECOD[%d] : Transaction",i); 128 log_printf(TRACE,Return_Address_Stack,FUNCTION," * DECOD [%d] : Transaction",i); 129 130 // Read information 125 131 Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_DECOD_CONTEXT_ID [i]):0; 126 132 Tcontrol_t push = PORT_READ(in_DECOD_PUSH [i]); 133 134 // Read pointer 127 135 Tptr_t top_old = reg_TOP [context]; 128 136 Tptr_t top_new = top_old; 129 Tptr_t bottom_old = reg_BOTTOM [context]; 130 //Tcontrol_t hit = internal_DECOD_HIT [i]; 131 Tcontrol_t miss = PORT_READ(in_DECOD_MISS_PREDICTION [i]); 132 133 log_printf(TRACE,Return_Address_Stack,FUNCTION," * context : %d",context); 134 135 log_printf(TRACE,Return_Address_Stack,FUNCTION," * before"); 136 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_top : %d",reg_TOP [context]); 137 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_bottom : %d",reg_BOTTOM [context]); 138 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_nb_elt : %d",reg_NB_ELT [context]); 139 140 if (push) 141 { 142 // push : increase the top (circular) 143 top_new = (top_old+1)%_param->_size_queue[context]; 144 145 reg_stack [context][top_new]._val = true; // New address 146 reg_stack [context][top_new]._predict = false; // No speculative 147 reg_stack [context][top_new]._miss = false; 148 reg_stack [context][top_new]._address = PORT_READ(in_DECOD_ADDRESS_PUSH [i]); 149 150 // Test if full : if true, then icrease the bottom (erase the most old stack) 151 if (reg_NB_ELT[context]==_param->_size_queue[context]) 152 reg_BOTTOM [context] = (bottom_old+1)%_param->_size_queue[context]; 153 // A new data is write : the stack is not empty 154 if (reg_NB_ELT[context]< _param->_size_queue[context]) 155 reg_NB_ELT[context]++; 156 } 157 else 158 { 159 // pop 160 // top_new = (top_old==0)?(_param->_size_queue[context]-1):(top_old-1); 161 162 //reg_stack [context][top_new]._val = ; 163 //reg_stack [context][top_new]._predict = ; 164 //reg_stack [context][top_new]._miss = ; 165 //reg_stack [context][top_new]._address = ; 166 167 // the stack is empty 168 if (reg_NB_ELT[context]>0) 169 { 170 top_new = (top_old==0)?(_param->_size_queue[context]-1):(top_old-1); 171 reg_NB_ELT[context] --; 172 } 173 } 174 175 reg_TOP [context] = top_new; 176 177 log_printf(TRACE,Return_Address_Stack,FUNCTION," * after"); 178 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_top : %d",reg_TOP [context]); 179 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_bottom : %d",reg_BOTTOM [context]); 180 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_nb_elt : %d",reg_NB_ELT [context]); 181 137 // Tptr_t bottom_old = reg_BOTTOM [context]; 138 // Tptr_t bottom_new = bottom_old; 139 Tptr_t nb_elt_old = reg_NB_ELT [context]; 140 Tptr_t nb_elt_new = nb_elt_old; 141 142 log_printf(TRACE,Return_Address_Stack,FUNCTION," * context : %d",context); 143 144 log_printf(TRACE,Return_Address_Stack,FUNCTION," * before"); 145 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_top : %d",top_old); 146 // log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_bottom : %d",bottom_old); 147 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_nb_elt : %d",nb_elt_old); 148 149 // Test if push 150 if (push) 151 { 152 log_printf(TRACE,Return_Address_Stack,FUNCTION," * push (call procedure)"); 153 154 // push : increase the top (circular) 155 top_new = (top_old+1)%_param->_size_queue[context]; 156 157 // Write new value in Queue 158 reg_stack [context][top_new]._address = PORT_READ(in_DECOD_ADDRESS_PUSH [i]); 159 160 // Test if full 161 // -> is full, the push erase the oldest value in stack, also nb_elt is the same 162 // -> is not full, increase nb_elt 163 // if (nb_elt_old==_param->_size_queue[context]) 164 // bottom_new = (bottom_old+1)%_param->_size_queue[context]; 165 // else 166 // nb_elt_new ++; 167 if (nb_elt_old!=_param->_size_queue[context]) 168 nb_elt_new ++; 169 } 170 else 171 { 172 // pop 173 log_printf(TRACE,Return_Address_Stack,FUNCTION," * pop (return procedure)"); 174 175 // Test if the stack is empty 176 if (nb_elt_old>0) 177 { 178 top_new = (top_old==0)?(_param->_size_queue[context]-1):(top_old-1); 179 nb_elt_new --; 180 } 181 // no else : can't pop 182 } 183 184 // Write new pointer 185 reg_TOP [context] = top_new; 186 // reg_BOTTOM [context] = bottom_new; 187 reg_NB_ELT [context] = nb_elt_new; 188 189 log_printf(TRACE,Return_Address_Stack,FUNCTION," * after"); 190 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_top : %d",top_new); 191 // log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_bottom : %d",bottom_new); 192 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_nb_elt : %d",nb_elt_new); 193 182 194 // have previous miss of ifetch ? 183 195 // 2 miss : 184 196 // 1) miss predict : is very limited (local at context), can be update very quickly 185 197 // 2) miss decod : result is in commit stage ... 186 if (miss) 187 { 188 reg_PREDICT_BOTTOM [context] = reg_BOTTOM [context]; 189 reg_PREDICT_TOP [context] = reg_TOP [context]; 190 reg_PREDICT_NB_ELT [context] = reg_NB_ELT [context]; 198 199 // manage by Update_Fetch_Prediction_Table and Update_Prediction_Table 200 // Note : 201 // if decod miss : ifetch can have predict call and return branchement. Also, the head of decod can be false 202 203 // Tcontrol_t miss = PORT_READ(in_DECOD_MISS_PREDICTION [i]); 204 205 // if (miss) 206 // { 207 // reg_PREDICT_BOTTOM [context] = reg_BOTTOM [context]; 208 // reg_PREDICT_TOP [context] = reg_TOP [context]; 209 // reg_PREDICT_NB_ELT [context] = reg_NB_ELT [context]; 191 210 192 // Scan full assoc !!!193 for (uint32_t j=0; j<_param->_size_queue [context]; j++)194 // Test if this slot is tagged with "predict" : if true, tagged as miss195 if (reg_stack [context][j]._predict)196 {197 reg_stack [context][j]._predict = false;198 reg_stack [context][j]._miss = true;199 }200 }211 // // Scan full assoc !!! 212 // for (uint32_t j=0; j<_param->_size_queue [context]; j++) 213 // // Test if this slot is tagged with "predict" : if true, tagged as miss 214 // if (reg_stack [context][j]._predict) 215 // { 216 // reg_stack [context][j]._predict = false; 217 // reg_stack [context][j]._miss = true; 218 // } 219 // } 201 220 } 202 221 … … 207 226 if (PORT_READ(in_UPDATE_VAL [i]) and internal_UPDATE_ACK [i]) 208 227 { 209 throw ERRORMORPHEO(FUNCTION,"Fonction à implémenter !!!!!!!!!!!!"); 210 211 212 // Tcontrol_t miss = PORT_READ(in_UPDATE_MISS_PREDICTION [i]); 213 // // 214 // if (miss) 215 // { 216 // Tcontrol_t context = (_param->_have_port_context_id)?PORT_READ(in_UPDATE_CONTEXT_ID [i]):0; 217 // Tcontrol_t ifetch = PORT_READ(in_UPDATE_PREDICTION_IFETCH [i]); 218 // Tcontrol_t push = PORT_READ(in_UPDATE_PUSH [i]); 219 // Tcontrol_t flush = PORT_READ(in_UPDATE_FLUSH [i]); 220 // Tptr_t index = PORT_READ(in_UPDATE_INDEX [i]); 221 // Taddress_t address = PORT_READ(in_UPDATE_ADDRESS [i]); 222 223 // if (push) 224 // { 225 // // // push 226 // // top_new = (top_old+1)%_param->_size_queue[context]; 227 228 // // reg_stack [context][index]._val = true; 229 // // reg_stack [context][index]._predict = false; 230 // // reg_stack [context][index]._miss = false; 231 // // reg_stack [context][index]._address = PORT_READ(in_UPDATE_ADDRESS [i]); 232 233 // } 234 // else 235 // { 236 // // //reg_stack [context][top_new]._val = ; 237 // // //reg_stack [context][top_new]._predict = ; 238 // // //reg_stack [context][top_new]._miss = ; 239 // // //reg_stack [context][top_new]._address = ; 240 // } 241 242 // // // // Mouais bof ....... 243 // // // reg_PREDICT_TOP [context] = index; 244 // } 228 log_printf(TRACE,Return_Address_Stack,FUNCTION," * UPDATE [%d] : Transaction",i); 229 230 Tcontext_t context_id = (_param->_have_port_context_id)?PORT_READ(in_UPDATE_CONTEXT_ID [i]):0; 231 Tcontrol_t flush = PORT_READ(in_UPDATE_FLUSH [i]); 232 233 log_printf(TRACE,Return_Address_Stack,FUNCTION," * context_id : %d",context_id); 234 log_printf(TRACE,Return_Address_Stack,FUNCTION," * flush : %d",flush ); 235 236 // An miss prediction on call/return = Return Address Stack is corrupted. 237 if (flush) 238 { 239 // All pointer is set at 0 240 reg_TOP [context_id] = 0; 241 // reg_BOTTOM [context_id] = 0; 242 reg_NB_ELT [context_id] = 0; 243 244 reg_PREDICT_TOP [context_id] = 0; 245 // reg_PREDICT_BOTTOM [context_id] = 0; 246 reg_PREDICT_NB_ELT [context_id] = 0; 247 } 248 else 249 { 250 // if miss_prediction -> restore queue 251 // else, the prediction is correct 252 Tcontrol_t miss_prediction = PORT_READ(in_UPDATE_MISS_PREDICTION [i]); 253 254 log_printf(TRACE,Return_Address_Stack,FUNCTION," * miss_prediction : %d",miss_prediction); 255 256 #ifdef DEBUG_TEST 257 Tptr_t index = PORT_READ(in_UPDATE_INDEX [i]); 258 Tcontrol_t prediction_ifetch = PORT_READ(in_UPDATE_PREDICTION_IFETCH [i]); 259 log_printf(TRACE,Return_Address_Stack,FUNCTION," * index : %d",index); 260 log_printf(TRACE,Return_Address_Stack,FUNCTION," * prediction_ifetch : %d",prediction_ifetch); 261 262 // if (prediction_ifetch) 263 // { 264 // if (index != reg_PREDICT_TOP [context_id]) 265 // throw ERRORMORPHEO(FUNCTION,_("Index is different of predict_top")); 266 // } 267 // else 268 // { 269 // if (index != reg_TOP [context_id]) 270 // throw ERRORMORPHEO(FUNCTION,_("Index is different of top")); 271 // } 272 273 #endif 274 if (miss_prediction) 275 { 276 Tcontrol_t push = PORT_READ(in_UPDATE_PUSH [i]); 277 log_printf(TRACE,Return_Address_Stack,FUNCTION," * push : %d",push); 278 #ifndef DEBUG_TEST 279 Tptr_t index = PORT_READ(in_UPDATE_INDEX [i]); 280 Tcontrol_t prediction_ifetch = PORT_READ(in_UPDATE_PREDICTION_IFETCH [i]); 281 log_printf(TRACE,Return_Address_Stack,FUNCTION," * index : %d",index); 282 log_printf(TRACE,Return_Address_Stack,FUNCTION," * prediction_ifetch : %d",prediction_ifetch); 283 #endif 284 285 286 Tptr_t top_old = (prediction_ifetch)?reg_PREDICT_TOP [context_id]:reg_TOP [context_id]; 287 Tptr_t top_new = top_old; 288 289 // Tptr_t bottom_old = (prediction_ifetch)?reg_PREDICT_BOTTOM [context_id]:reg_BOTTOM [context_id]; 290 // Tptr_t bottom_new = bottom_old; 291 292 Tptr_t nb_elt_old = (prediction_ifetch)?reg_PREDICT_NB_ELT [context_id]:reg_NB_ELT [context_id]; 293 Tptr_t nb_elt_new = nb_elt_old; 294 295 log_printf(TRACE,Return_Address_Stack,FUNCTION," * before"); 296 if (prediction_ifetch) 297 { 298 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_top : %d",top_old); 299 // log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_bottom : %d",bottom_old); 300 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_nb_elt : %d",nb_elt_old); 301 } 302 else 303 { 304 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_top : %d",top_old); 305 // log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_bottom : %d",bottom_old); 306 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_nb_elt : %d",nb_elt_old); 307 } 308 309 // if previous is push, pop the value 310 // else is previous is pop, push the poped value 311 if (push) 312 { 313 // previous is push, now must be pop 314 315 // Test if the stack is empty 316 if (nb_elt_old>0) // ?? 317 { 318 top_new = (top_old==0)?(_param->_size_queue[context_id]-1):(top_old-1); 319 nb_elt_new --; 320 } 321 } 322 else 323 { 324 // previous is pop, now must be push 325 Taddress_t address = PORT_READ(in_UPDATE_ADDRESS [i]); 326 327 // push : increase the top (circular) 328 // if (nb_elt_old==_param->_size_queue[context_id]) 329 // bottom_new = (bottom_old+1)%_param->_size_queue[context_id]; 330 // else 331 // nb_elt_new ++; 332 333 if (nb_elt_old!=_param->_size_queue[context_id]) 334 nb_elt_new ++; 335 336 top_new = index; 337 338 reg_stack [context_id][index]._address = address; 339 } 340 341 log_printf(TRACE,Return_Address_Stack,FUNCTION," * after"); 342 343 if (prediction_ifetch) 344 { 345 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_top : %d",top_new); 346 // log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_bottom : %d",bottom_new); 347 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_predict_nb_elt : %d",nb_elt_new); 348 349 reg_PREDICT_TOP [context_id] = top_new ; 350 // reg_PREDICT_BOTTOM [context_id] = bottom_new; 351 reg_PREDICT_NB_ELT [context_id] = nb_elt_new; 352 } 353 else 354 { 355 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_top : %d",top_new); 356 // log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_bottom : %d",bottom_new); 357 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_nb_elt : %d",nb_elt_new); 358 359 reg_TOP [context_id] = top_new ; 360 // reg_BOTTOM [context_id] = bottom_new; 361 reg_NB_ELT [context_id] = nb_elt_new; 362 } 363 } 364 } 245 365 } 246 366 } 367 368 #if defined(DEBUG_Return_Address_Stack) and DEBUG>=DEBUG_TRACE 369 log_printf(TRACE,Return_Address_Stack,FUNCTION," * Dump RAS"); 370 for (uint32_t i=0; i<_param->_nb_context; ++i) 371 { 372 log_printf(TRACE,Return_Address_Stack,FUNCTION," * Return Address Stack [%d]",i); 373 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_TOP : %d",reg_TOP [i]); 374 // log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_BOTTOM : %d",reg_BOTTOM [i]); 375 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_NB_ELT : %d",reg_NB_ELT [i]); 376 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_PREDICT_TOP : %d",reg_PREDICT_TOP [i]); 377 // log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_PREDICT_BOTTOM : %d",reg_PREDICT_BOTTOM [i]); 378 log_printf(TRACE,Return_Address_Stack,FUNCTION," * reg_PREDICT_NB_ELT : %d",reg_PREDICT_NB_ELT [i]); 379 380 for (uint32_t j=0; j<_param->_size_queue[i]; ++j) 381 log_printf(TRACE,Return_Address_Stack,FUNCTION," [%d] %.8x (%.8x)",j,reg_stack [i][j]._address,reg_stack [i][j]._address<<2); 382 } 383 #endif 247 384 248 385 #if defined(STATISTICS) or defined(VHDL_TESTBENCH) … … 250 387 #endif 251 388 252 log_ printf(FUNC,Return_Address_Stack,FUNCTION,"End");389 log_end(Return_Address_Stack,FUNCTION); 253 390 }; 254 391 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h
r98 r100 220 220 private : Tcounter_t ** reg_NB_INST_COMMIT_ALL ;//[nb_front_end][nb_context] 221 221 private : Tcounter_t ** reg_NB_INST_COMMIT_MEM ;//[nb_front_end][nb_context] 222 223 private : Tevent_state_t ** reg_EVENT_STATE ;//[nb_front_end][nb_context] 222 224 223 225 // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Types.h
r88 r100 27 27 typedef enum 28 28 { 29 ROB_EMPTY , // 30 ROB_BRANCH_WAIT_END , // 31 ROB_BRANCH_COMPLETE , // 32 ROB_STORE_WAIT_HEAD_OK , // 33 // ROB_STORE_WAIT_HEAD_KO , // 34 ROB_STORE_HEAD_OK , // 35 ROB_STORE_HEAD_KO , // 36 ROB_OTHER_WAIT_END , // 37 ROB_MISS_WAIT_END , // 38 ROB_END_OK_SPECULATIVE , // 39 ROB_END_OK , // 40 ROB_END_KO_SPECULATIVE , // 41 ROB_END_KO , // 42 ROB_END_MISS , // 43 ROB_END_EXCEPTION_WAIT_HEAD , // 29 ROB_EMPTY , // 30 ROB_BRANCH_WAIT_END , // 31 ROB_BRANCH_COMPLETE , // 32 ROB_STORE_WAIT_HEAD_OK , // 33 // ROB_STORE_WAIT_HEAD_KO , // 34 ROB_STORE_HEAD_OK , // 35 ROB_STORE_HEAD_KO , // 36 ROB_OTHER_WAIT_END , // 37 ROB_MISS_WAIT_END , // 38 ROB_END_OK_SPECULATIVE , // 39 ROB_END_OK , // 40 ROB_END_KO_SPECULATIVE , // 41 ROB_END_KO , // 42 ROB_END_BRANCH_MISS_SPECULATIVE, // 43 ROB_END_BRANCH_MISS , // 44 ROB_END_MISS , // 45 ROB_END_EXCEPTION_WAIT_HEAD , // 44 46 ROB_END_EXCEPTION // 45 47 } rob_state_t; … … 79 81 public : Tspecial_address_t num_reg_re_phy_new ; 80 82 81 public : Tevent_state_t event_state ;82 83 public : Texception_t exception ; 83 84 public : Texception_t exception_use ; … … 161 162 switch (x) 162 163 { 163 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_EMPTY : return "empty" ; break; 164 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_BRANCH_WAIT_END : return "branch_wait_end" ; break; 165 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_BRANCH_COMPLETE : return "branch_complete" ; break; 166 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_WAIT_HEAD_OK : return "store_wait_head_ok" ; break; 167 // case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_WAIT_HEAD_KO : return "store_wait_head_ko" ; break; 168 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_HEAD_OK : return "store_head_ok" ; break; 169 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_HEAD_KO : return "store_head_ko" ; break; 170 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_OTHER_WAIT_END : return "other_wait_end" ; break; 171 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_MISS_WAIT_END : return "miss_wait_end" ; break; 172 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_OK_SPECULATIVE : return "end_ok_speculative" ; break; 173 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_OK : return "end_ok" ; break; 174 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_KO_SPECULATIVE : return "end_ko_speculative" ; break; 175 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_KO : return "end_ko" ; break; 176 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_EXCEPTION_WAIT_HEAD : return "end_exception_wait_head" ; break; 177 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_EXCEPTION : return "end_exception" ; break; 164 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_EMPTY : return "ROB_EMPTY" ; break; 165 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_BRANCH_WAIT_END : return "ROB_BRANCH_WAIT_END" ; break; 166 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_BRANCH_COMPLETE : return "ROB_BRANCH_COMPLETE" ; break; 167 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_WAIT_HEAD_OK : return "ROB_STORE_WAIT_HEAD_OK" ; break; 168 // case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_WAIT_HEAD_KO : return "ROB_STORE_WAIT_HEAD_KO" ; break; 169 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_HEAD_OK : return "ROB_STORE_HEAD_OK" ; break; 170 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_HEAD_KO : return "ROB_STORE_HEAD_KO" ; break; 171 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_OTHER_WAIT_END : return "ROB_OTHER_WAIT_END" ; break; 172 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_MISS_WAIT_END : return "ROB_MISS_WAIT_END" ; break; 173 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_OK_SPECULATIVE : return "ROB_END_OK_SPECULATIVE" ; break; 174 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_OK : return "ROB_END_OK" ; break; 175 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_KO_SPECULATIVE : return "ROB_END_KO_SPECULATIVE" ; break; 176 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_KO : return "ROB_END_KO" ; break; 177 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_BRANCH_MISS_SPECULATIVE: return "ROB_END_BRANCH_MISS_SPECULATIVE" ; break; 178 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_BRANCH_MISS : return "ROB_END_BRANCH_MISS" ; break; 179 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_MISS : return "ROB_END_MISS" ; break; 180 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_EXCEPTION_WAIT_HEAD : return "ROB_END_EXCEPTION_WAIT_HEAD" ; break; 181 case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_EXCEPTION : return "ROB_END_EXCEPTION" ; break; 182 178 183 default : return "" ; break; 179 184 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_allocation.cpp
r98 r100 272 272 273 273 // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 _rob = new std::list<entry_t*> [_param->_nb_bank];274 ALLOC1(_rob ,std::list<entry_t*>,_param->_nb_bank); 275 275 276 reg_BANK_PTR = new uint32_t [_param->_nb_bank];277 278 reg_NB_INST_COMMIT_ALL = new Tcounter_t * [_param->_nb_front_end];279 reg_NB_INST_COMMIT_MEM = new Tcounter_t * [_param->_nb_front_end];276 ALLOC1(reg_BANK_PTR ,uint32_t ,_param->_nb_bank); 277 278 ALLOC2(reg_NB_INST_COMMIT_ALL ,Tcounter_t ,_param->_nb_front_end,_param->_nb_context [it1]); 279 ALLOC2(reg_NB_INST_COMMIT_MEM ,Tcounter_t ,_param->_nb_front_end,_param->_nb_context [it1]); 280 280 281 for (uint32_t i=0; i<_param->_nb_front_end; i++) 282 { 283 reg_NB_INST_COMMIT_ALL [i] = new Tcounter_t [_param->_nb_context [i]]; 284 reg_NB_INST_COMMIT_MEM [i] = new Tcounter_t [_param->_nb_context [i]]; 285 } 281 ALLOC2(reg_EVENT_STATE ,Tevent_state_t,_param->_nb_front_end,_param->_nb_context [it1]); 286 282 } 287 283 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_deallocation.cpp
r98 r100 178 178 179 179 // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 180 for (uint32_t i=0; i<_param->_nb_front_end; i++) 181 { 182 delete [] reg_NB_INST_COMMIT_ALL [i]; 183 delete [] reg_NB_INST_COMMIT_MEM [i]; 184 } 185 delete [] reg_NB_INST_COMMIT_ALL; 186 delete [] reg_NB_INST_COMMIT_MEM; 187 188 delete [] reg_BANK_PTR; 189 190 delete [] _rob; 180 DELETE1(_rob ,_param->_nb_bank); 181 DELETE1(reg_BANK_PTR ,_param->_nb_bank); 182 DELETE2(reg_NB_INST_COMMIT_ALL ,_param->_nb_front_end,_param->_nb_context [it1]); 183 DELETE2(reg_NB_INST_COMMIT_MEM ,_param->_nb_front_end,_param->_nb_context [it1]); 184 DELETE2(reg_EVENT_STATE ,_param->_nb_front_end,_param->_nb_context [it1]); 191 185 } 192 186 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_genMealy_commit.cpp
r88 r100 30 30 uint32_t bank_nb_access [_param->_nb_bank]; 31 31 Tcontrol_t commit_ack [_param->_nb_inst_commit]; 32 32 33 // Initialisation 33 34 for (uint32_t i=0; i<_param->_nb_bank; i++) … … 38 39 } 39 40 40 // commit interface 41 // commit interface -> scan all entry (Out of Order) 41 42 for (uint32_t i=0; i<_param->_nb_inst_commit; i++) 42 43 { 43 44 commit_ack [i] = false; 44 45 45 // Test if have instruction46 // Test if have valid instruction 46 47 if (PORT_READ(in_COMMIT_VAL [i])) 47 48 { 48 Tpacket_t packet = (_param->_have_port_rob_ptr )?PORT_READ(in_COMMIT_PACKET_ID [i]):0; 49 uint32_t num_bank = packet >> _param->_shift_num_bank; 49 // packet_id number can 50 Tpacket_t packet_id = (_param->_have_port_rob_ptr )?PORT_READ(in_COMMIT_PACKET_ID [i]):0; 51 uint32_t num_bank = packet_id >> _param->_shift_num_bank; 50 52 uint32_t num_bank_access = bank_nb_access [num_bank]; 51 53 … … 60 62 internal_BANK_COMMIT_NUM_INST [num_bank][num_bank_access] = i; 61 63 62 Tpacket_t packet_id = packet& _param->_mask_size_bank;64 Tpacket_t num_packet = packet_id & _param->_mask_size_bank; 63 65 64 66 // find the good entry !!! … … 67 69 it!=_rob[num_bank].end(); 68 70 it++) 69 if ((*it)->ptr == packet_id)71 if ((*it)->ptr == num_packet) 70 72 { 71 73 entry = (*it); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_genMealy_insert.cpp
r88 r100 54 54 std::list<generic::priority::select_t> * select_insert = _priority_insert ->select(); // same select for all insert 55 55 std::list<generic::priority::select_t>::iterator it=select_insert ->begin(); 56 56 57 // Scan all bank ... 57 58 for (uint32_t i=0; i<_param->_nb_bank; i++) 58 59 { … … 64 65 // log_printf(TRACE,Commit_unit,FUNCTION," * full : %d", bank_full [num_bank]); 65 66 67 // Scan all insert interface to find a valid transaction 66 68 while (it!=select_insert ->end()) 67 69 { … … 87 89 if (not bank_full [num_bank]) 88 90 { 89 // find 91 // find !!! 90 92 insert_ack [num_rename_unit][num_inst_insert] = true; 91 93 … … 112 114 } 113 115 116 // Write output 114 117 for (uint32_t i=0; i<_param->_nb_rename_unit; i++) 115 118 for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++) -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_genMealy_retire.cpp
r88 r100 48 48 retire_val [i][j] = false; 49 49 } 50 51 50 for (uint32_t i=0; i<_param->_nb_front_end; ++i) 52 51 for (uint32_t j=0; j<_param->_nb_context[i]; ++j) 53 spr_write_val [i][j] = 0; 54 52 { 53 spr_write_val [i][j] = 0; 54 spr_write_sr_f_val [i][j] = 0; 55 spr_write_sr_cy_val [i][j] = 0; 56 spr_write_sr_ov_val [i][j] = 0; 57 58 } 55 59 // Scan Top of each bank 56 60 for (uint32_t i=0; i<_param->_nb_bank; i++) … … 64 68 uint32_t x = entry->rename_unit_id; 65 69 uint32_t y = num_inst_retire [x]; 66 70 71 // test if : 72 // * can retire (all previous instruction is retired) 73 // * all structure is ok (not busy) 67 74 if (can_retire [x] and // in-order 68 75 (y < _param->_nb_inst_retire [x]) and … … 71 78 rob_state_t state = entry->state; 72 79 73 if ((state == ROB_END_OK ) or 74 (state == ROB_END_KO ) or 75 (state == ROB_END_MISS)// or 80 if ((state == ROB_END_OK ) or 81 (state == ROB_END_KO ) or 82 (state == ROB_END_BRANCH_MISS) or 83 (state == ROB_END_MISS )// or 76 84 // (state == ROB_END_EXCEPTION) 77 85 ) … … 85 93 bool spr_write_ack = true; 86 94 95 // Write in SR the good flag 87 96 if ((state == ROB_END_OK ) and write_re) 97 // ROB_END_BRANCH_MISS is a valid branch instruction but don't modify RE 88 98 { 89 99 spr_write_ack = PORT_READ(in_SPR_WRITE_ACK [front_end_id][context_id]); … … 138 148 PORT_WRITE(out_RETIRE_CONTEXT_ID [x][y], context_id ); 139 149 // PORT_WRITE(out_RETIRE_RENAME_UNIT_ID [x][y], entry->rename_unit_id ); 140 PORT_WRITE(out_RETIRE_EVENT_STATE [x][y], entry->event_state);150 PORT_WRITE(out_RETIRE_EVENT_STATE [x][y], reg_EVENT_STATE[front_end_id][context_id]); 141 151 PORT_WRITE(out_RETIRE_USE_STORE_QUEUE [x][y], entry->use_store_queue ); 142 152 PORT_WRITE(out_RETIRE_USE_LOAD_QUEUE [x][y], entry->use_load_queue ); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_genMoore.cpp
r98 r100 28 28 // =================================================================== 29 29 { 30 // Store instruction comming Out Of Order in Load Store Unit. 31 // Must be executed in no speculative mode. Also, send a signal when an Store is in head of ROB 32 30 33 Tcontrol_t val = false; 31 34 … … 35 38 rob_state_t state = entry->state; 36 39 40 // Test state 37 41 val = ((state == ROB_STORE_HEAD_OK) or 38 42 (state == ROB_STORE_HEAD_KO)); … … 40 44 if (val) 41 45 { 46 // Reexecute store 42 47 if (_param->_have_port_context_id) 43 48 PORT_WRITE(out_REEXECUTE_CONTEXT_ID [0], entry->context_id ); … … 62 67 // =================================================================== 63 68 { 69 // Branchement must be send at the prediction unit 64 70 uint32_t nb_scan_bank = 0; 65 71 72 // for each port, find a valid branchement. 66 73 for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++) 67 74 { … … 72 79 nb_scan_bank ++; 73 80 81 // translate bank number 74 82 uint32_t num_bank = (reg_NUM_BANK_HEAD+j)%_param->_nb_bank; 75 83 … … 124 132 } 125 133 } 126 127 // public : SC_OUT(Tcontrol_t ) * out_UPDATE_VAL ;128 // public : SC_IN (Tcontrol_t ) * in_UPDATE_ACK ;129 // public : SC_OUT(Tcontext_t ) * out_UPDATE_CONTEXT_ID ;130 // public : SC_OUT(Tcontext_t ) * out_UPDATE_FRONT_END_ID ;131 // public : SC_OUT(Tdepth_t ) * out_UPDATE_DEPTH ;132 // public : SC_OUT(Tevent_type_t ) * out_UPDATE_TYPE ;133 // public : SC_OUT(Tcontrol_t ) * out_UPDATE_IS_DELAY_SLOT ;134 // public : SC_OUT(Taddress_t ) * out_UPDATE_ADDRESS ;135 // public : SC_OUT(Taddress_t ) * out_UPDATE_ADDRESS_EPCR ;136 // public : SC_OUT(Tcontrol_t ) * out_UPDATE_ADDRESS_EEAR_VAL ;137 // public : SC_OUT(Taddress_t ) * out_UPDATE_ADDRESS_EEAR ;138 134 139 135 // =================================================================== -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_statistics_allocation.cpp
r98 r100 57 57 _stat->create_expr_average_by_cycle("average_inst_retire_ko", sum_nb_inst_retire_ko, "", _("Average instruction retire ko (event, miss) by cycle")); 58 58 _stat->create_expr_average_by_cycle("average_inst_retire" , "+ "+sum_nb_inst_retire_ok+" "+sum_nb_inst_retire_ko, "", _("Average instruction retire by cycle")); 59 60 _stat->create_expr ("IPC", "average_inst_retire_ok", TYPE_COUNTER, "inst/cycle", "Instruction Per Cycle"); 61 _stat->create_expr ("CPI", "/ 1 IPC" , TYPE_COUNTER, "cycle/inst", "Cycle Per Instruction"); 59 62 } 60 63 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_transition.cpp
r98 r100 26 26 if (PORT_READ(in_NRESET) == 0) 27 27 { 28 // Clear all bank 28 29 for (uint32_t i=0; i<_param->_nb_bank; i++) 29 30 { … … 32 33 } 33 34 35 // Reset pointer 34 36 reg_NUM_BANK_HEAD = 0; 35 37 reg_NUM_BANK_TAIL = 0; 36 38 39 // Reset counter 37 40 for (uint32_t i=0; i<_param->_nb_front_end; i++) 38 41 for (uint32_t j=0; j<_param->_nb_context [i]; j++) … … 40 43 reg_NB_INST_COMMIT_ALL [i][j] = 0; 41 44 reg_NB_INST_COMMIT_MEM [i][j] = 0; 45 46 reg_EVENT_STATE [i][j] = EVENT_STATE_NO_EVENT; 42 47 } 43 48 49 // Reset priority algorithm 44 50 _priority_insert->reset(); 45 51 } 46 52 else 47 53 { 48 // next priority54 // Compute next priority 49 55 _priority_insert->transition(); 56 57 // =================================================================== 58 // =====[ GARBAGE COLLECTOR ]========================================= 59 // =================================================================== 60 for (uint32_t i=0; i<_param->_nb_front_end; i++) 61 for (uint32_t j=0; j<_param->_nb_context [i]; j++) 62 switch (reg_EVENT_STATE [i][j]) 63 { 64 case EVENT_STATE_EVENT : reg_EVENT_STATE [i][j] = EVENT_STATE_WAITEND ; break; 65 case EVENT_STATE_END : reg_EVENT_STATE [i][j] = EVENT_STATE_NO_EVENT; break; 66 // case EVENT_STATE_NO_EVENT : 67 // case EVENT_STATE_WAITEND : 68 default : break; 69 } 50 70 51 71 // =================================================================== … … 55 75 if (internal_BANK_INSERT_VAL [i]) 56 76 { 77 // get rename unit source and instruction. 57 78 uint32_t x = internal_BANK_INSERT_NUM_RENAME_UNIT [i]; 58 79 uint32_t y = internal_BANK_INSERT_NUM_INST [i]; … … 67 88 #endif 68 89 90 // get information 69 91 Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_INSERT_FRONT_END_ID [x][y]):0; 70 92 Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_INSERT_CONTEXT_ID [x][y]):0; 71 93 Ttype_t type = PORT_READ(in_INSERT_TYPE [x][y]); 72 94 Toperation_t operation = PORT_READ(in_INSERT_OPERATION [x][y]); 95 bool is_store = is_operation_memory_store(operation); 96 73 97 Texception_t exception = PORT_READ(in_INSERT_EXCEPTION [x][y]); 74 98 … … 78 102 log_printf(TRACE,Commit_unit,FUNCTION," * operation : %d",operation ); 79 103 log_printf(TRACE,Commit_unit,FUNCTION," * exception : %d",exception ); 80 104 105 // Create new entry. 81 106 entry_t * entry = new entry_t; 82 107 … … 92 117 entry->exception = exception; 93 118 entry->exception_use = PORT_READ(in_INSERT_EXCEPTION_USE [x][y]); 94 entry->use_store_queue = (type == TYPE_MEMORY) and ( is_ operation_memory_store(operation));95 entry->use_load_queue = (type == TYPE_MEMORY) and (not is_ operation_memory_store(operation));119 entry->use_store_queue = (type == TYPE_MEMORY) and ( is_store); 120 entry->use_load_queue = (type == TYPE_MEMORY) and (not is_store); 96 121 entry->store_queue_ptr_write = PORT_READ(in_INSERT_STORE_QUEUE_PTR_WRITE [x][y]); 97 122 entry->load_queue_ptr_write = (_param->_have_port_load_queue_ptr)?PORT_READ(in_INSERT_LOAD_QUEUE_PTR_WRITE [x][y]):0; … … 114 139 entry->num_reg_re_phy_new = PORT_READ(in_INSERT_NUM_REG_RE_PHY_NEW [x][y]); 115 140 141 // Test if exception : 142 // * yes : no execute instruction, wait ROB Head 143 // * no : test type 144 // * BRANCH : l.j -> branch is ended 145 // other -> wait the execution end of branchment 146 // * MEMORY : store -> wait store is at head of ROB 147 // other -> wait end of instruction 148 // * OTHER 116 149 if (exception == EXCEPTION_NONE) 117 150 { … … 124 157 { 125 158 case TYPE_BRANCH : {entry->state=(no_execute==1)?ROB_BRANCH_COMPLETE:ROB_BRANCH_WAIT_END; break;} 126 case TYPE_MEMORY : {entry->state= ROB_STORE_WAIT_HEAD_OK; break;}159 case TYPE_MEMORY : {entry->state=(is_store ==1)?ROB_STORE_WAIT_HEAD_OK:ROB_OTHER_WAIT_END; break;} 127 160 default : {entry->state=(no_execute==1)?ROB_END_OK_SPECULATIVE:ROB_OTHER_WAIT_END; break;} 128 161 } … … 130 163 else 131 164 { 165 // Have an exception : wait head of ROB 166 132 167 // in_INSERT_NO_EXECUTE [x][y] : l.sys, l.trap 133 168 … … 135 170 } 136 171 172 // Push in rob 137 173 _rob[i].push_back(entry); 138 174 139 // Update nb_inst175 // Update counter and pointer 140 176 reg_NB_INST_COMMIT_ALL [front_end_id][context_id] ++; 141 177 if (type == TYPE_MEMORY) … … 160 196 if (internal_BANK_COMMIT_VAL [i][j]) 161 197 { 198 // An instruction is executed. Change state of this instruction 199 162 200 uint32_t x = internal_BANK_COMMIT_NUM_INST [i][j]; 163 201 … … 171 209 #endif 172 210 173 // Tpacket_t packet_id = (_param->_have_port_rob_ptr )?(PORT_READ(in_COMMIT_PACKET_ID [x])&_param->_mask_size_bank):0;174 175 211 log_printf(TRACE,Commit_unit,FUNCTION," * num_bank : %d",i); 176 // log_printf(TRACE,Commit_unit,FUNCTION," * packet_id : %d",(_param->_have_port_rob_ptr )?(PORT_READ(in_COMMIT_PACKET_ID [x])):0);177 // log_printf(TRACE,Commit_unit,FUNCTION," * num_entry : %d",packet_id);178 179 // test pandex with ptr_write.180 // Tpacket_t index = (packet_id<reg_BANK_PTR [i])?(reg_BANK_PTR [i]-packet_id):(_param->_size_bank+reg_BANK_PTR [i]-packet_id);181 212 182 213 // find the good entry !!! 183 entry_t * entry = internal_BANK_COMMIT_ENTRY [i][j];184 185 //Toperation_t operation = PORT_READ(in_COMMIT_OPERATION [x]);186 //Ttype_t type = PORT_READ(in_COMMIT_TYPE [x]);187 Texception_t exception = PORT_READ(in_COMMIT_EXCEPTION [x]);188 189 rob_state_t state = entry->state;190 Tcontext_t front_end_id = entry->front_end_id;191 Tcontext_t context_id = entry->context_id;192 193 // change state 214 entry_t * entry = internal_BANK_COMMIT_ENTRY [i][j]; 215 216 //Toperation_t operation = PORT_READ(in_COMMIT_OPERATION [x]); 217 //Ttype_t type = PORT_READ(in_COMMIT_TYPE [x]); 218 Texception_t exception = PORT_READ(in_COMMIT_EXCEPTION [x]); 219 220 rob_state_t state = entry->state; 221 Tcontext_t front_end_id = entry->front_end_id; 222 Tcontext_t context_id = entry->context_id; 223 224 // change state : test exception_use 194 225 // * test if exception : exception and mask 195 226 196 bool have_exception = false; 197 227 bool have_exception = false; 228 bool have_miss_speculation = false; 229 198 230 if (exception != EXCEPTION_NONE) 199 switch (entry->exception_use) 200 { 201 case EXCEPTION_USE_RANGE : {have_exception = ((exception == EXCEPTION_RANGE) and PORT_READ(in_SPR_READ_SR_OVE[front_end_id][context_id])); break;} 202 case EXCEPTION_USE_MEMORY_WITH_ALIGNMENT : {have_exception = ((exception == EXCEPTION_BUS_ERROR) or 203 (exception == EXCEPTION_DATA_TLB ) or 204 (exception == EXCEPTION_DATA_PAGE) or 205 (exception == EXCEPTION_ALIGNMENT)); break;}; 206 case EXCEPTION_USE_MEMORY_WITHOUT_ALIGNMENT : {have_exception = ((exception == EXCEPTION_BUS_ERROR) or 207 (exception == EXCEPTION_DATA_TLB ) or 208 (exception == EXCEPTION_DATA_PAGE)); break;}; 209 case EXCEPTION_USE_CUSTOM_0 : {have_exception = (exception == EXCEPTION_CUSTOM_0); break;}; 210 case EXCEPTION_USE_CUSTOM_1 : {have_exception = (exception == EXCEPTION_CUSTOM_1); break;}; 211 case EXCEPTION_USE_CUSTOM_2 : {have_exception = (exception == EXCEPTION_CUSTOM_2); break;}; 212 case EXCEPTION_USE_CUSTOM_3 : {have_exception = (exception == EXCEPTION_CUSTOM_3); break;}; 213 case EXCEPTION_USE_CUSTOM_4 : {have_exception = (exception == EXCEPTION_CUSTOM_4); break;}; 214 case EXCEPTION_USE_CUSTOM_5 : {have_exception = (exception == EXCEPTION_CUSTOM_5); break;}; 215 case EXCEPTION_USE_CUSTOM_6 : {have_exception = (exception == EXCEPTION_CUSTOM_6); break;}; 216 case EXCEPTION_USE_TRAP : {have_exception = false; break;}; 217 case EXCEPTION_USE_NONE : {have_exception = false; break;}; 218 case EXCEPTION_USE_ILLEGAL_INSTRUCTION : {have_exception = false; break;}; 219 case EXCEPTION_USE_SYSCALL : {have_exception = false; break;}; 220 default : 221 { 222 throw ERRORMORPHEO(FUNCTION,_("Commit : invalid exception_use.\n")); 223 break; 224 } 225 } 226 227 if (not have_exception) 228 { 229 switch (state) 230 { 231 case ROB_OTHER_WAIT_END : {state = ROB_END_OK_SPECULATIVE; break;} 232 case ROB_BRANCH_WAIT_END : {state = ROB_BRANCH_COMPLETE ; break;} 233 case ROB_MISS_WAIT_END : {state = ROB_END_KO_SPECULATIVE; break;} 234 default : 235 { 236 throw ERRORMORPHEO(FUNCTION,toString(_("Commit : invalid state value (%s).\n"),toString(state).c_str())); 237 break; 238 } 239 } 240 // can have an exception, but this instruction is not sensible a this exception 241 exception = EXCEPTION_NONE; 242 } 243 else 244 { 245 #ifdef DEBUG_TEST 246 if ((entry->type == TYPE_MEMORY) and (exception == EXCEPTION_MEMORY_LOAD_SPECULATIVE)) 247 throw ERRORMORPHEO(FUNCTION,_("Commit : invalid exception.\n")); 248 #endif 249 250 switch (state) 251 { 252 case ROB_OTHER_WAIT_END : 253 case ROB_BRANCH_WAIT_END : {state = ROB_END_EXCEPTION_WAIT_HEAD; break;} 254 case ROB_MISS_WAIT_END : {state = ROB_END_KO_SPECULATIVE ; break;} 255 default : 256 { 257 throw ERRORMORPHEO(FUNCTION,_("Commit : invalid state value.\n")); 258 break; 259 } 260 } 261 } 231 { 232 // Test if the instruction is a load and is a miss speculation (load is commit, but they have an dependence with a previous store) 233 have_miss_speculation = (exception == EXCEPTION_MEMORY_MISS_SPECULATION); 234 235 switch (entry->exception_use) 236 { 237 // Have overflow exception if bit overflow enable is set. 238 case EXCEPTION_USE_RANGE : {have_exception = ((exception == EXCEPTION_RANGE) and PORT_READ(in_SPR_READ_SR_OVE[front_end_id][context_id])); break;} 239 case EXCEPTION_USE_MEMORY_WITH_ALIGNMENT : {have_exception = ((exception == EXCEPTION_BUS_ERROR) or 240 (exception == EXCEPTION_DATA_TLB ) or 241 (exception == EXCEPTION_DATA_PAGE) or 242 (exception == EXCEPTION_ALIGNMENT)); break;}; 243 case EXCEPTION_USE_MEMORY_WITHOUT_ALIGNMENT : {have_exception = ((exception == EXCEPTION_BUS_ERROR) or 244 (exception == EXCEPTION_DATA_TLB ) or 245 (exception == EXCEPTION_DATA_PAGE)); break;}; 246 case EXCEPTION_USE_CUSTOM_0 : {have_exception = (exception == EXCEPTION_CUSTOM_0); break;}; 247 case EXCEPTION_USE_CUSTOM_1 : {have_exception = (exception == EXCEPTION_CUSTOM_1); break;}; 248 case EXCEPTION_USE_CUSTOM_2 : {have_exception = (exception == EXCEPTION_CUSTOM_2); break;}; 249 case EXCEPTION_USE_CUSTOM_3 : {have_exception = (exception == EXCEPTION_CUSTOM_3); break;}; 250 case EXCEPTION_USE_CUSTOM_4 : {have_exception = (exception == EXCEPTION_CUSTOM_4); break;}; 251 case EXCEPTION_USE_CUSTOM_5 : {have_exception = (exception == EXCEPTION_CUSTOM_5); break;}; 252 case EXCEPTION_USE_CUSTOM_6 : {have_exception = (exception == EXCEPTION_CUSTOM_6); break;}; 253 // Case already manage (decod stage -> in insert in ROB) 254 case EXCEPTION_USE_TRAP : {have_exception = false; exception = EXCEPTION_NONE; break;}; 255 case EXCEPTION_USE_NONE : {have_exception = false; exception = EXCEPTION_NONE; break;}; 256 case EXCEPTION_USE_ILLEGAL_INSTRUCTION : {have_exception = false; exception = EXCEPTION_NONE; break;}; 257 case EXCEPTION_USE_SYSCALL : {have_exception = false; exception = EXCEPTION_NONE; break;}; 258 default : 259 { 260 throw ERRORMORPHEO(FUNCTION,_("Commit : invalid exception_use.\n")); 261 break; 262 } 263 } 264 } 265 266 switch (state) 267 { 268 // Branch ... 269 case ROB_BRANCH_WAIT_END : {state = (have_exception)?ROB_END_EXCEPTION_WAIT_HEAD:ROB_BRANCH_COMPLETE; break;} 270 // Store KO 271 case ROB_MISS_WAIT_END : {state = ROB_END_KO_SPECULATIVE; break;} 272 // Store OK, Load and other instruction 273 case ROB_OTHER_WAIT_END : {state = (have_exception)?ROB_END_EXCEPTION_WAIT_HEAD:((have_miss_speculation)?ROB_END_MISS:ROB_END_OK_SPECULATIVE); break;} 274 default : 275 { 276 throw ERRORMORPHEO(FUNCTION,toString(_("Commit : invalid state value (%s).\n"),toString(state).c_str())); 277 break; 278 } 279 } 262 280 263 281 // update Re Order Buffer … … 287 305 288 306 entry_t * entry = _rob [i].front(); 307 rob_state_t state = entry->state; 308 289 309 #ifdef STATISTICS 290 310 if (usage_is_set(_usage,USE_STATISTICS)) 291 311 { 292 rob_state_t state = entry->state;293 294 312 if (state == ROB_END_OK) 295 313 (*_stat_nb_inst_retire_ok [x]) ++; … … 302 320 Tcontext_t context_id = entry->context_id ; 303 321 Ttype_t type = entry->type ; 322 323 if (state == ROB_END_BRANCH_MISS) 324 { 325 reg_EVENT_STATE [front_end_id][context_id] = EVENT_STATE_EVENT; 326 327 // !!!!!!!!!!! Compute address 328 } 304 329 305 330 // Update nb_inst … … 307 332 if (type == TYPE_MEMORY) 308 333 reg_NB_INST_COMMIT_MEM [front_end_id][context_id] --; 309 334 335 if (reg_NB_INST_COMMIT_ALL [front_end_id][context_id] == 0) 336 reg_EVENT_STATE [front_end_id][context_id] = EVENT_STATE_END; 337 310 338 reg_NUM_BANK_HEAD = (reg_NUM_BANK_HEAD+1)%_param->_nb_bank; 311 339 … … 350 378 #endif 351 379 352 entry->state = ROB_END_OK_SPECULATIVE; 380 entry->state = (PORT_READ(in_BRANCH_COMPLETE_MISS_PREDICTION [i]))?ROB_END_OK_SPECULATIVE:ROB_END_BRANCH_MISS_SPECULATIVE; 381 // entry->state = ROB_END_OK_SPECULATIVE; 353 382 } 354 383 355 384 // =================================================================== 385 // =====[ UPDATE ]==================================================== 386 // =================================================================== 387 { 388 // Not yet implemented 389 } 390 391 // =================================================================== 356 392 // =====[ EVENT ]===================================================== 357 393 // =================================================================== 394 { 395 // Not yet implemented 396 } 358 397 359 398 // =================================================================== … … 400 439 switch (state) 401 440 { 402 case ROB_BRANCH_WAIT_END : {state = ROB_MISS_WAIT_END; break;} 403 case ROB_BRANCH_COMPLETE : {state = ROB_END_MISS ; break;} 404 case ROB_STORE_WAIT_HEAD_OK : {state = ROB_STORE_HEAD_KO; break;} 405 //case ROB_STORE_WAIT_HEAD_KO : {state = ; break;} 406 case ROB_OTHER_WAIT_END : {state = ROB_MISS_WAIT_END; break;} 407 case ROB_END_OK_SPECULATIVE : {state = ROB_END_MISS ; break;} 408 case ROB_END_KO_SPECULATIVE : {state = ROB_END_MISS ; break;} 409 case ROB_END_EXCEPTION_WAIT_HEAD : {state = ROB_END_MISS ; break;} 410 411 // don't change 412 case ROB_STORE_HEAD_KO : {break;} 413 case ROB_MISS_WAIT_END : {break;} 414 case ROB_END_MISS : {break;} 415 416 // can't have miss speculation 417 case ROB_STORE_HEAD_OK : 418 case ROB_END_OK : 419 case ROB_END_KO : 420 case ROB_END_EXCEPTION : 421 default : 441 case ROB_BRANCH_WAIT_END : {state = ROB_MISS_WAIT_END; break;} 442 case ROB_BRANCH_COMPLETE : {state = ROB_END_MISS ; break;} 443 case ROB_END_BRANCH_MISS_SPECULATIVE : {state = ROB_END_MISS ; break;} 444 case ROB_STORE_WAIT_HEAD_OK : {state = ROB_STORE_HEAD_KO; break;} 445 //case ROB_STORE_WAIT_HEAD_KO : {state = ; break;} 446 case ROB_OTHER_WAIT_END : {state = ROB_MISS_WAIT_END; break;} 447 case ROB_END_OK_SPECULATIVE : {state = ROB_END_MISS ; break;} 448 case ROB_END_KO_SPECULATIVE : {state = ROB_END_MISS ; break;} 449 case ROB_END_EXCEPTION_WAIT_HEAD : {state = ROB_END_MISS ; break;} 450 451 // don't change 452 case ROB_STORE_HEAD_KO : {break;} 453 case ROB_MISS_WAIT_END : {break;} 454 case ROB_END_MISS : {break;} 455 456 // can't have miss speculation 457 case ROB_STORE_HEAD_OK : 458 case ROB_END_OK : 459 case ROB_END_KO : 460 case ROB_END_BRANCH_MISS : 461 case ROB_END_EXCEPTION : 462 default : 422 463 { 423 464 throw ERRORMORPHEO(FUNCTION,_("Miss Speculation : Invalide state.\n")); … … 434 475 switch (state) 435 476 { 436 case ROB_END_OK_SPECULATIVE : {state = ROB_END_OK ; break;} 437 case ROB_END_KO_SPECULATIVE : {state = ROB_END_KO ; break;} 477 case ROB_END_OK_SPECULATIVE : {state = ROB_END_OK ; break;} 478 case ROB_END_KO_SPECULATIVE : {state = ROB_END_KO ; break;} 479 case ROB_END_BRANCH_MISS_SPECULATIVE : {state = ROB_END_BRANCH_MISS ; break;} 438 480 default : {break;} 439 481 } … … 519 561 (*it)->num_reg_re_phy_new ); 520 562 521 log_printf(TRACE,Commit_unit,FUNCTION," %.2d %.2d %.1d %.1d %.8x %s",563 log_printf(TRACE,Commit_unit,FUNCTION," %.2d %.2d %.1d %.1d %.8x", 522 564 (*it)->exception , 523 565 (*it)->exception_use , 524 566 (*it)->flags , 525 567 (*it)->no_sequence , 526 (*it)->data_commit , 527 toString((*it)->event_state).c_str() 568 (*it)->data_commit 528 569 ); 529 570 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_Address_Translation_unit/src/Register_Address_Translation_unit.cpp
r88 r100 113 113 sensitive << (*(in_RENAME_CONTEXT_ID [i])); 114 114 115 sensitive << (*(in_RENAME_NUM_REG_RA_LOG [i])) 115 sensitive << (*(in_RENAME_VAL [i])) // Not necessary 116 << (*(in_RENAME_NUM_REG_RA_LOG [i])) 116 117 << (*(in_RENAME_NUM_REG_RB_LOG [i])) 117 118 << (*(in_RENAME_NUM_REG_RC_LOG [i])) -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_Address_Translation_unit/src/Register_Address_Translation_unit_genMealy_rename.cpp
r97 r100 29 29 if (PORT_READ(in_RENAME_VAL [i])) // not in sensitive list : it's to have valide value to array access 30 30 { 31 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * RENAME [%d]",i); 32 31 33 Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RENAME_FRONT_END_ID [i]):0; 32 34 Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_RENAME_CONTEXT_ID [i]):0; 33 35 34 Tgeneral_address_t num_reg_ra_log = PORT_READ(in_RENAME_NUM_REG_RA_LOG [i]); //%_param->_nb_general_register; 35 Tgeneral_address_t num_reg_rb_log = PORT_READ(in_RENAME_NUM_REG_RB_LOG [i]); //%_param->_nb_general_register; 36 Tspecial_address_t num_reg_rc_log = PORT_READ(in_RENAME_NUM_REG_RC_LOG [i]); //%_param->_nb_special_register; 37 Tgeneral_address_t num_reg_rd_log = PORT_READ(in_RENAME_NUM_REG_RD_LOG [i]); //%_param->_nb_general_register; 38 Tspecial_address_t num_reg_re_log = PORT_READ(in_RENAME_NUM_REG_RE_LOG [i]); //%_param->_nb_special_register; 36 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * front_end_id : %d",front_end_id); 37 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * context_id : %d",context_id); 39 38 40 PORT_WRITE(out_RENAME_NUM_REG_RA_PHY [i], rat_gpr[front_end_id][context_id][num_reg_ra_log]); 41 PORT_WRITE(out_RENAME_NUM_REG_RB_PHY [i], rat_gpr[front_end_id][context_id][num_reg_rb_log]); 42 PORT_WRITE(out_RENAME_NUM_REG_RC_PHY [i], rat_spr[front_end_id][context_id][num_reg_rc_log]); 43 PORT_WRITE(out_RENAME_NUM_REG_RD_PHY_OLD [i], rat_gpr[front_end_id][context_id][num_reg_rd_log]); 44 PORT_WRITE(out_RENAME_NUM_REG_RE_PHY_OLD [i], rat_spr[front_end_id][context_id][num_reg_re_log]); 45 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION,"yo6"); 39 Tgeneral_address_t num_reg_ra_log = PORT_READ(in_RENAME_NUM_REG_RA_LOG [i]); //%_param->_nb_general_register; 40 Tgeneral_address_t num_reg_rb_log = PORT_READ(in_RENAME_NUM_REG_RB_LOG [i]); //%_param->_nb_general_register; 41 Tspecial_address_t num_reg_rc_log = PORT_READ(in_RENAME_NUM_REG_RC_LOG [i]); //%_param->_nb_special_register; 42 Tgeneral_address_t num_reg_rd_log = PORT_READ(in_RENAME_NUM_REG_RD_LOG [i]); //%_param->_nb_general_register; 43 Tspecial_address_t num_reg_re_log = PORT_READ(in_RENAME_NUM_REG_RE_LOG [i]); //%_param->_nb_special_register; 44 45 Tgeneral_address_t num_reg_ra_phy = rat_gpr[front_end_id][context_id][num_reg_ra_log]; 46 Tgeneral_address_t num_reg_rb_phy = rat_gpr[front_end_id][context_id][num_reg_rb_log]; 47 Tspecial_address_t num_reg_rc_phy = rat_spr[front_end_id][context_id][num_reg_rc_log]; 48 Tgeneral_address_t num_reg_rd_phy_old= rat_gpr[front_end_id][context_id][num_reg_rd_log]; 49 Tspecial_address_t num_reg_re_phy_old= rat_spr[front_end_id][context_id][num_reg_re_log]; 50 51 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * num_reg_ra : %d -> %d",num_reg_ra_log,num_reg_ra_phy ); 52 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * num_reg_rb : %d -> %d",num_reg_rb_log,num_reg_rb_phy ); 53 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * num_reg_rc : %d -> %d",num_reg_rc_log,num_reg_rc_phy ); 54 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * num_reg_rd : %d -> %d",num_reg_rd_log,num_reg_rd_phy_old); 55 log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * num_reg_re : %d -> %d",num_reg_re_log,num_reg_re_phy_old); 56 57 58 PORT_WRITE(out_RENAME_NUM_REG_RA_PHY [i], num_reg_ra_phy ); 59 PORT_WRITE(out_RENAME_NUM_REG_RB_PHY [i], num_reg_rb_phy ); 60 PORT_WRITE(out_RENAME_NUM_REG_RC_PHY [i], num_reg_rc_phy ); 61 PORT_WRITE(out_RENAME_NUM_REG_RD_PHY_OLD [i], num_reg_rd_phy_old); 62 PORT_WRITE(out_RENAME_NUM_REG_RE_PHY_OLD [i], num_reg_re_phy_old); 46 63 } 47 64 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_Address_Translation_unit/src/Register_Address_Translation_unit_transition.cpp
r98 r100 37 37 38 38 for (uint32_t k=1; k<_param->_nb_general_register_logic; k++) 39 rat_gpr [i][j][k] = gpr++; 39 { 40 rat_gpr [i][j][k] = gpr++; 41 // rat_gpr_update_table[i][j][k] = 0; 42 } 40 43 for (uint32_t k=0; k<_param->_nb_special_register_logic; k++) 41 rat_spr [i][j][k] = spr++; 44 { 45 rat_spr [i][j][k] = spr++; 46 // rat_spr_update_table[i][j][k] = 0; 47 } 42 48 } 43 49 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Special_Register_unit/src/Special_Register_unit_transition.cpp
r98 r100 95 95 if (PORT_READ(in_SPR_COMMIT_VAL [i][j])) // out_SPR_COMMIT_ACK [i][j] 96 96 { 97 log_printf(TRACE,Special_Register_unit,FUNCTION," * SPR_COMMIT [%d][%d]",i,j); 98 log_printf(TRACE,Special_Register_unit,FUNCTION," * F : %d, %d",PORT_READ(in_SPR_COMMIT_SR_F_VAL [i][j]),PORT_READ(in_SPR_COMMIT_SR_F [i][j])); 99 log_printf(TRACE,Special_Register_unit,FUNCTION," * CY : %d, %d",PORT_READ(in_SPR_COMMIT_SR_CY_VAL [i][j]),PORT_READ(in_SPR_COMMIT_SR_CY [i][j])); 100 log_printf(TRACE,Special_Register_unit,FUNCTION," * OV : %d, %d",PORT_READ(in_SPR_COMMIT_SR_OV_VAL [i][j]),PORT_READ(in_SPR_COMMIT_SR_OV [i][j])); 101 102 log_printf(TRACE,Special_Register_unit,FUNCTION," * SPR (before) : %.8x",_spr [i][j][GROUP_SYSTEM_AND_CONTROL][SPR_SR]->read()); 97 103 SR * sr = static_cast<SR*>(_spr [i][j][GROUP_SYSTEM_AND_CONTROL][SPR_SR]); 98 104 … … 105 111 if (PORT_READ(in_SPR_COMMIT_SR_OV_VAL [i][j])) 106 112 sr->ov = PORT_READ(in_SPR_COMMIT_SR_OV [i][j]); 113 114 log_printf(TRACE,Special_Register_unit,FUNCTION," * SPR (after) : %.8x",_spr [i][j][GROUP_SYSTEM_AND_CONTROL][SPR_SR]->read()); 115 107 116 } 108 117 109 118 if (PORT_READ(in_SPR_EVENT_VAL [i][j])) // out_SPR_EVENT_ACK [i][j] 110 119 { 120 log_printf(TRACE,Special_Register_unit,FUNCTION," * SPR_EVENT [%d][%d]",i,j); 121 log_printf(TRACE,Special_Register_unit,FUNCTION," * SPR (before) : %.8x",_spr [i][j][GROUP_SYSTEM_AND_CONTROL][SPR_SR]->read()); 122 111 123 SR * sr = static_cast<SR*>(_spr [i][j][GROUP_SYSTEM_AND_CONTROL][SPR_SR]); 112 124 sr->dsx = PORT_READ(in_SPR_EVENT_SR_DSX [i][j]); … … 117 129 if (PORT_READ(in_SPR_EVENT_SR_TO_ESR [i][j])) 118 130 _spr [i][j][GROUP_SYSTEM_AND_CONTROL][SPR_ESR ]->write(sr->read()); 131 132 log_printf(TRACE,Special_Register_unit,FUNCTION," * SPR (after) : %.8x",_spr [i][j][GROUP_SYSTEM_AND_CONTROL][SPR_SR]->read()); 119 133 } 120 134 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/Makefile.deps
r81 r100 26 26 $(Behavioural_DIR_LIBRARY) 27 27 28 Queue_DEPENDENCIES = Queue_Control_library \29 Behavioural_library30 31 Queue_CLEAN = Queue_Control_library_clean \32 Behavioural_library_clean33 34 28 #-----[ Rules ]-------------------------------------------- 35 29 36 30 #.NOTPARALLEL : Queue_library Queue_library_clean 37 31 38 Queue_library : $(Queue_DEPENDENCIES)32 Queue_library : 39 33 @\ 34 $(MAKE) Behavioural_library;\ 35 $(MAKE) Queue_Control_library;\ 40 36 $(MAKE) --directory=$(DIR_MORPHEO)/Behavioural/Generic/Queue --makefile=Makefile; 41 37 42 Queue_library_clean : $(Queue_CLEAN)38 Queue_library_clean : 43 39 @\ 40 $(MAKE) Behavioural_library_clean;\ 41 $(MAKE) Queue_Control_library_clean;\ 44 42 $(MAKE) --directory=$(DIR_MORPHEO)/Behavioural/Generic/Queue --makefile=Makefile clean; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/config_size_queue_log2.cfg
r81 r100 2 2 1 32 *2 #_size_queue 3 3 32 32 *2 #_size_data 4 0 0 *2 #_nb_port_slot -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/config_size_queue_no_log2.cfg
r81 r100 2 2 3 256 *4 #_size_queue 3 3 32 32 *2 #_size_data 4 0 0 *2 #_nb_port_slot -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/include/test.h
r81 r100 16 16 17 17 #include "Behavioural/Generic/Queue/include/Queue.h" 18 #include "Common/include/Time.h" 18 19 19 20 using namespace std; … … 26 27 void test (string name, 27 28 morpheo::behavioural::generic::queue::Parameters * param); 28 29 class Time30 {31 private : timeval time_begin;32 // private : timeval time_end;33 34 public : Time ()35 {36 gettimeofday(&time_begin ,NULL);37 };38 39 public : ~Time ()40 {41 cout << *this;42 };43 44 public : friend ostream& operator<< (ostream& output_stream,45 const Time & x)46 {47 timeval time_end;48 49 gettimeofday(&time_end ,NULL);50 51 uint32_t nb_cycles = static_cast<uint32_t>(sc_simulation_time());52 53 double average = static_cast<double>(nb_cycles) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec);54 55 output_stream << nb_cycles << "\t(" << average << " cycles / seconds )" << endl;56 57 return output_stream;58 }59 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/src/main.cpp
r81 r100 8 8 #include "Behavioural/Generic/Queue/SelfTest/include/test.h" 9 9 10 #define NB_PARAMS 210 #define NB_PARAMS 3 11 11 12 12 void usage (int argc, char * argv[]) … … 14 14 cerr << "<Usage> " << argv[0] << " name_instance list_params" << endl 15 15 << "list_params is :" << endl 16 << " - size_queue (uint32_t)" << endl 17 << " - size_data (uint32_t)" << endl 16 << " - size_queue (uint32_t)" << endl 17 << " - size_data (uint32_t)" << endl 18 << " - nb_port_slot (uint32_t)" << endl 18 19 << "" << endl; 19 20 … … 36 37 uint32_t x = 1; 37 38 38 const string name = argv[x++]; 39 const uint32_t size_queue = atoi(argv[x++]); 40 const uint32_t size_data = atoi(argv[x++]); 39 const string name = argv[x++]; 40 const uint32_t size_queue = atoi(argv[x++]); 41 const uint32_t size_data = atoi(argv[x++]); 42 const uint32_t nb_port_slot = atoi(argv[x++]); 41 43 42 44 try … … 44 46 morpheo::behavioural::generic::queue::Parameters * param = new morpheo::behavioural::generic::queue::Parameters 45 47 (size_queue, 46 size_data 48 size_data , 49 nb_port_slot 47 50 ); 48 51 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/src/test.cpp
r88 r100 11 11 12 12 #include "Behavioural/Generic/Queue/SelfTest/include/test.h" 13 #include "Behavioural/include/Allocation.h" 13 14 #include "Common/include/Test.h" 14 15 … … 48 49 sc_clock * in_CLOCK = new sc_clock ("clock", 1.0, 0.5); 49 50 sc_signal<Tcontrol_t> * in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); 50 sc_signal<Tcontrol_t> * in_INSERT_VAL = new sc_signal<Tcontrol_t> ( "in_INSERT_VAL" ); 51 sc_signal<Tcontrol_t> * out_INSERT_ACK = new sc_signal<Tcontrol_t> ("out_INSERT_ACK" ); 52 sc_signal<Tdata_t > * in_INSERT_DATA = new sc_signal<Tdata_t > ( "in_INSERT_DATA"); 53 sc_signal<Tcontrol_t> * out_RETIRE_VAL = new sc_signal<Tcontrol_t> ("out_RETIRE_VAL" ); 54 sc_signal<Tcontrol_t> * in_RETIRE_ACK = new sc_signal<Tcontrol_t> ( "in_RETIRE_ACK" ); 55 sc_signal<Tdata_t > * out_RETIRE_DATA = new sc_signal<Tdata_t > ("out_RETIRE_DATA"); 51 52 ALLOC0_SC_SIGNAL( in_INSERT_VAL , "in_INSERT_VAL" ,Tcontrol_t); 53 ALLOC0_SC_SIGNAL(out_INSERT_ACK ,"out_INSERT_ACK" ,Tcontrol_t); 54 ALLOC0_SC_SIGNAL( in_INSERT_DATA, "in_INSERT_DATA",Tdata_t ); 55 ALLOC0_SC_SIGNAL(out_RETIRE_VAL ,"out_RETIRE_VAL" ,Tcontrol_t); 56 ALLOC0_SC_SIGNAL( in_RETIRE_ACK , "in_RETIRE_ACK" ,Tcontrol_t); 57 ALLOC0_SC_SIGNAL(out_RETIRE_DATA,"out_RETIRE_DATA",Tdata_t ); 58 ALLOC1_SC_SIGNAL(out_SLOT_VAL ,"out_SLOT_VAL" ,Tcontrol_t,_param->_nb_port_slot); 59 ALLOC1_SC_SIGNAL(out_SLOT_DATA ,"out_SLOT_DATA" ,Tdata_t ,_param->_nb_port_slot); 56 60 57 61 /******************************************************** … … 64 68 (*(_Queue->in_NRESET)) (*(in_NRESET)); 65 69 66 (*(_Queue-> in_INSERT_VAL )) (*( in_INSERT_VAL )); 67 (*(_Queue->out_INSERT_ACK )) (*(out_INSERT_ACK )); 68 (*(_Queue-> in_INSERT_DATA)) (*( in_INSERT_DATA)); 69 (*(_Queue->out_RETIRE_VAL )) (*(out_RETIRE_VAL )); 70 (*(_Queue-> in_RETIRE_ACK )) (*( in_RETIRE_ACK )); 71 (*(_Queue->out_RETIRE_DATA)) (*(out_RETIRE_DATA)); 70 INSTANCE0_SC_SIGNAL(_Queue, in_INSERT_VAL ); 71 INSTANCE0_SC_SIGNAL(_Queue,out_INSERT_ACK ); 72 INSTANCE0_SC_SIGNAL(_Queue, in_INSERT_DATA); 73 INSTANCE0_SC_SIGNAL(_Queue,out_RETIRE_VAL ); 74 INSTANCE0_SC_SIGNAL(_Queue, in_RETIRE_ACK ); 75 INSTANCE0_SC_SIGNAL(_Queue,out_RETIRE_DATA); 76 INSTANCE1_SC_SIGNAL(_Queue,out_SLOT_VAL ,_param->_nb_port_slot); 77 INSTANCE1_SC_SIGNAL(_Queue,out_SLOT_DATA ,_param->_nb_port_slot); 72 78 73 79 cout << "<" << name << "> Start Simulation ............" << endl; … … 103 109 uint32_t data_in = 0; 104 110 uint32_t data_out = 0; 111 uint32_t nb_elt = 0; 105 112 106 113 for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) … … 116 123 SC_START(0); // genMoore 117 124 125 for (uint32_t i=0; i<_param->_nb_port_slot; ++i) 126 { 127 TEST(Tcontrol_t, out_SLOT_VAL [i]->read(), (i<nb_elt)); 128 if (i<nb_elt) 129 TEST(Tdata_t , out_SLOT_DATA[i]->read(), data_out+i); 130 131 } 132 118 133 if ( in_INSERT_VAL->read() and out_INSERT_ACK->read()) 119 134 { 120 135 LABEL ("Transaction with interface : INSERT"); 121 136 data_in ++; 137 nb_elt ++; 122 138 } 123 139 if (out_RETIRE_VAL->read() and in_RETIRE_ACK->read()) … … 126 142 TEST(Tdata_t, out_RETIRE_DATA->read(), data_out); 127 143 data_out++; 144 nb_elt --; 128 145 } 129 146 … … 142 159 delete in_CLOCK; 143 160 delete in_NRESET; 161 162 DELETE0_SC_SIGNAL( in_INSERT_VAL ); 163 DELETE0_SC_SIGNAL(out_INSERT_ACK ); 164 DELETE0_SC_SIGNAL( in_INSERT_DATA); 165 DELETE0_SC_SIGNAL(out_RETIRE_VAL ); 166 DELETE0_SC_SIGNAL( in_RETIRE_ACK ); 167 DELETE0_SC_SIGNAL(out_RETIRE_DATA); 168 DELETE1_SC_SIGNAL(out_SLOT_VAL ,_param->_nb_port_slot); 169 DELETE1_SC_SIGNAL(out_SLOT_DATA ,_param->_nb_port_slot); 170 144 171 #endif 145 172 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/include/Parameters.h
r88 r100 22 22 { 23 23 //-----[ fields ]------------------------------------------------------------ 24 public : const uint32_t _size_queue ;25 public : const uint32_t _size_data ;26 24 public : const uint32_t _size_queue ; 25 public : const uint32_t _size_data ; 26 public : const uint32_t _nb_port_slot; 27 27 28 28 //-----[ methods ]----------------------------------------------------------- 29 29 public : Parameters (uint32_t size_queue, 30 uint32_t size_data ); 30 uint32_t size_data , 31 uint32_t nb_port_slot); 32 31 33 // public : Parameters (Parameters & param) ; 32 34 public : ~Parameters () ; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/include/Queue.h
r82 r100 74 74 public : SC_OUT(Tdata_t ) * out_RETIRE_DATA; 75 75 76 // ~~~~~[ Interface "slot" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 public : SC_OUT(Tcontrol_t) ** out_SLOT_VAL ; 78 public : SC_OUT(Tdata_t ) ** out_SLOT_DATA; 79 76 80 // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 81 protected : morpheo::behavioural::generic::queue_control::Queue_Control * _queue_control; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Parameters.cpp
r88 r100 17 17 #define FUNCTION "Queue::Parameters" 18 18 Parameters::Parameters (uint32_t size_queue, 19 uint32_t size_data ): 20 _size_queue (size_queue), 21 _size_data (size_data ) 19 uint32_t size_data , 20 uint32_t nb_port_slot): 21 _size_queue (size_queue), 22 _size_data (size_data ), 23 _nb_port_slot (nb_port_slot) 22 24 { 23 25 log_printf(FUNC,Queue,FUNCTION,"Begin"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Parameters_msg_error.cpp
r81 r100 23 23 Parameters_test test("Queue"); 24 24 25 if (_nb_port_slot > _size_queue) 26 test.error(_("nb_port_slot must be <= size_queue\n")); 27 25 28 log_printf(FUNC,Queue,FUNCTION,"End"); 26 29 … … 30 33 }; // end namespace queue 31 34 }; // end namespace generic 32 33 35 }; // end namespace behavioural 34 36 }; // end namespace morpheo -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_allocation.cpp
r88 r100 7 7 8 8 #include "Behavioural/Generic/Queue/include/Queue.h" 9 #include "Behavioural/include/Allocation.h" 9 10 10 11 namespace morpheo { … … 38 39 ,IN 39 40 ,SOUTH, 40 "Generalist interface"41 _("Generalist interface") 41 42 #endif 42 43 ); … … 48 49 // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 49 50 { 50 Interface_fifo * interface = _interfaces->set_interface("insert" 51 #ifdef POSITION 52 ,IN 53 ,WEST 54 ,"Insertion of data" 55 #endif 56 ); 51 ALLOC0_INTERFACE("insert", IN, WEST, _("Interface of data write.")); 57 52 58 in_INSERT_VAL = interface->set_signal_valack_in (VAL);59 out_INSERT_ACK = interface->set_signal_valack_out(ACK);60 in_INSERT_DATA = interface->set_signal_in <Tdata_t> ("data",_param->_size_data);53 ALLOC0_VALACK_IN ( in_INSERT_VAL ,VAL); 54 ALLOC0_VALACK_OUT(out_INSERT_ACK ,ACK); 55 ALLOC0_SIGNAL_IN ( in_INSERT_DATA ,"data",Tdata_t,_param->_size_data); 61 56 } 57 62 58 // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 63 59 { 64 Interface_fifo * interface = _interfaces->set_interface("retire" 65 #ifdef POSITION 66 ,IN 67 ,EAST 68 ,"Retire of data" 69 #endif 70 ); 60 ALLOC0_INTERFACE("retire", OUT, EAST, _("Interface of data read.")); 71 61 72 out_RETIRE_VAL = interface->set_signal_valack_out(VAL); 73 in_RETIRE_ACK = interface->set_signal_valack_in (ACK); 74 out_RETIRE_DATA = interface->set_signal_out <Tdata_t> ("data", _param->_size_data); 62 ALLOC0_VALACK_OUT(out_RETIRE_VAL ,VAL); 63 ALLOC0_VALACK_IN ( in_RETIRE_ACK ,ACK); 64 ALLOC0_SIGNAL_OUT(out_RETIRE_DATA ,"data",Tdata_t,_param->_size_data); 65 } 66 67 // ~~~~~[ Interface "slot" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 { 69 ALLOC1_INTERFACE("slot", OUT, EAST, _("Internal slot."),_param->_nb_port_slot); 70 71 ALLOC1_VALACK_OUT(out_SLOT_VAL ,VAL); 72 ALLOC1_SIGNAL_OUT(out_SLOT_DATA ,"data",Tdata_t,_param->_size_data); 75 73 } 76 74 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_deallocation.cpp
r88 r100 7 7 8 8 #include "Behavioural/Generic/Queue/include/Queue.h" 9 #include "Behavioural/include/Allocation.h" 9 10 10 11 namespace morpheo { … … 24 25 delete in_CLOCK ; 25 26 delete in_NRESET; 26 27 delete in_INSERT_VAL ; 28 delete out_INSERT_ACK ; 29 delete in_INSERT_DATA; 30 31 delete out_RETIRE_VAL ; 32 delete in_RETIRE_ACK ; 33 delete out_RETIRE_DATA; 27 28 DELETE0_SIGNAL( in_INSERT_VAL ,1); 29 DELETE0_SIGNAL(out_INSERT_ACK ,1); 30 DELETE0_SIGNAL( in_INSERT_DATA ,_param->_size_data); 31 32 DELETE0_SIGNAL(out_RETIRE_VAL ,1); 33 DELETE0_SIGNAL( in_RETIRE_ACK ,1); 34 DELETE0_SIGNAL(out_RETIRE_DATA ,_param->_size_data); 35 36 DELETE1_SIGNAL(out_SLOT_VAL ,_param->_nb_port_slot,1); 37 DELETE1_SIGNAL(out_SLOT_DATA ,_param->_nb_port_slot,_param->_size_data); 34 38 35 39 // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_genMoore.cpp
r81 r100 19 19 { 20 20 log_printf(FUNC,Queue,FUNCTION,"Begin"); 21 21 22 // Output 22 23 internal_INSERT_ACK = not _queue_control->full(); 23 24 internal_RETIRE_VAL = not _queue_control->empty(); … … 26 27 PORT_WRITE(out_RETIRE_VAL , internal_RETIRE_VAL); 27 28 PORT_WRITE(out_RETIRE_DATA,_queue_data[(*_queue_control)[0]]); 29 30 // Slot 31 // Note : Slot 0 is the same slot as retire interface. 32 uint32_t nb_elt = _queue_control->nb_elt(); 33 34 for (uint32_t i=0; i<_param->_nb_port_slot; ++i) 35 { 36 PORT_WRITE(out_SLOT_VAL [i], i<nb_elt); 37 PORT_WRITE(out_SLOT_DATA [i],_queue_data[(*_queue_control)[i]]); 38 } 28 39 29 40 log_printf(FUNC,Queue,FUNCTION,"End"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_vhdl_body.cpp
r81 r100 20 20 { 21 21 log_printf(FUNC,Queue,FUNCTION,"Begin"); 22 vhdl->set_body ("-----------------------------------------------------------------------------"); 23 vhdl->set_body ("-- Output"); 24 vhdl->set_body ("-----------------------------------------------------------------------------"); 25 vhdl->set_body ("out_INSERT_ACK <= not reg_FULL;"); 26 vhdl->set_body ("out_RETIRE_VAL <= not reg_EMPTY;"); 27 28 if (_param->_size_queue > 1) 29 vhdl->set_body ("out_RETIRE_DATA <= reg_DATA(conv_integer(reg_PTR_READ));"); 30 else 31 vhdl->set_body ("out_RETIRE_DATA <= reg_DATA(0);"); 32 33 vhdl->set_body (""); 34 vhdl->set_body ("-----------------------------------------------------------------------------"); 35 vhdl->set_body ("-- Signal"); 36 vhdl->set_body ("-----------------------------------------------------------------------------"); 37 vhdl->set_body (""); 38 vhdl->set_body ("signal_PTR_EQUAL <="); 39 if (_param->_size_queue > 1) 40 { 41 vhdl->set_body ("\t'1' when signal_NEXT_PTR_READ = signal_NEXT_PTR_WRITE else"); 42 vhdl->set_body ("\t'0';"); 43 } 44 else 45 vhdl->set_body ("\t'1';"); 46 vhdl->set_body ("signal_NEXT_FULL <="); 47 vhdl->set_body ("\t'1' when signal_WRITE='1' and signal_PTR_EQUAL='1' else"); 48 vhdl->set_body ("\t'0' when signal_READ ='1' else"); 49 vhdl->set_body ("\treg_FULL ;"); 50 vhdl->set_body ("signal_NEXT_EMPTY <="); 51 vhdl->set_body ("\t'1' when signal_READ ='1' and signal_PTR_EQUAL='1' else"); 52 vhdl->set_body ("\t'0' when signal_WRITE='1' else"); 53 vhdl->set_body ("\treg_EMPTY;"); 54 vhdl->set_body (""); 55 vhdl->set_body ("-- read"); 56 vhdl->set_body ("signal_READ <= (not reg_EMPTY) and in_RETIRE_ACK;"); 57 22 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 23 vhdl->set_comment(0," Output"); 24 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 25 vhdl->set_body (0,"out_INSERT_ACK <= not signal_FULL;"); 26 vhdl->set_body (0,"out_RETIRE_VAL <= not signal_EMPTY;"); 27 28 if (_param->_size_queue > 1) 29 vhdl->set_body (0,"out_RETIRE_DATA <= reg_DATA(conv_integer(signal_PTR_READ));"); 30 else 31 vhdl->set_body (0,"out_RETIRE_DATA <= reg_DATA(0);"); 32 33 vhdl->set_body (0,""); 34 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 35 vhdl->set_comment(0," Slot"); 36 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 37 vhdl->set_body (0,""); 38 if (_param->_nb_port_slot > 1) 39 for (uint32_t i=0; i<_param->_nb_port_slot; ++i) 40 if (i==0) 41 vhdl->set_body (0,"signal_SLOT_0 <= signal_PTR_READ;"); 42 else 43 { 44 if (is_power2(_param->_size_queue)) 45 vhdl->set_body (0,"signal_SLOT_"+toString(i)+" <= signal_PTR_READ+"+std_logic_cst(log2(_param->_size_queue),i)+";"); 46 else 47 vhdl->set_body (0,"signal_SLOT_"+toString(i)+" <= const_PTR_INIT when signal_SLOT_"+toString(i-1)+" = const_PTR_MAX else signal_SLOT_"+toString(i-1)+"+'1';"); 48 } 49 50 for (uint32_t i=0; i<_param->_nb_port_slot; ++i) 51 { 52 if (_param->_nb_port_slot > 1) 53 vhdl->set_body (0,"out_SLOT_"+toString(i)+"_VAL <= '1' when reg_NB_ELT > "+std_logic_cst(log2(_param->_size_queue+1),i)+" else '0';"); 54 else 55 vhdl->set_body (0,"out_SLOT_"+toString(i)+"_VAL <= not signal_EMPTY;"); 56 57 if (_param->_nb_port_slot > 1) 58 vhdl->set_body (0,"out_SLOT_"+toString(i)+"_DATA <= reg_DATA(conv_integer(signal_SLOT_"+toString(i)+"));"); 59 else 60 if (_param->_size_queue > 1) 61 vhdl->set_body (0,"out_SLOT_"+toString(i)+"_DATA <= reg_DATA(conv_integer(signal_PTR_READ));"); 62 else 63 vhdl->set_body (0,"out_SLOT_"+toString(i)+"_DATA <= reg_DATA(conv_integer(0));"); 64 } 65 66 vhdl->set_body (0,""); 67 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 68 vhdl->set_comment(0," Signal"); 69 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 70 vhdl->set_body (0,""); 71 vhdl->set_body (0,"signal_READ <= (not signal_EMPTY) and in_RETIRE_ACK;"); 72 vhdl->set_body (0,"signal_WRITE <= (not signal_FULL ) and in_INSERT_VAL;"); 73 vhdl->set_body (0,""); 74 if (_param->_nb_port_slot>1) 75 { 76 vhdl->set_body (0,"signal_EMPTY <= '1' when reg_NB_ELT = "+std_logic_cst(log2(_param->_size_queue+1),0)+" else '0';"); 77 if (is_power2(_param->_size_queue)) 78 vhdl->set_body (0,"signal_FULL <= reg_NB_ELT "+std_logic_range(log2(_param->_size_queue),log2(_param->_size_queue))+";"); 79 else 80 vhdl->set_body (0,"signal_FULL <= '1' when reg_NB_ELT = "+std_logic_cst(log2(_param->_size_queue+1),_param->_size_queue)+" else '0';"); 81 } 82 else 83 { 84 vhdl->set_body (0,"signal_EMPTY <= reg_EMPTY;"); 85 vhdl->set_body (0,"signal_FULL <= reg_FULL ;"); 86 } 87 vhdl->set_body (0,""); 88 if (_param->_size_queue > 1) 89 { 90 vhdl->set_body (0,"signal_PTR_READ <= reg_PTR_READ;"); 91 if (_param->_nb_port_slot>1) 92 { 93 if (is_power2(_param->_size_queue)) 94 vhdl->set_body (0,"signal_PTR_WRITE <= reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue))+";"); 95 else 96 vhdl->set_body (0,"signal_PTR_WRITE <= reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue))+" when reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue)) +" <= const_PTR_MAX else reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue))+" - const_PTR_MAX-'1';"); 97 } 98 else 99 vhdl->set_body (0,"signal_PTR_WRITE <= reg_PTR_WRITE;"); 100 } 101 vhdl->set_body (0,""); 102 103 if (_param->_nb_port_slot>1) 104 { 105 vhdl->set_body (0,""); 106 vhdl->set_comment(0," nb_elt"); 58 107 if (_param->_size_queue > 1) 59 108 { 60 vhdl->set_body ("signal_NEXT_PTR_READ <= "); 61 vhdl->set_body ("\treg_PTR_READ when signal_READ='0' else"); 62 if (is_log2(_param->_size_queue) == false) 63 vhdl->set_body ("\tconst_PTR_INIT when reg_PTR_READ = const_PTR_MAX else"); 64 65 if (_param->_size_queue > 2) 66 vhdl->set_body ("\treg_PTR_READ +'1';"); 67 else 68 vhdl->set_body ("\tnot reg_PTR_READ;"); 69 } 70 vhdl->set_body (""); 71 vhdl->set_body ("-- write"); 72 vhdl->set_body ("signal_WRITE <= (not reg_FULL ) and in_INSERT_VAL;"); 73 if (_param->_size_queue > 1) 74 { 75 vhdl->set_body ("signal_NEXT_PTR_WRITE <= "); 76 vhdl->set_body ("\treg_PTR_WRITE when signal_WRITE='0' else"); 77 if (is_log2(_param->_size_queue) == false) 78 vhdl->set_body ("\tconst_PTR_INIT when reg_PTR_WRITE = const_PTR_MAX else"); 79 if (_param->_size_queue > 2) 80 vhdl->set_body ("\treg_PTR_WRITE+'1';"); 81 else 82 vhdl->set_body ("\tnot reg_PTR_WRITE;"); 83 } 84 vhdl->set_body (""); 85 vhdl->set_body ("-----------------------------------------------------------------------------"); 86 vhdl->set_body ("-- Registers"); 87 vhdl->set_body ("-----------------------------------------------------------------------------"); 88 vhdl->set_body (""); 89 vhdl->set_body ("queue_write: process (in_CLOCK)"); 90 vhdl->set_body ("begin -- process queue_write"); 91 vhdl->set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then"); 92 vhdl->set_body (""); 93 vhdl->set_body ("\t\tif (in_NRESET = '0') then"); 94 if (_param->_size_queue > 1) 95 { 96 vhdl->set_body ("\t\t\treg_PTR_READ <= const_PTR_INIT;"); 97 vhdl->set_body ("\t\t\treg_PTR_WRITE <= const_PTR_INIT;"); 98 } 99 vhdl->set_body ("\t\t\treg_FULL <= '0';"); 100 vhdl->set_body ("\t\t\treg_EMPTY <= '1';"); 101 vhdl->set_body ("\t\telse"); 102 if (_param->_size_queue > 1) 103 { 104 vhdl->set_body ("\t\t\treg_PTR_READ <= signal_NEXT_PTR_READ ;"); 105 vhdl->set_body ("\t\t\treg_PTR_WRITE <= signal_NEXT_PTR_WRITE;"); 106 } 107 vhdl->set_body ("\t\t\treg_FULL <= signal_NEXT_FULL ;"); 108 vhdl->set_body ("\t\t\treg_EMPTY <= signal_NEXT_EMPTY;"); 109 vhdl->set_body (""); 110 vhdl->set_body ("\t\t\tif (signal_WRITE = '1') then"); 111 if (_param->_size_queue > 1) 112 vhdl->set_body ("\t\t\t\treg_DATA(conv_integer(reg_PTR_WRITE)) <= in_INSERT_DATA;"); 113 else 114 vhdl->set_body ("\t\t\t\treg_DATA(0) <= in_INSERT_DATA;"); 115 vhdl->set_body ("\t\t\tend if;"); 116 vhdl->set_body ("\t\tend if;"); 117 vhdl->set_body (""); 118 vhdl->set_body ("\tend if;"); 119 vhdl->set_body ("end process queue_write;"); 109 vhdl->set_body (0,"signal_NEXT_NB_ELT <= "); 110 vhdl->set_body (1,"reg_NB_ELT when (signal_READ xor signal_WRITE) = '0' else"); 111 if (_param->_size_queue > 2) 112 { 113 vhdl->set_body (1,"reg_NB_ELT +'1' when signal_WRITE='1' else"); 114 vhdl->set_body (1,"reg_NB_ELT -'1';"); 115 } 116 else 117 vhdl->set_body (1,"not reg_NB_ELT;"); 118 } 119 } 120 else 121 { 122 vhdl->set_body (0,"signal_PTR_EQUAL <="); 123 if (_param->_size_queue > 1) 124 { 125 vhdl->set_body (1,"'1' when signal_NEXT_PTR_READ = signal_NEXT_PTR_WRITE else"); 126 vhdl->set_body (1,"'0';"); 127 } 128 else 129 vhdl->set_body (1,"'1';"); 130 vhdl->set_body (0,"signal_NEXT_FULL <="); 131 vhdl->set_body (1,"'1' when signal_WRITE='1' and signal_PTR_EQUAL='1' else"); 132 vhdl->set_body (1,"'0' when signal_READ ='1' else"); 133 vhdl->set_body (1,"reg_FULL ;"); 134 vhdl->set_body (0,"signal_NEXT_EMPTY <="); 135 vhdl->set_body (1,"'1' when signal_READ ='1' and signal_PTR_EQUAL='1' else"); 136 vhdl->set_body (1,"'0' when signal_WRITE='1' else"); 137 vhdl->set_body (1,"reg_EMPTY;"); 138 vhdl->set_body (0,""); 139 140 vhdl->set_comment(0," write"); 141 if (_param->_size_queue > 1) 142 { 143 vhdl->set_body (0,"signal_NEXT_PTR_WRITE <= "); 144 vhdl->set_body (1,"reg_PTR_WRITE when signal_WRITE='0' else"); 145 if (is_log2(_param->_size_queue) == false) 146 vhdl->set_body (1,"const_PTR_INIT when reg_PTR_WRITE = const_PTR_MAX else"); 147 if (_param->_size_queue > 2) 148 vhdl->set_body (1,"reg_PTR_WRITE+'1';"); 149 else 150 vhdl->set_body (1,"not reg_PTR_WRITE;"); 151 } 152 } 153 154 vhdl->set_body (0,""); 155 vhdl->set_comment(0," read"); 156 if (_param->_size_queue > 1) 157 { 158 vhdl->set_body (0,"signal_NEXT_PTR_READ <= "); 159 vhdl->set_body (1,"reg_PTR_READ when signal_READ='0' else"); 160 if (is_log2(_param->_size_queue) == false) 161 vhdl->set_body (1,"const_PTR_INIT when reg_PTR_READ = const_PTR_MAX else"); 162 163 if (_param->_size_queue > 2) 164 vhdl->set_body (1,"reg_PTR_READ +'1';"); 165 else 166 vhdl->set_body (1,"not reg_PTR_READ;"); 167 } 168 vhdl->set_body (0,""); 169 170 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 171 vhdl->set_comment(0," Registers"); 172 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 173 vhdl->set_body (0,""); 174 vhdl->set_body (0,"queue_write: process (in_CLOCK)"); 175 vhdl->set_body (0,"begin -- process queue_write"); 176 vhdl->set_body (1,"if in_CLOCK'event and in_CLOCK = '1' then"); 177 vhdl->set_body (0,""); 178 vhdl->set_body (2,"if (in_NRESET = '0') then"); 179 if (_param->_size_queue > 1) 180 { 181 vhdl->set_body (3,"reg_PTR_READ <= const_PTR_INIT;"); 182 if (_param->_nb_port_slot>1) 183 vhdl->set_body (3,"reg_NB_ELT <= "+std_logic_cst(log2(_param->_size_queue+1),0)+";"); 184 else 185 vhdl->set_body (3,"reg_PTR_WRITE <= const_PTR_INIT;"); 186 } 187 if (_param->_nb_port_slot<=1) 188 { 189 vhdl->set_body (3,"reg_FULL <= '0';"); 190 vhdl->set_body (3,"reg_EMPTY <= '1';"); 191 } 192 vhdl->set_body (2,"else"); 193 if (_param->_size_queue > 1) 194 { 195 vhdl->set_body (3,"reg_PTR_READ <= signal_NEXT_PTR_READ ;"); 196 if (_param->_nb_port_slot>1) 197 vhdl->set_body (3,"reg_NB_ELT <= signal_NEXT_NB_ELT ;"); 198 else 199 vhdl->set_body (3,"reg_PTR_WRITE <= signal_NEXT_PTR_WRITE;"); 200 } 201 if (_param->_nb_port_slot<=1) 202 { 203 vhdl->set_body (3,"reg_FULL <= signal_NEXT_FULL ;"); 204 vhdl->set_body (3,"reg_EMPTY <= signal_NEXT_EMPTY;"); 205 } 206 vhdl->set_body (0,""); 207 vhdl->set_body (3,"if (signal_WRITE = '1') then"); 208 if (_param->_size_queue > 1) 209 vhdl->set_body (3,"\treg_DATA(conv_integer(signal_PTR_WRITE)) <= in_INSERT_DATA;"); 210 else 211 vhdl->set_body (3,"\treg_DATA(0) <= in_INSERT_DATA;"); 212 vhdl->set_body (3,"end if;"); 213 vhdl->set_body (2,"end if;"); 214 vhdl->set_body (0,""); 215 vhdl->set_body (1,"end if;"); 216 vhdl->set_body (0,"end process queue_write;"); 120 217 121 218 log_printf(FUNC,Queue,FUNCTION,"End"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_vhdl_declaration.cpp
r81 r100 24 24 25 25 vhdl->set_signal ("reg_DATA ", "Tqueue"); 26 vhdl->set_signal ("reg_FULL ", 1); 27 vhdl->set_signal ("reg_EMPTY ", 1); 28 if (_param->_size_queue > 1) 29 { 30 vhdl->set_signal ("reg_PTR_READ ", log2(_param->_size_queue)); 31 vhdl->set_signal ("reg_PTR_WRITE ", log2(_param->_size_queue)); 32 } 26 33 27 vhdl->set_signal ("signal_READ ", 1); 34 28 vhdl->set_signal ("signal_WRITE ", 1); 35 vhdl->set_signal ("signal_PTR_EQUAL ", 1); 29 vhdl->set_signal ("signal_EMPTY ", 1); 30 vhdl->set_signal ("signal_FULL ", 1); 36 31 37 32 if (_param->_size_queue > 1) 38 33 { 39 vhdl->set_signal ("signal_NEXT_PTR_READ ", log2(_param->_size_queue)); 40 vhdl->set_signal ("signal_NEXT_PTR_WRITE", log2(_param->_size_queue)); 34 vhdl->set_signal ("reg_PTR_READ ", log2(_param->_size_queue)); 35 vhdl->set_signal ("signal_NEXT_PTR_READ ", log2(_param->_size_queue)); 36 vhdl->set_signal ("signal_PTR_READ ", log2(_param->_size_queue)); 37 vhdl->set_signal ("signal_PTR_WRITE ", log2(_param->_size_queue)); 41 38 } 42 39 40 if (_param->_nb_port_slot>1) 41 { 42 vhdl->set_signal ("reg_NB_ELT ", log2(_param->_size_queue+1)); 43 vhdl->set_signal ("signal_NEXT_NB_ELT ", log2(_param->_size_queue+1)); 44 for (uint32_t i=0; i<_param->_nb_port_slot; ++i) 45 vhdl->set_signal ("signal_SLOT_"+toString(i), log2(_param->_size_queue)); 46 } 47 else 48 { 49 if (_param->_size_queue > 1) 50 { 51 vhdl->set_signal ("reg_PTR_WRITE ", log2(_param->_size_queue)); 52 vhdl->set_signal ("signal_NEXT_PTR_WRITE", log2(_param->_size_queue)); 53 } 54 vhdl->set_signal ("reg_FULL ", 1); 55 vhdl->set_signal ("reg_EMPTY ", 1); 43 56 vhdl->set_signal ("signal_NEXT_FULL ", 1); 44 57 vhdl->set_signal ("signal_NEXT_EMPTY ", 1); 45 58 vhdl->set_signal ("signal_PTR_EQUAL ", 1); 59 } 60 46 61 if (_param->_size_queue > 1) 47 62 { -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Makefile.mkf
r96 r100 3 3 # 4 4 5 all: _Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue/SelfTest 5 all: _Generic/Queue/SelfTest _Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue/SelfTest 6 7 _Generic/Queue/SelfTest: 8 gmake all -C Generic/Queue/SelfTest 6 9 7 10 _Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue/SelfTest: … … 9 12 10 13 clean: 14 gmake clean -C Generic/Queue/SelfTest 11 15 gmake clean -C Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue/SelfTest 12 16 … … 14 18 15 19 install: 20 gmake install -C Generic/Queue/SelfTest 16 21 gmake install -C Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue/SelfTest 17 22 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Constants.h
r97 r100 299 299 300 300 // Exception Execution 301 # define EXCEPTION_IFETCH_NONE 0x00 // Fetch Unit generate none exception302 # define EXCEPTION_IFETCH_INSTRUCTION_TLB 0x0a // ITLB miss303 # define EXCEPTION_IFETCH_INSTRUCTION_PAGE 0x04 // No matching or page violation protection in pages tables304 # define EXCEPTION_IFETCH_BUS_ERROR 0x02 // Access at a invalid physical address305 306 # define EXCEPTION_DECOD_NONE 0x00 // none exception307 # define EXCEPTION_DECOD_ILLEGAL_INSTRUCTION 0x01 // Instruction is illegal (no implemented)308 # define EXCEPTION_DECOD_SYSCALL 0x02 // System Call309 //#define EXCEPTION_DECOD_TRAP 0x0e // L.trap or debug unit (note : must read SR !)310 # define EXCEPTION_DECOD_INSTRUCTION_TLB 0x0a // ITLB miss311 # define EXCEPTION_DECOD_INSTRUCTION_PAGE 0x04 // No matching or page violation protection in pages tables312 # define EXCEPTION_DECOD_BUS_ERROR 0x02 // Access at a invalid physical address313 314 # define EXCEPTION_ALU_NONE 0x00 // Functionnal unit generate none exception315 # define EXCEPTION_ALU_RANGE 0x0b // 316 # define EXCEPTION_ALU_SPR_ACCESS_INVALID 0x12 // SPR present in ALU but not compatible privilege317 # define EXCEPTION_ALU_SPR_ACCESS_MUST_READ 0x13 // SPR not present in ALU318 # define EXCEPTION_ALU_SPR_ACCESS_MUST_WRITE 0x14 // SPR not present in ALU319 320 # define EXCEPTION_MEMORY_NONE 0x00 // Load/Store generate none exception321 # define EXCEPTION_MEMORY_ALIGNMENT 0x06 // Load/Store access is not aligned322 # define EXCEPTION_MEMORY_DATA_TLB 0x09 // DTLB miss323 # define EXCEPTION_MEMORY_DATA_PAGE 0x03 // No matching or page violation protection in pages tables324 # define EXCEPTION_MEMORY_BUS_ERROR 0x02 // Access at a invalid physical address325 # define EXCEPTION_MEMORY_MISS_SPECULATION 0x10 // Load miss speculation326 # define EXCEPTION_MEMORY_LOAD_SPECULATIVE 0x11 // The load is speculative : write in register file, but don't commit327 328 # define EXCEPTION_CUSTOM_NONE 0x00 // Custom unit generate none exception329 # define EXCEPTION_CUSTOM_CUST_0 0x19 // Reserved for custom exceptions330 # define EXCEPTION_CUSTOM_CUST_1 0x1a // Reserved for custom exceptions331 # define EXCEPTION_CUSTOM_CUST_2 0x1b // Reserved for custom exceptions332 # define EXCEPTION_CUSTOM_CUST_3 0x1c // Reserved for custom exceptions333 # define EXCEPTION_CUSTOM_CUST_4 0x1d // Reserved for custom exceptions334 # define EXCEPTION_CUSTOM_CUST_5 0x1e // Reserved for custom exceptions335 # define EXCEPTION_CUSTOM_CUST_6 0x1f // Reserved for custom exceptions336 337 # define EXCEPTION_USE_NONE 0x00 // 338 # define EXCEPTION_USE_ILLEGAL_INSTRUCTION 0x01 // illegal_instruction339 # define EXCEPTION_USE_RANGE 0x02 // range340 # define EXCEPTION_USE_MEMORY_WITH_ALIGNMENT 0x03 // TLB miss, page fault, bus error, alignment341 # define EXCEPTION_USE_MEMORY_WITHOUT_ALIGNMENT 0x04 // TLB miss, page fault, bus error342 # define EXCEPTION_USE_SYSCALL 0x05 // syscall343 # define EXCEPTION_USE_TRAP 0x06 // trap344 # define EXCEPTION_USE_CUSTOM_0 0x07 // 345 # define EXCEPTION_USE_CUSTOM_1 0x08 // 346 # define EXCEPTION_USE_CUSTOM_2 0x09 // 347 # define EXCEPTION_USE_CUSTOM_3 0x0a // 348 # define EXCEPTION_USE_CUSTOM_4 0x0b // 349 # define EXCEPTION_USE_CUSTOM_5 0x0c // 350 # define EXCEPTION_USE_CUSTOM_6 0x0d // 301 # define EXCEPTION_IFETCH_NONE 0x00 // Fetch Unit generate none exception 302 # define EXCEPTION_IFETCH_INSTRUCTION_TLB 0x0a // ITLB miss 303 # define EXCEPTION_IFETCH_INSTRUCTION_PAGE 0x04 // No matching or page violation protection in pages tables 304 # define EXCEPTION_IFETCH_BUS_ERROR 0x02 // Access at a invalid physical address 305 306 # define EXCEPTION_DECOD_NONE 0x00 // none exception 307 # define EXCEPTION_DECOD_ILLEGAL_INSTRUCTION 0x01 // Instruction is illegal (no implemented) 308 # define EXCEPTION_DECOD_SYSCALL 0x02 // System Call 309 //#define EXCEPTION_DECOD_TRAP 0x0e // L.trap or debug unit (note : must read SR !) 310 # define EXCEPTION_DECOD_INSTRUCTION_TLB 0x0a // ITLB miss 311 # define EXCEPTION_DECOD_INSTRUCTION_PAGE 0x04 // No matching or page violation protection in pages tables 312 # define EXCEPTION_DECOD_BUS_ERROR 0x02 // Access at a invalid physical address 313 314 # define EXCEPTION_ALU_NONE 0x00 // Functionnal unit generate none exception 315 # define EXCEPTION_ALU_RANGE 0x0b // 316 # define EXCEPTION_ALU_SPR_ACCESS_INVALID 0x12 // * SPR present in ALU but not compatible privilege 317 # define EXCEPTION_ALU_SPR_ACCESS_MUST_READ 0x13 // * SPR not present in ALU 318 # define EXCEPTION_ALU_SPR_ACCESS_MUST_WRITE 0x14 // * SPR not present in ALU 319 320 # define EXCEPTION_MEMORY_NONE 0x00 // Load/Store generate none exception 321 # define EXCEPTION_MEMORY_ALIGNMENT 0x06 // Load/Store access is not aligned 322 # define EXCEPTION_MEMORY_DATA_TLB 0x09 // DTLB miss 323 # define EXCEPTION_MEMORY_DATA_PAGE 0x03 // No matching or page violation protection in pages tables 324 # define EXCEPTION_MEMORY_BUS_ERROR 0x02 // Access at a invalid physical address 325 # define EXCEPTION_MEMORY_MISS_SPECULATION 0x10 // * Load miss speculation 326 # define EXCEPTION_MEMORY_LOAD_SPECULATIVE 0x11 // * The load is speculative : write in register file, but don't commit 327 328 # define EXCEPTION_CUSTOM_NONE 0x00 // Custom unit generate none exception 329 # define EXCEPTION_CUSTOM_CUST_0 0x19 // Reserved for custom exceptions 330 # define EXCEPTION_CUSTOM_CUST_1 0x1a // Reserved for custom exceptions 331 # define EXCEPTION_CUSTOM_CUST_2 0x1b // Reserved for custom exceptions 332 # define EXCEPTION_CUSTOM_CUST_3 0x1c // Reserved for custom exceptions 333 # define EXCEPTION_CUSTOM_CUST_4 0x1d // Reserved for custom exceptions 334 # define EXCEPTION_CUSTOM_CUST_5 0x1e // Reserved for custom exceptions 335 # define EXCEPTION_CUSTOM_CUST_6 0x1f // Reserved for custom exceptions 336 337 # define EXCEPTION_USE_NONE 0x00 // 338 # define EXCEPTION_USE_ILLEGAL_INSTRUCTION 0x01 // illegal_instruction 339 # define EXCEPTION_USE_RANGE 0x02 // range 340 # define EXCEPTION_USE_MEMORY_WITH_ALIGNMENT 0x03 // TLB miss, page fault, bus error, alignment 341 # define EXCEPTION_USE_MEMORY_WITHOUT_ALIGNMENT 0x04 // TLB miss, page fault, bus error 342 # define EXCEPTION_USE_SYSCALL 0x05 // syscall 343 # define EXCEPTION_USE_TRAP 0x06 // trap 344 # define EXCEPTION_USE_CUSTOM_0 0x07 // 345 # define EXCEPTION_USE_CUSTOM_1 0x08 // 346 # define EXCEPTION_USE_CUSTOM_2 0x09 // 347 # define EXCEPTION_USE_CUSTOM_3 0x0a // 348 # define EXCEPTION_USE_CUSTOM_4 0x0b // 349 # define EXCEPTION_USE_CUSTOM_5 0x0c // 350 # define EXCEPTION_USE_CUSTOM_6 0x0d // 351 351 352 352 # define exception_ifetch_to_exception_decod(x) x -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Version.h
r98 r100 10 10 #define MORPHEO_MAJOR_VERSION 0 11 11 #define MORPHEO_MINOR_VERSION 2 12 #define MORPHEO_REVISION " 98"12 #define MORPHEO_REVISION "100" 13 13 #define MORPHEO_CODENAME "Castor" 14 14 15 #define MORPHEO_DATE_DAY " 31"16 #define MORPHEO_DATE_MONTH " 12"17 #define MORPHEO_DATE_YEAR "200 8"15 #define MORPHEO_DATE_DAY "08" 16 #define MORPHEO_DATE_MONTH "01" 17 #define MORPHEO_DATE_YEAR "2009" 18 18 19 19 #define MORPHEO_VERSION morpheo::toString(MORPHEO_MAJOR_VERSION)+"."+morpheo::toString(MORPHEO_MINOR_VERSION)+"."+morpheo::toString(MORPHEO_REVISION) -
trunk/IPs/systemC/processor/Morpheo/Behavioural/mkf.info
r96 r100 15 15 16 16 # build src directory content 17 #target_dep all Generic/Queue/SelfTest17 target_dep all Generic/Queue/SelfTest 18 18 #target_dep all Generic/RegisterFile/RegisterFile_Monolithic/SelfTest 19 19 #target_dep all Generic/RegisterFile/RegisterFile_Multi_Banked/SelfTest -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Types.cpp
r88 r100 19 19 { 20 20 case INSTRUCTION_L_ADD : return instruction_t (TYPE_ALU ,OPERATION_ALU_L_ADD ,ORBIS32,1); 21 case INSTRUCTION_L_ADDC : return instruction_t (TYPE_ALU ,OPERATION_ALU_L_ADD 21 case INSTRUCTION_L_ADDC : return instruction_t (TYPE_ALU ,OPERATION_ALU_L_ADDC ,ORBIS32,1); 22 22 case INSTRUCTION_L_ADDI : return instruction_t (TYPE_ALU ,OPERATION_ALU_L_ADD ,ORBIS32,1); 23 case INSTRUCTION_L_ADDIC : return instruction_t (TYPE_ALU ,OPERATION_ALU_L_ADD 23 case INSTRUCTION_L_ADDIC : return instruction_t (TYPE_ALU ,OPERATION_ALU_L_ADDC ,ORBIS32,1); 24 24 case INSTRUCTION_L_AND : return instruction_t (TYPE_ALU ,OPERATION_ALU_L_AND ,ORBIS32,1); 25 25 case INSTRUCTION_L_ANDI : return instruction_t (TYPE_ALU ,OPERATION_ALU_L_AND ,ORBIS32,1);
Note: See TracChangeset
for help on using the changeset viewer.