Device API Reference

Snitch Cluster

void snrt_init()
void snrt_exit(int exit_code)
void snrt_printf_init()
int snrt_printf_log(const char *fmt, ...)
int snrt_printf(const char *fmt, ...)
void trampoline()

Trampoline function for the cluster core. This function will set up the stack pointer and call the offloaded function.

Stack pointer, function pointer, and argument are read from the shared_data struct in the .common section (shared between host and device).

Warning

Make sure that this function is compiled with ISA for the Snitch cores (RV32IM).

printf
SNRT_CLUSTER_L1_ZERO(decl)

Places a zero-initialized declaration into the L1 memory of each cluster. Every cluster receives its own copy.

SNRT_CLUSTER_L1_COPY(decl)

Places an initialized declaration into the L1 memory of each cluster. Each cluster receives its own copy.

SNRT_CLUSTER_L1(decl, cluster_id)

Places a initialized declaration into the L1 memory of a specific cluster.

_SETUP_GP()

Setup the core to a known state.

This function will set up the global pointer and thread pointer for the core.

__CLUSTER_ID_ASM

Calculate the cluster ID from mhartid and set busy flag.

Note

This is a string fragment intended to be used inside an asm volatile block. It reqires the following operands: %0: Base address of the busy register for cluster 0 %1: Threshold for cluster 1 %2: Threshold for cluster 2 %3: Threshold for cluster 3 %4: Threshold for cluster 4

_SET_CLUSTER_BUSY()

Calculate the cluster ID from mhartid and set the busy flag.

Note

This is a naked-friendly macro intended to be used inside an asm volatile block.

_CLEAR_CLUSTER_BUSY()

Compute cluster id from mhartid and clear busy.

Note

This is a naked-friendly macro intended to be used inside an asm volatile block.