#ifndef UPDATE_TAB_H_ #define UPDATE_TAB_H_ #include #include #include #include "arithmetics.h" //////////////////////////////////////////////////////////////////////// // An update tab entry //////////////////////////////////////////////////////////////////////// class UpdateTabEntry { typedef uint32_t size_t; public: bool valid; // It is a valid pending transaction bool update; // It is an update transaction size_t srcid; // The srcid of the initiator which wrote the data size_t trdid; // The trdid of the initiator which wrote the data size_t pktid; // The pktid of the initiator which wrote the data size_t count; // The number of acknowledge responses to receive UpdateTabEntry(){ valid = false; update = false; srcid = 0; trdid = 0; pktid = 0; count = 0; } UpdateTabEntry(bool i_valid, bool i_update, size_t i_srcid, size_t i_trdid, size_t i_pktid, size_t i_count) { valid = i_valid; update = i_update; srcid = i_srcid; trdid = i_trdid; pktid = i_pktid; count = i_count; } UpdateTabEntry(const UpdateTabEntry &source) { valid = source.valid; update = source.update; srcid = source.srcid; trdid = source.trdid; pktid = source.pktid; count = source.count; } //////////////////////////////////////////////////// // The init() function initializes the entry /////////////////////////////////////////////////// void init() { valid=false; update=false; srcid=0; trdid=0; pktid=0; count=0; } //////////////////////////////////////////////////////////////////// // The copy() function copies an existing entry // Its arguments are : // - source : the update tab entry to copy //////////////////////////////////////////////////////////////////// void copy(const UpdateTabEntry &source) { valid=source.valid; update=source.update; srcid=source.srcid; trdid=source.trdid; pktid=source.pktid; count=source.count; } //////////////////////////////////////////////////////////////////// // The print() function prints the entry //////////////////////////////////////////////////////////////////// void print(){ std::cout << "valid = " << valid << std::endl; std::cout << "update = " << update << std::endl; std::cout << "srcid = " << srcid << std::endl; std::cout << "trdid = " << trdid << std::endl; std::cout << "pktid = " << pktid << std::endl; std::cout << "count = " << count << std::endl; } }; //////////////////////////////////////////////////////////////////////// // The update tab //////////////////////////////////////////////////////////////////////// class UpdateTab{ typedef uint32_t size_t; private: size_t size_tab; std::vector tab; public: UpdateTab() : tab(0) { size_tab=0; } UpdateTab(size_t size_tab_i) : tab(size_tab_i) { size_tab=size_tab_i; } //////////////////////////////////////////////////////////////////// // The size() function returns the size of the tab //////////////////////////////////////////////////////////////////// const size_t size(){ return size_tab; } ///////////////////////////////////////////////////////////////////// // The init() function initializes the tab ///////////////////////////////////////////////////////////////////// void init(){ for ( size_t i=0; i