- Timestamp:
- Sep 24, 2014, 3:48:50 PM (10 years ago)
- Location:
- branches/RWT/modules/vci_mem_cache
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RWT/modules/vci_mem_cache
- Property svn:mergeinfo changed
/trunk/modules/vci_mem_cache (added) merged: 597,599,601,603,605,617
- Property svn:mergeinfo changed
-
branches/RWT/modules/vci_mem_cache/caba/source/include
- Property svn:mergeinfo changed
/trunk/modules/vci_mem_cache/caba/source/include (added) merged: 597,599,601,605
- Property svn:mergeinfo changed
-
branches/RWT/modules/vci_mem_cache/caba/source/include/xram_transaction.h
r767 r814 10 10 11 11 //////////////////////////////////////////////////////////////////////// 12 // A transaction tab entry 12 // A transaction tab entry 13 13 //////////////////////////////////////////////////////////////////////// 14 14 15 class TransactionTabEntry 15 class TransactionTabEntry 16 16 { 17 17 typedef sc_dt::sc_uint<64> wide_data_t; … … 21 21 22 22 public: 23 bool valid; // entry valid24 bool xram_read;// read request to XRAM25 addr_t nline;// index (zy) of the requested line26 size_t srcid;// processor requesting the transaction27 size_t trdid;// processor requesting the transaction28 size_t pktid;// processor requesting the transaction29 bool proc_read;// read request from processor30 size_t read_length;// length of the read (for the response)31 size_t word_index;// index of the first read word (for the response)32 std::vector<data_t> wdata; 33 std::vector<be_t> wdata_be; 34 bool rerror; 35 data_t ll_key; 36 bool config; 37 38 ///////////////////////////////////////////////////////////////////// 39 // The init() function initializes the entry 23 bool valid; // entry valid 24 bool xram_read; // read request to XRAM 25 addr_t nline; // index (zy) of the requested line 26 size_t srcid; // processor requesting the transaction 27 size_t trdid; // processor requesting the transaction 28 size_t pktid; // processor requesting the transaction 29 bool proc_read; // read request from processor 30 size_t read_length; // length of the read (for the response) 31 size_t word_index; // index of the first read word (for the response) 32 std::vector<data_t> wdata; // write buffer (one cache line) 33 std::vector<be_t> wdata_be; // be for each data in the write buffer 34 bool rerror; // error returned by xram 35 data_t ll_key; // LL key returned by the llsc_global_table 36 bool config; // transaction required by CONFIG FSM 37 38 ///////////////////////////////////////////////////////////////////// 39 // The init() function initializes the entry 40 40 ///////////////////////////////////////////////////////////////////// 41 41 void init() 42 42 { 43 valid 44 rerror 45 config 43 valid = false; 44 rerror = false; 45 config = false; 46 46 } 47 47 … … 69 69 void copy(const TransactionTabEntry &source) 70 70 { 71 valid 72 xram_read 73 nline 74 srcid 75 trdid 76 pktid 77 proc_read 71 valid = source.valid; 72 xram_read = source.xram_read; 73 nline = source.nline; 74 srcid = source.srcid; 75 trdid = source.trdid; 76 pktid = source.pktid; 77 proc_read = source.proc_read; 78 78 read_length = source.read_length; 79 word_index 79 word_index = source.word_index; 80 80 wdata_be.assign(source.wdata_be.begin(),source.wdata_be.end()); 81 81 wdata.assign(source.wdata.begin(),source.wdata.end()); … … 86 86 87 87 //////////////////////////////////////////////////////////////////// 88 // The print() function prints the entry 88 // The print() function prints the entry 89 89 //////////////////////////////////////////////////////////////////// 90 90 void print() … … 99 99 std::cout << "proc_read = " << proc_read << std::endl; 100 100 std::cout << "read_length = " << read_length << std::endl; 101 std::cout << "word_index = " << word_index << std::endl; 101 std::cout << "word_index = " << word_index << std::endl; 102 102 for(size_t i=0; i<wdata_be.size() ; i++) 103 103 { 104 std::cout << "wdata_be[" << std::dec << i << "] = " 104 std::cout << "wdata_be[" << std::dec << i << "] = " 105 105 << std::hex << wdata_be[i] << std::endl; 106 106 } 107 107 for(size_t i=0; i<wdata.size() ; i++) 108 108 { 109 std::cout << "wdata[" << std::dec << i << "] = " 109 std::cout << "wdata[" << std::dec << i << "] = " 110 110 << std::hex << wdata[i] << std::endl; 111 111 } … … 117 117 118 118 ///////////////////////////////////////////////////////////////////// 119 // 119 // Constructors 120 120 ///////////////////////////////////////////////////////////////////// 121 121 … … 131 131 TransactionTabEntry(const TransactionTabEntry &source) 132 132 { 133 valid 134 xram_read 135 nline 136 srcid 137 trdid 138 pktid 139 proc_read 133 valid = source.valid; 134 xram_read = source.xram_read; 135 nline = source.nline; 136 srcid = source.srcid; 137 trdid = source.trdid; 138 pktid = source.pktid; 139 proc_read = source.proc_read; 140 140 read_length = source.read_length; 141 word_index 141 word_index = source.word_index; 142 142 wdata_be.assign(source.wdata_be.begin(),source.wdata_be.end()); 143 wdata.assign(source.wdata.begin(),source.wdata.end()); 143 wdata.assign(source.wdata.begin(),source.wdata.end()); 144 144 rerror = source.rerror; 145 145 ll_key = source.ll_key; … … 150 150 151 151 //////////////////////////////////////////////////////////////////////// 152 // The transaction tab 152 // The transaction tab 153 153 //////////////////////////////////////////////////////////////////////// 154 154 class TransactionTab … … 185 185 186 186 //////////////////////////////////////////////////////////////////// 187 // 187 // Constructors 188 188 //////////////////////////////////////////////////////////////////// 189 189 TransactionTab() … … 194 194 195 195 TransactionTab(const std::string &name, 196 size_t n_entries, 196 size_t n_entries, 197 197 size_t n_words ) 198 198 : tab_name( name ), 199 size_tab( n_entries ) 199 size_tab( n_entries ) 200 200 { 201 201 tab = new TransactionTabEntry[size_tab]; 202 for ( size_t i=0; i<size_tab; i++) 202 for ( size_t i=0; i<size_tab; i++) 203 203 { 204 204 tab[i].alloc(n_words); … … 222 222 void init() 223 223 { 224 for ( size_t i=0; i<size_tab; i++) 224 for ( size_t i=0; i<size_tab; i++) 225 225 { 226 226 tab[i].init(); … … 247 247 TransactionTabEntry read(const size_t index) 248 248 { 249 assert( (index < size_tab) and 249 assert( (index < size_tab) and 250 250 "MEMC ERROR: Invalid Transaction Tab Entry"); 251 251 … … 255 255 // The full() function returns the state of the transaction tab 256 256 // Arguments : 257 // - index : (return argument) the index of an empty entry 257 // - index : (return argument) the index of an empty entry 258 258 // The function returns true if the transaction tab is full 259 259 ///////////////////////////////////////////////////////////////////// … … 265 265 { 266 266 index=i; 267 return false; 267 return false; 268 268 } 269 269 } … … 271 271 } 272 272 ///////////////////////////////////////////////////////////////////// 273 // The hit_read() function checks if an XRAM read transaction exists 273 // The hit_read() function checks if an XRAM read transaction exists 274 274 // for a given cache line. 275 275 // Arguments : 276 // - index : (return argument) the index of the hit entry, if there is 276 // - index : (return argument) the index of the hit entry, if there is 277 277 // - nline : the index (zy) of the requested line 278 278 // The function returns true if a read request has already been sent … … 282 282 for(size_t i=0; i<size_tab; i++) 283 283 { 284 if((tab[i].valid && (nline==tab[i].nline)) && (tab[i].xram_read)) 284 if((tab[i].valid && (nline==tab[i].nline)) && (tab[i].xram_read)) 285 285 { 286 286 index=i; 287 return true; 287 return true; 288 288 } 289 289 } … … 291 291 } 292 292 /////////////////////////////////////////////////////////////////////// 293 // The hit_write() function looks if an XRAM write transaction exists 293 // The hit_write() function looks if an XRAM write transaction exists 294 294 // for a given line. 295 295 // Arguments : … … 301 301 for(size_t i=0; i<size_tab; i++) 302 302 { 303 if(tab[i].valid && (nline==tab[i].nline) && !(tab[i].xram_read)) 303 if(tab[i].valid && (nline==tab[i].nline) && !(tab[i].xram_read)) 304 304 { 305 return true; 305 return true; 306 306 } 307 307 } … … 310 310 311 311 /////////////////////////////////////////////////////////////////////// 312 // The hit_write() function looks if an XRAM write transaction exists 312 // The hit_write() function looks if an XRAM write transaction exists 313 313 // for a given line. 314 314 // Arguments : … … 322 322 if(tab[i].valid && (nline==tab[i].nline) && !(tab[i].xram_read)) { 323 323 *index = i; 324 return true; 324 return true; 325 325 } 326 326 } … … 330 330 // The write_data_mask() function writes a vector of data (a line). 331 331 // The data is written only if the corresponding bits are set 332 // in the be vector. 332 // in the be vector. 333 333 // Arguments : 334 334 // - index : the index of the request in the transaction tab 335 // - be : vector of be 335 // - be : vector of be 336 336 // - data : vector of data 337 337 ///////////////////////////////////////////////////////////////////// 338 void write_data_mask(const size_t index, 339 const std::vector<be_t> &be, 340 const std::vector<data_t> &data) 338 void write_data_mask(const size_t index, 339 const std::vector<be_t> &be, 340 const std::vector<data_t> &data) 341 341 { 342 342 assert( (index < size_tab) and … … 349 349 "MEMC ERROR: Bad data size in TRT write_data_mask()"); 350 350 351 for(size_t i=0; i<tab[index].wdata_be.size() ; i++) 351 for(size_t i=0; i<tab[index].wdata_be.size() ; i++) 352 352 { 353 353 tab[index].wdata_be[i] = tab[index].wdata_be[i] | be[i]; … … 384 384 const size_t word_index, 385 385 const std::vector<be_t> &data_be, 386 const std::vector<data_t> &data, 386 const std::vector<data_t> &data, 387 387 const data_t ll_key = 0, 388 const bool config = false) 388 const bool config = false) 389 389 { 390 390 assert( (index < size_tab) and 391 391 "MEMC ERROR: The selected entry is out of range in TRT set()"); 392 392 393 assert( (data_be.size()==tab[index].wdata_be.size()) and 393 assert( (data_be.size()==tab[index].wdata_be.size()) and 394 394 "MEMC ERROR: Bad data_be argument in TRT set()"); 395 395 396 assert( (data.size()==tab[index].wdata.size()) and 396 assert( (data.size()==tab[index].wdata.size()) and 397 397 "MEMC ERROR: Bad data argument in TRT set()"); 398 398 399 tab[index].valid 400 tab[index].xram_read 401 tab[index].nline 402 tab[index].srcid 403 tab[index].trdid 404 tab[index].pktid 405 tab[index].proc_read 406 tab[index].read_length 407 tab[index].word_index 408 tab[index].ll_key 409 tab[index].config 410 for(size_t i=0; i<tab[index].wdata.size(); i++) 399 tab[index].valid = true; 400 tab[index].xram_read = xram_read; 401 tab[index].nline = nline; 402 tab[index].srcid = srcid; 403 tab[index].trdid = trdid; 404 tab[index].pktid = pktid; 405 tab[index].proc_read = proc_read; 406 tab[index].read_length = read_length; 407 tab[index].word_index = word_index; 408 tab[index].ll_key = ll_key; 409 tab[index].config = config; 410 for(size_t i=0; i<tab[index].wdata.size(); i++) 411 411 { 412 412 tab[index].wdata_be[i] = data_be[i]; … … 416 416 417 417 ///////////////////////////////////////////////////////////////////// 418 // The write_rsp() function writes two 32 bits words of the response 418 // The write_rsp() function writes two 32 bits words of the response 419 419 // to a XRAM read transaction. 420 420 // The BE field in TRT is taken into account. … … 435 435 "MEMC ERROR: The selected entry is out of range in TRT write_rsp()"); 436 436 437 assert( (word < tab[index].wdata_be.size()) and 437 assert( (word < tab[index].wdata_be.size()) and 438 438 "MEMC ERROR: Bad word index in TRT write_rsp()"); 439 439 … … 467 467 void erase(const size_t index) 468 468 { 469 assert( (index < size_tab) and 469 assert( (index < size_tab) and 470 470 "MEMC ERROR: The selected entry is out of range in TRT erase()"); 471 471 472 tab[index].valid 473 tab[index].rerror 472 tab[index].valid = false; 473 tab[index].rerror = false; 474 474 } 475 475 /////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.