Changeset 100
- Timestamp:
- Jan 8, 2009, 2:06:27 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 194 added
- 5 deleted
- 78 edited
- 24 copied
- 13 moved
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); -
trunk/IPs/systemC/processor/Morpheo/Common/include/Debug.h
r97 r100 47 47 48 48 extern debug_verbosity_t debug; 49 50 void debug_init (void); 51 void debug_init (debug_verbosity_t level); 49 extern bool debug_cycle_test; 50 extern double debug_cycle_start; 51 extern double debug_cycle_stop ; 52 53 void debug_init (void); 54 void debug_init (debug_verbosity_t level, 55 double cycle_start, 56 double cycle_stop ); 57 58 #ifdef SYSTEMC 59 #define debug_test_simulation_time \ 60 (not debug_cycle_test or \ 61 ( (sc_simulation_time() >= debug_cycle_start) and \ 62 ((sc_simulation_time() <= debug_cycle_stop) or \ 63 (debug_cycle_stop == -1)))) 64 #else 65 #define debug_test_simulation_time true 66 #endif 67 52 68 #ifdef DEBUG 53 54 69 # define log_printf(level, component, func, str... ) \ 55 70 do \ … … 57 72 debug_init(); \ 58 73 \ 59 if ((debug == DEBUG_ALL ) or \ 60 (DEBUG_ ## level == DEBUG_NONE) or \ 61 (( DEBUG_ ## level <= debug) and \ 62 ( DEBUG_ ## component == true )) ) \ 63 { \ 64 if (DEBUG_ ## level <= DEBUG_INFO) \ 65 { \ 66 msg("%s ",MSG_INFORMATION); \ 67 } \ 68 else \ 69 { \ 70 msg("%s ",MSG_DEBUG); \ 71 } \ 74 if (debug_test_simulation_time) \ 75 if ((debug == DEBUG_ALL ) or \ 76 (DEBUG_ ## level == DEBUG_NONE) or \ 77 (( DEBUG_ ## level <= debug) and \ 78 ( DEBUG_ ## component == true )) ) \ 79 { \ 80 if (DEBUG_ ## level <= DEBUG_INFO) \ 81 { \ 82 msg("%s ",MSG_INFORMATION); \ 83 } \ 84 else \ 85 { \ 86 msg("%s ",MSG_DEBUG); \ 87 } \ 72 88 \ 73 74 {\75 switch (DEBUG_ ## level)\76 77 78 79 80 81 82 83 84 }\85 86 {\87 88 msg(_("In file %s, "),__FILE__);\89 msg(_("at line %d " ),__LINE__);\90 91 }\92 93 msg("\n");\94 89 if (debug >= DEBUG_ALL ) \ 90 { \ 91 switch (DEBUG_ ## level) \ 92 { \ 93 case DEBUG_NONE : msg(_("(none ) ")); break; \ 94 case DEBUG_INFO : msg(_("(information) ")); break; \ 95 case DEBUG_TRACE : msg(_("(trace ) ")); break; \ 96 case DEBUG_FUNC : msg(_("(function ) ")); break; \ 97 case DEBUG_ALL : msg(_("(all ) ")); break; \ 98 default : msg(_("(undefine ) ")); break; \ 99 } \ 100 } \ 101 if (debug >= DEBUG_FUNC) \ 102 { \ 103 msg( "<%s> " ,func); \ 104 msg(_("In file %s, "),__FILE__); \ 105 msg(_("at line %d " ),__LINE__); \ 106 msg( ": " ); \ 107 } \ 108 msg(str); \ 109 msg("\n"); \ 110 } \ 95 111 } while(0) 96 112 -
trunk/IPs/systemC/processor/Morpheo/Common/src/Debug.cpp
r97 r100 15 15 #endif 16 16 debug_verbosity_t debug; 17 bool debug_cycle_test; 18 double debug_cycle_start; 19 double debug_cycle_stop ; 17 20 18 21 #undef FUNCTION … … 24 27 { 25 28 debug = DEBUG; 26 27 // 29 debug_cycle_test = false; 30 // debug_initialized = true; 28 31 } 29 32 #endif … … 32 35 #undef FUNCTION 33 36 #define FUNCTION "debug_init" 34 void debug_init (debug_verbosity_t level) 37 void debug_init (debug_verbosity_t level, 38 double cycle_start, 39 double cycle_stop ) 35 40 { 36 41 #ifdef DEBUG … … 39 44 // Take min 40 45 debug = (level < DEBUG)?level:DEBUG; 41 46 47 #ifdef SYSTEMC 48 debug_cycle_test = (cycle_stop > cycle_start) or (cycle_stop == -1); 49 debug_cycle_start = cycle_start; 50 debug_cycle_stop = cycle_stop; 51 #else 52 debug_cycle_test = false; 53 #endif 54 42 55 debug_initialized = true; 43 56 } -
trunk/IPs/systemC/processor/Morpheo/Common/src/Message.cpp
r97 r100 8 8 #include "Common/include/Debug.h" 9 9 #include "Common/include/Environment.h" 10 #include "Common/include/ToString.h"11 10 #include "Common/include/ErrorMorpheo.h" 11 #include "Common/include/Filename.h" 12 12 #include <sys/types.h> 13 #include <unistd.h>14 13 15 14 namespace morpheo { … … 39 38 { 40 39 // if the file is not define, take pid. 41 std::string filename = directory+"/Morpheo_"+((file!="")?file:toString<pid_t>(getpid()))+".log"; 40 std::string filename = morpheo::filename(directory, 41 "Morpheo", 42 "", 43 "log", 44 (file==""), 45 (file==""), 46 true); 42 47 43 48 log_stream = fopen (filename.c_str(), "w"); -
trunk/IPs/systemC/processor/Morpheo/Documentation/doc/document-morpheo-vhdl_generation/tex/document-morpheo-vhdl_generation-fr.tex
r98 r100 5 5 \SEction{Introduction} 6 6 7 Ce document est une aide pour les développeur des générateurs de modèles VHDL de \cpu.7 Ce document est une aide pour les développeurs des générateurs de modèles VHDL de \cpu. 8 8 Il est décomposé en 6 sections : 9 9 \begin{itemize} … … 16 16 \end{itemize} 17 17 18 \Section{Arborescence}\label{tree} 19 20 Dans le répertoire contenant le projet, nous avons les répertoires suivant : 21 \begin{description} 22 \item[IPs/systemC/processor/Morpheo/Documentation/ :] Contient différent document décrivant certain point du projet, dont cette documentation. 23 \item[IPs/systemC/processor/Morpheo/Behavioural/ :] 24 \item[IPs/systemC/processor/Morpheo/Behavioural/include/ :] 25 \begin{description} 26 \item [Parameters.h :] Contient la classe {\it Parameters}, cette classe définit les paramètres constants. 27 \item [Vhdl.h :] Contient la classe {\it Vhdl}. 28 \end{description} 29 \item[IPs/systemC/processor/Morpheo/Behavioural/\dots/Component :] Chaque composant est inclue dans un répertoire spécifique. 30 \item[IPs/systemC/processor/Morpheo/Behavioural/\dots/Component/include :] 31 \begin{description} 32 \item [Parameters.h :] Contient la classe {\it Parameters}, elle dérive de la classe contenu dans le fichier le répertoire {\it \dots/Behavioural/include/}. 33 \item [Component.h :] Contient la classe {\it Component}. Il définit l'interface, les registres ainsi que les méthodes du modèle systemC. 34 \item [Types.h :] Contient les types spéciaux. 35 \end{description} 36 \item[IPs/systemC/processor/Morpheo/Behavioural/\dots/Component/src :] 37 \begin{description} 38 \item [Component\_transition.cpp :] 39 \item [Component\_genMoore.cpp :] 40 \item [Component\_genMealy\_XXX.cpp :] 41 42 \item [Component\_vhdl\_declaration.cpp :] 43 \item [Component\_vhdl\_body.cpp :] 44 \end{description} 45 \item[IPs/systemC/processor/Morpheo/Behavioural/\dots/Component/Selftest :] 46 \end{description} 47 48 \Section{VHDL : déclaration}\label{vhdl_declaration} 49 50 Les déclarations ce font dans le fichier {\it Component\_vhdl\_declaration.cpp}. 51 52 \subSection{Interfaces} 53 L'interface est définit dans le modèle SystemC. Il n'ont pas nécessaire de la redéfinir pour le modèle VHDL. 54 55 La nomenclature est la suivante : 56 \begin{itemize} 57 \item La direction en minuscule ({\it in}, {\it out}). 58 \item Le nom de l'interface en majuscule ({\it READ}, {\it PUSH}, \dots). 59 \item Le numéro de l'interface (la première interface aura le numéro 0. S'il n'y a qu'une interface, celle ci aura tout de même le numéro 0). 60 \item Le nom du signal en majuscule ({\it VAL}, {\it ADDRESS}, \dots). 61 \end{itemize} 62 63 Par exemple pour la 2 ème interface de lecture d'un banc de registre : 64 \lstparam{VHDL} 65 \begin{lstlisting} 66 in_READ_1_VAL : in std_logic; 67 out_READ_1_ACK : out std_logic; 68 in_READ_1_ADDRESS : in std_logic_vector(8 downto 0); 69 out_READ_1_DATA : out std_logic_vector(31 downto 0); 70 \end{lstlisting} 71 72 Chaque composent (aussi bien combinatoire que séquentielle) possède un signal d'horloge et un signal de reset. (Ce dernier est actif à l'état bas). Ils ont tout les deux le même nom quelque soit le composant. 73 \lstparam{VHDL} 74 \begin{lstlisting} 75 in_CLOCK : in std_logic; 76 in_NRESET : in std_logic; 77 \end{lstlisting} 78 79 \subSection{Types} 80 81 Le type de base utilisé est le {\it std\_logic\_vector} (ou std\_logic si le vecteur est sur un seul bit). Pour cela on utilise la fonction suivante : 82 83 \lstparam{C++} 84 \begin{lstlisting} 85 std::string std_logic (uint32_t size); 86 \end{lstlisting} 87 88 Pour accéder à une partie du vecteur on utilise la fonction {\it std\_logic\_range}. Elle a les prototypes suivant : 89 \lstparam{C++} 90 \begin{lstlisting} 91 std::string std_logic_range (uint32_t size, 92 uint32_t max , 93 uint32_t min); 94 std::string std_logic_range (uint32_t max , 95 uint32_t min); 96 std::string std_logic_range (uint32_t size); 97 std::string _std_logic_range (uint32_t size, 98 uint32_t max , 99 uint32_t min); 100 std::string _std_logic_range (uint32_t max , 101 uint32_t min); 102 std::string _std_logic_range (uint32_t size); 103 \end{lstlisting} 104 105 La première fonction fais un test sur la taille que la seconde ne fait pas. 106 L'argument de la troisième définit la taille (ce qui implique que la borne minimum est 0 et la borne maximum est size-1). 107 Toute les fonctions avec préfixé par un underscore n'effectue pas de test sur les bornes. 108 109 Par exemple : 110 \begin{verbatim} 111 std_logic_range(4) renvoie "(3 downto 0)". 112 std_logic_range(1) renvoie "(0)". 113 _std_logic_range(1) renvoie "(0 downto 0)". 114 \end{verbatim} 115 116 Pour les types plus complexe, la classe {\it Vhdl} possède une méthode générique. Le premier argument est le nom du type le second est le type. 117 118 \lstparam{C++} 119 \begin{lstlisting} 120 void set_type (std::string name, 121 std::string type); 122 \end{lstlisting} 123 124 L'exemple suivant définit un type représentat un tableau de {\it nb\_word} mots de {\it size\_word} bit chacun : 125 \lstparam{C++} 126 \begin{lstlisting} 127 vhdl->set_type ("Tregfile", 128 "array "+std_logic_range(nb_word)+" of "+std_logic(size_word)); 129 \end{lstlisting} 130 131 \subSection{Constantes} 132 133 La déclaration de constante, ce fait avec la méthode {\it set\_constant} de la classe {\it Vhdl}. Les différentes surcharges de cette méthode est le type des arguments {\it type} et {\it init}. 134 135 \lstparam{C++} 136 \begin{lstlisting} 137 void set_constant (std::string name, 138 std::string type, 139 std::string init); 140 void set_constant (std::string name, 141 uint32_t size, 142 std::string init); 143 void set_constant (std::string name, 144 uint32_t size, 145 uint32_t init); 146 \end{lstlisting} 147 148 Par exemple pour coder les états d'un automate à 5 états en One Hot : 149 \lstparam{C++} 150 \begin{lstlisting} 151 vhdl->set_constant ("State_idle",5,1); 152 \end{lstlisting} 153 154 Dans le cas de signaux de type {\it std\_logic}, au lieu de déclarer des constantes, il existe deux fonctions permettant d'utiliser des constantes directement dans le corps du composant. 155 La première est {\it std\_logic\_others}. Elle permet de définir des constantes dont soit les bits sont à pleins un soit à plein zéro. 156 157 \lstparam{C++} 158 \begin{lstlisting} 159 std::string std_logic_others (uint32_t size, 160 bool cst ); 161 \end{lstlisting} 162 163 Pour toute les autres constantes, la méthode {\it std\_logic\_conv} transforme un entier en {\it std\_logic\_vector}. 164 165 \lstparam{C++} 166 \begin{lstlisting} 167 std::string std_logic_conv (uint32_t size, 168 std::string value); 169 std::string std_logic_conv (uint32_t size, 170 uint32_t value); 171 \end{lstlisting} 172 173 174 \subSection{Signaux internes} 175 176 Les signaux internes sont définit grâce au méthode {\it set\_signal}. Le premier argument est le nom du signal. Le second est soit un type soit une taille (dans le cas où le type est un {\it std\_logic\_vector}). 177 \lstparam{C++} 178 \begin{lstlisting} 179 void set_signal (std::string name, 180 std::string type); 181 void set_signal (std::string name, 182 uint32_t size); 183 \end{lstlisting} 184 185 La méthode est également surchargé si le signal à besoin d'une initialisation. 186 187 \lstparam{C++} 188 \begin{lstlisting} 189 void set_signal (std::string name, 190 std::string type, 191 std::string init); 192 void set_signal (std::string name, 193 uint32_t size, 194 std::string init); 195 void set_signal (std::string name, 196 uint32_t size, 197 uint32_t init); 198 \end{lstlisting} 199 200 En vhdl il est possible de renommer une champ d'un signal. Ceci ce fait à l'aide de la fonction {\it set\_alias}. Elle prend 4 arguments. Le premier étant le nom du signal après le renommage. le second est soit le type, soit la taille du {\it std\_logic\_vector} du signal rénommé. Les deux derniers conserné le signal à renommé : le nom de ce dernier ainsi que l'intervalle. Pour le dernier paramètre il est recommandé d'utilisé la fonction {\it std\_logic\_range}. 201 202 \lstparam{C++} 203 \begin{lstlisting} 204 void set_alias (std::string name1 , 205 std::string type1 , 206 std::string name2 , 207 std::string range2); 208 void set_alias (std::string name1 , 209 uint32_t size1 , 210 std::string name2 , 211 std::string range2); 212 \end{lstlisting} 213 214 \Section{VHDL : comportement}\label{vhdl_body} 215 216 Le comportement du composant est définit dans le fichier {\it Component\_vhdl\_body.cpp}. 217 218 Il n'y a pas de fonction aidant à l'écriture du Vhdl. 219 La méthode {\it set\_body} permet de définir une ligne de code VHDL. Un retour à la ligne est automatiquement inséré. Le premier argument est pour l'indentation. 220 \lstparam{C++} 221 \begin{lstlisting} 222 void set_body (uint32_t depth, 223 std::string text ); 224 void set_body (std::string text ); 225 \end{lstlisting} 226 227 Pour les commentaires, il y a la fonction {\it set\_comment}. 228 \lstparam{C++} 229 \begin{lstlisting} 230 void set_comment (uint32_t depth, 231 std::string text ); 232 void set_comment (std::string text ); 233 \end{lstlisting} 234 235 \Section{VHDL : structurelle}\label{vhdl_structural} 236 237 \subSection{Description du fichier {\it Component\_vhdl.cpp}} 238 Les modèles systemC structurelle sont des modèles qui instancie d'autre modèle. Il n'y a pas de description comportementale. Ces modèles sont générés automatiquement. 239 Par contre les modèles systemC comportementales peuvent être décrit par un modèle VHDL mixte (incluant une description comportementale et des instances d'autre composant). 240 241 Les modèles génériques sont dans le répertoire {\it IPs/systemC/processor/Morpheo/Behavioural/Generic}. 242 243 \lstparam{C++} 244 \begin{lstlisting}[caption={Component\_vhdl.cpp}, label=component_vhdl.cpp] 245 void component::vhdl (void) 246 { 247 Vhdl * vhdl = new Vhdl (_name); 248 249 _interfaces->set_port(vhdl); 250 _component->vhdl_instance(vhdl); 251 252 vhdl_declaration (vhdl); 253 vhdl_body (vhdl); 254 255 vhdl->generate_file(); 256 257 delete vhdl; 258 }; 259 \end{lstlisting} 260 261 262 La première étape est d'éditer le fichier {\it Component\_vhdl.cpp}. Le listing \ref{component_vhdl.cpp} représente le contenu de ce fichier. 263 \begin{itemize} 264 \item Ligne 3 : Déclaration et construction de la variable {\it vhdl} qui est du type {\it Vhdl}. 265 \item Ligne 5 : Ajout dans le modèle VHDL des interfaces présentes dans le modèle SystemC. (cf fichiers Component.h). 266 \item Ligne 6 : Ajout dans le modèle VHDL des composants internes dans le modèle SystemC. (cf fichiers Component.h et Component\_allocation.cpp). 267 \item Ligne 8 : Ajout dans le modèle VHDL des déclarations définit dans le fichiers Component\_vhdl\_declaration.cpp (cf section \ref{vhdl_declaration}). 268 \item Ligne 9 : Ajout dans le modèle VHDL de la description comportemental définit dans le fichiers Component\_vhdl\_body.cpp (cf section \ref{vhdl_body}). 269 \item Ligne 11 : Génération des fichiers VHDL. Le nom du fichier est construit à partir du nom fournit lors de la construction de la variable {\it vhdl}. 270 \item Ligne 13 : Destruction de l'objet. 271 \end{itemize} 272 273 Pour la suite, nous allons supposer l'instanciation d'une FIFO. 274 275 \subSection{Ajout d'une instance} 276 277 Dans le fichier Component\_vhdl.cpp : 278 \begin{enumerate} 279 \item Inclure la définition de la classe désirée. 280 \lstparam{C++} 281 \begin{lstlisting} 282 #include "Behavioural/Generic/Queue/include/Queue.h" 283 \end{lstlisting} 284 \item Creer les paramètres du modèles. 285 \lstparam{C++} 286 \begin{lstlisting} 287 morpheo::behavioural::generic::queue::Parameters * param_queue; 288 param_queue = new morpheo::behavioural::generic::queue::Parameters 289 (16, //size_queue 290 32);//size_data 291 \end{lstlisting} 292 \item Creer le modèle 293 \lstparam{C++} 294 \begin{lstlisting} 295 morpheo::behavioural::generic::queue::Queue * queue; 296 std::string queue_name = _name + "_queue"; 297 298 queue = new morpheo::behavioural::generic::queue::Queue 299 (queue_name.c_str() // nom du modèle 300 #ifdef STATISTICS 301 ,NULL // Pas paramètres pour les statistiques 302 #endif 303 ,param_queue // Paramètres de la file 304 ,USE_VHDL); // Utilisation du modèle VHDL 305 \end{lstlisting} 306 \item Inclure le modèle dans la liste des composants internes 307 \lstparam{C++} 308 \begin{lstlisting} 309 _component->set_component(queue->_component 310 #ifdef POSITION 311 , 20, 20, 20, 20 312 // Coordonée pour l'outil de visualisation 313 #endif 314 , INSTANCE_LIBRARY 315 // Instancier uniquement les libraries 316 ); 317 \end{lstlisting} 318 \item Indiquer dans le fichier Makefile.deps que le composant dépends de ce modèle. 319 \lstparam{make} 320 \begin{lstlisting} 321 # Inclure les dépendances 322 ifndef Queue 323 include $(DIR_MORPHEO)/Behavioural/Generic/Queue/Makefile.deps 324 endif 325 326 # Inclure les librairies 327 Component_LIBRARY = -lComponent \ 328 $(Queue_LIBRARY) 329 330 # Les chemins vers les libraries 331 Component_DIR_LIBRARY = -L$(Component_DIR)/lib \ 332 $(Queue_DIR_LIBRARY) 333 334 # Construction de la librarie ``Component'' 335 Component_library : 336 @\ 337 $(MAKE) Queue_library; \ 338 $(MAKE) --directory=$(Component_DIR) --makefile=Makefile; 339 340 # Effacement des fichiers générés 341 Component_library_clean : 342 @\ 343 $(MAKE) Queue_library_clean; \ 344 $(MAKE) --directory=$(Component_DIR) --makefile=Makefile clean; 345 \end{lstlisting} 346 \end{enumerate} 347 348 \subSection{Instanciation} 349 L'instanciation ce fait comme avec des composants VHDL classique : 350 \lstparam{C++} 351 \begin{lstlisting} 352 vhdl->set_comment(0,""); 353 vhdl->set_comment(0,"-----------------------------------"); 354 vhdl->set_comment(0,"-- Instance queue "); 355 vhdl->set_comment(0,"-----------------------------------"); 356 vhdl->set_comment(0,""); 357 358 vhdl->set_body (0,"instance_"+_name+"_queue : "+_name+"_queue"); 359 vhdl->set_body (0,"port map ("); 360 vhdl->set_body (1," in_CLOCK \t=>\t in_CLOCK "); 361 vhdl->set_body (1,", in_NRESET \t=>\t in_NRESET"); 362 vhdl->set_body (1,", in_INSERT_VAL \t=>\tinternal_QUEUE_INSERT_VAL"); 363 vhdl->set_body (1,",out_INSERT_ACK \t=>\tinternal_QUEUE_INSERT_ACK"); 364 vhdl->set_body (1,", in_INSERT_DATA \t=>\tinternal_QUEUE_INSERT_DATA"); 365 vhdl->set_body (1,",out_RETIRE_VAL \t=>\tinternal_QUEUE_RETIRE_VAL"); 366 vhdl->set_body (1,", in_RETIRE_ACK \t=>\tinternal_QUEUE_RETIRE_ACK"); 367 vhdl->set_body (1,",out_RETIRE_DATA \t=>\tinternal_QUEUE_RETIRE_DATA"); 368 vhdl->set_body (0,");"); 369 \end{lstlisting} 370 371 \Section{Exemples}\label{example} 372 373 \subSection{Banc de Registres Monolithique} 374 375 \subsubSection{Fichier RegisterFile\_Monolithic\_vhdl.cpp} 376 377 \lstparam{C++} 378 \begin{lstlisting}[caption={RegisterFile\_Monolithic\_vhdl.cpp}] 379 void RegisterFile_Monolithic::vhdl (void) 380 { 381 Vhdl * vhdl = new Vhdl (_name); 382 383 _interfaces->set_port (vhdl); 384 _component ->vhdl_instance(vhdl); 385 386 vhdl_declaration (vhdl); 387 vhdl_body (vhdl); 388 389 vhdl->generate_file(); 390 391 delete vhdl; 392 }; 393 \end{lstlisting} 394 395 396 \subsubSection{Fichier RegisterFile\_Monolithic\_vhdl\_declaration.cpp} 397 398 \lstparam{C++} 399 \begin{lstlisting}[caption={RegisterFile\_Monolithic\_vhdl\_declaration.cpp}] 400 void RegisterFile_Monolithic::vhdl_declaration (Vhdl * & vhdl) 401 { 402 vhdl->set_type ("Tregfile", "array " + std_logic_range(_param->_nb_word,true)+ 403 " of "+ 404 std_logic(_param->_size_word)); 405 406 vhdl->set_signal ("reg_DATA", "Tregfile"); 407 }; 408 \end{lstlisting} 409 410 \subsubSection{Fichier RegisterFile\_Monolithic\_vhdl\_body.cpp} 411 412 \lstparam{C++} 413 \begin{lstlisting}[caption={RegisterFile\_Monolithic\_vhdl\_body.cpp}] 414 void RegisterFile_Monolithic::vhdl_body (Vhdl * & vhdl) 415 { 416 vhdl->set_body (0,""); 417 vhdl->set_comment(0,"---------------------------------------------------"); 418 vhdl->set_comment(0," Ack"); 419 vhdl->set_comment(0,"---------------------------------------------------"); 420 vhdl->set_body (0,""); 421 422 for (uint32_t i = 0; i < _param->_nb_port_read; i++) 423 vhdl->set_body (0,"out_READ_"+toString(i)+"_ACK <= '1';"); 424 for (uint32_t i = 0; i < _param->_nb_port_write; i++) 425 vhdl->set_body (0,"out_WRITE_"+toString(i)+"_ACK <= '1';"); 426 427 vhdl->set_body (0,""); 428 vhdl->set_comment(0,"---------------------------------------------------"); 429 vhdl->set_comment(0," Read RegisterFile"); 430 vhdl->set_comment(0,"---------------------------------------------------"); 431 vhdl->set_body (0,""); 432 433 for (uint32_t i = 0; i < _param->_nb_port_read; i++) 434 { 435 std::string str_address; 436 if (_param->_have_port_address) 437 str_address = "conv_integer(in_READ_"+toString(i)+"_ADDRESS)"; 438 else 439 str_address = "0"; 440 441 vhdl->set_body (0,"out_READ_"+toString(i)+"_DATA <= reg_DATA ("+str_address+ 442 ") when in_READ_"+toString(i)+"_VAL = '1' else "+ 443 std_logic_others(_param->_size_word,0)+";"); 444 } 445 446 vhdl->set_body (0,""); 447 vhdl->set_comment(0,"---------------------------------------------------"); 448 vhdl->set_comment(0," Write RegisterFile"); 449 vhdl->set_comment(0,"---------------------------------------------------"); 450 vhdl->set_body (0,""); 451 452 vhdl->set_body (0,"RegisterFile_write: process (in_CLOCK)"); 453 vhdl->set_body (0,"begin -- process RegisterFile_write"); 454 vhdl->set_body (1,"if in_CLOCK'event and in_CLOCK = '1' then"); 455 456 for (uint32_t i = 0; i < _param->_nb_port_write; i++) 457 { 458 std::string str_address; 459 if (_param->_have_port_address) 460 str_address = "conv_integer(in_WRITE_"+toString(i)+"_ADDRESS)"; 461 else 462 str_address = "0"; 463 464 vhdl->set_body (2,"if (in_WRITE_"+toString(i)+"_VAL = '1') then"); 465 vhdl->set_body (3,"reg_DATA("+str_address+") <= in_WRITE_"+toString(i)+"_DATA;"); 466 vhdl->set_body (2,"end if;"); 467 } 468 469 vhdl->set_body (1,"end if;"); 470 vhdl->set_body (0,"end process RegisterFile_write;"); 471 }; 472 \end{lstlisting} 473 474 \subsubSection{Fichier RegisterFile\_Monolithic.vhdl} 475 476 \lstparam{VHDL} 477 \begin{lstlisting}[caption={RegisterFile\_Monolithic.cpp}] 478 library ieee; 479 use ieee.numeric_bit.all; 480 use ieee.numeric_std.all; 481 use ieee.std_logic_1164.all; 482 use ieee.std_logic_arith.all; 483 use ieee.std_logic_misc.all; 484 --use ieee.std_logic_signed.all; 485 use ieee.std_logic_unsigned.all; 486 --use ieee.std_logic_textio.all; 487 488 489 library work; 490 use work.RegisterFile_Monolithic_Pack.all; 491 492 493 entity RegisterFile_Monolithic is 494 port ( in_CLOCK : in std_logic; 495 in_NRESET : in std_logic; 496 in_READ_0_VAL : in std_logic; 497 out_READ_0_ACK : out std_logic; 498 in_READ_0_ADDRESS : in std_logic_vector(8 downto 0); 499 out_READ_0_DATA : out std_logic_vector(31 downto 0); 500 in_WRITE_0_VAL : in std_logic; 501 out_WRITE_0_ACK : out std_logic; 502 in_WRITE_0_ADDRESS: in std_logic_vector(8 downto 0); 503 in_WRITE_0_DATA : in std_logic_vector(31 downto 0) 504 ); 505 end RegisterFile_Monolithic; 506 507 architecture behavioural of RegisterFile_Monolithic is 508 type Tregfile is array (511 downto 0) of std_logic_vector(31 downto 0); 509 510 signal reg_DATA : Tregfile; 511 512 begin 513 ----------------------------------------------------- 514 -- Ackitement 515 ----------------------------------------------------- 516 517 out_READ_0_ACK <= '1'; 518 out_WRITE_0_ACK <= '1'; 519 520 ----------------------------------------------------- 521 -- Read RegisterFile 522 ----------------------------------------------------- 523 524 out_READ_0_DATA <= reg_DATA (conv_integer(in_READ_0_ADDRESS)) 525 when in_READ_0_VAL = '1' 526 else (others => '0'); 527 528 ----------------------------------------------------- 529 -- Write RegisterFile 530 ----------------------------------------------------- 531 532 RegisterFile_write: process (in_CLOCK) 533 begin -- process RegisterFile_write 534 if in_CLOCK'event and in_CLOCK = '1' then 535 if (in_WRITE_0_VAL = '1') then 536 reg_DATA(conv_integer(in_WRITE_0_ADDRESS)) <= in_WRITE_0_DATA; 537 end if; 538 end if; 539 end process RegisterFile_write; 540 end behavioural; 541 \end{lstlisting} 542 543 \subSection{Tampon entre la boucle d'exécutione et le buffer de réordonnancement} 544 545 \subsubSection{Fichier Execute\_queue\_vhdl.cpp} 546 547 \lstparam{C++} 548 \begin{lstlisting}[caption={Execute\_queue\_vhdl.cpp}] 549 void Execute_queue::vhdl (void) 550 { 551 morpheo::behavioural::generic::queue::Parameters * param_queue; 552 553 param_queue = new morpheo::behavioural::generic::queue::Parameters 554 (_param->_size_queue, 555 _param->_size_internal_queue 556 ); 557 558 morpheo::behavioural::generic::queue::Queue * queue; 559 560 std::string queue_name = _name + "_queue"; 561 queue = new morpheo::behavioural::generic::queue::Queue 562 (queue_name.c_str() 563 #ifdef STATISTICS 564 ,NULL 565 #endif 566 ,param_queue 567 ,USE_VHDL); 568 569 _component->set_component(queue->_component 570 #ifdef POSITION 571 , 50, 50, 50, 50 572 #endif 573 , INSTANCE_LIBRARY 574 ); 575 576 Vhdl * vhdl = new Vhdl (_name); 577 578 _interfaces->set_port(vhdl); 579 _component->vhdl_instance(vhdl); 580 581 vhdl_declaration (vhdl); 582 vhdl_body (vhdl); 583 584 vhdl->generate_file(); 585 586 delete vhdl; 587 }; 588 \end{lstlisting} 589 590 \subsubSection{Fichier Execute\_queue\_vhdl\_declaration.cpp} 591 592 \lstparam{C++} 593 \begin{lstlisting}[caption={Execute\_queue\_vhdl\_declaration.cpp}] 594 void Execute_queue::vhdl_declaration (Vhdl * & vhdl) 595 { 596 vhdl->set_alias ("internal_QUEUE_INSERT_VAL ", 597 1, 598 " in_EXECUTE_QUEUE_IN_VAL", 599 std_logic_range(1)); 600 vhdl->set_alias ("internal_QUEUE_INSERT_ACK ", 601 1, 602 "out_EXECUTE_QUEUE_IN_ACK", 603 std_logic_range(1)); 604 vhdl->set_signal ("internal_QUEUE_INSERT_DATA", 605 _param->_size_internal_queue); 606 vhdl->set_signal ("internal_QUEUE_RETIRE_DATA", 607 _param->_size_internal_queue); 608 vhdl->set_alias ("internal_QUEUE_RETIRE_VAL ", 609 1, 610 "out_EXECUTE_QUEUE_OUT_VAL", 611 std_logic_range(1)); 612 vhdl->set_alias ("internal_QUEUE_RETIRE_ACK ", 613 1, 614 " in_EXECUTE_QUEUE_OUT_ACK", 615 std_logic_range(1)); 616 617 uint32_t min = 0; 618 uint32_t max, size; 619 620 if(_param->_have_port_context_id ) 621 { 622 size = _param->_size_context_id; 623 max = min-1+size; 624 vhdl->set_alias ("internal_EXECUTE_QUEUE_OUT_CONTEXT_ID ", 625 std_logic(size), 626 "internal_QUEUE_RETIRE_DATA", 627 std_logic_range(_param->_size_internal_queue,max,min)); 628 min = max+1; 629 } 630 if(_param->_have_port_front_end_id ) 631 { 632 size = _param->_size_front_end_id; 633 max = min-1+size; 634 vhdl->set_alias ("internal_EXECUTE_QUEUE_OUT_FRONT_END_ID ", 635 std_logic(size), 636 "internal_QUEUE_RETIRE_DATA", 637 std_logic_range(_param->_size_internal_queue,max,min)); 638 min = max+1; 639 } 640 if(_param->_have_port_ooo_engine_id ) 641 { 642 size = _param->_size_ooo_engine_id; 643 max = min-1+size; 644 vhdl->set_alias ("internal_EXECUTE_QUEUE_OUT_OOO_ENGINE_ID ", 645 std_logic(size), 646 "internal_QUEUE_RETIRE_DATA", 647 std_logic_range(_param->_size_internal_queue,max,min)); 648 min = max+1; 649 } 650 if(_param->_have_port_rob_ptr) 651 { 652 size = _param->_size_rob_ptr; 653 max = min-1+size; 654 vhdl->set_alias ("internal_EXECUTE_QUEUE_OUT_PACKET_ID ", 655 std_logic(size), 656 "internal_QUEUE_RETIRE_DATA", 657 std_logic_range(_param->_size_internal_queue,max,min)); 658 min = max+1; 659 } 660 661 size = _param->_size_special_data; 662 max = min-1+size; 663 vhdl->set_alias ("internal_EXECUTE_QUEUE_OUT_FLAGS ", 664 std_logic(size), 665 "internal_QUEUE_RETIRE_DATA", 666 std_logic_range(_param->_size_internal_queue,max,min)); 667 min = max+1; 668 669 size = _param->_size_exception; 670 max = min-1+size; 671 vhdl->set_alias ("internal_EXECUTE_QUEUE_OUT_EXCEPTION ", 672 std_logic(size), 673 "internal_QUEUE_RETIRE_DATA", 674 std_logic_range(_param->_size_internal_queue,max,min)); 675 min = max+1; 676 677 size = 1; 678 max = min-1+size; 679 vhdl->set_alias ("internal_EXECUTE_QUEUE_OUT_NO_SEQUENCE ", 680 std_logic(size), 681 "internal_QUEUE_RETIRE_DATA", 682 std_logic_range(_param->_size_internal_queue,max,min)); 683 min = max+1; 684 685 size = _param->_size_instruction_address; 686 max = min-1+size; 687 vhdl->set_alias ("internal_EXECUTE_QUEUE_OUT_ADDRESS ", 688 std_logic(size), 689 "internal_QUEUE_RETIRE_DATA", 690 std_logic_range(_param->_size_internal_queue,max,min)); 691 min = max+1; 692 693 size = _param->_size_general_data; 694 max = min-1+size; 695 vhdl->set_alias ("internal_EXECUTE_QUEUE_OUT_DATA ", 696 std_logic(size), 697 "internal_QUEUE_RETIRE_DATA", 698 std_logic_range(_param->_size_internal_queue,max,min)); 699 min = max+1; 700 }; 701 \end{lstlisting} 702 703 \subsubSection{Fichier Execute\_queue\_vhdl\_body.cpp} 704 705 \lstparam{C++} 706 \begin{lstlisting}[caption={Execute\_queue\_vhdl\_body.cpp}] 707 void Execute_queue::vhdl_body (Vhdl * & vhdl) 708 { 709 vhdl->set_comment(0,""); 710 vhdl->set_comment(0,"-----------------------------------"); 711 vhdl->set_comment(0,"-- Instance queue "); 712 vhdl->set_comment(0,"-----------------------------------"); 713 vhdl->set_comment(0,""); 714 715 vhdl->set_body (0,"instance_"+_name+"_queue : "+_name+"_queue"); 716 vhdl->set_body (0,"port map ("); 717 vhdl->set_body (1," in_CLOCK \t=>\t in_CLOCK "); 718 vhdl->set_body (1,", in_NRESET \t=>\t in_NRESET"); 719 vhdl->set_body (1,", in_INSERT_VAL \t=>\tinternal_QUEUE_INSERT_VAL"); 720 vhdl->set_body (1,",out_INSERT_ACK \t=>\tinternal_QUEUE_INSERT_ACK"); 721 vhdl->set_body (1,", in_INSERT_DATA \t=>\tinternal_QUEUE_INSERT_DATA"); 722 vhdl->set_body (1,",out_RETIRE_VAL \t=>\tinternal_QUEUE_RETIRE_VAL"); 723 vhdl->set_body (1,", in_RETIRE_ACK \t=>\tinternal_QUEUE_RETIRE_ACK"); 724 vhdl->set_body (1,",out_RETIRE_DATA \t=>\tinternal_QUEUE_RETIRE_DATA"); 725 vhdl->set_body (0,");"); 726 727 vhdl->set_comment(0,""); 728 vhdl->set_comment(0,"-----------------------------------"); 729 vhdl->set_comment(0,"-- Input Buffer "); 730 vhdl->set_comment(0,"-----------------------------------"); 731 vhdl->set_comment(0,""); 732 733 { 734 uint32_t min = 0; 735 uint32_t max, size; 736 uint32_t size_queue = _param->_size_internal_queue; 737 738 if(_param->_have_port_context_id ) 739 { 740 size = _param->_size_context_id; 741 max = min-1+size; 742 vhdl->set_body (0,"internal_QUEUE_INSERT_DATA "+std_logic_range(size_queue,max,min)+ 743 " <= in_EXECUTE_QUEUE_IN_CONTEXT_ID;"); 744 min = max+1; 745 } 746 if(_param->_have_port_front_end_id ) 747 { 748 size = _param->_size_front_end_id; 749 max = min-1+size; 750 vhdl->set_body (0,"internal_QUEUE_INSERT_DATA "+std_logic_range(size_queue,max,min)+ 751 " <= in_EXECUTE_QUEUE_IN_FRONT_END_ID;"); 752 min = max+1; 753 } 754 if(_param->_have_port_ooo_engine_id ) 755 { 756 size = _param->_size_ooo_engine_id; 757 max = min-1+size; 758 vhdl->set_body (0,"internal_QUEUE_INSERT_DATA "+std_logic_range(size_queue,max,min)+ 759 " <= in_EXECUTE_QUEUE_IN_OOO_ENGINE_ID;"); 760 min = max+1; 761 } 762 if(_param->_have_port_rob_ptr) 763 { 764 size = _param->_size_rob_ptr; 765 max = min-1+size; 766 vhdl->set_body (0,"internal_QUEUE_INSERT_DATA "+std_logic_range(size_queue,max,min)+ 767 " <= in_EXECUTE_QUEUE_IN_PACKET_ID;"); 768 min = max+1; 769 } 770 771 size = _param->_size_special_data; 772 max = min-1+size; 773 vhdl->set_body (0,"internal_QUEUE_INSERT_DATA "+std_logic_range(size_queue,max,min)+ 774 " <= in_EXECUTE_QUEUE_IN_FLAGS;"); 775 min = max+1; 776 777 size = _param->_size_exception; 778 max = min-1+size; 779 vhdl->set_body (0,"internal_QUEUE_INSERT_DATA "+std_logic_range(size_queue,max,min)+ 780 " <= in_EXECUTE_QUEUE_IN_EXCEPTION;"); 781 min = max+1; 782 783 size = 1; 784 max = min-1+size; 785 vhdl->set_body (0,"internal_QUEUE_INSERT_DATA "+std_logic_range(size_queue,max,min)+ 786 " <= in_EXECUTE_QUEUE_IN_NO_SEQUENCE;"); 787 min = max+1; 788 789 size = _param->_size_instruction_address; 790 max = min-1+size; 791 vhdl->set_body (0,"internal_QUEUE_INSERT_DATA "+std_logic_range(size_queue,max,min)+ 792 " <= in_EXECUTE_QUEUE_IN_ADDRESS;"); 793 min = max+1; 794 795 size = _param->_size_general_data; 796 max = min-1+size; 797 vhdl->set_body (0,"internal_QUEUE_INSERT_DATA "+std_logic_range(size_queue,max,min)+ 798 " <= in_EXECUTE_QUEUE_IN_DATA;"); 799 min = max+1; 800 } 801 802 vhdl->set_comment(0,""); 803 vhdl->set_comment(0,"-----------------------------------"); 804 vhdl->set_comment(0,"-- Output Buffer "); 805 vhdl->set_comment(0,"-----------------------------------"); 806 vhdl->set_comment(0,""); 807 808 if(_param->_have_port_context_id) 809 vhdl->set_body (0,"out_EXECUTE_QUEUE_OUT_CONTEXT_ID "+ 810 " <= internal_EXECUTE_QUEUE_OUT_CONTEXT_ID ;"); 811 if(_param->_have_port_front_end_id) 812 vhdl->set_body (0,"out_EXECUTE_QUEUE_OUT_FRONT_END_ID "+ 813 " <= internal_EXECUTE_QUEUE_OUT_FRONT_END_ID ;"); 814 if(_param->_have_port_ooo_engine_id) 815 vhdl->set_body (0,"out_EXECUTE_QUEUE_OUT_OOO_ENGINE_ID"+ 816 " <= internal_EXECUTE_QUEUE_OUT_OOO_ENGINE_ID;"); 817 if(_param->_have_port_rob_ptr) 818 vhdl->set_body (0,"out_EXECUTE_QUEUE_OUT_PACKET_ID "+ 819 " <= internal_EXECUTE_QUEUE_OUT_PACKET_ID ;"); 820 vhdl->set_body (0,"out_EXECUTE_QUEUE_OUT_FLAGS "+ 821 " <= internal_EXECUTE_QUEUE_OUT_FLAGS ;"); 822 vhdl->set_body (0,"out_EXECUTE_QUEUE_OUT_EXCEPTION "+ 823 " <= internal_EXECUTE_QUEUE_OUT_EXCEPTION ;"); 824 vhdl->set_body (0,"out_EXECUTE_QUEUE_OUT_NO_SEQUENCE "+ 825 " <= internal_EXECUTE_QUEUE_OUT_NO_SEQUENCE ;"); 826 vhdl->set_body (0,"out_EXECUTE_QUEUE_OUT_ADDRESS "+ 827 " <= internal_EXECUTE_QUEUE_OUT_ADDRESS ;"); 828 vhdl->set_body (0,"out_EXECUTE_QUEUE_OUT_DATA "+ 829 " <= internal_EXECUTE_QUEUE_OUT_DATA ;"); 830 }; 831 \end{lstlisting} 832 833 \subsubSection{Fichier Execute\_queue.vhdl} 834 835 \lstparam{VHDL} 836 \begin{lstlisting}[caption={Execute\_queue.cpp}] 837 library ieee; 838 use ieee.numeric_bit.all; 839 use ieee.numeric_std.all; 840 use ieee.std_logic_1164.all; 841 use ieee.std_logic_arith.all; 842 use ieee.std_logic_misc.all; 843 --use ieee.std_logic_signed.all; 844 use ieee.std_logic_unsigned.all; 845 --use ieee.std_logic_textio.all; 846 847 library work; 848 use work.Execute_queue_0_Pack.all; 849 use work.Execute_queue_0_queue_Pack.all; 850 851 entity Execute_queue_0 is 852 port ( 853 in_CLOCK : in std_logic; 854 in_NRESET : in std_logic; 855 in_EXECUTE_QUEUE_IN_VAL : in std_logic; 856 out_EXECUTE_QUEUE_IN_ACK : out std_logic; 857 in_EXECUTE_QUEUE_IN_CONTEXT_ID : in std_logic; 858 in_EXECUTE_QUEUE_IN_FRONT_END_ID : in std_logic; 859 in_EXECUTE_QUEUE_IN_OOO_ENGINE_ID : in std_logic; 860 in_EXECUTE_QUEUE_IN_PACKET_ID : in std_logic_vector(5 downto 0); 861 in_EXECUTE_QUEUE_IN_FLAGS : in std_logic_vector(1 downto 0); 862 in_EXECUTE_QUEUE_IN_EXCEPTION : in std_logic_vector(4 downto 0); 863 in_EXECUTE_QUEUE_IN_NO_SEQUENCE : in std_logic; 864 in_EXECUTE_QUEUE_IN_ADDRESS : in std_logic_vector(31 downto 0); 865 in_EXECUTE_QUEUE_IN_DATA : in std_logic_vector(31 downto 0); 866 out_EXECUTE_QUEUE_OUT_VAL : out std_logic; 867 in_EXECUTE_QUEUE_OUT_ACK : in std_logic; 868 out_EXECUTE_QUEUE_OUT_CONTEXT_ID : out std_logic; 869 out_EXECUTE_QUEUE_OUT_FRONT_END_ID : out std_logic; 870 out_EXECUTE_QUEUE_OUT_OOO_ENGINE_ID : out std_logic; 871 out_EXECUTE_QUEUE_OUT_PACKET_ID : out std_logic_vector(5 downto 0); 872 out_EXECUTE_QUEUE_OUT_FLAGS : out std_logic_vector(1 downto 0); 873 out_EXECUTE_QUEUE_OUT_EXCEPTION : out std_logic_vector(4 downto 0); 874 out_EXECUTE_QUEUE_OUT_NO_SEQUENCE : out std_logic; 875 out_EXECUTE_QUEUE_OUT_ADDRESS : out std_logic_vector(31 downto 0); 876 out_EXECUTE_QUEUE_OUT_DATA : out std_logic_vector(31 downto 0) 877 ); 878 end Execute_queue_0; 879 880 architecture behavioural of Execute_queue_0 is 881 882 signal internal_QUEUE_INSERT_DATA : std_logic_vector(80 downto 0); 883 signal internal_QUEUE_RETIRE_DATA : std_logic_vector(80 downto 0); 884 885 alias internal_QUEUE_INSERT_VAL : std_logic is 886 in_EXECUTE_QUEUE_IN_VAL; 887 alias internal_QUEUE_INSERT_ACK : std_logic is 888 out_EXECUTE_QUEUE_IN_ACK; 889 alias internal_QUEUE_RETIRE_VAL : std_logic is 890 out_EXECUTE_QUEUE_OUT_VAL; 891 alias internal_QUEUE_RETIRE_ACK : std_logic is 892 in_EXECUTE_QUEUE_OUT_ACK; 893 alias internal_EXECUTE_QUEUE_OUT_CONTEXT_ID : std_logic is 894 internal_QUEUE_RETIRE_DATA (0); 895 alias internal_EXECUTE_QUEUE_OUT_FRONT_END_ID : std_logic is 896 internal_QUEUE_RETIRE_DATA (1); 897 alias internal_EXECUTE_QUEUE_OUT_OOO_ENGINE_ID : std_logic is 898 internal_QUEUE_RETIRE_DATA (2); 899 alias internal_EXECUTE_QUEUE_OUT_PACKET_ID : std_logic_vector(5 downto 0) is 900 internal_QUEUE_RETIRE_DATA (8 downto 3); 901 alias internal_EXECUTE_QUEUE_OUT_FLAGS : std_logic_vector(1 downto 0) is 902 internal_QUEUE_RETIRE_DATA (10 downto 9); 903 alias internal_EXECUTE_QUEUE_OUT_EXCEPTION : std_logic_vector(4 downto 0) is 904 internal_QUEUE_RETIRE_DATA (15 downto 11); 905 alias internal_EXECUTE_QUEUE_OUT_NO_SEQUENCE : std_logic is 906 internal_QUEUE_RETIRE_DATA (16); 907 alias internal_EXECUTE_QUEUE_OUT_ADDRESS : std_logic_vector(31 downto 0) is 908 internal_QUEUE_RETIRE_DATA (48 downto 17); 909 alias internal_EXECUTE_QUEUE_OUT_DATA : std_logic_vector(31 downto 0) is 910 internal_QUEUE_RETIRE_DATA (80 downto 49); 911 912 begin 913 -- 914 -- ----------------------------------- 915 -- -- Instance queue 916 -- ----------------------------------- 917 -- 918 instance_Execute_queue_0_queue : Execute_queue_0_queue 919 port map ( 920 in_CLOCK => in_CLOCK 921 , in_NRESET => in_NRESET 922 , in_INSERT_VAL => internal_QUEUE_INSERT_VAL 923 ,out_INSERT_ACK => internal_QUEUE_INSERT_ACK 924 , in_INSERT_DATA => internal_QUEUE_INSERT_DATA 925 ,out_RETIRE_VAL => internal_QUEUE_RETIRE_VAL 926 , in_RETIRE_ACK => internal_QUEUE_RETIRE_ACK 927 ,out_RETIRE_DATA => internal_QUEUE_RETIRE_DATA 928 ); 929 -- 930 -- ----------------------------------- 931 -- -- Input Buffer 932 -- ----------------------------------- 933 -- 934 internal_QUEUE_INSERT_DATA (0) <= in_EXECUTE_QUEUE_IN_CONTEXT_ID; 935 internal_QUEUE_INSERT_DATA (1) <= in_EXECUTE_QUEUE_IN_FRONT_END_ID; 936 internal_QUEUE_INSERT_DATA (2) <= in_EXECUTE_QUEUE_IN_OOO_ENGINE_ID; 937 internal_QUEUE_INSERT_DATA (8 downto 3) <= in_EXECUTE_QUEUE_IN_PACKET_ID; 938 internal_QUEUE_INSERT_DATA (10 downto 9) <= in_EXECUTE_QUEUE_IN_FLAGS; 939 internal_QUEUE_INSERT_DATA (15 downto 11) <= in_EXECUTE_QUEUE_IN_EXCEPTION; 940 internal_QUEUE_INSERT_DATA (16) <= in_EXECUTE_QUEUE_IN_NO_SEQUENCE; 941 internal_QUEUE_INSERT_DATA (48 downto 17) <= in_EXECUTE_QUEUE_IN_ADDRESS; 942 internal_QUEUE_INSERT_DATA (80 downto 49) <= in_EXECUTE_QUEUE_IN_DATA; 943 -- 944 -- ----------------------------------- 945 -- -- Output Buffer 946 -- ----------------------------------- 947 -- 948 out_EXECUTE_QUEUE_OUT_CONTEXT_ID <= internal_EXECUTE_QUEUE_OUT_CONTEXT_ID; 949 out_EXECUTE_QUEUE_OUT_FRONT_END_ID <= internal_EXECUTE_QUEUE_OUT_FRONT_END_ID; 950 out_EXECUTE_QUEUE_OUT_OOO_ENGINE_ID <= internal_EXECUTE_QUEUE_OUT_OOO_ENGINE_ID; 951 out_EXECUTE_QUEUE_OUT_PACKET_ID <= internal_EXECUTE_QUEUE_OUT_PACKET_ID; 952 out_EXECUTE_QUEUE_OUT_FLAGS <= internal_EXECUTE_QUEUE_OUT_FLAGS; 953 out_EXECUTE_QUEUE_OUT_EXCEPTION <= internal_EXECUTE_QUEUE_OUT_EXCEPTION; 954 out_EXECUTE_QUEUE_OUT_NO_SEQUENCE <= internal_EXECUTE_QUEUE_OUT_NO_SEQUENCE; 955 out_EXECUTE_QUEUE_OUT_ADDRESS <= internal_EXECUTE_QUEUE_OUT_ADDRESS; 956 out_EXECUTE_QUEUE_OUT_DATA <= internal_EXECUTE_QUEUE_OUT_DATA; 957 958 end behavioural; 959 \end{lstlisting} 960 961 962 \Section {Test du VHDL}\label{testbench} 963 964 Lors d'une simulation systemC, \cpu va générer des fichiers de tests pour le modèle VHDL de chaque composant interne. 965 Ces tests sont tous écrit de la même façon. Soit l'interface X et le signal Y : 966 \begin{itemize} 967 \item Une variable {\it counter} indique le numéro de cycle courant. Elle est initialisé à 0. Elle est incrémenté à chaque cycle. 968 \item Le composant est instancé avec des signaux internes de même nom. 969 \item Pour chaque cycle, on affecte à chaque entrée la valeur obtenu lors de la simulation systemC. 970 \item Pour chaque sortie, on définit un signal dont le nom est {\it out\_X\_Y\_test}. Ces signaux sont affecté au valeur obtenu des sorties lors la simulation systemC. 971 \item Le signal {\it interface\_X\_test\_ok} est égal à 1 si chaque sortie calculé par la simulation VHDL est égal au sortie attendu (calculé par la simulation systemC). 972 \item Le signal {\it interface\_X\_test\_transaction} est à 1 si tous les signaux de validité et d'aquittement sont à 1. 973 \item Le signal {\it interface\_X\_test\_tmp} est à 1 si la simulation systemC indique qu'il y a une transaction et que la simulation vhdl indique également une transaction et que toute les sortie sont bien les sorties obtenu. Si la simulation systemC n'indique pas de transaction, on vérifie que c'est également le cas pour la simulation VHDL. 974 \item Le signal {\it interface\_X\_test} est égal au signal {\it interface\_X\_test\_tmp} quand il n'y a pas de reset. sinon il est positionné à 1. 975 \item Le signal {\it test} est un et logique entre tout tous les signaux {\it interface\_X\_test}. 976 \item La simulation VHDL ce termine si le signal {\it test} vaut 0 (dans ce cas, le test est un échec), ou que le registre {\it counter} vaut le nombre de cycle requis par la simulation systemC (dans ce cas, le test est un succès). 977 \end{itemize} 978 979 Nous pouvons remarquer que : 980 \begin{itemize} 981 \item Nous vérifions la compatibilité au cycle des transactions entre le modèle systemC et le modèle VHDL. 982 \item Nous vérifions la compatibilité au bit près des données échangé lors qu'il y a une transaction sur une interface. 983 \item Nous ne vérifions pas la compatibilité au bit près des données présente sur une interface qui ne fait pas de transaction lors d'un cycle. 984 \end{itemize} 985 986 \lstparam{VHDL} 987 \begin{lstlisting}[caption={Execute\_queue\_Testbench.vhdl}] 988 library ieee; 989 use ieee.numeric_bit.all; 990 use ieee.numeric_std.all; 991 use ieee.std_logic_1164.all; 992 use ieee.std_logic_arith.all; 993 use ieee.std_logic_misc.all; 994 --use ieee.std_logic_signed.all; 995 use ieee.std_logic_unsigned.all; 996 --use ieee.std_logic_textio.all; 997 998 library work; 999 use work.Execute_queue_0_Pack.all; 1000 1001 entity Execute_queue_0_Testbench is 1002 end Execute_queue_0_Testbench; 1003 1004 architecture behavioural of Execute_queue_0_Testbench is 1005 1006 signal in_CLOCK : std_logic := '0'; 1007 signal in_NRESET : std_logic := '0'; 1008 signal in_EXECUTE_QUEUE_IN_VAL : std_logic; 1009 signal out_EXECUTE_QUEUE_IN_ACK : std_logic; 1010 signal out_EXECUTE_QUEUE_IN_ACK_test : std_logic; 1011 signal in_EXECUTE_QUEUE_IN_PACKET_ID : std_logic_vector(3 downto 0); 1012 signal in_EXECUTE_QUEUE_IN_FLAGS : std_logic_vector(1 downto 0); 1013 signal in_EXECUTE_QUEUE_IN_EXCEPTION : std_logic_vector(4 downto 0); 1014 signal in_EXECUTE_QUEUE_IN_NO_SEQUENCE : std_logic; 1015 signal in_EXECUTE_QUEUE_IN_ADDRESS : std_logic_vector(31 downto 0); 1016 signal in_EXECUTE_QUEUE_IN_DATA : std_logic_vector(31 downto 0); 1017 signal out_EXECUTE_QUEUE_OUT_VAL : std_logic; 1018 signal out_EXECUTE_QUEUE_OUT_VAL_test : std_logic; 1019 signal in_EXECUTE_QUEUE_OUT_ACK : std_logic; 1020 signal out_EXECUTE_QUEUE_OUT_PACKET_ID : std_logic_vector(3 downto 0); 1021 signal out_EXECUTE_QUEUE_OUT_PACKET_ID_test : std_logic_vector(3 downto 0); 1022 signal out_EXECUTE_QUEUE_OUT_FLAGS : std_logic_vector(1 downto 0); 1023 signal out_EXECUTE_QUEUE_OUT_FLAGS_test : std_logic_vector(1 downto 0); 1024 signal out_EXECUTE_QUEUE_OUT_EXCEPTION : std_logic_vector(4 downto 0); 1025 signal out_EXECUTE_QUEUE_OUT_EXCEPTION_test : std_logic_vector(4 downto 0); 1026 signal out_EXECUTE_QUEUE_OUT_NO_SEQUENCE : std_logic; 1027 signal out_EXECUTE_QUEUE_OUT_NO_SEQUENCE_test : std_logic; 1028 signal out_EXECUTE_QUEUE_OUT_ADDRESS : std_logic_vector(31 downto 0); 1029 signal out_EXECUTE_QUEUE_OUT_ADDRESS_test : std_logic_vector(31 downto 0); 1030 signal out_EXECUTE_QUEUE_OUT_DATA : std_logic_vector(31 downto 0); 1031 signal out_EXECUTE_QUEUE_OUT_DATA_test : std_logic_vector(31 downto 0); 1032 1033 signal counter : natural; 1034 signal test : std_logic; 1035 signal interface_test : std_logic; 1036 signal interface_test_ok : std_logic; 1037 signal interface_execute_queue_in_test : std_logic; 1038 signal interface_execute_queue_in_test_ok : std_logic; 1039 signal interface_execute_queue_in_test_transaction : std_logic; 1040 signal interface_execute_queue_in_test_tmp : std_logic; 1041 signal interface_execute_queue_out_test : std_logic; 1042 signal interface_execute_queue_out_test_ok : std_logic; 1043 signal interface_execute_queue_out_test_transaction : std_logic; 1044 signal interface_execute_queue_out_test_tmp : std_logic; 1045 1046 begin 1047 1048 ------------------------------------------------------ 1049 -- Component - Intanciation 1050 ------------------------------------------------------ 1051 1052 instance_Execute_queue_0 : Execute_queue_0 1053 port map ( 1054 in_CLOCK => in_CLOCK 1055 , in_NRESET => in_NRESET 1056 , in_EXECUTE_QUEUE_IN_VAL => in_EXECUTE_QUEUE_IN_VAL 1057 ,out_EXECUTE_QUEUE_IN_ACK => out_EXECUTE_QUEUE_IN_ACK 1058 , in_EXECUTE_QUEUE_IN_PACKET_ID => in_EXECUTE_QUEUE_IN_PACKET_ID 1059 , in_EXECUTE_QUEUE_IN_FLAGS => in_EXECUTE_QUEUE_IN_FLAGS 1060 , in_EXECUTE_QUEUE_IN_EXCEPTION => in_EXECUTE_QUEUE_IN_EXCEPTION 1061 , in_EXECUTE_QUEUE_IN_NO_SEQUENCE => in_EXECUTE_QUEUE_IN_NO_SEQUENCE 1062 , in_EXECUTE_QUEUE_IN_ADDRESS => in_EXECUTE_QUEUE_IN_ADDRESS 1063 , in_EXECUTE_QUEUE_IN_DATA => in_EXECUTE_QUEUE_IN_DATA 1064 ,out_EXECUTE_QUEUE_OUT_VAL => out_EXECUTE_QUEUE_OUT_VAL 1065 , in_EXECUTE_QUEUE_OUT_ACK => in_EXECUTE_QUEUE_OUT_ACK 1066 ,out_EXECUTE_QUEUE_OUT_PACKET_ID => out_EXECUTE_QUEUE_OUT_PACKET_ID 1067 ,out_EXECUTE_QUEUE_OUT_FLAGS => out_EXECUTE_QUEUE_OUT_FLAGS 1068 ,out_EXECUTE_QUEUE_OUT_EXCEPTION => out_EXECUTE_QUEUE_OUT_EXCEPTION 1069 ,out_EXECUTE_QUEUE_OUT_NO_SEQUENCE => out_EXECUTE_QUEUE_OUT_NO_SEQUENCE 1070 ,out_EXECUTE_QUEUE_OUT_ADDRESS => out_EXECUTE_QUEUE_OUT_ADDRESS 1071 ,out_EXECUTE_QUEUE_OUT_DATA => out_EXECUTE_QUEUE_OUT_DATA 1072 ); 1073 ------------------------------------------------------ 1074 -- interface "" 1075 ------------------------------------------------------ 1076 1077 -- Test exhaustive 1078 1079 interface_test_ok <= '1' when true 1080 else '0'; 1081 1082 interface_test <= '1' when (in_NRESET = '0') else interface_test_ok; 1083 ------------------------------------------------------ 1084 -- interface "execute_queue_in" 1085 ------------------------------------------------------ 1086 1087 with counter select 1088 in_EXECUTE_QUEUE_IN_VAL <= 1089 '0' when 0, 1090 '0' when 1, 1091 '0' when 2, 1092 '0' when 3, 1093 '0' when 4, 1094 '1' when 5, 1095 '1' when 6, 1096 '0' when 7, 1097 '0' when 8, 1098 '1' when 9, 1099 '1' when 10, 1100 '1' when 11, 1101 '1' when 12, 1102 '1' when 13, 1103 '1' when 14, 1104 '1' when 15, 1105 '1' when 16, 1106 '0' when 17, 1107 '1' when 18, 1108 '1' when 19, 1109 '1' when 20, 1110 '0' when 21, 1111 '1' when 22, 1112 '1' when 23, 1113 '0' when 24, 1114 '1' when 25, 1115 '0' when 26, 1116 '0' when others; 1117 1118 with counter select 1119 out_EXECUTE_QUEUE_IN_ACK_test <= 1120 '0' when 0, 1121 '1' when 1, 1122 '1' when 2, 1123 '1' when 3, 1124 '1' when 4, 1125 '1' when 5, 1126 '1' when 6, 1127 '1' when 7, 1128 '1' when 8, 1129 '1' when 9, 1130 '1' when 10, 1131 '1' when 11, 1132 '1' when 12, 1133 '1' when 13, 1134 '1' when 14, 1135 '1' when 15, 1136 '1' when 16, 1137 '1' when 17, 1138 '1' when 18, 1139 '1' when 19, 1140 '1' when 20, 1141 '1' when 21, 1142 '1' when 22, 1143 '1' when 23, 1144 '1' when 24, 1145 '1' when 25, 1146 '1' when 26, 1147 '0' when others; 1148 1149 with counter select 1150 in_EXECUTE_QUEUE_IN_PACKET_ID <= 1151 "0000" when 0, 1152 "0000" when 1, 1153 "0000" when 2, 1154 "0000" when 3, 1155 "0000" when 4, 1156 "0000" when 5, 1157 "0001" when 6, 1158 "0001" when 7, 1159 "0001" when 8, 1160 "0010" when 9, 1161 "0011" when 10, 1162 "0100" when 11, 1163 "0101" when 12, 1164 "0110" when 13, 1165 "0111" when 14, 1166 "1000" when 15, 1167 "1001" when 16, 1168 "1001" when 17, 1169 "1010" when 18, 1170 "1011" when 19, 1171 "1100" when 20, 1172 "1100" when 21, 1173 "1101" when 22, 1174 "1110" when 23, 1175 "1110" when 24, 1176 "1111" when 25, 1177 "1111" when 26, 1178 (others => '0') when others; 1179 1180 with counter select 1181 in_EXECUTE_QUEUE_IN_FLAGS <= 1182 "00" when 0, 1183 "00" when 1, 1184 "00" when 2, 1185 "00" when 3, 1186 "00" when 4, 1187 "11" when 5, 1188 "11" when 6, 1189 "11" when 7, 1190 "11" when 8, 1191 "00" when 9, 1192 "11" when 10, 1193 "11" when 11, 1194 "11" when 12, 1195 "10" when 13, 1196 "01" when 14, 1197 "01" when 15, 1198 "11" when 16, 1199 "11" when 17, 1200 "10" when 18, 1201 "00" when 19, 1202 "11" when 20, 1203 "11" when 21, 1204 "10" when 22, 1205 "01" when 23, 1206 "01" when 24, 1207 "01" when 25, 1208 "01" when 26, 1209 (others => '0') when others; 1210 1211 with counter select 1212 in_EXECUTE_QUEUE_IN_EXCEPTION <= 1213 "00000" when 0, 1214 "00000" when 1, 1215 "00000" when 2, 1216 "00000" when 3, 1217 "00000" when 4, 1218 "10001" when 5, 1219 "10010" when 6, 1220 "10010" when 7, 1221 "10010" when 8, 1222 "11011" when 9, 1223 "10011" when 10, 1224 "10001" when 11, 1225 "11000" when 12, 1226 "11011" when 13, 1227 "00001" when 14, 1228 "00001" when 15, 1229 "01010" when 16, 1230 "01010" when 17, 1231 "01100" when 18, 1232 "01100" when 19, 1233 "11011" when 20, 1234 "11011" when 21, 1235 "00101" when 22, 1236 "01001" when 23, 1237 "01001" when 24, 1238 "10001" when 25, 1239 "10001" when 26, 1240 (others => '0') when others; 1241 1242 with counter select 1243 in_EXECUTE_QUEUE_IN_NO_SEQUENCE <= 1244 '0' when 0, 1245 '0' when 1, 1246 '0' when 2, 1247 '0' when 3, 1248 '0' when 4, 1249 '1' when 5, 1250 '1' when 6, 1251 '1' when 7, 1252 '1' when 8, 1253 '1' when 9, 1254 '1' when 10, 1255 '1' when 11, 1256 '1' when 12, 1257 '1' when 13, 1258 '1' when 14, 1259 '1' when 15, 1260 '1' when 16, 1261 '1' when 17, 1262 '1' when 18, 1263 '1' when 19, 1264 '1' when 20, 1265 '1' when 21, 1266 '1' when 22, 1267 '1' when 23, 1268 '1' when 24, 1269 '1' when 25, 1270 '1' when 26, 1271 '0' when others; 1272 1273 with counter select 1274 in_EXECUTE_QUEUE_IN_ADDRESS <= 1275 "00000000000000000000000000000000" when 0, 1276 "00000000000000000000000000000000" when 1, 1277 "00000000000000000000000000000000" when 2, 1278 "00000000000000000000000000000000" when 3, 1279 "00000000000000000000000000000000" when 4, 1280 "00101010111010001001010001001010" when 5, 1281 "01111001111000101010100111100011" when 6, 1282 "01111001111000101010100111100011" when 7, 1283 "01111001111000101010100111100011" when 8, 1284 "00010001100100001100110111100111" when 9, 1285 "01000001101001111100010011001001" when 10, 1286 "00100101011100010011000010100011" when 11, 1287 "01100111011000111000010001011110" when 12, 1288 "01110001111100110010010001010100" when 13, 1289 "01110011011110111000110111011100" when 14, 1290 "01000100000010111010110111111100" when 15, 1291 "01010001111010101101001101101011" when 16, 1292 "01010001111010101101001101101011" when 17, 1293 "00011101010011101101010000111011" when 18, 1294 "00111000010000110111111111011011" when 19, 1295 "01111001101000011101111010101010" when 20, 1296 "01111001101000011101111010101010" when 21, 1297 "01100100100110111011011101111100" when 22, 1298 "00010101101101011010111101011100" when 23, 1299 "00010101101101011010111101011100" when 24, 1300 "01010111100110111110010011110001" when 25, 1301 "01010111100110111110010011110001" when 26, 1302 (others => '0') when others; 1303 1304 with counter select 1305 in_EXECUTE_QUEUE_IN_DATA <= 1306 "00000000000000000000000000000000" when 0, 1307 "00000000000000000000000000000000" when 1, 1308 "00000000000000000000000000000000" when 2, 1309 "00000000000000000000000000000000" when 3, 1310 "00000000000000000000000000000000" when 4, 1311 "01100010010101010101100011101100" when 5, 1312 "01110101010001011110000101000110" when 6, 1313 "01110101010001011110000101000110" when 7, 1314 "01110101010001011110000101000110" when 8, 1315 "01100110111011110100001110001101" when 9, 1316 "01101011011010000000011110011010" when 10, 1317 "01100010101110111101100101011010" when 11, 1318 "01110101101000101010100011010100" when 12, 1319 "00101100101010001000011000010001" when 13, 1320 "01101100111010101111000010000111" when 14, 1321 "00000101000001110010001101100111" when 15, 1322 "00101101010100010111011110010110" when 16, 1323 "00101101010100010111011110010110" when 17, 1324 "01110010010110100000011011111011" when 18, 1325 "01110110010001001010010001011100" when 19, 1326 "01110101110001101100001100111010" when 20, 1327 "01110101110001101100001100111010" when 21, 1328 "00100111010110101100011110010100" when 22, 1329 "01110100000100100010011010111011" when 23, 1330 "01110100000100100010011010111011" when 24, 1331 "00110001000011000101000010110011" when 25, 1332 "00110001000011000101000010110011" when 26, 1333 (others => '0') when others; 1334 1335 -- Test partial 1336 1337 interface_execute_queue_in_test_ok <= '1' when true 1338 and out_EXECUTE_QUEUE_IN_ACK = out_EXECUTE_QUEUE_IN_ACK_test 1339 else '0'; 1340 1341 interface_execute_queue_in_test_transaction <= '1' 1342 and in_EXECUTE_QUEUE_IN_VAL 1343 and out_EXECUTE_QUEUE_IN_ACK 1344 ; 1345 1346 with counter select 1347 interface_execute_queue_in_test_tmp <= 1348 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1349 when 5, 1350 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1351 when 6, 1352 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1353 when 9, 1354 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1355 when 10, 1356 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1357 when 11, 1358 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1359 when 12, 1360 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1361 when 13, 1362 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1363 when 14, 1364 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1365 when 15, 1366 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1367 when 16, 1368 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1369 when 18, 1370 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1371 when 19, 1372 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1373 when 20, 1374 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1375 when 22, 1376 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1377 when 23, 1378 interface_execute_queue_in_test_transaction and interface_execute_queue_in_test_ok 1379 when 25, 1380 not interface_execute_queue_in_test_transaction when others; 1381 1382 interface_execute_queue_in_test <= '1' when (in_NRESET = '0') else 1383 interface_execute_queue_in_test_tmp; 1384 ------------------------------------------------------ 1385 -- interface "execute_queue_out" 1386 ------------------------------------------------------ 1387 1388 with counter select 1389 out_EXECUTE_QUEUE_OUT_VAL_test <= 1390 '0' when 0, 1391 '0' when 1, 1392 '0' when 2, 1393 '0' when 3, 1394 '0' when 4, 1395 '0' when 5, 1396 '1' when 6, 1397 '1' when 7, 1398 '0' when 8, 1399 '0' when 9, 1400 '1' when 10, 1401 '1' when 11, 1402 '1' when 12, 1403 '1' when 13, 1404 '1' when 14, 1405 '1' when 15, 1406 '1' when 16, 1407 '1' when 17, 1408 '0' when 18, 1409 '1' when 19, 1410 '1' when 20, 1411 '1' when 21, 1412 '1' when 22, 1413 '1' when 23, 1414 '1' when 24, 1415 '0' when 25, 1416 '1' when 26, 1417 '0' when others; 1418 1419 with counter select 1420 in_EXECUTE_QUEUE_OUT_ACK <= 1421 '0' when 0, 1422 '0' when 1, 1423 '0' when 2, 1424 '0' when 3, 1425 '0' when 4, 1426 '1' when 5, 1427 '1' when 6, 1428 '1' when 7, 1429 '1' when 8, 1430 '0' when 9, 1431 '1' when 10, 1432 '1' when 11, 1433 '1' when 12, 1434 '1' when 13, 1435 '1' when 14, 1436 '1' when 15, 1437 '1' when 16, 1438 '1' when 17, 1439 '1' when 18, 1440 '1' when 19, 1441 '1' when 20, 1442 '0' when 21, 1443 '1' when 22, 1444 '1' when 23, 1445 '1' when 24, 1446 '1' when 25, 1447 '1' when 26, 1448 '0' when others; 1449 1450 with counter select 1451 out_EXECUTE_QUEUE_OUT_PACKET_ID_test <= 1452 "0000" when 0, 1453 "0000" when 1, 1454 "0000" when 2, 1455 "0000" when 3, 1456 "0000" when 4, 1457 "0000" when 5, 1458 "0000" when 6, 1459 "0001" when 7, 1460 "0001" when 8, 1461 "0001" when 9, 1462 "0010" when 10, 1463 "0011" when 11, 1464 "0100" when 12, 1465 "0101" when 13, 1466 "0110" when 14, 1467 "0111" when 15, 1468 "1000" when 16, 1469 "1001" when 17, 1470 "1001" when 18, 1471 "1010" when 19, 1472 "1011" when 20, 1473 "1100" when 21, 1474 "1100" when 22, 1475 "1101" when 23, 1476 "1110" when 24, 1477 "1110" when 25, 1478 "1111" when 26, 1479 (others => '0') when others; 1480 1481 with counter select 1482 out_EXECUTE_QUEUE_OUT_FLAGS_test <= 1483 "00" when 0, 1484 "00" when 1, 1485 "00" when 2, 1486 "00" when 3, 1487 "00" when 4, 1488 "00" when 5, 1489 "11" when 6, 1490 "11" when 7, 1491 "11" when 8, 1492 "11" when 9, 1493 "00" when 10, 1494 "11" when 11, 1495 "11" when 12, 1496 "11" when 13, 1497 "10" when 14, 1498 "01" when 15, 1499 "01" when 16, 1500 "11" when 17, 1501 "11" when 18, 1502 "10" when 19, 1503 "00" when 20, 1504 "11" when 21, 1505 "11" when 22, 1506 "10" when 23, 1507 "01" when 24, 1508 "01" when 25, 1509 "01" when 26, 1510 (others => '0') when others; 1511 1512 with counter select 1513 out_EXECUTE_QUEUE_OUT_EXCEPTION_test <= 1514 "00000" when 0, 1515 "00000" when 1, 1516 "00000" when 2, 1517 "00000" when 3, 1518 "00000" when 4, 1519 "00000" when 5, 1520 "10001" when 6, 1521 "10010" when 7, 1522 "10010" when 8, 1523 "10010" when 9, 1524 "11011" when 10, 1525 "10011" when 11, 1526 "10001" when 12, 1527 "11000" when 13, 1528 "11011" when 14, 1529 "00001" when 15, 1530 "00001" when 16, 1531 "01010" when 17, 1532 "01010" when 18, 1533 "01100" when 19, 1534 "01100" when 20, 1535 "11011" when 21, 1536 "11011" when 22, 1537 "00101" when 23, 1538 "01001" when 24, 1539 "01001" when 25, 1540 "10001" when 26, 1541 (others => '0') when others; 1542 1543 with counter select 1544 out_EXECUTE_QUEUE_OUT_NO_SEQUENCE_test <= 1545 '0' when 0, 1546 '0' when 1, 1547 '0' when 2, 1548 '0' when 3, 1549 '0' when 4, 1550 '0' when 5, 1551 '1' when 6, 1552 '1' when 7, 1553 '1' when 8, 1554 '1' when 9, 1555 '1' when 10, 1556 '1' when 11, 1557 '1' when 12, 1558 '1' when 13, 1559 '1' when 14, 1560 '1' when 15, 1561 '1' when 16, 1562 '1' when 17, 1563 '1' when 18, 1564 '1' when 19, 1565 '1' when 20, 1566 '1' when 21, 1567 '1' when 22, 1568 '1' when 23, 1569 '1' when 24, 1570 '1' when 25, 1571 '1' when 26, 1572 '0' when others; 1573 1574 with counter select 1575 out_EXECUTE_QUEUE_OUT_ADDRESS_test <= 1576 "00000000000000000000000000000000" when 0, 1577 "00000000000000000000000000000000" when 1, 1578 "00000000000000000000000000000000" when 2, 1579 "00000000000000000000000000000000" when 3, 1580 "00000000000000000000000000000000" when 4, 1581 "00000000000000000000000000000000" when 5, 1582 "00101010111010001001010001001010" when 6, 1583 "01111001111000101010100111100011" when 7, 1584 "01111001111000101010100111100011" when 8, 1585 "01111001111000101010100111100011" when 9, 1586 "00010001100100001100110111100111" when 10, 1587 "01000001101001111100010011001001" when 11, 1588 "00100101011100010011000010100011" when 12, 1589 "01100111011000111000010001011110" when 13, 1590 "01110001111100110010010001010100" when 14, 1591 "01110011011110111000110111011100" when 15, 1592 "01000100000010111010110111111100" when 16, 1593 "01010001111010101101001101101011" when 17, 1594 "01010001111010101101001101101011" when 18, 1595 "00011101010011101101010000111011" when 19, 1596 "00111000010000110111111111011011" when 20, 1597 "01111001101000011101111010101010" when 21, 1598 "01111001101000011101111010101010" when 22, 1599 "01100100100110111011011101111100" when 23, 1600 "00010101101101011010111101011100" when 24, 1601 "00010101101101011010111101011100" when 25, 1602 "01010111100110111110010011110001" when 26, 1603 (others => '0') when others; 1604 1605 with counter select 1606 out_EXECUTE_QUEUE_OUT_DATA_test <= 1607 "00000000000000000000000000000000" when 0, 1608 "00000000000000000000000000000000" when 1, 1609 "00000000000000000000000000000000" when 2, 1610 "00000000000000000000000000000000" when 3, 1611 "00000000000000000000000000000000" when 4, 1612 "00000000000000000000000000000000" when 5, 1613 "01100010010101010101100011101100" when 6, 1614 "01110101010001011110000101000110" when 7, 1615 "01110101010001011110000101000110" when 8, 1616 "01110101010001011110000101000110" when 9, 1617 "01100110111011110100001110001101" when 10, 1618 "01101011011010000000011110011010" when 11, 1619 "01100010101110111101100101011010" when 12, 1620 "01110101101000101010100011010100" when 13, 1621 "00101100101010001000011000010001" when 14, 1622 "01101100111010101111000010000111" when 15, 1623 "00000101000001110010001101100111" when 16, 1624 "00101101010100010111011110010110" when 17, 1625 "00101101010100010111011110010110" when 18, 1626 "01110010010110100000011011111011" when 19, 1627 "01110110010001001010010001011100" when 20, 1628 "01110101110001101100001100111010" when 21, 1629 "01110101110001101100001100111010" when 22, 1630 "00100111010110101100011110010100" when 23, 1631 "01110100000100100010011010111011" when 24, 1632 "01110100000100100010011010111011" when 25, 1633 "00110001000011000101000010110011" when 26, 1634 (others => '0') when others; 1635 1636 -- Test partial 1637 1638 interface_execute_queue_out_test_ok <= '1' when true 1639 and out_EXECUTE_QUEUE_OUT_VAL = out_EXECUTE_QUEUE_OUT_VAL_test 1640 and out_EXECUTE_QUEUE_OUT_PACKET_ID = out_EXECUTE_QUEUE_OUT_PACKET_ID_test 1641 and out_EXECUTE_QUEUE_OUT_FLAGS = out_EXECUTE_QUEUE_OUT_FLAGS_test 1642 and out_EXECUTE_QUEUE_OUT_EXCEPTION = out_EXECUTE_QUEUE_OUT_EXCEPTION_test 1643 and out_EXECUTE_QUEUE_OUT_NO_SEQUENCE = out_EXECUTE_QUEUE_OUT_NO_SEQUENCE_test 1644 and out_EXECUTE_QUEUE_OUT_ADDRESS = out_EXECUTE_QUEUE_OUT_ADDRESS_test 1645 and out_EXECUTE_QUEUE_OUT_DATA = out_EXECUTE_QUEUE_OUT_DATA_test 1646 else '0'; 1647 1648 interface_execute_queue_out_test_transaction <= '1' 1649 and out_EXECUTE_QUEUE_OUT_VAL 1650 and in_EXECUTE_QUEUE_OUT_ACK 1651 ; 1652 1653 with counter select 1654 interface_execute_queue_out_test_tmp <= 1655 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1656 when 6, 1657 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1658 when 7, 1659 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1660 when 10, 1661 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1662 when 11, 1663 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1664 when 12, 1665 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1666 when 13, 1667 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1668 when 14, 1669 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1670 when 15, 1671 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1672 when 16, 1673 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1674 when 17, 1675 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1676 when 19, 1677 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1678 when 20, 1679 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1680 when 22, 1681 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1682 when 23, 1683 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1684 when 24, 1685 interface_execute_queue_out_test_transaction and interface_execute_queue_out_test_ok 1686 when 26, 1687 not interface_execute_queue_out_test_transaction when others; 1688 1689 interface_execute_queue_out_test <= '1' when (in_NRESET = '0') else 1690 interface_execute_queue_out_test_tmp; 1691 1692 ------------------------------------------------------ 1693 -- Test 1694 ------------------------------------------------------ 1695 1696 test <= '1' 1697 and interface_test 1698 and interface_execute_queue_in_test 1699 and interface_execute_queue_out_test; 1700 1701 ------------------------------------------------------ 1702 -- reset 1703 ------------------------------------------------------ 1704 1705 -- if the systemC simulate have multiple reset, we make the last 1706 in_NRESET <= '1' after 150 ns; 1707 1708 ------------------------------------------------------ 1709 -- process clock_name 1710 ------------------------------------------------------ 1711 1712 in_CLOCK <= not in_CLOCK after 50 ns; 1713 1714 process (in_CLOCK) 1715 begin 1716 if (in_CLOCK'event and in_CLOCK = '1') then 1717 1718 if (in_NRESET = '0') then 1719 counter <= 4; 1720 else 1721 counter <= counter+1; 1722 1723 assert not (counter >= 27) report "Test OK" severity FAILURE; 1724 assert not (test = '0') report "Test KO" severity FAILURE; 1725 end if; 1726 end if; 1727 end process; 1728 end behavioural; 1729 \end{lstlisting} 18 \input{\dirroot/document-morpheo-vhdl_generation-fr-01_tree} 19 \input{\dirroot/document-morpheo-vhdl_generation-fr-02_vhdl_declaration} 20 \input{\dirroot/document-morpheo-vhdl_generation-fr-03_vhdl_body} 21 \input{\dirroot/document-morpheo-vhdl_generation-fr-04_vhdl_structural} 22 \input{\dirroot/document-morpheo-vhdl_generation-fr-05_example} 23 \input{\dirroot/document-morpheo-vhdl_generation-fr-06_testbench} -
trunk/IPs/systemC/processor/Morpheo/Files/Instance_scalar_1.cfg
r95 r100 1 1 <?xml version="1.0" encoding="ISO-8859-1" ?> 2 2 3 <core name="Instance_ min">3 <core name="Instance_scalar_1"> 4 4 5 5 <thread id="0"> -
trunk/IPs/systemC/processor/Morpheo/Files/Instance_scalar_2.cfg
r95 r100 1 1 <?xml version="1.0" encoding="ISO-8859-1" ?> 2 2 3 <core name="Instance_ min">3 <core name="Instance_scalar_2"> 4 4 5 5 <thread id="0"> … … 71 71 <parameter name="nb_inst_branch_update" value="1" /> 72 72 <parameter name="btb_size_queue" value="32"/> 73 <parameter name="btb_associativity" value=" 2" />73 <parameter name="btb_associativity" value="1" /> 74 74 <parameter name="btb_size_counter" value="2" /> 75 <parameter name="btb_victim_scheme" value=" 1" />75 <parameter name="btb_victim_scheme" value="3" /> 76 76 <parameter name="dir_predictor_scheme" value="1" /> 77 77 </front_end> -
trunk/IPs/systemC/processor/Morpheo/Files/Morpheo.gen
r97 r100 73 73 <parameter name="btb_associativity" min="1" max="8" step="* 2" default="1" level="..." description="..." /> 74 74 <parameter name="btb_size_counter" min="2" max="8" step="* 2" default="2" level="..." description="..." /> 75 <parameter name="btb_victim_scheme" min="1" max="8" step=" * 2" default="1" level="..." description="..." />75 <parameter name="btb_victim_scheme" min="1" max="8" step="+ 1" default="1" level="..." description="..." /> 76 76 <parameter name="dir_predictor_scheme" min="1" max="8" step="* 2" default="1" level="..." description="..." /> 77 77 <parameter name="dir_have_bht" min="1" max="8" step="* 2" default="1" level="..." description="..." /> -
trunk/IPs/systemC/processor/Morpheo/Files/Morpheo.sim
r97 r100 8 8 <parameter name="use_vhdl_testbench_assert" value="0" /> 9 9 <parameter name="use_position" value="0" /> 10 <parameter name="use_statistics" value=" 0" />10 <parameter name="use_statistics" value="1" /> 11 11 <parameter name="use_information" value="0" /> 12 12 <parameter name="use_header" value="1" /> 13 13 14 <parameter name=" nb_cycle_before_begin"value="0" />15 <parameter name=" period_save"value="0" />14 <parameter name="statistics_cycle_start" value="0" /> 15 <parameter name="statistics_period" value="0" /> 16 16 17 <parameter name="simulation_nb_cycle" value=" 200" />17 <parameter name="simulation_nb_cycle" value="10000" /> 18 18 <parameter name="simulation_nb_instruction" value="0" /> 19 19 … … 23 23 <parameter name="directory_log" value="." /> 24 24 25 <parameter name="debug_level" value="trace" /> 25 <parameter name="debug_level" value="0" /> 26 <parameter name="debug_cycle_start" value="0" /> 27 <parameter name="debug_cycle_stop" value="400" /> 26 28 <parameter name="debug_have_log_file" value="0" /> 27 29 -
trunk/IPs/systemC/processor/Morpheo/Script/xilinx_extract_info.sh
r85 r100 5 5 #----------------------------------------------------------- 6 6 7 for i in *.fpga.log; do 8 echo "===== $i"; 9 grep "Number of Slice Registers" $i; 10 grep "Number used as Logic" $i; 11 grep "Number used as Memory" $i; 12 grep "Maximum Frequency" $i; 13 done 7 ##-----[ usage ]--------------------------------------------- 8 #function usage () 9 #{ 10 # echo "Usage : ${0} [files]"; 11 # echo "Arguments : "; 12 # echo ' * files : lists of files. If empty, take *.fpga.log'; 13 ## echo "Notes :"; 14 ## echo " * Morpheo's environnement must be positionned."; 15 # 16 # exit; 17 #} 18 19 #-----[ info ]---------------------------------------------- 20 function info () 21 { 22 echo "===== ${1}"; 23 grep "Number of Slice Registers" ${1}; 24 grep "Number of Slice LUTs" ${1}; 25 grep "Number used as Logic" ${1}; 26 grep "Number used as Memory" ${1}; 27 grep "Number used as RAM" ${1}; 28 grep "Maximum Frequency" ${1}; 29 } 30 31 #-----[ main ]---------------------------------------------- 32 function main () 33 { 34 if test $# -eq 0; then 35 files="*.fpga.log"; 36 else 37 files="$*"; 38 fi; 39 40 for i in $files; do 41 info $i; 42 done 43 } 44 45 #-----[ Corps ]--------------------------------------------- 46 main ${*} 47 -
trunk/Makefile.tools
r96 r100 119 119 120 120 #-----[ newlib ]------------------------------------------- 121 NEWLIB_INCDIR = -I$(NEWLIB)/include 122 NEWLIB_LIBDIR = -L$(NEWLIB)/lib 123 NEWLIB_LIBNAME = -lc -lm 121 124 122 125 #-----[ qt ]----------------------------------------------- 126 QT_INCDIR = -I$(QT)/include 127 QT_LIBDIR = -L$(QT)/lib 128 QT_LIBNAME = 123 129 QT_BIN = $(QT)/bin 124 QT_INCDIR = $(QT)/include125 QT_LIBDIR = $(QT)/lib126 QT_LIBNAME = -
trunk/Softwares/Basic_test/Makefile
r81 r100 1 # 2 # $Id$ 3 # 4 # [ Description ] 5 # 6 # Makefile 7 # 8 1 9 # common definition 2 include Makefile.morpheo 10 DIR_SRC = ./src 11 DIR_C = $(DIR_SRC)/c 12 DIR_ASM = $(DIR_SRC)/asm 13 DIR_SYS = $(DIR_SRC)/sys 14 DIR_INC = $(DIR_SRC)/include 15 DIR_LDSCRIPT = ../Common/ldscript/ 3 16 4 #-----[ Directory ]--------------------------------------------------------------- 5 6 DIR_LOCAL = . 7 DIR_LOCAL_C = $(DIR_LOCAL)/src/c 8 DIR_LOCAL_ASM = $(DIR_LOCAL)/src/asm 9 DIR_LOCAL_SYS = $(DIR_LOCAL)/src/sys 10 DIR_LOCAL_INC = $(DIR_LOCAL)/src/c/include 11 12 DIR_GLOBAL = $(SOFT)/Global.or32 13 DIR_GLOBAL_C = $(DIR_GLOBAL)/src/c 14 DIR_GLOBAL_ASM = $(DIR_GLOBAL)/src/asm 15 DIR_GLOBAL_SYS = $(DIR_GLOBAL)/src/sys 16 DIR_GLOBAL_INC = $(DIR_GLOBAL)/include 17 18 DIR_INC = -I$(DIR_LOCAL_INC) -I$(DIR_GLOBAL_INC) 19 DIR_OBJ = obj 20 DIR_BIN = bin 21 22 EXE = soft 17 INCDIR = -I$(DIR_INC) -I$(DIR_COMMON_INC) $(NEWLIB_INCDIR) 18 LIBDIR = $(NEWLIB_LIBDIR) 19 LIBNAME = $(NEWLIB_LIBNAME) 23 20 24 21 #-----[ Files ]------------------------------------------------------------------- 25 OBJ_ASM = $(patsubst $(DIR_LOCAL_ASM)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_LOCAL_ASM)/*.s)) \ 26 $(patsubst $(DIR_GLOBAL_ASM)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_GLOBAL_ASM)/*.s)) 27 OBJ_SYS = $(patsubst $(DIR_LOCAL_SYS)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_LOCAL_SYS)/*.s)) \ 28 $(patsubst $(DIR_GLOBAL_SYS)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_GLOBAL_SYS)/*.s)) 29 OBJ_C = $(patsubst $(DIR_LOCAL_C)/%.c,$(DIR_OBJ)/%.o,$(wildcard $(DIR_LOCAL_C)/*.c)) \ 30 $(patsubst $(DIR_GLOBAL_C)/%.c,$(DIR_OBJ)/%.o,$(wildcard $(DIR_GLOBAL_C)/*.c)) 22 OBJECTS = $(OBJECTS_COMMON) \ 23 $(patsubst $(DIR_ASM)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_ASM)/*.s)) \ 24 $(patsubst $(DIR_SYS)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SYS)/*.s)) \ 25 $(patsubst $(DIR_C)/%.c,$(DIR_OBJ)/%.o,$(wildcard $(DIR_C)/*.c)) 31 26 32 OBJ = $(OBJ_SYS) $(OBJ_ASM) $(OBJ_C) 33 34 #-----[ Rules ]------------------------------------------------------------------- 35 .PRECIOUS : $(DIR_BIN)/%.x $(DIR_OBJ)/%.o $(DIR_OBJ)/%.a 36 37 all : test_env $(DIR_BIN)/$(EXE).x.txt 38 39 $(DIR_BIN)/%.x.txt : $(DIR_BIN)/%.x 40 @\ 41 $(ECHO) "List symbols of $*";\ 42 $(NM) $(NM_OPT) $^ > $@.nm;\ 43 $(ECHO) "Display information of $*";\ 44 $(OBJDUMP) $(OBJDUMP_OPT) $^ > $@; 45 46 $(DIR_BIN)/%.x : $(OBJ_SYS) $(OBJ) 47 @\ 48 $(ECHO) "Linkage of $*";\ 49 $(LD) -o $@ $^ $(LD_OPT); 50 51 $(DIR_OBJ)/%.o : $(DIR_LOCAL_ASM)/%.s 52 @\ 53 $(ECHO) "Compile of $*";\ 54 $(CC) $(CC_OPT) $(DIR_INC) -o $@ -c $^ ;\ 55 $(CC) $(CC_OPT) $(DIR_INC) -S -o $@.s -c $^ ; 56 # @$(AS) $(AS_OPT) $^ -o $@ 57 58 $(DIR_OBJ)/%.o : $(DIR_LOCAL_SYS)/%.s 59 @\ 60 $(ECHO) "Compile of $*";\ 61 $(CC) $(CC_OPT) $(DIR_INC) -o $@ -c $^ ;\ 62 $(CC) $(CC_OPT) $(DIR_INC) -S -o $@.s -c $^ ; 63 # @$(AS) $(AS_OPT) $^ -o $@ 64 65 $(DIR_OBJ)/%.o : $(DIR_LOCAL_C)/%.c 66 @\ 67 $(ECHO) "Compile of $*";\ 68 $(CC) $(CC_OPT) $(DIR_INC) -o $@ -c $^ ;\ 69 $(CC) $(CC_OPT) $(DIR_INC) -S -o $@.s -c $^ ; 70 71 $(DIR_OBJ)/%.o : $(DIR_GLOBAL_ASM)/%.s 72 @\ 73 $(ECHO) "Compile of $*";\ 74 $(CC) $(CC_OPT) $(DIR_INC) -o $@ -c $^ ;\ 75 $(CC) $(CC_OPT) $(DIR_INC) -S -o $@.s -c $^ ; 76 # @$(AS) $(AS_OPT) $^ -o $@ 77 78 $(DIR_OBJ)/%.o : $(DIR_GLOBAL_SYS)/%.s 79 @\ 80 $(ECHO) "Compile of $*";\ 81 $(CC) $(CC_OPT) $(DIR_INC) -o $@ -c $^ ;\ 82 $(CC) $(CC_OPT) $(DIR_INC) -S -o $@.s -c $^ ; 83 # @$(AS) $(AS_OPT) $^ -o $@ 84 85 $(DIR_OBJ)/%.o : $(DIR_GLOBAL_C)/%.c 86 @\ 87 $(ECHO) "Compile of $*";\ 88 $(CC) $(CC_OPT) $(DIR_INC) -o $@ -c $^ ;\ 89 $(CC) $(CC_OPT) $(DIR_INC) -S -o $@.s -c $^ ; 90 91 #-----[ Environement ]------------------------------------------------------------ 92 test_env : 93 # ifeq ($(origin TOOLS), undefined) 94 # $(error "variable TOOLS is undefined"); 95 # endif 96 # ifeq ($(origin SOFT), undefined) 97 # $(error "variable SOFT is undefined"); 98 # endif 99 @$(MKDIR) $(DIR_OBJ) $(DIR_BIN) 100 101 #-----[ Maintenance ]------------------------------------------------------------- 102 clean : 103 @\ 104 $(ECHO) "Delete temporary files "`$(PWD)`;\ 105 $(RM) $(DIR_OBJ) $(DIR_BIN);\ 106 $(MAKE) clean_rec DIR_CLEAN=.; 107 108 #Clean recursive 109 clean_rec : 110 @\ 111 $(ECHO) "Delete temporary files in directory $(DIR_CLEAN)";\ 112 $(RM) -f $(DIR_CLEAN)/*~;\ 113 for files in `$(LS) $(DIR_CLEAN)`; do \ 114 if $(TEST) -d $(DIR_CLEAN)/$$files; \ 115 then \ 116 $(MAKE) clean_rec DIR_CLEAN=$(DIR_CLEAN)/$$files; \ 117 fi; \ 118 done; 119 120 #-----[ Help ]-------------------------------------------------------------------- 121 help : 122 @\ 123 $(ECHO) "";\ 124 $(ECHO) "List of directive : ";\ 125 $(ECHO) " * make : Compile the software";\ 126 $(ECHO) " * make clean : Erase all files generates";\ 127 $(ECHO) " * make bench_list : View all benchmark";\ 128 $(ECHO) " * make bench_exec : Print the file \"$(FILE_BENCH)\" - it's the Workload";\ 129 $(ECHO) " * make bench : Compile the Benchmark Suite";\ 130 $(ECHO) ""; 27 include ../Makefile.Software -
trunk/Softwares/Makefile.Software
r88 r100 18 18 19 19 EXE = soft 20 21 DIR_COMMON = $(MORPHEO_TOPLEVEL)/Softwares/Common 22 DIR_COMMON_C = $(DIR_GLOBAL)/src/c 23 DIR_COMMON_ASM = $(DIR_GLOBAL)/src/asm 24 DIR_COMMON_SYS = $(DIR_GLOBAL)/src/sys 25 DIR_COMMON_INC = $(DIR_GLOBAL)/include 26 27 OBJECTS_COMMON = $(patsubst $(DIR_COMMON_ASM)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_COMMON_ASM)/*.s)) \ 28 $(patsubst $(DIR_COMMON_SYS)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_COMMON_SYS)/*.s)) \ 29 $(patsubst $(DIR_COMMON_C)/%.c,$(DIR_OBJ)/%.o,$(wildcard $(DIR_COMMON_C)/*.c)) 30 20 31 21 32 #-----[ To the compilation ]------------------------------------------------------ … … 43 54 44 55 # Tools's option 45 OR32_CC_OPT = $(INC LUDE) $(OPTIMIZE) -Wlong-long56 OR32_CC_OPT = $(INCDIR) $(OPTIMIZE) -Wlong-long 46 57 # -DHAVE_LIBC 47 58 OR32_AS_OPT = 48 OR32_LD_OPT = -T$(DIR_LDSCRIPT)/or32.ld $(LIB RARY)59 OR32_LD_OPT = -T$(DIR_LDSCRIPT)/or32.ld $(LIBDIR) $(LIBNAME) 49 60 OR32_OBJDUMP_OPT = -D 50 61 OR32_NM_OPT = -n -
trunk/Softwares/Minimal_soft/Makefile
r98 r100 12 12 DIR_ASM = $(DIR_SRC)/asm 13 13 DIR_SYS = $(DIR_SRC)/sys 14 DIR_INC = $(DIR_ C)/include15 DIR_LDSCRIPT = ../ Global/ldscript/14 DIR_INC = $(DIR_SRC)/include 15 DIR_LDSCRIPT = ../Common/ldscript/ 16 16 17 INCLUDE = -I$(DIR_INC) 18 LIBRARY = 17 INCDIR = -I$(DIR_INC) 18 LIBDIR = 19 LIBNAME = 19 20 20 21 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Minimal_soft/src/c/main.c
r81 r100 1 #include "thread_info.h"2 #include "cpu_info.h"3 4 1 //=====[ main ]================================================================= 5 2 /* -
trunk/Softwares/Test/Test_000/Makefile
r88 r100 13 13 DIR_ASM = $(DIR_SRC)/asm 14 14 DIR_SYS = $(DIR_SRC)/sys 15 DIR_INC = $(DIR_ C)/include16 DIR_LDSCRIPT = $(DIR_SOFT)/ Global/ldscript/15 DIR_INC = $(DIR_SRC)/include 16 DIR_LDSCRIPT = $(DIR_SOFT)/Common/ldscript/ 17 17 18 INCLUDE = -I$(DIR_INC) 19 LIBRARY = 18 INCDIR = -I$(DIR_INC) 19 LIBDIR = 20 LIBNAME = 20 21 21 22 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Test/Test_001/Makefile
r88 r100 13 13 DIR_ASM = $(DIR_SRC)/asm 14 14 DIR_SYS = $(DIR_SRC)/sys 15 DIR_INC = $(DIR_ C)/include16 DIR_LDSCRIPT = $(DIR_SOFT)/ Global/ldscript/15 DIR_INC = $(DIR_SRC)/include 16 DIR_LDSCRIPT = $(DIR_SOFT)/Common/ldscript/ 17 17 18 INCLUDE = -I$(DIR_INC) 19 LIBRARY = 18 INCDIR = -I$(DIR_INC) 19 LIBDIR = 20 LIBNAME = 20 21 21 22 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Test/Test_002/Makefile
r88 r100 13 13 DIR_ASM = $(DIR_SRC)/asm 14 14 DIR_SYS = $(DIR_SRC)/sys 15 DIR_INC = $(DIR_ C)/include16 DIR_LDSCRIPT = $(DIR_SOFT)/ Global/ldscript/15 DIR_INC = $(DIR_SRC)/include 16 DIR_LDSCRIPT = $(DIR_SOFT)/Common/ldscript/ 17 17 18 INCLUDE = -I$(DIR_INC) 19 LIBRARY = 18 INCDIR = -I$(DIR_INC) 19 LIBDIR = 20 LIBNAME = 20 21 21 22 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Test/Test_003/Makefile
r88 r100 13 13 DIR_ASM = $(DIR_SRC)/asm 14 14 DIR_SYS = $(DIR_SRC)/sys 15 DIR_INC = $(DIR_ C)/include16 DIR_LDSCRIPT = $(DIR_SOFT)/ Global/ldscript/15 DIR_INC = $(DIR_SRC)/include 16 DIR_LDSCRIPT = $(DIR_SOFT)/Common/ldscript/ 17 17 18 INCLUDE = -I$(DIR_INC) 19 LIBRARY = 18 INCDIR = -I$(DIR_INC) 19 LIBDIR = 20 LIBNAME = 20 21 21 22 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Test/Test_004/Makefile
r88 r100 13 13 DIR_ASM = $(DIR_SRC)/asm 14 14 DIR_SYS = $(DIR_SRC)/sys 15 DIR_INC = $(DIR_ C)/include16 DIR_LDSCRIPT = $(DIR_SOFT)/ Global/ldscript/15 DIR_INC = $(DIR_SRC)/include 16 DIR_LDSCRIPT = $(DIR_SOFT)/Common/ldscript/ 17 17 18 INCLUDE = -I$(DIR_INC) 19 LIBRARY = 18 INCDIR = -I$(DIR_INC) 19 LIBDIR = 20 LIBNAME = 20 21 21 22 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Test/Test_005/Makefile
r88 r100 13 13 DIR_ASM = $(DIR_SRC)/asm 14 14 DIR_SYS = $(DIR_SRC)/sys 15 DIR_INC = $(DIR_ C)/include16 DIR_LDSCRIPT = $(DIR_SOFT)/ Global/ldscript/15 DIR_INC = $(DIR_SRC)/include 16 DIR_LDSCRIPT = $(DIR_SOFT)/Common/ldscript/ 17 17 18 INCLUDE = -I$(DIR_INC) 19 LIBRARY = 18 INCDIR = -I$(DIR_INC) 19 LIBDIR = 20 LIBNAME = 20 21 21 22 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Test/Test_006/Makefile
r88 r100 13 13 DIR_ASM = $(DIR_SRC)/asm 14 14 DIR_SYS = $(DIR_SRC)/sys 15 DIR_INC = $(DIR_ C)/include16 DIR_LDSCRIPT = $(DIR_SOFT)/ Global/ldscript/15 DIR_INC = $(DIR_SRC)/include 16 DIR_LDSCRIPT = $(DIR_SOFT)/Common/ldscript/ 17 17 18 INCLUDE = -I$(DIR_INC) 19 LIBRARY = 18 INCDIR = -I$(DIR_INC) 19 LIBDIR = 20 LIBNAME = 20 21 21 22 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Test/Test_007/Makefile
r98 r100 13 13 DIR_ASM = $(DIR_SRC)/asm 14 14 DIR_SYS = $(DIR_SRC)/sys 15 DIR_INC = $(DIR_ C)/include16 DIR_LDSCRIPT = $(DIR_SOFT)/ Global/ldscript/15 DIR_INC = $(DIR_SRC)/include 16 DIR_LDSCRIPT = $(DIR_SOFT)/Common/ldscript/ 17 17 18 INCLUDE = -I$(DIR_INC) 19 LIBRARY = 18 INCDIR = -I$(DIR_INC) 19 LIBDIR = 20 LIBNAME = 20 21 21 22 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Test/Test_008/Makefile
r98 r100 13 13 DIR_ASM = $(DIR_SRC)/asm 14 14 DIR_SYS = $(DIR_SRC)/sys 15 DIR_INC = $(DIR_ C)/include16 DIR_LDSCRIPT = $(DIR_SOFT)/ Global/ldscript/15 DIR_INC = $(DIR_SRC)/include 16 DIR_LDSCRIPT = $(DIR_SOFT)/Common/ldscript/ 17 17 18 INCLUDE = -I$(DIR_INC) 19 LIBRARY = 18 INCDIR = -I$(DIR_INC) 19 LIBDIR = 20 LIBNAME = 20 21 21 22 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Test/Test_009/Makefile
r98 r100 13 13 DIR_ASM = $(DIR_SRC)/asm 14 14 DIR_SYS = $(DIR_SRC)/sys 15 DIR_INC = $(DIR_ C)/include16 DIR_LDSCRIPT = $(DIR_SOFT)/ Global/ldscript/15 DIR_INC = $(DIR_SRC)/include 16 DIR_LDSCRIPT = $(DIR_SOFT)/Common/ldscript/ 17 17 18 INCLUDE = -I$(DIR_INC) 19 LIBRARY = 18 INCDIR = -I$(DIR_INC) 19 LIBDIR = 20 LIBNAME = 20 21 21 22 #-----[ Files ]------------------------------------------------------------------- -
trunk/Softwares/Test/Test_009/src/sys/crt0.s
r98 r100 37 37 (r4) (r7) 38 38 1) 0x00000000 0x00000000 - 0x00000000 0 0 39 40 */ 41 42 /* Mask to read OV (SR[11]), CY (SR[10]) and F (SR[9]) */ 43 l.movhi r5, hi(0x000000e0) 44 l.ori r5, r5, lo(0x000000e0) 45 39 2) 0x14011959 0x25071959 - 0x390832b2 0 0 40 3) 0xebfee6a7 0xdaf8e6a7 - 0xc6f7cd4e 1 0 41 4) 0xebfee6a7 0x25071959 - 0x11060000 1 0 42 5) 0x14011959 0xdaf8e6a7 - 0xeefa0000 0 0 43 6) 0x87654321 0xabcdef01 - 0x33333222 1 1 44 7) 0x789abcde 0x08765432 - 0x81111110 0 1 45 */ 46 47 /* Mask to read OV (SR[11]), CY (SR[10]) and not F (SR[9]) */ 48 l.movhi r5, hi(0x00000c00) 49 l.ori r5, r5, lo(0x00000c00) 50 46 51 /**********/ 47 52 /* Test 1 */ … … 70 75 l.bnf _end_ko 71 76 l.nop 77 78 /**********/ 79 /* Test 2 */ 80 /**********/ 81 l.movhi r1, hi(0x14011959) /* RA */ 82 l.ori r1, r1, lo(0x14011959) 83 l.movhi r2, hi(0x25071959) /* RB */ 84 l.ori r2, r2, lo(0x25071959) 85 l.movhi r3, hi(0x390832b2) /* RD wait */ 86 l.ori r3, r3, lo(0x390832b2) 87 l.movhi r6, hi(0x00000000) /* SR wait */ 88 l.ori r6, r6, lo(0x00000000) 89 90 l.add r4, r1, r2 91 92 /* Test flag */ 93 l.mfspr r7, r0, 17 94 l.and r7, r7, r5 95 96 l.sfeq r6, r7 97 l.bnf _end_ko 98 l.nop 99 100 /* Test result */ 101 l.sfeq r3, r4 102 l.bnf _end_ko 103 l.nop 104 105 /**********/ 106 /* Test 3 */ 107 /**********/ 108 l.movhi r1, hi(0xebfee6a7) /* RA */ 109 l.ori r1, r1, lo(0xebfee6a7) 110 l.movhi r2, hi(0xdaf8e6a7) /* RB */ 111 l.ori r2, r2, lo(0xdaf8e6a7) 112 l.movhi r3, hi(0xc6f7cd4e) /* RD wait */ 113 l.ori r3, r3, lo(0xc6f7cd4e) 114 l.movhi r6, hi(0x00000400) /* SR wait */ 115 l.ori r6, r6, lo(0x00000400) 116 117 l.add r4, r1, r2 118 119 /* Test flag */ 120 l.mfspr r7, r0, 17 121 l.and r7, r7, r5 122 123 l.sfeq r6, r7 124 l.bnf _end_ko 125 l.nop 126 127 /* Test result */ 128 l.sfeq r3, r4 129 l.bnf _end_ko 130 l.nop 131 132 /**********/ 133 /* Test 4 */ 134 /**********/ 135 l.movhi r1, hi(0xebfee6a7) /* RA */ 136 l.ori r1, r1, lo(0xebfee6a7) 137 l.movhi r2, hi(0x25071959) /* RB */ 138 l.ori r2, r2, lo(0x25071959) 139 l.movhi r3, hi(0x11060000) /* RD wait */ 140 l.ori r3, r3, lo(0x11060000) 141 l.movhi r6, hi(0x00000400) /* SR wait */ 142 l.ori r6, r6, lo(0x00000400) 143 144 l.add r4, r1, r2 145 146 /* Test flag */ 147 l.mfspr r7, r0, 17 148 l.and r7, r7, r5 149 150 l.sfeq r6, r7 151 l.bnf _end_ko 152 l.nop 153 154 /* Test result */ 155 l.sfeq r3, r4 156 l.bnf _end_ko 157 l.nop 158 159 /**********/ 160 /* Test 5 */ 161 /**********/ 162 l.movhi r1, hi(0x14011959) /* RA */ 163 l.ori r1, r1, lo(0x14011959) 164 l.movhi r2, hi(0xdaf8e6a7) /* RB */ 165 l.ori r2, r2, lo(0xdaf8e6a7) 166 l.movhi r3, hi(0xeefa0000) /* RD wait */ 167 l.ori r3, r3, lo(0xeefa0000) 168 l.movhi r6, hi(0x00000000) /* SR wait */ 169 l.ori r6, r6, lo(0x00000000) 170 171 l.add r4, r1, r2 172 173 /* Test flag */ 174 l.mfspr r7, r0, 17 175 l.and r7, r7, r5 176 177 l.sfeq r6, r7 178 l.bnf _end_ko 179 l.nop 180 181 /* Test result */ 182 l.sfeq r3, r4 183 l.bnf _end_ko 184 l.nop 185 186 /**********/ 187 /* Test 6 */ 188 /**********/ 189 l.movhi r1, hi(0x87654321) /* RA */ 190 l.ori r1, r1, lo(0x87654321) 191 l.movhi r2, hi(0xabcdef01) /* RB */ 192 l.ori r2, r2, lo(0xabcdef01) 193 l.movhi r3, hi(0x33333222) /* RD wait */ 194 l.ori r3, r3, lo(0x33333222) 195 l.movhi r6, hi(0x00000c00) /* SR wait */ 196 l.ori r6, r6, lo(0x00000c00) 197 198 l.add r4, r1, r2 199 200 /* Test flag */ 201 l.mfspr r7, r0, 17 202 l.and r7, r7, r5 203 204 l.sfeq r6, r7 205 l.bnf _end_ko 206 l.nop 207 208 /* Test result */ 209 l.sfeq r3, r4 210 l.bnf _end_ko 211 l.nop 212 213 /**********/ 214 /* Test 7 */ 215 /**********/ 216 l.movhi r1, hi(0x789abcde) /* RA */ 217 l.ori r1, r1, lo(0x789abcde) 218 l.movhi r2, hi(0x08765432) /* RB */ 219 l.ori r2, r2, lo(0x08765432) 220 l.movhi r3, hi(0x81111110) /* RD wait */ 221 l.ori r3, r3, lo(0x81111110) 222 l.movhi r6, hi(0x00000800) /* SR wait */ 223 l.ori r6, r6, lo(0x00000800) 224 225 l.add r4, r1, r2 226 227 /* Test flag */ 228 l.mfspr r7, r0, 17 229 l.and r7, r7, r5 230 231 l.sfeq r6, r7 232 l.bnf _end_ko 233 l.nop 234 235 /* Test result */ 236 l.sfeq r3, r4 237 l.bnf _end_ko 238 l.nop 239 240 /**********/ 241 /* End */ 242 /**********/ 243 72 244 l.j _end_ok 73 245 l.nop 74
Note: See TracChangeset
for help on using the changeset viewer.