|
Snitch Runtime
|
This file provides functions to program the Snitch DMA. More...
#include <math.h>Go to the source code of this file.
Typedefs | |
| typedef uint32_t | snrt_dma_txid_t |
| A DMA transfer identifier. | |
Functions | |
| static uint32_t | snrt_dma_start_1d (uint64_t dst, uint64_t src, size_t size, const uint32_t channel=0) |
| Start an asynchronous 1D DMA transfer with 64-bit wide pointers on a specific DMA channel. | |
| static uint32_t | snrt_dma_start_1d (volatile void *dst, volatile void *src, size_t size, const uint32_t channel=0) |
| Start an asynchronous 1D DMA transfer using native-size pointers. | |
| void | snrt_dma_enable_mcast (uint32_t mask) |
| Enable multicast for successive transfers. | |
| void | snrt_dma_disable_mcast () |
| Disable multicast for successive transfers. | |
| static uint32_t | snrt_dma_start_1d_mcast (uint64_t dst, uint64_t src, size_t size, uint32_t mask, const uint32_t channel=0) |
| Start an asynchronous multicast 1D DMA transfer with 64-bit wide pointers. | |
| static uint32_t | snrt_dma_start_1d_mcast (volatile void *dst, volatile void *src, size_t size, uint32_t mask, const uint32_t channel=0) |
| Start an asynchronous multicast 1D DMA transfer using native-size pointers. | |
| static snrt_dma_txid_t | snrt_dma_start_2d (uint64_t dst, uint64_t src, size_t size, size_t dst_stride, size_t src_stride, size_t repeat, const uint32_t channel=0) |
| Start an asynchronous 2D DMA transfer with 64-bit wide pointers. | |
| static uint32_t | snrt_dma_start_2d (volatile void *dst, volatile void *src, size_t size, size_t dst_stride, size_t src_stride, size_t repeat, const uint32_t channel=0) |
| Start an asynchronous 2D DMA transfer using native-size pointers. | |
| static uint32_t | snrt_dma_start_2d_mcast (uint64_t dst, uint64_t src, size_t size, size_t dst_stride, size_t src_stride, size_t repeat, uint32_t mask, const uint32_t channel=0) |
| Start an asynchronous, multicast 2D DMA transfer with 64-bit wide pointers. | |
| static uint32_t | snrt_dma_start_2d_mcast (volatile void *dst, volatile void *src, size_t size, size_t dst_stride, size_t src_stride, size_t repeat, uint32_t mask, const uint32_t channel=0) |
| Start an asynchronous, multicast 2D DMA transfer using native-size pointers. | |
| static void | snrt_dma_wait (snrt_dma_txid_t txid, const uint32_t channel=0) |
| Block until a DMA transfer finishes on a specific DMA channel. | |
| static void | snrt_dma_wait_all (const uint32_t channel=0) |
| 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 (volatile void *dst, volatile 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_load_1d_tile_mcast (void *dst, void *src, size_t tile_idx, size_t tile_size, uint32_t prec, uint32_t mcast) |
| Load a tile of a 1D array. | |
| snrt_dma_txid_t | snrt_dma_1d_to_2d (volatile void *dst, volatile void *src, size_t size, size_t row_size, size_t stride) |
| Transfer and reshape a 1D array into a 2D array. | |
| snrt_dma_txid_t | snrt_dma_2d_to_1d (volatile void *dst, volatile void *src, size_t size, size_t row_size, size_t stride) |
| Transfer and reshape a 2D array into 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, size_t tile_ld) |
| Load a 2D tile of a 2D 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_load_2d_tile_mcast (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, size_t tile_ld, uint32_t mask) |
| Load a 2D tile of a 2D array using multicast. | |
| snrt_dma_txid_t | snrt_dma_load_2d_tile_mcast (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, uint32_t mask) |
| Load a 2D tile of a 2D array. | |
| snrt_dma_txid_t | snrt_dma_load_2d_tile_in_banks (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, size_t num_banks) |
| Load a 2D tile of a 2D array and reshape it to occupy a subset of TCDM banks. | |
| 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, size_t tile_ld) |
| Store a 2D tile to 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 of a 2D array. | |
| snrt_dma_txid_t | snrt_dma_store_2d_tile_from_banks (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, size_t num_banks) |
| Store a 2D tile of a 2D array from a 1D layout occupying a subset of TCDM banks. | |
This file provides functions to program the Snitch DMA.
|
inline |
Transfer and reshape a 1D array into a 2D array.
| dst | Pointer to the destination array. |
| src | Pointer to the source array. |
| size | Number of bytes to transfer. |
| row_size | Size of a row in the 2D array, in bytes. |
| stride | Stride between successive rows in the 2D array, in bytes. |
|
inline |
Transfer and reshape a 2D array into a 1D array.
| dst | Pointer to the destination array. |
| src | Pointer to the source array. |
| size | Number of bytes to transfer. |
| row_size | Size of a row in the 2D array, in bytes. |
| stride | Stride between successive rows in the 2D array, in bytes. |
|
inline |
Disable multicast for successive transfers.
Resets the multicast mask to zero.
|
inline |
Enable multicast for successive transfers.
| mask | Multicast mask applied to successive transfers. |
|
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 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. |
| mcast | Multicast mask applied on the destination address. |
|
inline |
Load a 2D tile of a 2D array.
The stride in the destination tile is assumed to be that of a 1D tile, effectively. In other words, this is the same as snrt_dma_2d_to_1d().
|
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. |
| tile_ld | Leading dimension of the tile, in bytes. |
|
inline |
Load a 2D tile of a 2D array and reshape it to occupy a subset of TCDM banks.
| 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. |
| num_banks | Number of banks to reshape the tile into. |
|
inline |
Load a 2D tile of a 2D array using multicast.
| mask | Multicast mask. |
|
inline |
Load a 2D tile of a 2D array.
The stride in the destination tile is assumed to be that of a 1D tile, effectively. In other words, this is similar to snrt_dma_2d_to_1d().
|
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 to use the DMA. |
|
inlinestatic |
Start an asynchronous 1D DMA transfer with 64-bit wide pointers on a specific DMA channel.
| dst | The destination address. |
| src | The source address. |
| size | The size of the transfer in bytes. |
| channel | The index of the channel. |
channel argument as an immediate, thus this must be known at compile time. As a consequence, the function must use internal linkage (static keyword) and must be always inlined. This is true also for all functions invoking this function, and passing down an argument to channel.
|
inlinestatic |
Start an asynchronous 1D DMA transfer using native-size pointers.
This is a convenience overload of snrt_dma_start_1d(uint64_t, uint64_t, size_t, uint32_t) using void* pointers.
|
inlinestatic |
Start an asynchronous multicast 1D DMA transfer with 64-bit wide pointers.
| mask | Multicast mask applied on the destination address. |
|
inlinestatic |
Start an asynchronous multicast 1D DMA transfer using native-size pointers.
This is a convenience overload of snrt_dma_start_1d_mcast(uint64_t, uint64_t, size_t, uint32_t, uint32_t) using void* pointers.
|
inlinestatic |
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. |
| channel | The index of the channel. |
channel argument as an immediate, thus this must be known at compile time. As a consequence, the function must use internal linkage (static keyword) and must be always inlined. This is true also for all functions invoking this function, and passing down an argument to channel.
|
inlinestatic |
Start an asynchronous 2D DMA transfer using native-size pointers.
This is a convenience overload of snrt_dma_start_2d(uint64_t, uint64_t, size_t, size_t, size_t, size_t, uint32_t) using void* pointers.
|
inlinestatic |
Start an asynchronous, multicast 2D DMA transfer with 64-bit wide pointers.
| mask | Multicast mask. |
|
inlinestatic |
Start an asynchronous, multicast 2D DMA transfer using native-size pointers.
This is a convenience overload of snrt_dma_start_2d_mcast(uint64_t, uint64_t, size_t, size_t, size_t, size_t, uint32_t, uint32_t) using void* pointers.
|
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 of a 2D array.
The stride in the source tile is assumed to be that of a 1D tile, effectively. In other words, this is the same as snrt_dma_1d_to_2d().
|
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. |
| tile_ld | Leading dimension of the tile, in bytes. |
|
inline |
Store a 2D tile of a 2D array from a 1D layout occupying a subset of TCDM banks.
| 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. |
| num_banks | Number of banks the tile is stored in. |
|
inlinestatic |
Block until a DMA transfer finishes on a specific DMA channel.
| txid | The DMA transfer's ID. |
| channel | The index of the channel. |
channel argument as an immediate, thus this must be known at compile time. As a consequence, the function must use internal linkage (static keyword) and must be always inlined. This is true also for all functions invoking this function, and passing down an argument to channel.
|
inlinestatic |
Block until a specific DMA channel is idle.
| channel | The index of the channel. |
channel argument as an immediate, thus this must be known at compile time. As a consequence, the function must use internal linkage (static keyword) and must be always inlined. This is true also for all functions invoking this function, and passing down an argument to channel.
|
inline |
Block until the first num_channels channels are idle.
| num_channels | The number of channels to wait on. |