2019-05-28 06:49:44 +08:00
|
|
|
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
|
|
|
|
|
2018-05-14 03:40:34 +08:00
|
|
|
##################
|
|
|
|
# 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>
|
2018-08-08 12:51:24 +08:00
|
|
|
#
|
|
|
|
# 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-05-14 03:40:34 +08:00
|
|
|
|
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
|
2019-05-28 06:49:44 +08:00
|
|
|
TARGET_PROJECT_MAKEFRAG ?= $(firesim_base_dir)/src/main/makefrag/$(TARGET_PROJECT)/Makefrag
|
2018-08-26 03:49:11 +08:00
|
|
|
|
2019-05-28 06:49:44 +08:00
|
|
|
# The host-platform type (currently only f1 supported)
|
|
|
|
PLATFORM ?= f1
|
|
|
|
|
|
|
|
ifdef FIRESIM_STANDALONE
|
|
|
|
|
|
|
|
base_dir := $(firesim_base_dir)
|
2019-07-13 06:50:15 +08:00
|
|
|
chipyard_dir := $(firesim_base_dir)/target-rtl/chipyard
|
|
|
|
rocketchip_dir := $(chipyard_dir)/generators/rocket-chip
|
2018-05-14 03:40:34 +08:00
|
|
|
|
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
|
|
|
|
2018-11-28 04:40:59 +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
|
2018-11-28 04:40:59 +08:00
|
|
|
$(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
|
2019-05-28 06:49:44 +08:00
|
|
|
touch $(FIRRTL_SUBMODULE_DIR)/utils/bin/firrtl.jar
|
|
|
|
mkdir -p $(@D)
|
|
|
|
cp -p $(FIRRTL_SUBMODULE_DIR)/utils/bin/firrtl.jar $@
|
2018-11-28 04:40:59 +08:00
|
|
|
|
|
|
|
firrtl: $(FIRRTL_JAR)
|
|
|
|
.PHONY: firrtl
|
|
|
|
|
2019-05-28 06:49:44 +08:00
|
|
|
else
|
|
|
|
# REBAR make variables
|
|
|
|
base_dir := $(abspath ../../..)
|
|
|
|
sim_dir := $(firesim_base_dir)
|
2019-07-13 06:50:15 +08:00
|
|
|
chipyard_dir := $(base_dir)
|
2019-05-28 06:49:44 +08:00
|
|
|
include $(base_dir)/variables.mk
|
|
|
|
include $(base_dir)/common.mk
|
|
|
|
endif
|
2018-08-27 11:22:37 +08:00
|
|
|
|
2018-08-08 12:51:24 +08:00
|
|
|
# Include target-specific sources and input generation recipes
|
2018-08-27 11:22:37 +08:00
|
|
|
include $(TARGET_PROJECT_MAKEFRAG)
|
2018-05-14 03:40:34 +08:00
|
|
|
|
2018-08-08 12:51:24 +08:00
|
|
|
verilog: $(VERILOG)
|
|
|
|
compile: $(VERILOG)
|
2018-05-14 03:40:34 +08:00
|
|
|
|
2019-05-28 06:49:44 +08:00
|
|
|
# Phony targets for launching the sbt shell and running scalatests
|
|
|
|
sbt: $(FIRRTL_JAR)
|
2019-07-22 07:48:18 +08:00
|
|
|
cd $(base_dir) && $(SBT) "project $(firesim_sbt_project)" "shell"
|
2019-05-28 06:49:44 +08:00
|
|
|
test: $(FIRRTL_JAR)
|
2019-07-22 07:48:18 +08:00
|
|
|
cd $(base_dir) && $(SBT) "project $(firesim_sbt_project)" "test"
|
2019-05-28 06:49:44 +08:00
|
|
|
|
2018-08-08 12:51:24 +08:00
|
|
|
# All target-agnostic firesim recipes are defined here
|
2019-05-28 06:49:44 +08:00
|
|
|
include target-agnostic.mk
|
2018-05-14 03:40:34 +08:00
|
|
|
|