#ifndef IOB_TRANSACTION_H_ #define IOB_TRANSACTION_H_ #include #include #include #include "arithmetics.h" #define DEBUG_IOB_TRANSACTION 0 // The index of Transaction Tab Entry corresponds to the trdid of the VCI packet on XRAM network //////////////////////////////////////////////////////////////////////// // A transaction tab entry //////////////////////////////////////////////////////////////////////// class TransactionTabIOEntry { typedef uint32_t size_t; public: bool valid; // entry valid size_t srcid; // processor requesting the transaction size_t trdid; // processor requesting the transaction ///////////////////////////////////////////////////////////////////// // The init() function initializes the entry ///////////////////////////////////////////////////////////////////// void init() { valid = false; } //////////////////////////////////////////////////////////////////// // The copy() function copies an existing entry // Its arguments are : // - source : the transaction tab entry to copy //////////////////////////////////////////////////////////////////// void copy(const TransactionTabIOEntry &source) { valid = source.valid; srcid = source.srcid; trdid = source.trdid; } //////////////////////////////////////////////////////////////////// // The print() function prints the entry //////////////////////////////////////////////////////////////////// void print(){ std::cout << "valid = " << valid << std::endl; std::cout << "srcid = " << srcid << std::endl; std::cout << "trdid = " << trdid << std::endl; } ///////////////////////////////////////////////////////////////////// // Constructors ///////////////////////////////////////////////////////////////////// TransactionTabIOEntry() { valid=false; } TransactionTabIOEntry(const TransactionTabIOEntry &source){ valid = source.valid; srcid = source.srcid; trdid = source.trdid; } }; // end class TransactionTabIOEntry //////////////////////////////////////////////////////////////////////// // The transaction tab //////////////////////////////////////////////////////////////////////// class TransactionTabIO{ // typedef uint32_t size_t; private: size_t size_tab; // The size of the tab public: TransactionTabIOEntry *tab; // The transaction tab //////////////////////////////////////////////////////////////////// // Constructors //////////////////////////////////////////////////////////////////// TransactionTabIO() { size_tab=0; tab=NULL; } TransactionTabIO(size_t n_entries) { size_tab = n_entries; tab = new TransactionTabIOEntry[size_tab]; } ~TransactionTabIO() { delete [] tab; } ///////////////////////////////////////////////////////////////////// // The size() function returns the size of the tab ///////////////////////////////////////////////////////////////////// size_t size() { return size_tab; } ///////////////////////////////////////////////////////////////////// // The init() function initializes the transaction tab entries ///////////////////////////////////////////////////////////////////// void init() { for ( size_t i=0; i