Snitch Runtime
|
This file provides functions to program the Snitch DMA. More...
Go to the source code of this file.
Macros | |
#define | OP_CUSTOM1 0b0101011 |
#define | XDMA_FUNCT3 0b000 |
#define | DMSRC_FUNCT7 0b0000000 |
#define | DMDST_FUNCT7 0b0000001 |
#define | DMCPYI_FUNCT7 0b0000010 |
#define | DMCPY_FUNCT7 0b0000011 |
#define | DMSTATI_FUNCT7 0b0000100 |
#define | DMSTAT_FUNCT7 0b0000101 |
#define | DMSTR_FUNCT7 0b0000110 |
#define | DMREP_FUNCT7 0b0000111 |
#define | R_TYPE_ENCODE(funct7, rs2, rs1, funct3, rd, opcode) |
Typedefs | |
typedef uint32_t | snrt_dma_txid_t |
A DMA transfer identifier. | |
Functions | |
uint32_t | snrt_dma_start_1d_wideptr (uint64_t dst, uint64_t src, size_t size) |
Start an asynchronous 1D DMA transfer with 64-bit wide pointers. | |
snrt_dma_txid_t | snrt_dma_start_1d (void *dst, const void *src, size_t size) |
Start an asynchronous 1D DMA transfer with native-size pointers. | |
snrt_dma_txid_t | snrt_dma_start_2d_wideptr (uint64_t dst, uint64_t src, size_t size, size_t dst_stride, size_t src_stride, size_t repeat) |
Start an asynchronous 2D DMA transfer with 64-bit wide pointers. | |
snrt_dma_txid_t | snrt_dma_start_2d (void *dst, const void *src, size_t size, size_t dst_stride, size_t src_stride, size_t repeat) |
Start an asynchronous 2D DMA transfer with native-size pointers. | |
snrt_dma_txid_t | snrt_dma_start_1d_channel_wideptr (uint64_t dst, uint64_t src, size_t size, uint32_t channel) |
Start an asynchronous 1D DMA transfer with 64-bit wide pointers on a specific channel. | |
snrt_dma_txid_t | snrt_dma_start_1d_channel (void *dst, const void *src, size_t size, uint32_t channel) |
Start an asynchronous 1D DMA transfer with native-size pointers on a specific channel. | |
snrt_dma_txid_t | snrt_dma_start_2d_channel_wideptr (uint64_t dst, uint64_t src, size_t size, size_t dst_stride, size_t src_stride, size_t repeat, uint32_t channel) |
Start an asynchronous 2D DMA transfer with 64-bit wide pointers on a specific channel. | |
snrt_dma_txid_t | snrt_dma_start_2d_channel (void *dst, const void *src, size_t size, size_t dst_stride, size_t src_stride, size_t repeat, uint32_t channel) |
Start an asynchronous 2D DMA transfer with native-size pointers on a specific channel. | |
void | snrt_dma_wait (snrt_dma_txid_t tid) |
Block until a DMA transfer finishes. | |
void | snrt_dma_wait_channel (snrt_dma_txid_t tid, uint32_t channel) |
Block until a DMA transfer finishes on a specific channel. | |
void | snrt_dma_wait_all () |
Block until all DMA operation ceases. | |
void | snrt_dma_wait_all_channel (uint32_t channel) |
Block until a specific DMA channel is idle. | |
void | snrt_dma_wait_all_channels (uint32_t num_channels) |
Block until the first num_channels channels are idle. | |
void | snrt_dma_start_tracking () |
Start tracking of dma performance region. Does not have any implications on the HW. Only injects a marker in the DMA traces that can be analyzed. | |
void | snrt_dma_stop_tracking () |
Stop tracking of dma performance region. Does not have any implications on the HW. Only injects a marker in the DMA traces that can be analyzed. | |
void | snrt_dma_memset (void *ptr, uint8_t value, uint32_t len) |
Fast memset function performed by DMA. | |
snrt_dma_txid_t | snrt_dma_load_1d_tile (void *dst, void *src, size_t tile_idx, size_t tile_size, uint32_t prec) |
Load a tile of a 1D array. | |
snrt_dma_txid_t | snrt_dma_store_1d_tile (void *dst, void *src, size_t tile_idx, size_t tile_size, uint32_t prec) |
Store a tile to a 1D array. | |
snrt_dma_txid_t | snrt_dma_load_2d_tile (void *dst, void *src, size_t tile_x1_idx, size_t tile_x0_idx, size_t tile_x1_size, size_t tile_x0_size, size_t full_x0_size, uint32_t prec) |
Load a 2D tile of a 2D array. | |
snrt_dma_txid_t | snrt_dma_store_2d_tile (void *dst, void *src, size_t tile_x1_idx, size_t tile_x0_idx, size_t tile_x1_size, size_t tile_x0_size, size_t full_x0_size, uint32_t prec) |
Store a 2D tile to a 2D array. | |
This file provides functions to program the Snitch DMA.
#define R_TYPE_ENCODE | ( | funct7, | |
rs2, | |||
rs1, | |||
funct3, | |||
rd, | |||
opcode ) |
|
inline |
Load a tile of a 1D array.
dst | Pointer to the tile destination. |
src | Pointer to the source array. |
tile_idx | Index of the tile in the 1D array. |
tile_size | Number of elements within a tile of the 1D array. |
prec | Number of bytes of each element in the 1D array. |
|
inline |
Load a 2D tile of a 2D array.
dst | Pointer to the tile destination. |
src | Pointer to the source array. |
tile_x1_idx | Outermost coordinate of the tile in the 2D array. |
tile_x0_idx | Innermost coordinate of the tile in the 2D array. |
tile_x1_size | Number of elements in the outermost dimension of the tile. |
tile_x0_size | Number of elements in the innermost dimension of the tile. |
full_x0_size | Number of elements in the innermost dimension of the array. |
prec | Number of bytes of each element in the 2D array. |
|
inline |
Fast memset function performed by DMA.
ptr | Pointer to the start of the region. |
value | Value to set. |
len | Number of bytes, must be a multiple of the DMA bus width. |
|
inline |
Start an asynchronous 1D DMA transfer with native-size pointers.
dst | The destination pointer. |
src | The source pointer. |
size | The size of the transfer in bytes. |
|
inline |
Start an asynchronous 1D DMA transfer with native-size pointers on a specific channel.
dst | The destination pointer. |
src | The source pointer. |
size | The size of the transfer in bytes. |
channel | The index of the channel. |
|
inline |
Start an asynchronous 1D DMA transfer with 64-bit wide pointers on a specific channel.
dst | The destination address. |
src | The source address. |
size | The size of the transfer in bytes. |
channel | The index of the channel. |
|
inline |
Start an asynchronous 1D DMA transfer with 64-bit wide pointers.
dst | The destination address. |
src | The source address. |
size | The size of the transfer in bytes. |
|
inline |
Start an asynchronous 2D DMA transfer with native-size pointers.
dst | The destination address. |
src | The source address. |
size | The size of every 1D transfer within the 2D transfer in bytes. |
dst_stride | The offset between consecutive 1D transfers at the destination, in bytes. |
src_stride | The offset between consecutive 1D transfers at the source, in bytes. |
repeat | The number of 1D transfers composing the 2D transfer. |
|
inline |
Start an asynchronous 2D DMA transfer with native-size pointers on a specific channel.
dst | The destination address. |
src | The source address. |
size | The size of every 1D transfer within the 2D transfer in bytes. |
dst_stride | The offset between consecutive 1D transfers at the destination, in bytes. |
src_stride | The offset between consecutive 1D transfers at the source, in bytes. |
repeat | The number of 1D transfers composing the 2D transfer. |
channel | The index of the channel. |
|
inline |
Start an asynchronous 2D DMA transfer with 64-bit wide pointers on a specific channel.
dst | The destination address. |
src | The source address. |
size | The size of every 1D transfer within the 2D transfer in bytes. |
dst_stride | The offset between consecutive 1D transfers at the destination, in bytes. |
src_stride | The offset between consecutive 1D transfers at the source, in bytes. |
repeat | The number of 1D transfers composing the 2D transfer. |
channel | The index of the channel. |
|
inline |
Start an asynchronous 2D DMA transfer with 64-bit wide pointers.
dst | The destination address. |
src | The source address. |
size | The size of every 1D transfer within the 2D transfer in bytes. |
dst_stride | The offset between consecutive 1D transfers at the destination, in bytes. |
src_stride | The offset between consecutive 1D transfers at the source, in bytes. |
repeat | The number of 1D transfers composing the 2D transfer. |
|
inline |
Start tracking of dma performance region. Does not have any implications on the HW. Only injects a marker in the DMA traces that can be analyzed.
|
inline |
Stop tracking of dma performance region. Does not have any implications on the HW. Only injects a marker in the DMA traces that can be analyzed.
|
inline |
Store a tile to a 1D array.
dst | Pointer to the destination array. |
src | Pointer to the source tile. |
tile_idx | Index of the tile in the 1D array. |
tile_size | Number of elements within a tile of the 1D array. |
prec | Number of bytes of each element in the 1D array. |
|
inline |
Store a 2D tile to a 2D array.
dst | Pointer to the destination array. |
src | Pointer to the source tile. |
tile_x1_idx | Outermost coordinate of the tile in the 2D array. |
tile_x0_idx | Innermost coordinate of the tile in the 2D array. |
tile_x1_size | Number of elements in the outermost dimension of the tile. |
tile_x0_size | Number of elements in the innermost dimension of the tile. |
full_x0_size | Number of elements in the innermost dimension of the array. |
prec | Number of bytes of each element in the 2D array. |
|
inline |
Block until a DMA transfer finishes.
dst | The DMA transfer ID. |
|
inline |
Block until a specific DMA channel is idle.
channel | The index of the channel. |
|
inline |
Block until the first num_channels
channels are idle.
num_channels | The number of channels to wait on. |
|
inline |
Block until a DMA transfer finishes on a specific channel.
dst | The DMA transfer ID. |