Changeset 440 for branches/v5/modules/vci_mem_cache/caba/source/include
- Timestamp:
- Jul 17, 2013, 9:24:48 AM (11 years ago)
- Location:
- branches/v5/modules/vci_mem_cache
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/v5/modules/vci_mem_cache
-
Property
svn:mergeinfo
set to
/trunk/modules/vci_mem_cache merged eligible
-
Property
svn:mergeinfo
set to
-
branches/v5/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h
r307 r440 40 40 //////////////////////////////////////////////////////////////////////// 41 41 class Owner{ 42 typedef uint32_t size_t;43 42 44 43 public: … … 92 91 93 92 typedef uint32_t tag_t; 94 typedef uint32_t size_t;95 93 96 94 public: … … 165 163 void print() 166 164 { 167 std::cout << "Valid = " << valid << " ; IS COUNT = " << is_cnt << " ; Dirty = " << dirty << " ; Lock = " 168 << lock 165 std::cout << "Valid = " << valid 166 << " ; IS COUNT = " << is_cnt 167 << " ; Dirty = " << dirty 168 << " ; Lock = " << lock 169 169 << " ; Tag = " << std::hex << tag << std::dec 170 170 << " ; Count = " << count … … 187 187 typedef uint32_t data_t; 188 188 typedef uint32_t tag_t; 189 typedef uint32_t size_t;190 189 191 190 private: … … 275 274 276 275 ///////////////////////////////////////////////////////////////////// 276 // The inval function invalidate an entry defined by the set and 277 // way arguments. 278 ///////////////////////////////////////////////////////////////////// 279 void inval( const size_t &set, const size_t &way ) 280 { 281 m_dir_tab[set][way].init(); 282 } 283 284 ///////////////////////////////////////////////////////////////////// 277 285 // The read_neutral() function reads a directory entry, without 278 286 // changing the LRU … … 321 329 // update LRU bits 322 330 bool all_recent = true; 323 for ( size_t i=0 ; i<m_ways ; i++ ) { 324 if ( i != way ) all_recent = m_lru_tab[set][i].recent && all_recent; 325 } 326 if ( all_recent ) { 327 for( size_t i=0 ; i<m_ways ; i++ ) m_lru_tab[set][i].recent = false; 328 } else { 329 m_lru_tab[set][way].recent = true; 331 for ( size_t i=0 ; i<m_ways ; i++ ) 332 { 333 if ( i != way ) all_recent = m_lru_tab[set][i].recent && all_recent; 334 } 335 if ( all_recent ) 336 { 337 for( size_t i=0 ; i<m_ways ; i++ ) m_lru_tab[set][i].recent = false; 338 } 339 else 340 { 341 m_lru_tab[set][way].recent = true; 330 342 } 331 343 } // end write() … … 408 420 /////////////////////////////////////////////////////////////////////// 409 421 class HeapEntry{ 410 typedef uint32_t size_t;411 422 412 423 public: … … 472 483 //////////////////////////////////////////////////////////////////////// 473 484 class HeapDirectory{ 474 typedef uint32_t size_t;475 485 476 486 private: -
branches/v5/modules/vci_mem_cache/caba/source/include/update_tab.h
r307 r440 11 11 //////////////////////////////////////////////////////////////////////// 12 12 class UpdateTabEntry { 13 13 14 typedef uint32_t size_t; 14 15 typedef sc_dt::sc_uint<40> addr_t; 15 16 16 17 public: 18 17 19 bool valid; // It is a valid pending transaction 18 20 bool update; // It is an update transaction 19 21 bool brdcast; // It is a broadcast invalidate 20 bool rsp; // It needs a response to the initiator 22 bool rsp; // Response to the initiator required 23 bool ack; // Acknowledge to the CONFIG FSM required 21 24 size_t srcid; // The srcid of the initiator which wrote the data 22 25 size_t trdid; // The trdid of the initiator which wrote the data … … 25 28 size_t count; // The number of acknowledge responses to receive 26 29 27 UpdateTabEntry(){ 30 UpdateTabEntry() 31 { 28 32 valid = false; 29 33 update = false; 30 34 brdcast = false; 31 35 rsp = false; 36 ack = false; 32 37 srcid = 0; 33 38 trdid = 0; … … 38 43 39 44 UpdateTabEntry(bool i_valid, 40 bool i_update, 41 bool i_brdcast, 42 bool i_rsp, 43 size_t i_srcid, 44 size_t i_trdid, 45 size_t i_pktid, 46 addr_t i_nline, 47 size_t i_count) 45 bool i_update, 46 bool i_brdcast, 47 bool i_rsp, 48 bool i_ack, 49 size_t i_srcid, 50 size_t i_trdid, 51 size_t i_pktid, 52 addr_t i_nline, 53 size_t i_count) 48 54 { 49 55 valid = i_valid; … … 51 57 brdcast = i_brdcast; 52 58 rsp = i_rsp; 59 ack = i_ack; 53 60 srcid = i_srcid; 54 61 trdid = i_trdid; … … 64 71 brdcast = source.brdcast; 65 72 rsp = source.rsp; 73 ack = source.ack; 66 74 srcid = source.srcid; 67 75 trdid = source.trdid; … … 80 88 brdcast= false; 81 89 rsp = false; 90 ack = false; 82 91 srcid = 0; 83 92 trdid = 0; … … 98 107 brdcast= source.brdcast; 99 108 rsp = source.rsp; 109 ack = source.ack ; 100 110 srcid = source.srcid; 101 111 trdid = source.trdid; … … 108 118 // The print() function prints the entry 109 119 //////////////////////////////////////////////////////////////////// 110 void print(){ 111 std::cout << std::dec << "valid = " << valid << std::endl; 112 std::cout << "update = " << update << std::endl; 113 std::cout << "brdcast= " << brdcast<< std::endl; 114 std::cout << "rsp = " << rsp << std::endl; 115 std::cout << "srcid = " << srcid << std::endl; 116 std::cout << "trdid = " << trdid << std::endl; 117 std::cout << "pktid = " << pktid << std::endl; 118 std::cout << std::hex << "nline = " << nline << std::endl; 119 std::cout << std::dec << "count = " << count << std::endl; 120 void print() 121 { 122 std::cout << " val = " << std::dec << valid 123 << " / updt = " << update 124 << " / bc = " << brdcast 125 << " / rsp = " << rsp 126 << " / ack = " << ack 127 << " / count = " << count 128 << " / srcid = " << std::hex << srcid 129 << " / trdid = " << trdid 130 << " / pktid = " << pktid 131 << " / nline = " << nline << std::endl; 120 132 } 121 133 }; … … 126 138 class UpdateTab{ 127 139 128 typedef uint32_t size_t; 129 typedef sc_dt::sc_uint<40> addr_t; 140 typedef uint64_t addr_t; 130 141 131 142 private: 132 size_t size_tab;143 size_t size_tab; 133 144 std::vector<UpdateTabEntry> tab; 134 145 … … 150 161 // The size() function returns the size of the tab 151 162 //////////////////////////////////////////////////////////////////// 152 const size_t size(){ 163 const size_t size() 164 { 153 165 return size_tab; 154 166 } 155 167 156 157 168 //////////////////////////////////////////////////////////////////// 158 169 // The print() function diplays the tab content 159 170 //////////////////////////////////////////////////////////////////// 160 void print(){ 161 for(size_t i=0; i<size_tab; i++) { 162 std::cout << "UPDATE TAB ENTRY " << std::dec << i << "--------" << std::endl; 171 void print() 172 { 173 std::cout << "UPDATE TABLE Content" << std::endl; 174 for(size_t i=0; i<size_tab; i++) 175 { 176 std::cout << "[" << std::dec << i << "] "; 163 177 tab[i].print(); 164 178 } … … 166 180 } 167 181 168 169 182 ///////////////////////////////////////////////////////////////////// 170 183 // The init() function initializes the tab 171 184 ///////////////////////////////////////////////////////////////////// 172 void init(){ 173 for ( size_t i=0; i<size_tab; i++) { 174 tab[i].init(); 175 } 176 } 177 185 void init() 186 { 187 for ( size_t i=0; i<size_tab; i++) tab[i].init(); 188 } 178 189 179 190 ///////////////////////////////////////////////////////////////////// … … 201 212 /////////////////////////////////////////////////////////////////////////// 202 213 bool set(const bool update, 203 const bool brdcast, 204 const bool rsp, 205 const size_t srcid, 206 const size_t trdid, 207 const size_t pktid, 208 const addr_t nline, 209 const size_t count, 210 size_t &index) 211 { 212 for ( size_t i=0 ; i<size_tab ; i++ ) { 213 if( !tab[i].valid ) { 214 const bool brdcast, 215 const bool rsp, 216 const bool ack, 217 const size_t srcid, 218 const size_t trdid, 219 const size_t pktid, 220 const addr_t nline, 221 const size_t count, 222 size_t &index) 223 { 224 for ( size_t i=0 ; i<size_tab ; i++ ) 225 { 226 if( !tab[i].valid ) 227 { 214 228 tab[i].valid = true; 215 229 tab[i].update = update; 216 230 tab[i].brdcast = brdcast; 217 231 tab[i].rsp = rsp; 232 tab[i].ack = ack; 218 233 tab[i].srcid = (size_t) srcid; 219 234 tab[i].trdid = (size_t) trdid; … … 236 251 ///////////////////////////////////////////////////////////////////// 237 252 bool decrement( const size_t index, 238 size_t &counter )253 size_t &counter ) 239 254 { 240 255 assert((index<size_tab) && "Bad Update Tab Entry"); 241 if ( tab[index].valid ) { 256 if ( tab[index].valid ) 257 { 242 258 tab[index].count--; 243 259 counter = tab[index].count; 244 260 return true; 245 } else { 261 } 262 else 263 { 246 264 return false; 247 265 } … … 253 271 bool is_full() 254 272 { 255 for(size_t i = 0 ; i < size_tab ; i++){ 256 if(!tab[i].valid){ 257 return false; 258 } 273 for(size_t i = 0 ; i < size_tab ; i++) 274 { 275 if(!tab[i].valid) return false; 259 276 } 260 277 return true; … … 266 283 bool is_not_empty() 267 284 { 268 for(size_t i = 0 ; i < size_tab ; i++){ 269 if(tab[i].valid){ 285 for(size_t i = 0 ; i < size_tab ; i++) 286 { 287 if(tab[i].valid) return true; 288 } 289 return false; 290 } 291 292 ///////////////////////////////////////////////////////////////////// 293 // The need_rsp() function returns the need of a response 294 // Arguments : 295 // - index : the index of the entry 296 ///////////////////////////////////////////////////////////////////// 297 bool need_rsp(const size_t index) 298 { 299 assert(index<size_tab && "Bad Update Tab Entry"); 300 return tab[index].rsp; 301 } 302 303 ///////////////////////////////////////////////////////////////////// 304 // The need_ack() function returns the need of an acknowledge 305 // Arguments : 306 // - index : the index of the entry 307 ///////////////////////////////////////////////////////////////////// 308 bool need_ack(const size_t index) 309 { 310 assert(index<size_tab && "Bad Update Tab Entry"); 311 return tab[index].ack; 312 } 313 314 ///////////////////////////////////////////////////////////////////// 315 // The is_brdcast() function returns the transaction type 316 // Arguments : 317 // - index : the index of the entry 318 ///////////////////////////////////////////////////////////////////// 319 bool is_brdcast(const size_t index) 320 { 321 assert(index<size_tab && "Bad Update Tab Entry"); 322 return tab[index].brdcast; 323 } 324 325 ///////////////////////////////////////////////////////////////////// 326 // The is_update() function returns the transaction type 327 // Arguments : 328 // - index : the index of the entry 329 ///////////////////////////////////////////////////////////////////// 330 bool is_update(const size_t index) 331 { 332 assert(index<size_tab && "Bad Update Tab Entry"); 333 return tab[index].update; 334 } 335 336 ///////////////////////////////////////////////////////////////////// 337 // The srcid() function returns the srcid value 338 // Arguments : 339 // - index : the index of the entry 340 ///////////////////////////////////////////////////////////////////// 341 size_t srcid(const size_t index) 342 { 343 assert(index<size_tab && "Bad Update Tab Entry"); 344 return tab[index].srcid; 345 } 346 347 ///////////////////////////////////////////////////////////////////// 348 // The trdid() function returns the trdid value 349 // Arguments : 350 // - index : the index of the entry 351 ///////////////////////////////////////////////////////////////////// 352 size_t trdid(const size_t index) 353 { 354 assert(index<size_tab && "Bad Update Tab Entry"); 355 return tab[index].trdid; 356 } 357 358 ///////////////////////////////////////////////////////////////////// 359 // The pktid() function returns the pktid value 360 // Arguments : 361 // - index : the index of the entry 362 ///////////////////////////////////////////////////////////////////// 363 size_t pktid(const size_t index) 364 { 365 assert(index<size_tab && "Bad Update Tab Entry"); 366 return tab[index].pktid; 367 } 368 369 ///////////////////////////////////////////////////////////////////// 370 // The nline() function returns the nline value 371 // Arguments : 372 // - index : the index of the entry 373 ///////////////////////////////////////////////////////////////////// 374 addr_t nline(const size_t index) 375 { 376 assert(index<size_tab && "Bad Update Tab Entry"); 377 return tab[index].nline; 378 } 379 380 ///////////////////////////////////////////////////////////////////// 381 // The search_inval() function returns the index of the entry in UPT 382 // Arguments : 383 // - nline : the line number of the entry in the directory 384 ///////////////////////////////////////////////////////////////////// 385 bool search_inval(const addr_t nline,size_t &index) 386 { 387 size_t i ; 388 389 for (i = 0 ; i < size_tab ; i++) 390 { 391 if ( (tab[i].nline == nline) and tab[i].valid and not tab[i].update ) 392 { 393 index = i ; 270 394 return true; 271 395 } … … 275 399 276 400 ///////////////////////////////////////////////////////////////////// 277 // The need_rsp() function returns the need of a response 278 // Arguments : 279 // - index : the index of the entry 280 ///////////////////////////////////////////////////////////////////// 281 bool need_rsp(const size_t index) 282 { 283 assert(index<size_tab && "Bad Update Tab Entry"); 284 return tab[index].rsp; 285 } 286 287 ///////////////////////////////////////////////////////////////////// 288 // The is_update() function returns the transaction type 289 // Arguments : 290 // - index : the index of the entry 291 ///////////////////////////////////////////////////////////////////// 292 bool is_brdcast(const size_t index) 293 { 294 assert(index<size_tab && "Bad Update Tab Entry"); 295 return tab[index].brdcast; 296 } 297 298 ///////////////////////////////////////////////////////////////////// 299 // The is_update() function returns the transaction type 300 // Arguments : 301 // - index : the index of the entry 302 ///////////////////////////////////////////////////////////////////// 303 bool is_update(const size_t index) 304 { 305 assert(index<size_tab && "Bad Update Tab Entry"); 306 return tab[index].update; 307 } 308 309 ///////////////////////////////////////////////////////////////////// 310 // The srcid() function returns the srcid value 311 // Arguments : 312 // - index : the index of the entry 313 ///////////////////////////////////////////////////////////////////// 314 size_t srcid(const size_t index) 315 { 316 assert(index<size_tab && "Bad Update Tab Entry"); 317 return tab[index].srcid; 318 } 319 320 ///////////////////////////////////////////////////////////////////// 321 // The trdid() function returns the trdid value 322 // Arguments : 323 // - index : the index of the entry 324 ///////////////////////////////////////////////////////////////////// 325 size_t trdid(const size_t index) 326 { 327 assert(index<size_tab && "Bad Update Tab Entry"); 328 return tab[index].trdid; 329 } 330 331 ///////////////////////////////////////////////////////////////////// 332 // The pktid() function returns the pktid value 333 // Arguments : 334 // - index : the index of the entry 335 ///////////////////////////////////////////////////////////////////// 336 size_t pktid(const size_t index) 337 { 338 assert(index<size_tab && "Bad Update Tab Entry"); 339 return tab[index].pktid; 340 } 341 342 ///////////////////////////////////////////////////////////////////// 343 // The nline() function returns the nline value 344 // Arguments : 345 // - index : the index of the entry 346 ///////////////////////////////////////////////////////////////////// 347 addr_t nline(const size_t index) 348 { 349 assert(index<size_tab && "Bad Update Tab Entry"); 350 return tab[index].nline; 351 } 352 353 ///////////////////////////////////////////////////////////////////// 354 // The search_inval() function returns the index of the entry in UPT 401 // The read_nline() function returns the index of the entry in UPT 355 402 // Arguments : 356 403 // - nline : the line number of the entry in the directory 357 404 ///////////////////////////////////////////////////////////////////// 358 bool search_inval(const addr_t nline,size_t &index)405 bool read_nline(const addr_t nline,size_t &index) 359 406 { 360 407 size_t i ; 361 408 362 for (i = 0 ; i < size_tab ; i++){ 363 if((tab[i].nline == nline) && tab[i].valid){ 364 if(!tab[i].update){ 365 index = i ; 366 return true; 367 } 368 } 369 } 370 return false; 371 } 372 373 ///////////////////////////////////////////////////////////////////// 374 // The read_nline() function returns the index of the entry in UPT 375 // Arguments : 376 // - nline : the line number of the entry in the directory 377 ///////////////////////////////////////////////////////////////////// 378 bool read_nline(const addr_t nline,size_t &index) 379 { 380 size_t i ; 381 382 for (i = 0 ; i < size_tab ; i++){ 383 if((tab[i].nline == nline) && tab[i].valid){ 409 for (i = 0 ; i < size_tab ; i++) 410 { 411 if ( (tab[i].nline == nline) and tab[i].valid ) 412 { 384 413 index = i ; 385 414 return true; -
branches/v5/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h
r362 r440 52 52 #include "dspin_dhccp_param.h" 53 53 54 #define TRANSACTION_TAB_LINES 4 // Number of lines in the transaction tab 55 #define UPDATE_TAB_LINES 4 // Number of lines in the update tab 54 #define TRT_ENTRIES 4 // Number of entries in TRT 55 #define UPT_ENTRIES 4 // Number of entries in UPT 56 #define HEAP_ENTRIES 1024 // Number of entries in HEAP 56 57 57 58 namespace soclib { namespace caba { 59 58 60 using namespace sc_core; 59 61 60 template<typename vci_param> 62 template<typename vci_param_int, 63 typename vci_param_ext, 64 size_t dspin_in_width, 65 size_t dspin_out_width> 61 66 class VciMemCache 62 67 : public soclib::caba::BaseModule 63 68 { 64 typedef sc_dt::sc_uint<40> addr_t; 65 typedef typename vci_param::fast_addr_t vci_addr_t; 69 typedef typename vci_param_int::fast_addr_t addr_t; 70 71 typedef typename sc_dt::sc_uint<64> wide_data_t; 72 66 73 typedef uint32_t data_t; 67 74 typedef uint32_t tag_t; 68 typedef uint32_t size_t;69 75 typedef uint32_t be_t; 70 76 typedef uint32_t copy_t; 71 77 72 78 /* States of the TGT_CMD fsm */ 73 enum tgt_cmd_fsm_state_e{ 79 enum tgt_cmd_fsm_state_e 80 { 74 81 TGT_CMD_IDLE, 82 TGT_CMD_ERROR, 75 83 TGT_CMD_READ, 76 84 TGT_CMD_WRITE, 77 TGT_CMD_CAS 85 TGT_CMD_CAS, 86 TGT_CMD_CONFIG 78 87 }; 79 88 80 89 /* States of the TGT_RSP fsm */ 81 enum tgt_rsp_fsm_state_e{ 90 enum tgt_rsp_fsm_state_e 91 { 92 TGT_RSP_CONFIG_IDLE, 93 TGT_RSP_TGT_CMD_IDLE, 82 94 TGT_RSP_READ_IDLE, 83 95 TGT_RSP_WRITE_IDLE, 84 96 TGT_RSP_CAS_IDLE, 85 97 TGT_RSP_XRAM_IDLE, 86 TGT_RSP_ INIT_IDLE,98 TGT_RSP_MULTI_ACK_IDLE, 87 99 TGT_RSP_CLEANUP_IDLE, 100 TGT_RSP_CONFIG, 101 TGT_RSP_TGT_CMD, 88 102 TGT_RSP_READ, 89 103 TGT_RSP_WRITE, 90 104 TGT_RSP_CAS, 91 105 TGT_RSP_XRAM, 92 TGT_RSP_ INIT,106 TGT_RSP_MULTI_ACK, 93 107 TGT_RSP_CLEANUP 94 108 }; 95 109 96 110 /* States of the DSPIN_TGT fsm */ 97 enum cc_receive_fsm_state_e{ 111 enum cc_receive_fsm_state_e 112 { 98 113 CC_RECEIVE_IDLE, 99 114 CC_RECEIVE_CLEANUP, 115 CC_RECEIVE_CLEANUP_EOP, 100 116 CC_RECEIVE_MULTI_ACK 101 117 }; 102 118 103 119 /* States of the CC_SEND fsm */ 104 enum cc_send_fsm_state_e{ 120 enum cc_send_fsm_state_e 121 { 122 CC_SEND_CONFIG_IDLE, 105 123 CC_SEND_XRAM_RSP_IDLE, 106 124 CC_SEND_WRITE_IDLE, 107 125 CC_SEND_CAS_IDLE, 108 126 CC_SEND_CLEANUP_IDLE, 127 CC_SEND_CONFIG_INVAL_HEADER, 128 CC_SEND_CONFIG_INVAL_NLINE, 129 CC_SEND_CONFIG_BRDCAST_HEADER, 130 CC_SEND_CONFIG_BRDCAST_NLINE, 109 131 CC_SEND_CLEANUP_ACK, 110 132 CC_SEND_XRAM_RSP_BRDCAST_HEADER, … … 126 148 127 149 /* States of the MULTI_ACK fsm */ 128 enum multi_ack_fsm_state_e{ 150 enum multi_ack_fsm_state_e 151 { 129 152 MULTI_ACK_IDLE, 130 153 MULTI_ACK_UPT_LOCK, 131 154 MULTI_ACK_UPT_CLEAR, 132 MULTI_ACK_WRITE_RSP 155 MULTI_ACK_WRITE_RSP, 156 MULTI_ACK_CONFIG_ACK 157 }; 158 159 /* States of the CONFIG fsm */ 160 enum config_fsm_state_e 161 { 162 CONFIG_IDLE, 163 CONFIG_LOOP, 164 CONFIG_RSP, 165 CONFIG_DIR_REQ, 166 CONFIG_DIR_ACCESS, 167 CONFIG_DIR_UPT_LOCK, 168 CONFIG_BC_SEND, 169 CONFIG_BC_WAIT, 170 CONFIG_INV_SEND, 171 CONFIG_HEAP_REQ, 172 CONFIG_HEAP_SCAN, 173 CONFIG_HEAP_LAST, 174 CONFIG_INV_WAIT 133 175 }; 134 176 135 177 /* States of the READ fsm */ 136 enum read_fsm_state_e{ 178 enum read_fsm_state_e 179 { 137 180 READ_IDLE, 138 181 READ_DIR_REQ, … … 151 194 152 195 /* States of the WRITE fsm */ 153 enum write_fsm_state_e{ 196 enum write_fsm_state_e 197 { 154 198 WRITE_IDLE, 155 199 WRITE_NEXT, … … 177 221 178 222 /* States of the IXR_RSP fsm */ 179 enum ixr_rsp_fsm_state_e{ 223 enum ixr_rsp_fsm_state_e 224 { 180 225 IXR_RSP_IDLE, 181 226 IXR_RSP_ACK, … … 185 230 186 231 /* States of the XRAM_RSP fsm */ 187 enum xram_rsp_fsm_state_e{ 232 enum xram_rsp_fsm_state_e 233 { 188 234 XRAM_RSP_IDLE, 189 235 XRAM_RSP_TRT_COPY, … … 204 250 205 251 /* States of the IXR_CMD fsm */ 206 enum ixr_cmd_fsm_state_e{ 252 enum ixr_cmd_fsm_state_e 253 { 207 254 IXR_CMD_READ_IDLE, 208 255 IXR_CMD_WRITE_IDLE, 209 256 IXR_CMD_CAS_IDLE, 210 257 IXR_CMD_XRAM_IDLE, 211 IXR_CMD_READ _NLINE,212 IXR_CMD_WRITE _NLINE,213 IXR_CMD_CAS _NLINE,214 IXR_CMD_XRAM _DATA258 IXR_CMD_READ, 259 IXR_CMD_WRITE, 260 IXR_CMD_CAS, 261 IXR_CMD_XRAM 215 262 }; 216 263 217 264 /* States of the CAS fsm */ 218 enum cas_fsm_state_e{ 265 enum cas_fsm_state_e 266 { 219 267 CAS_IDLE, 220 268 CAS_DIR_REQ, … … 241 289 242 290 /* States of the CLEANUP fsm */ 243 enum cleanup_fsm_state_e{ 291 enum cleanup_fsm_state_e 292 { 244 293 CLEANUP_IDLE, 245 294 CLEANUP_GET_NLINE, … … 256 305 CLEANUP_UPT_CLEAR, 257 306 CLEANUP_WRITE_RSP, 258 CLEANUP_SEND_ACK 307 CLEANUP_CONFIG_ACK, 308 CLEANUP_SEND_CLACK 259 309 }; 260 310 261 311 /* States of the ALLOC_DIR fsm */ 262 enum alloc_dir_fsm_state_e{ 312 enum alloc_dir_fsm_state_e 313 { 263 314 ALLOC_DIR_RESET, 315 ALLOC_DIR_CONFIG, 264 316 ALLOC_DIR_READ, 265 317 ALLOC_DIR_WRITE, … … 270 322 271 323 /* States of the ALLOC_TRT fsm */ 272 enum alloc_trt_fsm_state_e{ 324 enum alloc_trt_fsm_state_e 325 { 273 326 ALLOC_TRT_READ, 274 327 ALLOC_TRT_WRITE, … … 279 332 280 333 /* States of the ALLOC_UPT fsm */ 281 enum alloc_upt_fsm_state_e{ 334 enum alloc_upt_fsm_state_e 335 { 336 ALLOC_UPT_CONFIG, 282 337 ALLOC_UPT_WRITE, 283 338 ALLOC_UPT_XRAM_RSP, … … 288 343 289 344 /* States of the ALLOC_HEAP fsm */ 290 enum alloc_heap_fsm_state_e{ 345 enum alloc_heap_fsm_state_e 346 { 291 347 ALLOC_HEAP_RESET, 292 348 ALLOC_HEAP_READ, … … 294 350 ALLOC_HEAP_CAS, 295 351 ALLOC_HEAP_CLEANUP, 296 ALLOC_HEAP_XRAM_RSP 352 ALLOC_HEAP_XRAM_RSP, 353 ALLOC_HEAP_CONFIG 297 354 }; 298 355 … … 325 382 }; 326 383 384 /* Configuration commands */ 385 enum cmd_config_type_e 386 { 387 CMD_CONFIG_INVAL = 0, 388 CMD_CONFIG_SYNC = 1 389 }; 390 327 391 // debug variables (for each FSM) 328 bool m_debug_global; 329 bool m_debug_tgt_cmd_fsm; 330 bool m_debug_tgt_rsp_fsm; 331 bool m_debug_cc_send_fsm; 332 bool m_debug_cc_receive_fsm; 333 bool m_debug_multi_ack_fsm; 334 bool m_debug_read_fsm; 335 bool m_debug_write_fsm; 336 bool m_debug_cas_fsm; 337 bool m_debug_cleanup_fsm; 338 bool m_debug_ixr_cmd_fsm; 339 bool m_debug_ixr_rsp_fsm; 340 bool m_debug_xram_rsp_fsm; 392 bool m_debug; 341 393 bool m_debug_previous_hit; 342 394 size_t m_debug_previous_count; 343 395 344 396 bool m_monitor_ok; 345 vci_addr_tm_monitor_base;346 vci_addr_tm_monitor_length;397 addr_t m_monitor_base; 398 addr_t m_monitor_length; 347 399 348 400 // instrumentation counters 349 401 uint32_t m_cpt_cycles; // Counter of cycles 402 350 403 uint32_t m_cpt_read; // Number of READ transactions 404 uint32_t m_cpt_read_remote; // number of remote READ transactions 405 uint32_t m_cpt_read_flits; // number of flits for READs 406 uint32_t m_cpt_read_cost; // Number of (flits * distance) for READs 407 351 408 uint32_t m_cpt_read_miss; // Number of MISS READ 409 352 410 uint32_t m_cpt_write; // Number of WRITE transactions 411 uint32_t m_cpt_write_remote; // number of remote WRITE transactions 412 uint32_t m_cpt_write_flits; // number of flits for WRITEs 413 uint32_t m_cpt_write_cost; // Number of (flits * distance) for WRITEs 414 353 415 uint32_t m_cpt_write_miss; // Number of MISS WRITE 354 416 uint32_t m_cpt_write_cells; // Cumulated length for WRITE transactions … … 366 428 uint32_t m_cpt_cas; // Number of CAS transactions 367 429 430 uint32_t m_cpt_cleanup_cost; // Number of (flits * distance) for CLEANUPs 431 432 uint32_t m_cpt_update_flits; // Number of flits for UPDATEs 433 uint32_t m_cpt_update_cost; // Number of (flits * distance) for UPDATEs 434 435 uint32_t m_cpt_inval_cost; // Number of (flits * distance) for INVALs 436 437 uint32_t m_cpt_get; 438 439 uint32_t m_cpt_put; 440 368 441 size_t m_prev_count; 369 442 … … 373 446 374 447 public: 375 sc_in<bool> p_clk;376 sc_in<bool> p_resetn;377 soclib::caba::VciTarget<vci_param >p_vci_tgt;378 soclib::caba::VciInitiator<vci_param >p_vci_ixr;379 soclib::caba::DspinInput< 33>p_dspin_in;380 soclib::caba::DspinOutput< 40>p_dspin_out;448 sc_in<bool> p_clk; 449 sc_in<bool> p_resetn; 450 soclib::caba::VciTarget<vci_param_int> p_vci_tgt; 451 soclib::caba::VciInitiator<vci_param_ext> p_vci_ixr; 452 soclib::caba::DspinInput<dspin_in_width> p_dspin_in; 453 soclib::caba::DspinOutput<dspin_out_width> p_dspin_out; 381 454 382 455 VciMemCache( 383 456 sc_module_name name, // Instance Name 384 const soclib::common::MappingTable &mtp, // Mapping table for directnetwork385 const soclib::common::MappingTable &mtx, // Mapping table for externalnetwork386 const soclib::common::IntTab &srcid_x, // global index on externalnetwork387 const soclib::common::IntTab &tgtid_d, // global index on directnetwork388 const size_t cc_global_id, // global index on ccnetwork457 const soclib::common::MappingTable &mtp, // Mapping table INT network 458 const soclib::common::MappingTable &mtx, // Mapping table RAM network 459 const soclib::common::IntTab &srcid_x, // global index RAM network 460 const soclib::common::IntTab &tgtid_d, // global index INT network 461 const size_t cc_global_id, // global index CC network 389 462 const size_t nways, // Number of ways per set 390 463 const size_t nsets, // Number of sets 391 464 const size_t nwords, // Number of words per line 392 const size_t max_copies, // max number of copies in heap393 const size_t heap_size= 1024, // number of heap entries394 const size_t trt_lines=TR ANSACTION_TAB_LINES,395 const size_t upt_lines=UP DATE_TAB_LINES,465 const size_t max_copies, // max number of copies 466 const size_t heap_size=HEAP_ENTRIES, 467 const size_t trt_lines=TRT_ENTRIES, 468 const size_t upt_lines=UPT_ENTRIES, 396 469 const size_t debug_start_cycle=0, 397 470 const bool debug_ok=false ); … … 401 474 void print_stats(); 402 475 void print_trace(); 403 void copies_monitor( vci_addr_t addr);404 void start_monitor( vci_addr_t addr, vci_addr_t length);476 void copies_monitor(addr_t addr); 477 void start_monitor(addr_t addr, addr_t length); 405 478 void stop_monitor(); 406 479 … … 409 482 void transition(); 410 483 void genMoore(); 411 void check_monitor( const char *buf, vci_addr_t addr, data_t data); 412 void check_monitor_read( const char *buf, vci_addr_t addr); 484 void check_monitor( const char *buf, addr_t addr, data_t data, bool read); 413 485 414 486 // Component attributes 415 std::list<soclib::common::Segment> m_seglist; // segments allocated to memcache487 std::list<soclib::common::Segment> m_seglist; // segments allocated 416 488 size_t m_nseg; // number of segments 417 489 soclib::common::Segment **m_seg; // array of segments pointers 418 const size_t m_srcid_x; // global index on external network 490 size_t m_seg_config; // config segment index 491 const size_t m_srcid_x; // global index on RAM network 419 492 const size_t m_initiators; // Number of initiators 420 493 const size_t m_heap_size; // Size of the heap … … 434 507 size_t m_max_copies; // max number of copies in heap 435 508 GenericLLSCGlobalTable 436 < 32 , // number of slots 437 4096, // number of processors in the system 438 8000, // registratioçn life span (in # of LL operations) 439 typename vci_param::fast_addr_t > // address type 440 m_llsc_table; // ll/sc global registration table 509 < 32 , // number of slots 510 4096, // number of processors in the system 511 8000, // registration life (# of LL operations) 512 addr_t > m_llsc_table; // ll/sc registration table 441 513 442 514 // adress masks 443 const soclib::common::AddressMaskingTable< vci_addr_t> m_x;444 const soclib::common::AddressMaskingTable< vci_addr_t> m_y;445 const soclib::common::AddressMaskingTable< vci_addr_t> m_z;446 const soclib::common::AddressMaskingTable< vci_addr_t> m_nline;515 const soclib::common::AddressMaskingTable<addr_t> m_x; 516 const soclib::common::AddressMaskingTable<addr_t> m_y; 517 const soclib::common::AddressMaskingTable<addr_t> m_z; 518 const soclib::common::AddressMaskingTable<addr_t> m_nline; 447 519 448 520 // broadcast address 449 uint32_t m_broadcast_address;521 uint32_t m_broadcast_boundaries; 450 522 451 523 ////////////////////////////////////////////////// … … 453 525 ////////////////////////////////////////////////// 454 526 527 sc_signal<int> r_tgt_cmd_fsm; 528 455 529 // Fifo between TGT_CMD fsm and READ fsm 456 GenericFifo< uint64_t>m_cmd_read_addr_fifo;530 GenericFifo<addr_t> m_cmd_read_addr_fifo; 457 531 GenericFifo<size_t> m_cmd_read_length_fifo; 458 532 GenericFifo<size_t> m_cmd_read_srcid_fifo; … … 461 535 462 536 // Fifo between TGT_CMD fsm and WRITE fsm 463 GenericFifo< uint64_t>m_cmd_write_addr_fifo;537 GenericFifo<addr_t> m_cmd_write_addr_fifo; 464 538 GenericFifo<bool> m_cmd_write_eop_fifo; 465 539 GenericFifo<size_t> m_cmd_write_srcid_fifo; … … 470 544 471 545 // Fifo between TGT_CMD fsm and CAS fsm 472 GenericFifo< uint64_t>m_cmd_cas_addr_fifo;546 GenericFifo<addr_t> m_cmd_cas_addr_fifo; 473 547 GenericFifo<bool> m_cmd_cas_eop_fifo; 474 548 GenericFifo<size_t> m_cmd_cas_srcid_fifo; … … 477 551 GenericFifo<data_t> m_cmd_cas_wdata_fifo; 478 552 479 // Fifo between INIT_RSPfsm and CLEANUP fsm553 // Fifo between CC_RECEIVE fsm and CLEANUP fsm 480 554 GenericFifo<uint64_t> m_cc_receive_to_cleanup_fifo; 481 555 482 // Fifo between INIT_RSPfsm and MULTI_ACK fsm556 // Fifo between CC_RECEIVE fsm and MULTI_ACK fsm 483 557 GenericFifo<uint64_t> m_cc_receive_to_multi_ack_fifo; 484 558 485 sc_signal<int> r_tgt_cmd_fsm; 559 // Buffer between TGT_CMD fsm and TGT_RSP fsm 560 // (segmentation violation response request) 561 sc_signal<bool> r_tgt_cmd_to_tgt_rsp_req; 562 563 sc_signal<uint32_t> r_tgt_cmd_to_tgt_rsp_rdata; 564 sc_signal<size_t> r_tgt_cmd_to_tgt_rsp_error; 565 sc_signal<size_t> r_tgt_cmd_to_tgt_rsp_srcid; 566 sc_signal<size_t> r_tgt_cmd_to_tgt_rsp_trdid; 567 sc_signal<size_t> r_tgt_cmd_to_tgt_rsp_pktid; 568 569 sc_signal<addr_t> r_tgt_cmd_config_addr; 570 sc_signal<size_t> r_tgt_cmd_config_cmd; 571 572 /////////////////////////////////////////////////////// 573 // Registers controlled by the CONFIG fsm 574 /////////////////////////////////////////////////////// 575 576 sc_signal<int> r_config_fsm; // FSM state 577 sc_signal<bool> r_config_lock; // lock protecting exclusive access 578 sc_signal<int> r_config_cmd; // config request status 579 sc_signal<addr_t> r_config_address; // target buffer physical address 580 sc_signal<size_t> r_config_srcid; // config request srcid 581 sc_signal<size_t> r_config_trdid; // config request trdid 582 sc_signal<size_t> r_config_pktid; // config request pktid 583 sc_signal<size_t> r_config_nlines; // number of lines covering the buffer 584 sc_signal<size_t> r_config_dir_way; // DIR: selected way 585 sc_signal<size_t> r_config_dir_count; // DIR: number of copies 586 sc_signal<bool> r_config_dir_is_cnt; // DIR: counter mode (broadcast required) 587 sc_signal<size_t> r_config_dir_copy_srcid; // DIR: first copy SRCID 588 sc_signal<bool> r_config_dir_copy_inst; // DIR: first copy L1 type 589 sc_signal<size_t> r_config_dir_next_ptr; // DIR: index of next copy in HEAP 590 sc_signal<size_t> r_config_heap_next; // current pointer to scan HEAP 591 592 sc_signal<size_t> r_config_upt_index; // UPT index 593 594 // Buffer between CONFIG fsm and TGT_RSP fsm (send a done response to L1 cache) 595 sc_signal<bool> r_config_to_tgt_rsp_req; // valid request 596 sc_signal<bool> r_config_to_tgt_rsp_error; // error response 597 sc_signal<size_t> r_config_to_tgt_rsp_srcid; // Transaction srcid 598 sc_signal<size_t> r_config_to_tgt_rsp_trdid; // Transaction trdid 599 sc_signal<size_t> r_config_to_tgt_rsp_pktid; // Transaction pktid 600 601 // Buffer between CONFIG fsm and CC_SEND fsm (multi-inval / broadcast-inval) 602 sc_signal<bool> r_config_to_cc_send_multi_req; // multi-inval request 603 sc_signal<bool> r_config_to_cc_send_brdcast_req; // broadcast-inval request 604 sc_signal<addr_t> r_config_to_cc_send_nline; // line index 605 sc_signal<size_t> r_config_to_cc_send_trdid; // UPT index 606 GenericFifo<bool> m_config_to_cc_send_inst_fifo; // fifo for the L1 type 607 GenericFifo<size_t> m_config_to_cc_send_srcid_fifo; // fifo for owners srcid 608 609 #if L1_MULTI_CACHE 610 GenericFifo<size_t> m_config_to_cc_send_cache_id_fifo; // fifo for cache_id 611 #endif 486 612 487 613 /////////////////////////////////////////////////////// … … 489 615 /////////////////////////////////////////////////////// 490 616 491 sc_signal<int> r_read_fsm; // FSM state 492 sc_signal<size_t> r_read_copy; // Srcid of the first copy 493 sc_signal<size_t> r_read_copy_cache; // Srcid of the first copy 494 sc_signal<bool> r_read_copy_inst; // Type of the first copy 495 sc_signal<tag_t> r_read_tag; // cache line tag (in directory) 496 sc_signal<bool> r_read_is_cnt; // is_cnt bit (in directory) 497 sc_signal<bool> r_read_lock; // lock bit (in directory) 498 sc_signal<bool> r_read_dirty; // dirty bit (in directory) 499 sc_signal<size_t> r_read_count; // number of copies 500 sc_signal<size_t> r_read_ptr; // pointer to the heap 501 sc_signal<data_t> * r_read_data; // data (one cache line) 502 sc_signal<size_t> r_read_way; // associative way (in cache) 503 sc_signal<size_t> r_read_trt_index; // Transaction Table index 504 sc_signal<size_t> r_read_next_ptr; // Next entry to point to 505 sc_signal<bool> r_read_last_free; // Last free entry 506 sc_signal<typename vci_param::fast_addr_t> 507 r_read_ll_key; // LL key returned by the llsc_global_table 617 sc_signal<int> r_read_fsm; // FSM state 618 sc_signal<size_t> r_read_copy; // Srcid of the first copy 619 sc_signal<size_t> r_read_copy_cache; // Srcid of the first copy 620 sc_signal<bool> r_read_copy_inst; // Type of the first copy 621 sc_signal<tag_t> r_read_tag; // cache line tag (in directory) 622 sc_signal<bool> r_read_is_cnt; // is_cnt bit (in directory) 623 sc_signal<bool> r_read_lock; // lock bit (in directory) 624 sc_signal<bool> r_read_dirty; // dirty bit (in directory) 625 sc_signal<size_t> r_read_count; // number of copies 626 sc_signal<size_t> r_read_ptr; // pointer to the heap 627 sc_signal<data_t> * r_read_data; // data (one cache line) 628 sc_signal<size_t> r_read_way; // associative way (in cache) 629 sc_signal<size_t> r_read_trt_index; // Transaction Table index 630 sc_signal<size_t> r_read_next_ptr; // Next entry to point to 631 sc_signal<bool> r_read_last_free; // Last free entry 632 sc_signal<addr_t> r_read_ll_key; // LL key from the llsc_global_table 508 633 509 634 // Buffer between READ fsm and IXR_CMD fsm (ask a missing cache line to XRAM) … … 520 645 sc_signal<size_t> r_read_to_tgt_rsp_word; // first word of the response 521 646 sc_signal<size_t> r_read_to_tgt_rsp_length; // length of the response 522 sc_signal<typename vci_param::fast_addr_t> 523 r_read_to_tgt_rsp_ll_key; // LL key returned by the llsc_global_table 647 sc_signal<addr_t> r_read_to_tgt_rsp_ll_key; // LL key from the llsc_global_table 524 648 525 649 /////////////////////////////////////////////////////////////// … … 578 702 GenericFifo<bool> m_write_to_cc_send_inst_fifo; // fifo for the L1 type 579 703 GenericFifo<size_t> m_write_to_cc_send_srcid_fifo; // fifo for srcids 704 580 705 #if L1_MULTI_CACHE 581 706 GenericFifo<size_t> m_write_to_cc_send_cache_id_fifo; // fifo for srcids … … 596 721 sc_signal<size_t> r_multi_ack_pktid; // pending write pktid 597 722 sc_signal<addr_t> r_multi_ack_nline; // pending write nline 723 724 // signaling completion of multi-inval to CONFIG fsm 725 sc_signal<bool> r_multi_ack_to_config_ack; 598 726 599 727 // Buffer between MULTI_ACK fsm and TGT_RSP fsm (complete write/update transaction) … … 633 761 sc_signal<size_t> r_cleanup_way; // associative way (in cache) 634 762 635 sc_signal<size_t> r_cleanup_write_srcid; // srcid of write r esponse763 sc_signal<size_t> r_cleanup_write_srcid; // srcid of write rsp 636 764 sc_signal<size_t> r_cleanup_write_trdid; // trdid of write rsp 637 765 sc_signal<size_t> r_cleanup_write_pktid; // pktid of write rsp 638 sc_signal<bool> r_cleanup_write_need_rsp;// needs a write rsp 766 767 sc_signal<bool> r_cleanup_need_rsp; // write response required 768 sc_signal<bool> r_cleanup_need_ack; // config acknowledge required 639 769 640 770 sc_signal<size_t> r_cleanup_index; // index of the INVAL line (in the UPT) 641 771 772 // signaling completion of broadcast-inval to CONFIG fsm 773 sc_signal<bool> r_cleanup_to_config_ack; 774 642 775 // Buffer between CLEANUP fsm and TGT_RSP fsm (acknowledge a write command from L1) 643 776 sc_signal<bool> r_cleanup_to_tgt_rsp_req; // valid request … … 703 836 GenericFifo<bool> m_cas_to_cc_send_inst_fifo; // fifo for the L1 type 704 837 GenericFifo<size_t> m_cas_to_cc_send_srcid_fifo; // fifo for srcids 838 705 839 #if L1_MULTI_CACHE 706 840 GenericFifo<size_t> m_cas_to_cc_send_cache_id_fifo; // fifo for srcids … … 749 883 sc_signal<size_t> r_xram_rsp_to_tgt_rsp_length; // length of the response 750 884 sc_signal<bool> r_xram_rsp_to_tgt_rsp_rerror; // send error to requester 751 sc_signal<typename vci_param::fast_addr_t> 752 r_xram_rsp_to_tgt_rsp_ll_key; // LL key returned by the llsc_global_table 885 sc_signal<addr_t> r_xram_rsp_to_tgt_rsp_ll_key; // LL key from llsc_global_table 753 886 754 887 // Buffer between XRAM_RSP fsm and CC_SEND fsm (Inval L1 Caches) … … 759 892 GenericFifo<bool> m_xram_rsp_to_cc_send_inst_fifo; // fifo for the L1 type 760 893 GenericFifo<size_t> m_xram_rsp_to_cc_send_srcid_fifo; // fifo for srcids 894 761 895 #if L1_MULTI_CACHE 762 896 GenericFifo<size_t> m_xram_rsp_to_cc_send_cache_id_fifo; // fifo for srcids -
branches/v5/modules/vci_mem_cache/caba/source/include/xram_transaction.h
r362 r440 13 13 //////////////////////////////////////////////////////////////////////// 14 14 15 class TransactionTabEntry { 16 typedef uint32_t size_t; 15 class TransactionTabEntry 16 { 17 typedef sc_dt::sc_uint<64> wide_data_t; 18 typedef sc_dt::sc_uint<40> addr_t; 17 19 typedef uint32_t data_t; 18 typedef sc_dt::sc_uint<40> addr_t;19 20 typedef uint32_t be_t; 20 21 … … 84 85 // The print() function prints the entry 85 86 //////////////////////////////////////////////////////////////////// 86 void print(){ 87 void print() 88 { 87 89 std::cout << "valid = " << valid << std::endl; 88 90 std::cout << "xram_read = " << xram_read << std::endl; … … 137 139 // The transaction tab 138 140 //////////////////////////////////////////////////////////////////////// 139 class TransactionTab{ 140 typedef uint32_t size_t; 141 typedef uint32_t data_t; 142 typedef sc_dt::sc_uint<40> addr_t; 143 typedef uint32_t be_t; 141 class TransactionTab 142 { 143 typedef sc_dt::sc_uint<64> wide_data_t; 144 typedef sc_dt::sc_uint<40> addr_t; 145 typedef uint32_t data_t; 146 typedef uint32_t be_t; 144 147 145 148 private: 146 size_t size_tab; // The size of the tab 149 const std::string tab_name; // the name for logs 150 size_t size_tab; // the size of the tab 147 151 148 152 data_t be_to_mask(be_t be) … … 176 180 } 177 181 178 TransactionTab(size_t n_entries, size_t n_words) 179 { 180 size_tab = n_entries; 182 TransactionTab(const std::string &name, 183 size_t n_entries, 184 size_t n_words ) 185 : tab_name( name ), 186 size_tab( n_entries ) 187 { 181 188 tab = new TransactionTabEntry[size_tab]; 182 for ( size_t i=0; i<size_tab; i++) { 189 for ( size_t i=0; i<size_tab; i++) 190 { 183 191 tab[i].alloc(n_words); 184 192 } … … 368 376 369 377 ///////////////////////////////////////////////////////////////////// 370 // The write_rsp() function writes a word of the response to an371 // XRAM read transaction.378 // The write_rsp() function writes two 32 bits words of the response 379 // to a XRAM read transaction. 372 380 // The BE field in TRT is taken into account. 373 381 // Arguments : 374 382 // - index : the index of the transaction in the transaction tab 375 383 // - word_index : the index of the data in the line 376 // - data : the data to write384 // - data : a 64 bits value 377 385 // - error : invalid data 378 386 ///////////////////////////////////////////////////////////////////// 379 void write_rsp(const size_t index, 380 const size_t word, 381 const data_t data, 382 const bool rerror) 383 { 384 assert( (index < size_tab) 385 && "Selected entry out of range in write_rsp() Transaction Tab"); 386 assert( (word <= tab[index].wdata_be.size()) 387 && "Bad word_index in write_rsp() in TransactionTab"); 388 assert( tab[index].valid 389 && "Transaction Tab Entry invalid in write_rsp()"); 390 assert( tab[index].xram_read 391 && "Selected entry is not an XRAM read transaction in write_rsp()"); 392 393 data_t mask = be_to_mask(tab[index].wdata_be[word]); 394 tab[index].wdata[word] = (tab[index].wdata[word] & mask) | (data & ~mask); 387 void write_rsp(const size_t index, 388 const size_t word, 389 const wide_data_t data, 390 const bool rerror) 391 { 392 data_t value; 393 data_t mask; 394 395 if ( index >= size_tab ) 396 { 397 std::cout << "VCI_MEM_CACHE ERRROR " << tab_name 398 << " TRT entry out of range in write_rsp()" << std::endl; 399 exit(0); 400 } 401 if ( word > tab[index].wdata_be.size() ) 402 { 403 std::cout << "VCI_MEM_CACHE ERRROR " << tab_name 404 << " Bad word_index in write_rsp() in TRT" << std::endl; 405 exit(0); 406 } 407 if ( not tab[index].valid ) 408 { 409 std::cout << "VCI_MEM_CACHE ERRROR " << tab_name 410 << " TRT Entry invalid in write_rsp()" << std::endl; 411 exit(0); 412 } 413 if ( not tab[index].xram_read ) 414 { 415 std::cout << "VCI_MEM_CACHE ERRROR " << tab_name 416 << " TRT entry is not an XRAM GET in write_rsp()" << std::endl; 417 exit(0); 418 } 419 420 // first 32 bits word 421 value = (data_t)data; 422 mask = be_to_mask(tab[index].wdata_be[word]); 423 tab[index].wdata[word] = (tab[index].wdata[word] & mask) | (value & ~mask); 424 425 // second 32 bits word 426 value = (data_t)(data>>32); 427 mask = be_to_mask(tab[index].wdata_be[word+1]); 428 tab[index].wdata[word+1] = (tab[index].wdata[word+1] & mask) | (value & ~mask); 429 430 // error update 395 431 tab[index].rerror |= rerror; 396 432 }
Note: See TracChangeset
for help on using the changeset viewer.