hqjenny-chipyard/variables.mk

179 lines
7.8 KiB
Makefile
Raw Normal View History

2019-03-09 08:23:35 +08:00
#########################################################################################
# makefile variables shared across multiple makefiles
#########################################################################################
#########################################################################################
# variables to invoke the generator
2019-03-09 08:23:35 +08:00
# descriptions:
# SBT_PROJECT = the SBT project that you should find the classes/packages in
2019-04-23 13:36:04 +08:00
# MODEL = the top level module of the project in Chisel (normally the harness)
# VLOG_MODEL = the top level module of the project in Firrtl/Verilog (normally the harness)
# MODEL_PACKAGE = the scala package to find the MODEL in
2019-03-09 08:23:35 +08:00
# CONFIG = the configuration class to give the parameters for the project
# CONFIG_PACKAGE = the scala package to find the CONFIG class
# GENERATOR_PACKAGE = the scala package to find the Generator class in
# TB = wrapper over the TestHarness needed to simulate in a verilog simulator
# TOP = top level module of the project (normally the module instantiated by the harness)
#
# project specific:
# SUB_PROJECT = use the specific subproject default variables
2019-03-09 08:23:35 +08:00
#########################################################################################
#########################################################################################
# subproject overrides
# description:
# - make it so that you only change 1 param to change most or all of them!
# - mainly intended for quick developer setup for common flags
#########################################################################################
SUB_PROJECT ?= example
ifeq ($(SUB_PROJECT),example)
SBT_PROJECT ?= example
MODEL ?= BoomRocketTestHarness
VLOG_MODEL ?= TestHarness
MODEL_PACKAGE ?= $(SBT_PROJECT)
CONFIG ?= DefaultRocketConfig
CONFIG_PACKAGE ?= $(SBT_PROJECT)
GENERATOR_PACKAGE ?= $(SBT_PROJECT)
TB ?= TestDriver
TOP ?= BoomRocketTop
endif
# for BOOM developers
ifeq ($(SUB_PROJECT),boom)
SBT_PROJECT ?= boom
MODEL ?= TestHarness
VLOG_MODEL ?= TestHarness
MODEL_PACKAGE ?= boom.system
2019-07-02 02:57:29 +08:00
CONFIG ?= LargeBoomConfig
CONFIG_PACKAGE ?= boom.system
GENERATOR_PACKAGE ?= boom.system
TB ?= TestDriver
2019-06-13 05:54:49 +08:00
TOP ?= BoomRocketSystem
endif
2019-04-24 07:20:23 +08:00
# for Rocket-chip developers
2019-04-24 02:50:36 +08:00
ifeq ($(SUB_PROJECT),rocketchip)
SBT_PROJECT ?= rocketchip
MODEL ?= TestHarness
VLOG_MODEL ?= TestHarness
MODEL_PACKAGE ?= freechips.rocketchip.system
CONFIG ?= DefaultConfig
CONFIG_PACKAGE ?= freechips.rocketchip.system
GENERATOR_PACKAGE ?= freechips.rocketchip.system
TB ?= TestDriver
TOP ?= ExampleRocketSystem
2019-04-24 02:50:36 +08:00
endif
# for Hwacha developers
2019-04-24 07:20:23 +08:00
ifeq ($(SUB_PROJECT),hwacha)
SBT_PROJECT ?= hwacha
MODEL ?= TestHarness
VLOG_MODEL ?= TestHarness
MODEL_PACKAGE ?= freechips.rocketchip.system
CONFIG ?= HwachaConfig
CONFIG_PACKAGE ?= hwacha
GENERATOR_PACKAGE ?= hwacha
TB ?= TestDriver
TOP ?= ExampleRocketSystem
2019-04-24 07:20:23 +08:00
endif
# Stand-in firechip variables:
# TODO: need a seperate generator and test harnesses for each target
#ifeq ($(SUB_PROJECT),firechip)
# SBT_PROJECT ?= $(SUB_PROJECT)
# MODEL ?= TestHarness
# VLOG_MODEL ?= TestHarness
# MODEL_PACKAGE ?= freechips.rocketchip.system
# CONFIG ?= FireSimRocketChipConfig
# CONFIG_PACKAGE ?= firesim.firesim
# GENERATOR_PACKAGE ?= firesim.firesim
# TB ?= TestDriver
# TOP ?= FireSimNoNIC
#endif
2019-03-09 08:23:35 +08:00
#########################################################################################
# path to rocket-chip and testchipip
#########################################################################################
2019-06-22 02:28:35 +08:00
ROCKETCHIP_DIR = $(base_dir)/generators/rocket-chip
TESTCHIP_DIR = $(base_dir)/generators/testchipip
CHIPYARD_FIRRTL_DIR = $(base_dir)/tools/firrtl
2019-03-09 08:23:35 +08:00
#########################################################################################
# names of various files needed to compile and run things
#########################################################################################
long_name = $(MODEL_PACKAGE).$(MODEL).$(CONFIG)
2019-03-09 08:23:35 +08:00
# match the long_name to what the specific generator will output
ifeq ($(GENERATOR_PACKAGE),freechips.rocketchip.system)
long_name=$(CONFIG_PACKAGE).$(CONFIG)
endif
ifeq ($(GENERATOR_PACKAGE),hwacha)
long_name=$(MODEL_PACKAGE).$(CONFIG)
2019-04-24 02:50:36 +08:00
endif
FIRRTL_FILE ?= $(build_dir)/$(long_name).fir
ANNO_FILE ?= $(build_dir)/$(long_name).anno.json
VERILOG_FILE ?= $(build_dir)/$(long_name).top.v
TOP_FIR ?= $(build_dir)/$(long_name).top.fir
TOP_ANNO ?= $(build_dir)/$(long_name).top.anno.json
HARNESS_FILE ?= $(build_dir)/$(long_name).harness.v
HARNESS_FIR ?= $(build_dir)/$(long_name).harness.fir
HARNESS_ANNO ?= $(build_dir)/$(long_name).harness.anno.json
HARNESS_SMEMS_FILE ?= $(build_dir)/$(long_name).harness.mems.v
HARNESS_SMEMS_CONF ?= $(build_dir)/$(long_name).harness.mems.conf
HARNESS_SMEMS_FIR ?= $(build_dir)/$(long_name).harness.mems.fir
SMEMS_FILE ?= $(build_dir)/$(long_name).mems.v
SMEMS_CONF ?= $(build_dir)/$(long_name).mems.conf
SMEMS_FIR ?= $(build_dir)/$(long_name).mems.fir
sim_dotf ?= $(build_dir)/sim_files.f
sim_harness_blackboxes ?= $(build_dir)/firrtl_black_box_resource_files.harness.f
sim_top_blackboxes ?= $(build_dir)/firrtl_black_box_resource_files.top.f
2019-03-09 08:23:35 +08:00
#########################################################################################
# java arguments used in sbt
#########################################################################################
JAVA_ARGS ?= -Xmx8G -Xss8M -XX:MaxPermSize=256M
2019-03-09 08:23:35 +08:00
#########################################################################################
# default sbt launch command
#########################################################################################
SCALA_VERSION=2.12.4
SCALA_VERSION_MAJOR=$(basename $(SCALA_VERSION))
SBT ?= java $(JAVA_ARGS) -jar $(ROCKETCHIP_DIR)/sbt-launch.jar ++$(SCALA_VERSION)
2019-03-09 08:23:35 +08:00
#########################################################################################
# output directory for tests
#########################################################################################
output_dir=$(sim_dir)/output/$(long_name)
#########################################################################################
# helper variables to run binaries
#########################################################################################
BINARY ?=
2019-05-25 12:22:46 +08:00
SIM_FLAGS ?= +max-cycles=$(timeout_cycles)
sim_out_name = $(notdir $(basename $(BINARY))).$(long_name)
2019-03-09 08:23:35 +08:00
#########################################################################################
# build output directory for compilation
#########################################################################################
2019-05-08 14:05:13 +08:00
gen_dir=$(sim_dir)/generated-src
build_dir=$(gen_dir)/$(long_name)
2019-03-09 08:23:35 +08:00
#########################################################################################
# vsrcs needed to run projects
#########################################################################################
rocketchip_vsrc_dir = $(ROCKETCHIP_DIR)/src/main/resources/vsrc
#########################################################################################
# sources needed to run simulators
#########################################################################################
sim_vsrcs = \
$(VERILOG_FILE) \
$(HARNESS_FILE) \
$(SMEMS_FILE) \
$(HARNESS_SMEMS_FILE)
2019-03-09 08:23:35 +08:00
#########################################################################################
# assembly/benchmark variables
#########################################################################################
timeout_cycles = 10000000
bmark_timeout_cycles = 100000000