Skip to content

Commit

Permalink
Makefile: Improve sim makefile flow
Browse files Browse the repository at this point in the history
  • Loading branch information
sermazz committed Aug 16, 2024
1 parent 019021e commit 788f425
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
#
# Moritz Scherer <scheremo@iis.ee.ethz.ch>

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
8 changes: 3 additions & 5 deletions chimera.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 25 additions & 0 deletions target/sim/sim.mk
Original file line number Diff line number Diff line change
@@ -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 <scheremo@iis.ee.ethz.ch>

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

0 comments on commit 788f425

Please sign in to comment.