From 788f425c19afbcc0a593d8b057069854e8cc7da6 Mon Sep 17 00:00:00 2001 From: Sergio Mazzola Date: Thu, 15 Aug 2024 18:52:21 +0200 Subject: [PATCH] Makefile: Improve sim makefile flow --- Makefile | 15 ++++++++------- chimera.mk | 8 +++----- target/sim/sim.mk | 25 +++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 target/sim/sim.mk diff --git a/Makefile b/Makefile index 5f6bcac..1de31c1 100644 --- a/Makefile +++ b/Makefile @@ -4,16 +4,17 @@ # # Moritz Scherer -CHIM_ROOT ?= $(shell pwd) -BENDER ?= bender -d $(CHIM_ROOT) +CHIM_ROOT ?= $(shell pwd) +BENDER ?= bender -d $(CHIM_ROOT) + +CHS_ROOT ?= $(shell $(BENDER) path cheshire) +SNITCH_ROOT ?= $(shell $(BENDER) path snitch_cluster) +IDMA_ROOT ?= $(shell $(BENDER) path idma) -CHS_ROOT ?= $(shell $(BENDER) path cheshire) -SNITCH_ROOT ?= $(shell $(BENDER) path snitch_cluster) -IDMA_ROOT ?= $(shell $(BENDER) path idma) CHS_XLEN ?= 32 -CHIM_HW_DIR ?= $(CHIM_ROOT)/hw -CHIM_SW_DIR ?= $(CHIM_ROOT)/sw +CHIM_HW_DIR ?= $(CHIM_ROOT)/hw +CHIM_SW_DIR ?= $(CHIM_ROOT)/sw -include $(CHS_ROOT)/cheshire.mk -include $(CHIM_ROOT)/chimera.mk diff --git a/chimera.mk b/chimera.mk index 47d923f..2b2ec53 100644 --- a/chimera.mk +++ b/chimera.mk @@ -71,11 +71,9 @@ chim-nonfree-init: -include $(CHIM_NONFREE_DIR)/nonfree.mk - -include $(CHIM_ROOT)/bender.mk - --include $(CHIM_ROOT)/sim.mk - # Include subdir Makefiles --include $(CHIM_ROOT)/sw/sw.mk -include $(CHIM_ROOT)/utils/utils.mk +-include $(CHIM_ROOT)/sw/sw.mk +# Include target makefiles +-include $(CHIM_ROOT)/target/sim/sim.mk diff --git a/target/sim/sim.mk b/target/sim/sim.mk new file mode 100644 index 0000000..a210b50 --- /dev/null +++ b/target/sim/sim.mk @@ -0,0 +1,25 @@ +# Copyright 2024 ETH Zurich and University of Bologna. +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 +# +# Moritz Scherer + +ifndef sim_mk +sim_mk=1 + +CHIM_SIM_DIR ?= $(CHIM_ROOT)/target/sim + +.PHONY: sim sim-clean + +chim-sim-clean: + @rm -rf $(CHIM_SIM_DIR)/vsim/work + @rm -rf $(CHIM_SIM_DIR)/vsim/transcript + @rm -f $(CHIM_SIM_DIR)/vsim/compile.tcl + +chim-sim: $(CHIM_SIM_DIR)/vsim/compile.tcl + +$(CHIM_SIM_DIR)/vsim/compile.tcl: chs-hw-init snitch-hw-init + @bender script vsim $(COMMON_TARGS) $(SIM_TARGS) --vlog-arg="$(VLOG_ARGS)"> $@ + echo 'vlog "$(realpath $(CHS_ROOT))/target/sim/src/elfloader.cpp" -ccflags "-std=c++11"' >> $@ + +endif # sim_mk