Snitch Runtime
Loading...
Searching...
No Matches
ssr.h File Reference

This file contains functions to conveniently program Snitch's SSRs. More...

Go to the source code of this file.

Enumerations

enum  snrt_ssr_dm { SNRT_SSR_DM0 = 0 , SNRT_SSR_DM1 = 1 , SNRT_SSR_DM2 = 2 , SNRT_SSR_DM_ALL = 31 }
 The different SSRs. More...
 
enum  snrt_ssr_dim { SNRT_SSR_1D = 0 , SNRT_SSR_2D = 1 , SNRT_SSR_3D = 2 , SNRT_SSR_4D = 3 }
 The different dimensions. More...
 
enum  {
  REG_STATUS = 0 , REG_REPEAT = 1 , REG_BOUNDS = 2 , REG_STRIDES = 6 ,
  REG_RPTR = 24 , REG_WPTR = 28
}
 The SSR configuration registers. More...
 

Functions

void snrt_fpu_fence ()
 Synchronize the integer and float pipelines.
 
void snrt_ssr_enable ()
 Enable all SSRs.
 
void snrt_ssr_disable ()
 Disable all SSRs.
 
uint32_t read_ssr_cfg (uint32_t reg, uint32_t dm)
 Read the value of an SSR configuration register.
 
void write_ssr_cfg (uint32_t reg, uint32_t dm, uint32_t value)
 Write a value to an SSR configuration register.
 
void snrt_ssr_loop_1d (enum snrt_ssr_dm dm, size_t b0, size_t s0)
 Configure an SSR data mover for a 1D loop nest.
 
void snrt_ssr_loop_2d (enum snrt_ssr_dm dm, size_t b0, size_t b1, size_t s0, size_t s1)
 Configure an SSR data mover for a 2D loop nest.
 
void snrt_ssr_loop_3d (enum snrt_ssr_dm dm, size_t b0, size_t b1, size_t b2, size_t s0, size_t s1, size_t s2)
 Configure an SSR data mover for a 3D loop nest.
 
void snrt_ssr_loop_4d (enum snrt_ssr_dm dm, size_t b0, size_t b1, size_t b2, size_t b3, size_t s0, size_t s1, size_t s2, size_t s3)
 Configure an SSR data mover for a 4D loop nest.
 
void snrt_ssr_repeat (enum snrt_ssr_dm dm, size_t count)
 Configure the repetition count for a stream.
 
void snrt_ssr_read (enum snrt_ssr_dm dm, enum snrt_ssr_dim dim, volatile void *ptr)
 Start a streaming read.
 
void snrt_ssr_write (enum snrt_ssr_dm dm, enum snrt_ssr_dim dim, volatile void *ptr)
 Start a streaming write.
 

Detailed Description

This file contains functions to conveniently program Snitch's SSRs.

An SSR stream can be configured to replace a store (or load) sequence as could be generated by an N-dimensional affine loop nest:

for (int i = 0; i < b1; i++)
for (int j = 0; j < b0; j++)
array[i * s1 + j * s0] = 0;

The configuration functions provided in this file reflect the parameters one would define to set up such a loop nest.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

The SSR configuration registers.

Enumerator
REG_STATUS 

SSR status register

REG_REPEAT 

SSR repeat register

REG_BOUNDS 

SSR bounds register

REG_STRIDES 

SSR strides register

REG_RPTR 

SSR read pointer register

REG_WPTR 

SSR write pointer register

◆ snrt_ssr_dim

The different dimensions.

Enumerator
SNRT_SSR_1D 

1D stream

SNRT_SSR_2D 

2D stream

SNRT_SSR_3D 

3D stream

SNRT_SSR_4D 

4D stream

◆ snrt_ssr_dm

The different SSRs.

Enumerator
SNRT_SSR_DM0 

SSR data mover 0

SNRT_SSR_DM1 

SSR data mover 1

SNRT_SSR_DM2 

SSR data mover 2

SNRT_SSR_DM_ALL 

Write to all SSRs

Function Documentation

◆ read_ssr_cfg()

uint32_t read_ssr_cfg ( uint32_t reg,
uint32_t dm )
inline

Read the value of an SSR configuration register.

Parameters
regThe register index.
dmThe SSR index.
Returns
The value of the register.

◆ snrt_ssr_loop_1d()

void snrt_ssr_loop_1d ( enum snrt_ssr_dm dm,
size_t b0,
size_t s0 )
inline

Configure an SSR data mover for a 1D loop nest.

Parameters
dmThe SSR index.
b0The bound of the loop.
s0The stride of the loop.

◆ snrt_ssr_loop_2d()

void snrt_ssr_loop_2d ( enum snrt_ssr_dm dm,
size_t b0,
size_t b1,
size_t s0,
size_t s1 )
inline

Configure an SSR data mover for a 2D loop nest.

Parameters
dmThe SSR index.
b0The bound of the first loop.
b1The bound of the second loop.
s0The stride of the first loop.
s1The stride of the second loop.

◆ snrt_ssr_loop_3d()

void snrt_ssr_loop_3d ( enum snrt_ssr_dm dm,
size_t b0,
size_t b1,
size_t b2,
size_t s0,
size_t s1,
size_t s2 )
inline

Configure an SSR data mover for a 3D loop nest.

Parameters
dmThe SSR index.
b0The bound of the first loop.
b1The bound of the second loop.
b2The bound of the third loop.
s0The stride of the first loop.
s1The stride of the second loop.
s2The stride of the third loop.

◆ snrt_ssr_loop_4d()

void snrt_ssr_loop_4d ( enum snrt_ssr_dm dm,
size_t b0,
size_t b1,
size_t b2,
size_t b3,
size_t s0,
size_t s1,
size_t s2,
size_t s3 )
inline

Configure an SSR data mover for a 4D loop nest.

Parameters
dmThe SSR index.
b0The bound of the first loop.
b1The bound of the second loop.
b2The bound of the third loop.
b3The bound of the fourth loop.
s0The stride of the first loop.
s1The stride of the second loop.
s2The stride of the third loop.
s3The stride of the fourth loop.

◆ snrt_ssr_read()

void snrt_ssr_read ( enum snrt_ssr_dm dm,
enum snrt_ssr_dim dim,
volatile void * ptr )
inline

Start a streaming read.

Parameters
dmThe SSR index.
dimThe number of dimensions to use.
ptrThe pointer to the data.

◆ snrt_ssr_repeat()

void snrt_ssr_repeat ( enum snrt_ssr_dm dm,
size_t count )
inline

Configure the repetition count for a stream.

Parameters
dmThe SSR index.
countThe repetition count.

◆ snrt_ssr_write()

void snrt_ssr_write ( enum snrt_ssr_dm dm,
enum snrt_ssr_dim dim,
volatile void * ptr )
inline

Start a streaming write.

Parameters
dmThe SSR index.
dimThe number of dimensions to use.
ptrThe pointer to the data.

◆ write_ssr_cfg()

void write_ssr_cfg ( uint32_t reg,
uint32_t dm,
uint32_t value )
inline

Write a value to an SSR configuration register.

Parameters
regThe register index.
dmThe SSR index.
valueThe value to write.