Skip to content

Commit 0ae2022

Browse files
committed
sw: Generate multicast macros from configuration
1 parent a1eca96 commit 0ae2022

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

sw/snRuntime/src/sync.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include <math.h>
1818

19+
#define SNRT_BROADCAST_MASK ((SNRT_CLUSTER_NUM - 1) * SNRT_CLUSTER_OFFSET)
20+
1921
//================================================================================
2022
// Mutex functions
2123
//================================================================================
@@ -76,7 +78,7 @@ inline void snrt_mutex_release(volatile uint32_t *pmtx) {
7678
//================================================================================
7779

7880
inline void snrt_wake_all(uint32_t core_mask) {
79-
#ifdef SUPPORTS_MULTICAST
81+
#ifdef SNRT_SUPPORTS_MULTICAST
8082
// Multicast cluster interrupt to every other cluster's core
8183
// Note: we need to address another cluster's address space
8284
// because the cluster XBAR has not been extended to support
@@ -85,7 +87,7 @@ inline void snrt_wake_all(uint32_t core_mask) {
8587
uintptr_t addr = (uintptr_t)snrt_cluster_clint_set_ptr() -
8688
SNRT_CLUSTER_OFFSET * snrt_cluster_idx();
8789
if (snrt_cluster_idx() == 0) addr += SNRT_CLUSTER_OFFSET;
88-
snrt_enable_multicast(BCAST_MASK_ALL);
90+
snrt_enable_multicast(SNRT_BROADCAST_MASK);
8991
*((uint32_t *)addr) = core_mask;
9092
snrt_disable_multicast();
9193
#else

target/snitch_cluster/sw/runtime/common/snitch_cluster_cfg.h.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
#define SNRT_TCDM_SIZE (CLUSTER_BOOTROM_BASE_ADDR - CLUSTER_TCDM_BASE_ADDR)
1313
#define SNRT_CLUSTER_OFFSET ${cfg['cluster']['cluster_base_offset']}
1414

15+
#define SNRT_SUPPORTS_MULTICAST ${cfg['cluster']['enable_multicast']}
16+
1517
// Software configuration
1618
#define SNRT_LOG2_STACK_SIZE 10

target/snitch_cluster/sw/runtime/rtl/src/snrt.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include <stddef.h>
88
#include <stdint.h>
99

10-
#define SUPPORTS_MULTICAST
11-
#define BCAST_MASK_ALL 0x000C0000
1210
// Forward declarations
1311
#include "alloc_decls.h"
1412
#include "cls_decls.h"

0 commit comments

Comments
 (0)