Changeset 117 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/src/Load_store_unit_function_speculative_load_commit_transition.cpp
- Timestamp:
- May 16, 2009, 4:42:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/src/Load_store_unit_function_speculative_load_commit_transition.cpp
r112 r117 242 242 243 243 for (uint32_t i=0; i< _param->_size_store_queue ; i++) 244 { 245 reg_STORE_QUEUE_NB_CHECK [i] = 0; 244 246 _store_queue [i]._state = STORE_QUEUE_EMPTY; 247 } 245 248 246 249 for (uint32_t i=0; i< _param->_size_load_queue ; i++) … … 252 255 else 253 256 { 257 //================================================================ 258 // Interface "MEMORY_OUT" 259 //================================================================ 260 261 if (( internal_MEMORY_OUT_VAL == 1) and 262 (PORT_READ(in_MEMORY_OUT_ACK[0]) == 1)) 263 { 264 log_printf(TRACE,Load_store_unit,FUNCTION," * MEMORY_OUT[0] transaction"); 265 266 switch (internal_MEMORY_OUT_SELECT_QUEUE) 267 { 268 case SELECT_STORE_QUEUE : 269 { 270 // ======================= 271 // ===== STORE_QUEUE ===== 272 // ======================= 273 274 log_printf(TRACE,Load_store_unit,FUNCTION," * store_queue [%d]",reg_STORE_QUEUE_PTR_READ); 275 276 // Entry flush and increase the read pointer 277 _store_queue [reg_STORE_QUEUE_PTR_READ]._state = STORE_QUEUE_EMPTY; 278 279 reg_STORE_QUEUE_PTR_READ = (reg_STORE_QUEUE_PTR_READ+1)%_param->_size_store_queue; 280 281 break; 282 } 283 case SELECT_LOAD_QUEUE : 284 { 285 // ====================== 286 // ===== LOAD_QUEUE ===== 287 // ====================== 288 289 log_printf(TRACE,Load_store_unit,FUNCTION," * load_queue [%d]",internal_MEMORY_OUT_PTR); 290 291 // Entry flush and increase the read pointer 292 293 _load_queue [internal_MEMORY_OUT_PTR]._state = LOAD_QUEUE_EMPTY; 294 295 // reg_LOAD_QUEUE_PTR_READ = (reg_LOAD_QUEUE_PTR_READ+1)%_param->_size_load_queue; 296 297 break; 298 } 299 case SELECT_LOAD_QUEUE_SPECULATIVE : 300 { 301 log_printf(TRACE,Load_store_unit,FUNCTION," * load_queue [%d] (speculative)",internal_MEMORY_OUT_PTR); 302 303 // !!! WARNING !!! 304 // !!! Test special case : 305 // !!! in a cycle an instruction can check the last store AND commit instruction 306 // !!! also the memory_out is before the port_check 307 308 _load_queue [internal_MEMORY_OUT_PTR]._state = LOAD_QUEUE_CHECK; 309 // NOTE : a speculative load write in the register file. 310 // if the speculation is a miss, write_rd is re set at 1. 311 _load_queue [internal_MEMORY_OUT_PTR]._write_rd = 0; 312 313 #ifdef STATISTICS 314 if (usage_is_set(_usage,USE_STATISTICS)) 315 (*_stat_nb_inst_load_commit_speculative) ++; 316 #endif 317 318 break; 319 } 320 321 break; 322 } 323 } 324 254 325 //================================================================ 255 326 // Interface "PORT_CHECK" … … 278 349 279 350 // find a entry that it need a check 280 Tlsq_ptr_t index_store = _load_queue[index_load]._store_queue_ptr_write; 351 Tlsq_ptr_t index_store = _load_queue[index_load]._store_queue_ptr_write; 352 Tlsq_ptr_t index_store_old = index_store; 353 281 354 // Init variable 282 355 bool end_check = false; … … 534 607 // The check is finish if all bit is set 535 608 end_check = (_load_queue[index_load]._check_hit_byte == _param->_mask_check_hit_byte); 609 536 610 } 537 611 } … … 553 627 log_printf(TRACE,Load_store_unit,FUNCTION," * next"); 554 628 log_printf(TRACE,Load_store_unit,FUNCTION," * new store_queue_ptr_write : %d",index_store); 629 630 log_printf(TRACE,Load_store_unit,FUNCTION," * update reg_STORE_QUEUE_NB_CHECK"); 631 #ifdef DEBUG 632 if (reg_STORE_QUEUE_NB_CHECK [index_store] == 0) 633 throw ERRORMORPHEO(FUNCTION,_("reg_STORE_QUEUE_NB_CHECK must be > 0\n")); 634 #endif 635 reg_STORE_QUEUE_NB_CHECK [index_store] --; 636 555 637 // if (_load_queue[index_load]._store_queue_ptr_write == 0) 556 638 // _load_queue[index_load]._store_queue_ptr_write = _param->_size_store_queue-1; … … 615 697 log_printf(TRACE,Load_store_unit,FUNCTION," * state new : %s",toString(_load_queue[index_load]._state).c_str()); 616 698 log_printf(TRACE,Load_store_unit,FUNCTION," * exception : %d",_load_queue[index_load]._exception); 699 700 if (end_check) 701 { 702 log_printf(TRACE,Load_store_unit,FUNCTION," * end check, decrease all nb_check"); 703 704 uint32_t i=index_store; 705 while (i!=reg_STORE_QUEUE_PTR_READ) 706 { 707 i=((i==0)?_param->_size_store_queue:i)-1; 708 709 #ifdef DEBUG 710 if (reg_STORE_QUEUE_NB_CHECK [i] == 0) 711 throw ERRORMORPHEO(FUNCTION,_("reg_STORE_QUEUE_NB_CHECK must be > 0\n")); 712 #endif 713 714 reg_STORE_QUEUE_NB_CHECK [i] --; 715 //i=(i+1)%_param->_size_store_queue; 716 } 717 } 617 718 } 618 719 } … … 803 904 804 905 //================================================================ 805 // Interface "MEMORY_OUT"806 //================================================================807 808 if (( internal_MEMORY_OUT_VAL == 1) and809 (PORT_READ(in_MEMORY_OUT_ACK[0]) == 1))810 {811 log_printf(TRACE,Load_store_unit,FUNCTION," * MEMORY_OUT[0] transaction");812 813 switch (internal_MEMORY_OUT_SELECT_QUEUE)814 {815 case SELECT_STORE_QUEUE :816 {817 // =======================818 // ===== STORE_QUEUE =====819 // =======================820 821 log_printf(TRACE,Load_store_unit,FUNCTION," * store_queue [%d]",reg_STORE_QUEUE_PTR_READ);822 823 // Entry flush and increase the read pointer824 _store_queue [reg_STORE_QUEUE_PTR_READ]._state = STORE_QUEUE_EMPTY;825 826 reg_STORE_QUEUE_PTR_READ = (reg_STORE_QUEUE_PTR_READ+1)%_param->_size_store_queue;827 828 break;829 }830 case SELECT_LOAD_QUEUE :831 {832 // ======================833 // ===== LOAD_QUEUE =====834 // ======================835 836 log_printf(TRACE,Load_store_unit,FUNCTION," * load_queue [%d]",internal_MEMORY_OUT_PTR);837 838 // Entry flush and increase the read pointer839 840 _load_queue [internal_MEMORY_OUT_PTR]._state = LOAD_QUEUE_EMPTY;841 842 // reg_LOAD_QUEUE_PTR_READ = (reg_LOAD_QUEUE_PTR_READ+1)%_param->_size_load_queue;843 844 break;845 }846 case SELECT_LOAD_QUEUE_SPECULATIVE :847 {848 log_printf(TRACE,Load_store_unit,FUNCTION," * load_queue [%d] (speculative)",internal_MEMORY_OUT_PTR);849 850 _load_queue [internal_MEMORY_OUT_PTR]._state = LOAD_QUEUE_CHECK;851 // NOTE : a speculative load write in the register file.852 // if the speculation is a miss, write_rd is re set at 1.853 _load_queue [internal_MEMORY_OUT_PTR]._write_rd = 0;854 855 #ifdef STATISTICS856 if (usage_is_set(_usage,USE_STATISTICS))857 (*_stat_nb_inst_load_commit_speculative) ++;858 #endif859 860 break;861 }862 863 break;864 }865 }866 867 //================================================================868 906 // Interface "DCACHE_REQ" 869 907 //================================================================ … … 943 981 Tdcache_address_t address_lsb = (address & _param->_mask_address_lsb); 944 982 Tdcache_address_t check_hit_byte = gen_mask_not<Tdcache_address_t>(address_lsb+(memory_size(operation)>>3)-1,address_lsb) & _param->_mask_check_hit_byte; 983 Tlsq_ptr_t store_queue_ptr_write = _speculative_access_queue [internal_SPECULATIVE_ACCESS_QUEUE_PTR_READ]._store_queue_ptr_write; 945 984 946 985 log_printf(TRACE,Load_store_unit,FUNCTION," * address : 0x%.8x", address); … … 955 994 _load_queue [ptr_write]._packet_id = _speculative_access_queue [internal_SPECULATIVE_ACCESS_QUEUE_PTR_READ]._packet_id; 956 995 _load_queue [ptr_write]._operation = operation; 957 _load_queue [ptr_write]._store_queue_ptr_write = _speculative_access_queue [internal_SPECULATIVE_ACCESS_QUEUE_PTR_READ]._store_queue_ptr_write;996 _load_queue [ptr_write]._store_queue_ptr_write = store_queue_ptr_write; 958 997 _load_queue [ptr_write]._address = address; 959 998 _load_queue [ptr_write]._check_hit_byte = check_hit_byte; … … 964 1003 // NOTE : if have an exception, must write in register, because a depend instruction wait the load data. 965 1004 _load_queue [ptr_write]._write_rd = _speculative_access_queue [internal_SPECULATIVE_ACCESS_QUEUE_PTR_READ]._write_rd ; 966 967 1005 _load_queue [ptr_write]._num_reg_rd = _speculative_access_queue [internal_SPECULATIVE_ACCESS_QUEUE_PTR_READ]._num_reg_rd ; 968 1006 _load_queue [ptr_write]._exception = exception; … … 980 1018 (*_stat_nb_inst_load) ++; 981 1019 #endif 1020 1021 // Only load need check 1022 if (is_operation_memory_load(_load_queue [ptr_write]._operation)) 1023 { 1024 log_printf(TRACE,Load_store_unit,FUNCTION," * update nb_check"); 1025 log_printf(TRACE,Load_store_unit,FUNCTION," * store_queue_ptr_write : %d",store_queue_ptr_write); 1026 log_printf(TRACE,Load_store_unit,FUNCTION," * reg_STORE_QUEUE_PTR_READ : %d",reg_STORE_QUEUE_PTR_READ); 1027 1028 uint32_t i=store_queue_ptr_write; 1029 while (i!=reg_STORE_QUEUE_PTR_READ) 1030 { 1031 i=((i==0)?_param->_size_store_queue:i)-1; 1032 1033 log_printf(TRACE,Load_store_unit,FUNCTION," * i : %d",i); 1034 1035 reg_STORE_QUEUE_NB_CHECK [i] ++; 1036 } 1037 } 982 1038 } 983 1039 … … 1075 1131 uint32_t j = (reg_STORE_QUEUE_PTR_READ+i)%_param->_size_store_queue; 1076 1132 1077 log_printf(TRACE,Load_store_unit,FUNCTION," [%.4d] %.4d %.4d %.4d, %.4d, %.4d, %.4d, %.8x %.8x, %.2d, % s",1133 log_printf(TRACE,Load_store_unit,FUNCTION," [%.4d] %.4d %.4d %.4d, %.4d, %.4d, %.4d, %.8x %.8x, %.2d, %.2d %s", 1078 1134 j, 1079 1135 _store_queue[j]._context_id , … … 1088 1144 //_store_queue[j]._num_reg_rd , 1089 1145 _store_queue[j]._exception , 1146 reg_STORE_QUEUE_NB_CHECK [j] , 1090 1147 toString(_store_queue[j]._state).c_str()); 1091 1148 }
Note: See TracChangeset
for help on using the changeset viewer.