#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; // Response to the initiator required bool ack; // Acknowledge to the CONFIG FSM required 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; ack = false; srcid = 0; trdid = 0; pktid = 0; nline = 0; count = 0; } UpdateTabEntry(bool i_valid, bool i_update, bool i_brdcast, bool i_rsp, bool i_ack, 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; ack = i_ack; 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; ack = source.ack; 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; ack = 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; ack = source.ack ; 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 << " val = " << std::dec << valid << " / updt = " << update << " / bc = " << brdcast << " / rsp = " << rsp << " / ack = " << ack << " / count = " << count << " / srcid = " << std::hex << srcid << " / trdid = " << trdid << " / pktid = " << pktid << " / nline = " << nline << std::endl; } }; //////////////////////////////////////////////////////////////////////// // The update tab //////////////////////////////////////////////////////////////////////// class UpdateTab{ typedef uint64_t 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() { std::cout << "UPDATE TABLE Content" << std::endl; for(size_t i=0; i