2014-09-11 02:38:21 -07:00
|
|
|
# check RISCV environment variable
|
|
|
|
ifndef RISCV
|
|
|
|
$(error Please set environment variable RISCV. Please take a look at README)
|
|
|
|
endif
|
|
|
|
|
2016-08-15 22:03:03 -07:00
|
|
|
MODEL ?= TestHarness
|
2016-09-14 18:10:21 -07:00
|
|
|
PROJECT ?= rocketchip
|
|
|
|
CFG_PROJECT ?= $(PROJECT)
|
2016-09-19 13:23:17 -07:00
|
|
|
CONFIG ?= DefaultConfig
|
|
|
|
# TODO: For now must match rocketchip.Generator
|
|
|
|
long_name = $(PROJECT).$(CONFIG)
|
|
|
|
|
2015-08-25 13:26:14 -07:00
|
|
|
CXX ?= g++
|
2014-01-31 12:25:19 -08:00
|
|
|
CXXFLAGS := -O1
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2016-05-25 11:36:24 -07:00
|
|
|
SBT ?= java -Xmx2G -Xss8M -XX:MaxPermSize=256M -jar $(base_dir)/sbt-launch.jar
|
2015-06-25 23:17:35 -07:00
|
|
|
SHELL := /bin/bash
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2016-06-20 11:18:47 -07:00
|
|
|
FIRRTL_JAR ?= $(base_dir)/firrtl/utils/bin/firrtl.jar
|
|
|
|
FIRRTL ?= java -Xmx2G -Xss8M -XX:MaxPermSize=256M -cp $(FIRRTL_JAR) firrtl.Driver
|
|
|
|
|
2016-08-05 14:45:00 -07:00
|
|
|
$(FIRRTL_JAR): $(shell find $(base_dir)/firrtl/src/main/scala -iname "*.scala")
|
2016-06-20 11:18:47 -07:00
|
|
|
$(MAKE) -C $(base_dir)/firrtl SBT="$(SBT)" root_dir=$(base_dir)/firrtl build-scala
|
2016-08-19 11:06:01 -07:00
|
|
|
touch $(FIRRTL_JAR)
|
2016-06-20 11:18:47 -07:00
|
|
|
|
2014-08-31 20:26:55 -07:00
|
|
|
src_path = src/main/scala
|
2016-08-19 10:58:56 -07:00
|
|
|
default_submodules = . hardfloat context-dependent-environments chisel3
|
|
|
|
chisel_srcs = $(foreach submodule,$(default_submodules) $(ROCKETCHIP_ADDONS),$(shell find $(base_dir)/$(submodule)/$(src_path) -name "*.scala"))
|
2014-08-31 20:26:55 -07:00
|
|
|
|
|
|
|
disasm := 2>
|
2015-09-03 15:36:11 -07:00
|
|
|
which_disasm := $(shell which spike-dasm 2> /dev/null)
|
2014-08-31 20:26:55 -07:00
|
|
|
ifneq ($(which_disasm),)
|
2014-09-09 20:49:28 -07:00
|
|
|
disasm := 3>&1 1>&2 2>&3 | $(which_disasm) $(DISASM_EXTENSION) >
|
2014-08-31 20:26:55 -07:00
|
|
|
endif
|
|
|
|
|
|
|
|
timeout_cycles = 100000000
|
|
|
|
|
2016-08-05 11:07:42 -07:00
|
|
|
bootrom_img = $(base_dir)/bootrom/bootrom.img
|
|
|
|
|
2014-08-31 20:26:55 -07:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Build Tests
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
|
|
|
%.hex:
|
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
|
|
|
|
2016-01-28 12:15:14 -08:00
|
|
|
%.riscv.hex: %.riscv
|
2014-08-31 20:26:55 -07:00
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
2015-11-05 10:15:02 -08:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Constants Header Files
|
|
|
|
#---------------------------------------------------------------------
|
|
|
|
|
2016-09-14 11:34:23 -07:00
|
|
|
# sed uses -E (instead of -r) for BSD support
|
2016-09-19 13:23:17 -07:00
|
|
|
params_file = $(generated_dir)/$(long_name).prm
|
2015-11-05 10:15:02 -08:00
|
|
|
consts_header = $(generated_dir)/consts.$(CONFIG).h
|
|
|
|
$(consts_header): $(params_file)
|
|
|
|
echo "#ifndef __CONST_H__" > $@
|
|
|
|
echo "#define __CONST_H__" >> $@
|
2016-09-14 11:34:23 -07:00
|
|
|
sed -E 's/\(([A-Za-z0-9_]+),([A-Za-z0-9_]+)\)/#define \1 \2/' $< >> $@
|
2015-11-05 10:15:02 -08:00
|
|
|
echo "#endif // __CONST_H__" >> $@
|
|
|
|
|
2016-09-19 13:23:17 -07:00
|
|
|
params_file_debug = $(generated_dir_debug)/$(long_name).prm
|
2015-11-05 10:15:02 -08:00
|
|
|
consts_header_debug = $(generated_dir_debug)/consts.$(CONFIG).h
|
|
|
|
$(consts_header_debug): $(params_file_debug)
|
|
|
|
echo "#ifndef __CONST_H__" > $@
|
|
|
|
echo "#define __CONST_H__" >> $@
|
2016-09-14 11:34:23 -07:00
|
|
|
sed -E 's/\(([A-Za-z0-9_]+),([A-Za-z0-9_]+)\)/#define \1 \2/' $< >> $@
|
2015-11-05 10:15:02 -08:00
|
|
|
echo "#endif // __CONST_H__" >> $@
|
2016-08-10 11:40:58 -07:00
|
|
|
|
|
|
|
clean-run-output:
|
|
|
|
rm -f $(output_dir)/{*.out,*.run,*.vpd}
|