firesim/sim/Makefile

76 lines
2.3 KiB
Makefile
Raw Normal View History

ifndef FIRESIM_ENV_SOURCED
$(error You must source sourceme-f1-manager.sh or env.sh to use this Makefile)
endif
firesim_base_dir := $(abspath .)
default: compile
##################
# Parameters #
##################
2018-08-27 11:22:37 +08:00
# Multiple target-projects, each with it's own chisel generator, co-exist in firesim.
# Their sources exist in:
# src/main/{cc, scala, makefrag}/<target-project-name>
#
# Currently these projects are:
2018-08-27 11:22:37 +08:00
# firesim: the default, rocket-chip-based target-designs
# midasexamples: simple chisel designs demonstrating how to build midas-style simulators
TARGET_PROJECT ?= firesim
2018-08-27 11:22:37 +08:00
# Users can override this to point at a makefrag defined in a parent project
# that submodules firesim or source sim/Makefrag directly
TARGET_PROJECT_MAKEFRAG ?= $(firesim_base_dir)/src/main/makefrag/$(TARGET_PROJECT)/Makefrag
# The host-platform type (currently only f1 supported)
PLATFORM ?= f1
ifdef FIRESIM_STANDALONE
base_dir := $(firesim_base_dir)
chipyard_dir := $(firesim_base_dir)/target-rtl/chipyard
rocketchip_dir := $(chipyard_dir)/generators/rocket-chip
2019-01-26 03:42:11 +08:00
JVM_MEMORY ?= 16G
2019-07-11 02:39:36 +08:00
SCALA_VERSION ?= 2.12.4
2019-07-20 00:53:47 +08:00
JAVA_ARGS ?= -Xmx$(JVM_MEMORY)
2019-07-11 08:00:35 +08:00
SBT ?= java $(JAVA_ARGS) -jar $(rocketchip_dir)/sbt-launch.jar ++$(SCALA_VERSION)
2018-09-24 07:22:25 +08:00
# Manage the FIRRTL dependency manually
2019-06-28 13:11:06 +08:00
FIRRTL_SUBMODULE_DIR ?= $(firesim_base_dir)/target-rtl/chipyard/tools/firrtl
FIRRTL_JAR ?= $(firesim_base_dir)/target-rtl/chipyard/lib/firrtl.jar
$(FIRRTL_JAR): $(shell find $(FIRRTL_SUBMODULE_DIR)/src/main/scala -iname "*.scala")
2019-07-11 02:39:36 +08:00
$(MAKE) -C $(FIRRTL_SUBMODULE_DIR) SBT="$(SBT)" root_dir=$(FIRRTL_SUBMODULE_DIR) build-scala
touch $(FIRRTL_SUBMODULE_DIR)/utils/bin/firrtl.jar
mkdir -p $(@D)
cp -p $(FIRRTL_SUBMODULE_DIR)/utils/bin/firrtl.jar $@
firrtl: $(FIRRTL_JAR)
.PHONY: firrtl
else
# REBAR make variables
base_dir := $(abspath ../../..)
sim_dir := $(firesim_base_dir)
chipyard_dir := $(base_dir)
include $(base_dir)/variables.mk
include $(base_dir)/common.mk
endif
2018-08-27 11:22:37 +08:00
# Include target-specific sources and input generation recipes
2018-08-27 11:22:37 +08:00
include $(TARGET_PROJECT_MAKEFRAG)
verilog: $(VERILOG)
compile: $(VERILOG)
# Phony targets for launching the sbt shell and running scalatests
sbt: $(FIRRTL_JAR)
cd $(base_dir) && $(SBT) "project $(firesim_sbt_project)" "shell"
test: $(FIRRTL_JAR)
cd $(base_dir) && $(SBT) "project $(firesim_sbt_project)" "test"
# All target-agnostic firesim recipes are defined here
include target-agnostic.mk