MatchLib
Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Scratchpad< T, N, CAPACITY_IN_BYTES > Class Template Reference

Parameterized banked scratchpad memory. More...

#include <Scratchpad.h>

Inheritance diagram for Scratchpad< T, N, CAPACITY_IN_BYTES >:

Classes

struct  bank_req_t
 

Public Member Functions

typedef NVUINTW (NBANKS_LOG2) bank_sel_t
 
typedef NVUINTW (ADDR_WIDTH-NBANKS_LOG2) bank_addr_t
 
 SC_HAS_PROCESS (Scratchpad)
 
 Scratchpad (sc_module_name name_)
 
void run ()
 

Public Attributes

sc_in_clk clk
 
sc_in< bool > rst
 
Connections::In< cli_req_t< T, ADDR_WIDTH, N > > cli_req
 
Connections::Out< cli_rsp_t< T, N > > cli_rsp
 
mem_array_sep< T, CAPACITY_IN_BYTES, N > banks
 
bank_req_t input_reqs [N]
 
bool input_reqs_valid [N]
 
bank_req_t bank_reqs [N]
 
bool bank_reqs_valid [N]
 
bank_rsps_data [N]
 
bool bank_rsps_valid [N]
 
bool load_rsps_valid [N]
 
cli_req_t< T, ADDR_WIDTH, N > curr_cli_req
 
cli_rsp_t< T, N > load_rsp
 
bank_sel_t bank_src_lane [N]
 
bank_sel_t bank_dst_lane [N]
 

Static Public Attributes

static const int ADDR_WIDTH = nvhls::nbits<CAPACITY_IN_BYTES - 1>::val
 
static const int NBANKS_LOG2 = nvhls::nbits<N - 1>::val
 

Detailed Description

template<typename T, int N, int CAPACITY_IN_BYTES>
class Scratchpad< T, N, CAPACITY_IN_BYTES >

Parameterized banked scratchpad memory.

Template Parameters
TEntryType
NNumber of requests
CAPACITY_IN_BYTES
Overview
-Assumptions: All N requests are guaranteed conflict-free.

Ports: 1 input port for requests (load OR store) from client 1 output port for replies (load only) back to client

Input parameters: Number of banks (assumed to be same as the number of requests) Address Width

A Simple Example
#include <Scratchpad.h>
...
Connections::In< cli_req_t<data32_t, ADDR_WIDTH,N> > cli_req;
Connections::Out< cli_rsp_t<data32_t, N> > cli_rsp;
...
// Connect the DUT
myscratchpad.clk(clk);
myscratchpad.rst(rst);
myscratchpad.cli_req(cli_req);
myscratchpad.cli_rsp(cli_rsp);
...
Usage Guidelines

This module sets the stall mode to flush by default to mitigate possible RTL bugs that can occur in the default stall mode. If you are confident that this class of bugs will not occur in your use case, you can change the stall mode via TCL directive:

directive set /path/to/Scratchpad/run/while -PIPELINE_STALL_MODE stall

This may reduce area/power.

Definition at line 87 of file Scratchpad.h.


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