- 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/update_tab.h
r767 r814 8 8 9 9 //////////////////////////////////////////////////////////////////////// 10 // An update tab entry 10 // An update tab entry 11 11 //////////////////////////////////////////////////////////////////////// 12 12 class UpdateTabEntry { … … 17 17 public: 18 18 19 bool valid;// It is a valid pending transaction20 bool update;// It is an update transaction21 bool brdcast;// It is a broadcast invalidate22 bool rsp;// Response to the initiator required23 bool ack;// Acknowledge to the CONFIG FSM required24 size_t srcid;// The srcid of the initiator which wrote the data25 size_t trdid;// The trdid of the initiator which wrote the data26 size_t pktid;// The pktid of the initiator which wrote the data27 addr_t nline;// The identifier of the cache line28 size_t count;// The number of acknowledge responses to receive19 bool valid; // It is a valid pending transaction 20 bool update; // It is an update transaction 21 bool brdcast; // It is a broadcast invalidate 22 bool rsp; // Response to the initiator required 23 bool ack; // Acknowledge to the CONFIG FSM required 24 size_t srcid; // The srcid of the initiator which wrote the data 25 size_t trdid; // The trdid of the initiator which wrote the data 26 size_t pktid; // The pktid of the initiator which wrote the data 27 addr_t nline; // The identifier of the cache line 28 size_t count; // The number of acknowledge responses to receive 29 29 30 30 UpdateTabEntry() 31 31 { 32 valid 32 valid = false; 33 33 update = false; 34 34 brdcast = false; 35 35 rsp = false; 36 36 ack = false; 37 srcid 38 trdid 39 pktid 40 nline 41 count 42 } 43 44 UpdateTabEntry(bool i_valid, 37 srcid = 0; 38 trdid = 0; 39 pktid = 0; 40 nline = 0; 41 count = 0; 42 } 43 44 UpdateTabEntry(bool i_valid, 45 45 bool i_update, 46 46 bool i_brdcast, 47 47 bool i_rsp, 48 48 bool i_ack, 49 size_t i_srcid, 50 size_t i_trdid, 51 size_t i_pktid, 49 size_t i_srcid, 50 size_t i_trdid, 51 size_t i_pktid, 52 52 addr_t i_nline, 53 size_t i_count) 54 { 55 valid 56 update 53 size_t i_count) 54 { 55 valid = i_valid; 56 update = i_update; 57 57 brdcast = i_brdcast; 58 58 rsp = i_rsp; 59 59 ack = i_ack; 60 srcid 61 trdid 62 pktid 63 nline 64 count 60 srcid = i_srcid; 61 trdid = i_trdid; 62 pktid = i_pktid; 63 nline = i_nline; 64 count = i_count; 65 65 } 66 66 … … 80 80 81 81 //////////////////////////////////////////////////// 82 // The init() function initializes the entry 82 // The init() function initializes the entry 83 83 /////////////////////////////////////////////////// 84 84 void init() 85 85 { 86 valid = false;87 update = false;88 brdcast = false;89 rsp = false;90 ack = false;91 srcid = 0;92 trdid = 0;93 pktid = 0;94 nline = 0;95 count = 0;86 valid = false; 87 update = false; 88 brdcast = false; 89 rsp = false; 90 ack = false; 91 srcid = 0; 92 trdid = 0; 93 pktid = 0; 94 nline = 0; 95 count = 0; 96 96 } 97 97 … … 116 116 117 117 //////////////////////////////////////////////////////////////////// 118 // The print() function prints the entry 118 // The print() function prints the entry 119 119 //////////////////////////////////////////////////////////////////// 120 120 void print() 121 121 { 122 std::cout << " val = " << std::dec << valid 123 << " / updt = " << update 122 std::cout << " val = " << std::dec << valid 123 << " / updt = " << update 124 124 << " / bc = " << brdcast 125 << " / rsp = " << rsp 126 << " / ack = " << ack 125 << " / rsp = " << rsp 126 << " / ack = " << ack 127 127 << " / count = " << count 128 << " / srcid = " << std::hex << srcid 129 << " / trdid = " << trdid 128 << " / srcid = " << std::hex << srcid 129 << " / trdid = " << trdid 130 130 << " / pktid = " << pktid 131 131 << " / nline = " << nline << std::endl; … … 134 134 135 135 //////////////////////////////////////////////////////////////////////// 136 // The update tab 136 // The update tab 137 137 //////////////////////////////////////////////////////////////////////// 138 138 class UpdateTab{ … … 159 159 160 160 //////////////////////////////////////////////////////////////////// 161 // The size() function returns the size of the tab 161 // The size() function returns the size of the tab 162 162 //////////////////////////////////////////////////////////////////// 163 163 const size_t size() … … 167 167 168 168 //////////////////////////////////////////////////////////////////// 169 // The print() function diplays the tab content 169 // The print() function diplays the tab content 170 170 //////////////////////////////////////////////////////////////////// 171 171 void print() 172 172 { 173 173 std::cout << "UPDATE TABLE Content" << std::endl; 174 for(size_t i=0; i<size_tab; i++) 174 for(size_t i=0; i<size_tab; i++) 175 175 { 176 176 std::cout << "[" << std::dec << i << "] "; … … 181 181 182 182 ///////////////////////////////////////////////////////////////////// 183 // The init() function initializes the tab 183 // The init() function initializes the tab 184 184 ///////////////////////////////////////////////////////////////////// 185 185 void init() … … 189 189 190 190 ///////////////////////////////////////////////////////////////////// 191 // The reads() function reads an entry 191 // The reads() function reads an entry 192 192 // Arguments : 193 193 // - entry : the entry to read … … 211 211 // This function returns true if the write successed (an entry was empty). 212 212 /////////////////////////////////////////////////////////////////////////// 213 bool set(const bool 213 bool set(const bool update, 214 214 const bool brdcast, 215 215 const bool rsp, … … 222 222 size_t &index) 223 223 { 224 for ( size_t i=0 ; i<size_tab ; i++ ) 225 { 226 if( !tab[i].valid ) 224 for ( size_t i=0 ; i<size_tab ; i++ ) 225 { 226 if( !tab[i].valid ) 227 227 { 228 tab[i].valid 229 tab[i].update 230 tab[i].brdcast 231 tab[i].rsp 232 tab[i].ack 233 tab[i].srcid 234 tab[i].trdid 235 tab[i].pktid 236 tab[i].nline 237 tab[i].count 238 index 228 tab[i].valid = true; 229 tab[i].update = update; 230 tab[i].brdcast = brdcast; 231 tab[i].rsp = rsp; 232 tab[i].ack = ack; 233 tab[i].srcid = (size_t) srcid; 234 tab[i].trdid = (size_t) trdid; 235 tab[i].pktid = (size_t) pktid; 236 tab[i].nline = (addr_t) nline; 237 tab[i].count = (size_t) count; 238 index = i; 239 239 return true; 240 240 } … … 251 251 ///////////////////////////////////////////////////////////////////// 252 252 bool decrement( const size_t index, 253 size_t &counter ) 253 size_t &counter ) 254 254 { 255 255 assert((index<size_tab) && "Bad Update Tab Entry"); 256 if ( tab[index].valid ) 256 if ( tab[index].valid ) 257 257 { 258 258 tab[index].count--; 259 259 counter = tab[index].count; 260 260 return true; 261 } 262 else 261 } 262 else 263 263 { 264 264 return false; … … 298 298 { 299 299 assert(index<size_tab && "Bad Update Tab Entry"); 300 return tab[index].rsp; 300 return tab[index].rsp; 301 301 } 302 302 … … 309 309 { 310 310 assert(index<size_tab && "Bad Update Tab Entry"); 311 return tab[index].ack; 311 return tab[index].ack; 312 312 } 313 313 … … 320 320 { 321 321 assert(index<size_tab && "Bad Update Tab Entry"); 322 return tab[index].brdcast; 322 return tab[index].brdcast; 323 323 } 324 324 … … 331 331 { 332 332 assert(index<size_tab && "Bad Update Tab Entry"); 333 return tab[index].update; 333 return tab[index].update; 334 334 } 335 335 … … 342 342 { 343 343 assert(index<size_tab && "Bad Update Tab Entry"); 344 return tab[index].srcid; 344 return tab[index].srcid; 345 345 } 346 346 … … 353 353 { 354 354 assert(index<size_tab && "Bad Update Tab Entry"); 355 return tab[index].trdid; 355 return tab[index].trdid; 356 356 } 357 357 … … 364 364 { 365 365 assert(index<size_tab && "Bad Update Tab Entry"); 366 return tab[index].pktid; 366 return tab[index].pktid; 367 367 } 368 368 … … 403 403 // - nline : the line number of the entry in the directory 404 404 ///////////////////////////////////////////////////////////////////// 405 bool read_nline(const addr_t nline,size_t &index) 405 bool read_nline(const addr_t nline,size_t &index) 406 406 { 407 407 size_t i ; … … 422 422 // Arguments : 423 423 // - index : the index of the entry 424 ///////////////////////////////////////////////////////////////////// 424 ///////////////////////////////////////////////////////////////////// 425 425 void clear(const size_t index) 426 426 { 427 427 assert(index<size_tab && "Bad Update Tab Entry"); 428 428 tab[index].valid=false; 429 return; 429 return; 430 430 } 431 431
Note: See TracChangeset
for help on using the changeset viewer.