From d6996dff6863488a649a0f335a6141801b8f8f4e Mon Sep 17 00:00:00 2001 From: Tim Fischer Date: Wed, 17 Jan 2024 10:42:28 +0100 Subject: [PATCH] runtime: Generate defines from configuration --- target/snitch_cluster/Makefile | 3 ++- .../runtime/common/snitch_cluster_defs.h.tpl | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 target/snitch_cluster/sw/runtime/common/snitch_cluster_defs.h.tpl diff --git a/target/snitch_cluster/Makefile b/target/snitch_cluster/Makefile index 037621213..d3fe51bd1 100644 --- a/target/snitch_cluster/Makefile +++ b/target/snitch_cluster/Makefile @@ -152,7 +152,8 @@ test/bootrom.elf test/bootrom.dump test/bootrom.bin: test/bootrom.S test/bootrom ############ CLUSTER_GEN_HEADERS = snitch_cluster_cfg.h \ - snitch_cluster_addrmap.h + snitch_cluster_addrmap.h \ + snitch_cluster_defs.h REGGEN_HEADERS = snitch_cluster_peripheral.h diff --git a/target/snitch_cluster/sw/runtime/common/snitch_cluster_defs.h.tpl b/target/snitch_cluster/sw/runtime/common/snitch_cluster_defs.h.tpl new file mode 100644 index 000000000..4e422b84f --- /dev/null +++ b/target/snitch_cluster/sw/runtime/common/snitch_cluster_defs.h.tpl @@ -0,0 +1,21 @@ +// Copyright 2023 ETH Zurich and University of Bologna. +// Licensed under the Apache License, Version 2.0, see LICENSE for details. +// SPDX-License-Identifier: Apache-2.0 + +#include "snitch_cluster_addrmap.h" +#include "snitch_cluster_cfg.h" +#include "snitch_cluster_peripheral.h" + +// Hardware parameters +#define SNRT_BASE_HARTID CFG_CLUSTER_BASE_HARTID +#define SNRT_CLUSTER_CORE_NUM CFG_CLUSTER_NR_CORES +#define SNRT_CLUSTER_NUM ${cfg['nr_s1_quadrant'] * cfg['s1_quadrant']['nr_clusters']} +#define SNRT_CLUSTER_DM_CORE_NUM 1 +#define SNRT_TCDM_START_ADDR CLUSTER_TCDM_BASE_ADDR +#define SNRT_TCDM_SIZE (CLUSTER_PERIPH_BASE_ADDR - CLUSTER_TCDM_BASE_ADDR) +#define SNRT_CLUSTER_OFFSET ${cfg['cluster']['cluster_base_offset']} +#define SNRT_CLUSTER_HW_BARRIER_ADDR \ + (CLUSTER_PERIPH_BASE_ADDR + SNITCH_CLUSTER_PERIPHERAL_HW_BARRIER_REG_OFFSET) + +// Software configuration +#define SNRT_LOG2_STACK_SIZE 10