API Class of xf::common::utils_hw

template class xf::common::utils_hw::UramArray

#include "xf_utils_hw/uram_array.hpp"

Overview

Helper class to create URAM array that can be updated every cycle with forwarding regs.

Forwarding regs keeps a history of address and values, and when acess to URAM hits the “cache”, read from URAM is skipped. This addresses the Read-After-Write dependency across iterations. The depth of the cache, specified with the _NCache variable, dependes on the latency of actual write. It is suggested to be set after initial sythesis attempts.

When element can be held in one URAM row (72-bit), this helper would try to pack multiple elements to one row. If it is beyond 72-bits, multiple URAMs will be used to ensure elements can be fetched in one cycle.

To make the cache really functional, HLS needs to be instructed to ignore inter-iteration dependencies on blocks of UramArray objects. Please refer to the test of this module for an example.

Attention

This module requires HLS 2019.1 or above.

Parameters:

_WData the width of every element.
_NData the number of elements in the array.
_NCache the number of cache.
template <
    int _WData,
    int _NData,
    int _NCache
    >
class UramArray

// fields

ap_uint <72>* blocks[details::need_num< _WData, _NData >::value_x][details::need_num< _WData, _NData >::value_y]

Methods

memSet

int memSet (const ap_uint <_WData>& d)

initialization for uram.

Parameters:

d value for initialization.

Returns:

number of block which had been initialize.

write

void write (
    int index,
    const ap_uint <_WData>& d
    )

write to uram.

Parameters:

index the index which you want to write.
d the value what you want to write.

read

ap_uint <_WData> read (int index)

read from uram.

Parameters:

index the index which you want to read.

Returns:

value you had read.