Snitch Runtime
Loading...
Searching...
No Matches
team.h
Go to the documentation of this file.
1// Copyright 2023 ETH Zurich and University of Bologna.
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
16#pragma once
17
23inline uint32_t __attribute__((const)) snrt_hartid() {
24 uint32_t hartid;
25 asm("csrr %0, mhartid" : "=r"(hartid));
26 return hartid;
27}
28
34inline uint32_t __attribute__((const)) snrt_cluster_num() {
35 return SNRT_CLUSTER_NUM;
36}
37
43inline uint32_t __attribute__((const)) snrt_cluster_core_num() {
44 return SNRT_CLUSTER_CORE_NUM;
45}
46
52inline uint32_t __attribute__((const)) snrt_global_core_base_hartid() {
53 return SNRT_BASE_HARTID;
54}
55
61inline uint32_t __attribute__((const)) snrt_global_core_num() {
63}
64
70inline uint32_t __attribute__((const)) snrt_global_compute_core_num() {
72}
73
79inline uint32_t __attribute__((const)) snrt_global_core_idx() {
81}
82
88inline uint32_t __attribute__((const)) snrt_global_compute_core_idx() {
91}
92
98inline uint32_t __attribute__((const)) snrt_cluster_idx() {
100}
101
107inline uint32_t __attribute__((const)) snrt_cluster_core_idx() {
109}
110
116inline uint32_t __attribute__((const)) snrt_cluster_dm_core_num() {
117 return SNRT_CLUSTER_DM_CORE_NUM;
118}
119
125inline uint32_t __attribute__((const)) snrt_cluster_compute_core_num() {
127}
128
134inline int __attribute__((const)) snrt_is_compute_core() {
136}
137
143inline int __attribute__((const)) snrt_cluster_is_last_compute_core() {
145}
146
152inline int __attribute__((const)) snrt_is_dm_core() {
153 return !snrt_is_compute_core();
154}
int snrt_is_dm_core()
Check if the current core is a data mover (DM) core.
Definition team.h:152
uint32_t snrt_cluster_num()
Get the number of Snitch clusters in the system.
Definition team.h:34
uint32_t snrt_global_core_base_hartid()
Get the hartid of the first Snitch core in the system.
Definition team.h:52
uint32_t snrt_global_compute_core_idx()
Get the index of the current Snitch compute core in the system.
Definition team.h:88
uint32_t snrt_global_core_idx()
Get the index (!= hartid) of the current Snitch core in the system.
Definition team.h:79
uint32_t snrt_cluster_dm_core_num()
Get the number of data mover (DM) cores per cluster.
Definition team.h:116
int snrt_is_compute_core()
Check if the current core is a compute core.
Definition team.h:134
uint32_t snrt_global_core_num()
Get the total number of Snitch cores in the system.
Definition team.h:61
uint32_t snrt_hartid()
Get the RISC-V hardware thread ID (hartid).
Definition team.h:23
uint32_t snrt_cluster_core_idx()
Get the index of the current Snitch core within the cluster.
Definition team.h:107
uint32_t snrt_cluster_core_num()
Get the number of cores per cluster.
Definition team.h:43
uint32_t snrt_global_compute_core_num()
Get the total number of Snitch compute cores in the system.
Definition team.h:70
uint32_t snrt_cluster_compute_core_num()
Get the number of compute cores per cluster.
Definition team.h:125
int snrt_cluster_is_last_compute_core()
Check if the current core is the last compute core in the cluster.
Definition team.h:143
uint32_t snrt_cluster_idx()
Get the index of the current Snitch cluster in the system.
Definition team.h:98