SPRUIG8J January 2018 – March 2024
A parameter template is a variable of type
__SE_TEMPLATE_v1
or __SA_TEMPLATE_v1
that is
used to specify counters, sizes, and flags that control the behavior of the
Streaming Engine (SE) and Streaming Address Generator (SA). The iteration counters
(ICNT) and dimension offsets (DIM) for up to six levels of nesting apply to both the
SE and SA. Functional flags are specific to either the SE or the SA. The parameter
templates are effectively vectors of 64-bit values.
Note that __SE_TEMPLATE_v1
and
__SA_TEMPLATE_v1
are defined as separate types.
To initialize parameters for the
__SE_TEMPLATE_v1
type, call
__gen_SE_TEMPLATE_v1()
.
__SE_TEMPLATE_v1 se_params = __gen_SE_TEMPLATE_v1();
To initialize parameters for the
__SA_TEMPLATE_v1
type, call
__gen_SA_TEMPLATE_v1()
.
__SA_TEMPLATE_v1 sa_params = __gen_SA_TEMPLATE_v1();
After initialization, configure the parameter template using assignments like the following:
p.ICNT0 = <value>;
p.ICNT<n> = <value>;
p.DIM<n> = <value>;
p.DECDIM<n>.WIDTH = <value>;
p.LEZR_CN = <value>;
For example, to configure a parameter vector for an SE with four dimensions:
// Setup Template Vector Based on Settings and Open the Stream
// Based on Iteration Counters and Dimensions (in Terms of # of Elems)
__SE_TEMPLATE_v1 params = __gen_SE_TEMPLATE_v1();
params.ICNT0 = 4;
params.ICNT1 = 2;
params.DIM1 = 4;
params.ICNT2 = 2;
params.DIM2 = 8;
params.ICNT3 = 4;
params.DIM3 = -16;
The counters and dimension sizes for unused
dimensions do not need to be configured as long as the DIMFMT
flag
is set to the proper format flag. This flag tells the hardware to ignore
uninitialized data in these unused fields.
For the Streaming Engine, the following additional
flags can be configured within a variable defined with the
__SE_TEMPLATE_v1
type. These flags are documented in the
c7x_strm.h
file.
ELETYPE
TRANSPOSE
PROMOTE
GRPDUP
VECLEN
ELDUP
DECIM
DIR
DIMFMT
DECDIM1
DECDIM2
LEZR
For example, the following statements configure SE
parameters using constants provided in c7x_strm.h
.
se_params.DIMFMT = __SE_DIMFMT_4D;
se_params.DIR = __SE_DIR_INC;
se_params.TRANSPOSE = __SE_TRANSPOSE_OFF;
se_params.DECIM = __SE_DECIM_OFF;
se_params.VECLEN = __SE_VECLEN_4ELEMS; // 4 ELEMENTS
se_params.ELETYPE = __SE_ELETYPE_32BIT;
se_params.PROMOTE = __SE_PROMOTE_OFF;
se_params.GRPDUP = __SE_GRPDUP_OFF;
se_params.ELDUP = __SE_ELEDUP_OFF;
se_params.DECDIM1 = __SE_DECDIM0;
se_params.DECDIM2 = __SE_DECDIM0;
se_params.LEZR = __SE_LEZR_OFF;
For the Streaming Address Generator, the following
additional flags can be configured within a variable defined with the
__SA_TEMPLATE_v1
type.
VECLEN
DIMFMT
DECDIM1
DECDIM1SD
DECDIM2
DECDIM2SD
For example, the following statements configure SA
parameters using constants provided in c7x_strm.h
.
sa_params.VECLEN = __SA_VECLEN_4ELEMS; // 4 ELEMENTS
sa_params.DIMFMT = __SA_DIMFMT_4D;
sa_params.DECDIM1 = __SA_DECDIM0;
sa_params.DECDIM2 = __SA_DECDIM0;