#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; typedef sc_dt::sc_uint<40> addr_t; public: bool valid; // It is a valid pending transaction bool update; // It is an update transaction bool brdcast; // It is a broadcast invalidate bool rsp; // It needs a response to the initiator 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 addr_t nline; // The identifier of the cache line size_t count; // The number of acknowledge responses to receive UpdateTabEntry(){ valid = false; update = false; brdcast = false; rsp = false; srcid = 0; trdid = 0; pktid = 0; nline = 0; count = 0; } UpdateTabEntry(bool i_valid, bool i_update, bool i_brdcast, bool i_rsp, size_t i_srcid, size_t i_trdid, size_t i_pktid, addr_t i_nline, size_t i_count) { valid = i_valid; update = i_update; brdcast = i_brdcast; rsp = i_rsp; srcid = i_srcid; trdid = i_trdid; pktid = i_pktid; nline = i_nline; count = i_count; } UpdateTabEntry(const UpdateTabEntry &source) { valid = source.valid; update = source.update; brdcast = source.brdcast; rsp = source.rsp; srcid = source.srcid; trdid = source.trdid; pktid = source.pktid; nline = source.nline; count = source.count; } //////////////////////////////////////////////////// // The init() function initializes the entry /////////////////////////////////////////////////// void init() { valid = false; update = false; brdcast= false; rsp = false; srcid = 0; trdid = 0; pktid = 0; nline = 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; brdcast= source.brdcast; rsp = source.rsp; srcid = source.srcid; trdid = source.trdid; pktid = source.pktid; nline = source.nline; count = source.count; } //////////////////////////////////////////////////////////////////// // The print() function prints the entry //////////////////////////////////////////////////////////////////// void print(){ std::cout << std::dec << "valid = " << valid << std::endl; std::cout << "update = " << update << std::endl; std::cout << "brdcast= " << brdcast<< std::endl; std::cout << "rsp = " << rsp << std::endl; std::cout << "srcid = " << srcid << std::endl; std::cout << "trdid = " << trdid << std::endl; std::cout << "pktid = " << pktid << std::endl; std::cout << std::hex << "nline = " << nline << std::endl; std::cout << std::dec << "count = " << count << std::endl; } }; //////////////////////////////////////////////////////////////////////// // The update tab //////////////////////////////////////////////////////////////////////// class UpdateTab{ typedef uint32_t size_t; typedef sc_dt::sc_uint<40> addr_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 print() function diplays the tab content //////////////////////////////////////////////////////////////////// void print(){ for(size_t i=0; i