MatchLib
Classes | Public Types | Static Public Attributes | List of all members
ScratchpadTraits< WORD_TYPE, NUM_BANKS, CAPACITY_IN_WORDS > Struct Template Reference

Traits class for Scratchpad and ScratchpadClass. More...

#include <Scratchpad.h>

Classes

struct  scratchpad_req_t
 

Public Types

typedef WORD_TYPE word_type
 
typedef ScratchpadClass< word_type, num_banks, capacity_in_words > mem_class_t
 
typedef Scratchpad< word_type, num_banks, capacity_in_words > mem_module_t
 
typedef mem_class_t::req_t base_req_t
 
typedef mem_class_t::rsp_t base_rsp_t
 
typedef mem_class_t::bank_sel_t bank_sel_t
 
typedef ac_int< addr_width, false > addr_t
 

Static Public Attributes

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
 

Detailed Description

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
TEntryType
NNumber of requests
CAPACITY_IN_WORDSTotal 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; // Note: for Scratchpad num_banks must equal num_inputs
static const int words_per_bank = capacity_in_words / num_banks;
typedef typename mem_class_t::req_t base_req_t;
typedef typename mem_class_t::rsp_t base_rsp_t;
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;
struct scratchpad_req_t : public base_req_t {
scratchpad_req_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)
Definition: Scratchpad.h:101
Parameterized banked scratchpad memory implemented as a SystemC module.
Definition: Scratchpad.h:259
A Simple Example
#include <Scratchpad.h>
...
// local Scratchpad "traits" class provides all related types and constants
// Here the
// EntryType is uint32
// number of banks is 16
// total capacity in words is 16 * 0x1000
...
local_mem::mem_class_t scratchpad1; // instantiate a ScratchpadClass
...
local_mem::scratchpad_req_t sp_req; // local scratchpad request type
local_mem::word_type sum=0; // EntryType stored in memory
Traits class for Scratchpad and ScratchpadClass.
Definition: Scratchpad.h:396

Definition at line 396 of file Scratchpad.h.


The documentation for this struct was generated from the following file: