L1 APIs

MLP

The basic components of the FCN are defined in the template class FCN. Frequent used activation functions are also implemented.

namespace mlp

// classes

template <
    typename t_FloatType,
    typename t_XDataType,
    unsigned int t_DdrWidth,
    unsigned int t_XDdrWidth,
    unsigned int t_aColMemWords = 1,
    unsigned int t_aRowMemWords = 1,
    unsigned int t_bColMemWords = 1,
    unsigned int t_maxWSize = 0,
    unsigned int t_maxBSize = 0
    >
class Fcn

relu

#include "mlp/activations.hpp"
template <typename t_DataType>
t_DataType relu (t_DataType x)

relu (rectified linear unit) is a very common activation function in deep neural network

Parameters:

x is the input value

sigmoid

#include "mlp/activations.hpp"
template <typename t_DataType>
t_DataType sigmoid (t_DataType x)

sigmoid function is a very common activation function in MLP

Parameters:

x is the input value

tansig

#include "mlp/activations.hpp"
template <typename t_DataType>
t_DataType tansig (t_DataType x)

tansig function is used as an activation function in some MLPs

Parameters:

x is the input value

Reverse Time Migration

Here describes the basic components for solving wave equations by explicit FDTD method, and components for RTM. These components are further classified according to the problems’ dimentions e.g. 2D or 3D.

Data Movers

Data movers are implemented for kernel memory communication, dataType conversion and stream datawidth conversion.

namespace rtm

// classes

template <
    int t_MaxDimZ,
    int t_MaxDimY,
    int t_HalfOrder,
    int t_PEZ,
    int t_PEX,
    int t_NumSM
    >
class Domain3D

template <
    typename t_DataType,
    int t_Order,
    int t_MaxDim = 1024,
    int t_MaxB = 40,
    int t_PE = t_Order / 2
    >
class RTM2D

template <
    typename t_Domain,
    typename t_DataType,
    int t_Order,
    int t_MaxDimZ = 128,
    int t_MaxDimY = 128,
    int t_MaxB = 40,
    int t_PEZ = 1,
    int t_PEX = 1
    >
class RTM3D

template <
    typename t_DataType,
    int t_Order,
    int t_MaxDim = 1024,
    int t_PE = 1
    >
class Stencil2D

template <
    typename t_DataType,
    int t_Order,
    int t_MaxDimZ = 128,
    int t_MaxDimY = 128,
    int t_PEZ = 1,
    int t_PEX = 1
    >
class Stencil3D

memSelStream

#include "rtm/dataMover.hpp"
template <
    typename t_InterfaceType,
    typename t_DataType
    >
void memSelStream (
    unsigned int p_n,
    unsigned int p_k,
    t_InterfaceType* p_mem0,
    t_InterfaceType* p_mem1,
    hls::stream <t_DataType>& p_str
    )

memSelStream reads data alternatively from two memory addresses to a stream

Parameters:

t_InterfaceType is the datatype in memory
t_DataType is the datatype in of the stream
p_n is the number of data to be read
p_k is the selection
p_mem0 is the first memory port
p_mem1 is the second memory port
p_str is the output stream

streamSelMem

#include "rtm/dataMover.hpp"
template <
    typename t_InterfaceType,
    typename t_DataType
    >
void streamSelMem (
    unsigned int p_n,
    unsigned int p_k,
    t_InterfaceType* p_mem0,
    t_InterfaceType* p_mem1,
    hls::stream <t_DataType>& p_str
    )

streamSelMem reads write alternatively to two memory addresses from a stream

Parameters:

t_InterfaceType is the datatype in memory
t_DataType is the datatype in of the stream
p_n is the number of data to be read
p_k is the selection
p_mem0 is the first memory port
p_mem1 is the second memory port
p_str is the input stream

wide2stream

#include "rtm/dataMover.hpp"
template <
    unsigned int t_DataWidth,
    unsigned int t_Multi
    >
void wide2stream (
    unsigned int p_n,
    hls::stream <ap_uint <t_DataWidth*t_Multi>>& p_wide,
    hls::stream <ap_uint <t_DataWidth>>& p_str
    )

wide2stream converts an integer of wide datawidth to an integer of base datawidth

Parameters:

t_DataWidth is the base datawidth
t_Multi is the factor between two datawidth
p_n is the number of data to be read
p_wide is the input stream of wide datawidth
p_str is the output stream of base datawidth

stream2wide

#include "rtm/dataMover.hpp"
template <
    unsigned int t_DataWidth,
    unsigned int t_Multi
    >
void stream2wide (
    unsigned int p_n,
    hls::stream <ap_uint <t_DataWidth>>& p_str,
    hls::stream <ap_uint <t_DataWidth*t_Multi>>& p_wide
    )

stream2wide converts an integer of base datawidth to an integer of wide datawidth

Parameters:

t_DataWidth is the base datawidth
t_Multi is the factor between two datawidth
p_n is the number of data to be read
p_str is the input stream of base datawidth
p_wide is the output stream of wide datawidth