#ifndef XRAM_TRANSACTION_V1_H_ #define XRAM_TRANSACTION_V1_H_ #include #include #include #include "arithmetics.h" #define DEBUG_XRAM_TRANSACTION 0 //////////////////////////////////////////////////////////////////////// // A transaction tab entry //////////////////////////////////////////////////////////////////////// class TransactionTabEntry { typedef uint32_t size_t; typedef uint32_t data_t; typedef sc_dt::sc_uint<40> addr_t; typedef uint32_t be_t; public: bool valid; // entry valid bool xram_read; // read request to XRAM addr_t nline; // index (zy) of the requested line size_t srcid; // processor requesting the transaction size_t trdid; // processor requesting the transaction size_t pktid; // processor requesting the transaction bool proc_read; // read request from processor bool single_word; // single word in case of processor read size_t word_index; // word index in case of single word read std::vector wdata; // write buffer (one cache line) std::vector wdata_be; // be for each data in the write buffer ///////////////////////////////////////////////////////////////////// // The init() function initializes the entry ///////////////////////////////////////////////////////////////////// void init() { valid = false; } ///////////////////////////////////////////////////////////////////// // The alloc() function initializes the vectors of an entry // Its arguments are : // - n_words : number of words per line in the cache ///////////////////////////////////////////////////////////////////// void alloc(size_t n_words) { wdata_be.reserve( (int)n_words ); wdata.reserve( (int)n_words ); for(size_t i=0; i &be, const std::vector &data) { assert( (index < size_tab) && "Invalid Transaction Tab Entry"); assert(be.size()==tab[index].wdata_be.size() && "Bad data mask in write_data_mask in TransactionTab"); assert(data.size()==tab[index].wdata.size() && "Bad data in write_data_mask in TransactionTab"); for(size_t i=0; i &data_be, const std::vector &data) { assert( (index < size_tab) && "The selected entry is out of range in set() Transaction Tab"); assert(data_be.size()==tab[index].wdata_be.size() && "Bad data_be argument in set() TransactionTab"); assert(data.size()==tab[index].wdata.size() && "Bad data argument in set() TransactionTab"); tab[index].valid = true; tab[index].xram_read = xram_read; tab[index].nline = nline; tab[index].srcid = srcid; tab[index].trdid = trdid; tab[index].pktid = pktid; tab[index].proc_read = proc_read; tab[index].single_word = single_word; tab[index].word_index = word_index; for(size_t i=0; i