- Timestamp:
- Jul 17, 2013, 9:24:48 AM (11 years ago)
- Location:
- branches/v5/modules/vci_mem_cache
- Files:
-
- 2 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/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.