Traits class for Scratchpad and ScratchpadClass.
More...
#include <Scratchpad.h>
template<typename WORD_TYPE, int NUM_BANKS, int CAPACITY_IN_WORDS>
struct ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >
Traits class for Scratchpad and ScratchpadClass.
- Template Parameters
-
T | EntryType |
N | Number of requests |
CAPACITY_IN_WORDS | Total number of words of type T in memory |
- Overview
- This traits class provides a clean way to access all types and constants that might be needed when using Scratchpad or ScratchpadClass.
- Available Type and Constants
typedef WORD_TYPE word_type;
static const int num_banks = NUM_BANKS;
static const int capacity_in_words = CAPACITY_IN_WORDS;
static const int num_inputs = num_banks;
static const int words_per_bank = capacity_in_words / num_banks;
static const int addr_width = mem_class_t::ADDR_WIDTH;
static const int bank_sel_width = mem_class_t::NBANKS_LOG2;
typedef typename mem_class_t::bank_sel_t bank_sel_t;
typedef ac_int<addr_width, false> addr_t;
for (unsigned i=0; i < num_inputs; i++)
this->valids[i] = 0;
}
}
void set(unsigned idx, addr_t _addr, word_type _data=0) {
sc_assert(idx < num_inputs);
this->valids[idx] = 1;
this->addr[idx] = _addr;
this->data[idx] = _data;
}
Parameterized banked scratchpad memory implemented as a C++ class (i.e. not a SystemC module)
Parameterized banked scratchpad memory implemented as a SystemC module.
- A Simple Example
#include <Scratchpad.h>
...
...
local_mem::mem_class_t scratchpad1;
...
local_mem::scratchpad_req_t sp_req;
local_mem::word_type sum=0;
Traits class for Scratchpad and ScratchpadClass.
Definition at line 396 of file Scratchpad.h.
◆ word_type
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
typedef WORD_TYPE ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >::word_type |
◆ mem_class_t
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
◆ mem_module_t
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
typedef Scratchpad<word_type, num_banks, capacity_in_words> ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >::mem_module_t |
◆ base_req_t
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
◆ base_rsp_t
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
◆ bank_sel_t
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
typedef mem_class_t::bank_sel_t ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >::bank_sel_t |
◆ addr_t
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
typedef ac_int<addr_width, false> ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >::addr_t |
◆ num_banks
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
const int ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >::num_banks = NUM_BANKS |
|
static |
◆ capacity_in_words
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
const int ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >::capacity_in_words = CAPACITY_IN_WORDS |
|
static |
◆ num_inputs
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
const int ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >::num_inputs = num_banks |
|
static |
◆ words_per_bank
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
const int ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >::words_per_bank = capacity_in_words / num_banks |
|
static |
◆ addr_width
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
const int ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >::addr_width = mem_class_t::ADDR_WIDTH |
|
static |
◆ bank_sel_width
template<typename WORD_TYPE , int NUM_BANKS, int CAPACITY_IN_WORDS>
const int ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS >::bank_sel_width = mem_class_t::NBANKS_LOG2 |
|
static |
The documentation for this struct was generated from the following file: