2014-09-11 11:38:21 +02:00
|
|
|
# check RISCV environment variable
|
|
|
|
ifndef RISCV
|
|
|
|
$(error Please set environment variable RISCV. Please take a look at README)
|
|
|
|
endif
|
|
|
|
|
2015-10-25 18:24:39 +01:00
|
|
|
MODEL ?= Top
|
2015-07-28 09:23:31 +02:00
|
|
|
PROJECT := rocketchip
|
2015-08-25 22:26:14 +02:00
|
|
|
CXX ?= g++
|
2014-01-31 21:25:19 +01:00
|
|
|
CXXFLAGS := -O1
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2016-04-19 23:22:22 +02:00
|
|
|
CHISEL_VERSION ?= 2
|
2016-05-25 20:09:37 +02:00
|
|
|
export CHISEL_VERSION
|
2016-03-06 02:19:53 +01:00
|
|
|
|
2016-04-19 23:22:22 +02:00
|
|
|
SBT ?= java -Xmx2G -Xss8M -XX:MaxPermSize=256M -jar sbt-launch.jar
|
2015-06-26 08:17:35 +02:00
|
|
|
SHELL := /bin/bash
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2016-03-06 02:19:53 +01:00
|
|
|
ifeq ($(CHISEL_VERSION),2)
|
2016-03-31 04:06:32 +02:00
|
|
|
CHISEL_ARGS := $(PROJECT) $(MODEL) $(CONFIG) --W0W --minimumCompatibility 3.0.0 --backend $(BACKEND) --configName $(CONFIG) --compileInitializationUnoptimized --targetDir $(generated_dir)
|
2016-03-06 02:19:53 +01:00
|
|
|
else
|
|
|
|
CHISEL_ARGS := --W0W --minimumCompatibility 3.0.0 --backend $(BACKEND) --configName $(CONFIG) --compileInitializationUnoptimized --targetDir $(generated_dir)
|
|
|
|
endif
|
2015-07-28 09:23:31 +02:00
|
|
|
|
2014-09-01 05:26:55 +02:00
|
|
|
src_path = src/main/scala
|
2016-05-16 22:06:45 +02:00
|
|
|
default_submodules = . junctions uncore hardfloat rocket groundtest context-dependent-environments
|
2015-09-16 21:28:03 +02:00
|
|
|
chisel_srcs = $(addprefix $(base_dir)/,$(addsuffix /$(src_path)/*.scala,$(default_submodules) $(ROCKETCHIP_ADDONS)))
|
2014-09-01 05:26:55 +02:00
|
|
|
|
|
|
|
disasm := 2>
|
2015-09-04 00:36:11 +02:00
|
|
|
which_disasm := $(shell which spike-dasm 2> /dev/null)
|
2014-09-01 05:26:55 +02:00
|
|
|
ifneq ($(which_disasm),)
|
2014-09-10 05:49:28 +02:00
|
|
|
disasm := 3>&1 1>&2 2>&3 | $(which_disasm) $(DISASM_EXTENSION) >
|
2014-09-01 05:26:55 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
timeout_cycles = 100000000
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# DRAMSim2
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2013-05-01 11:58:53 +02:00
|
|
|
DRAMSIM_OBJS := $(patsubst %.cpp,%.o,$(wildcard $(base_dir)/dramsim2/*.cpp))
|
2012-12-04 16:04:26 +01:00
|
|
|
$(DRAMSIM_OBJS): %.o: %.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -DNO_STORAGE -DNO_OUTPUT -Dmain=nomain -c -o $@ $<
|
2013-05-01 11:58:53 +02:00
|
|
|
$(sim_dir)/libdramsim.a: $(DRAMSIM_OBJS)
|
2012-12-04 16:04:26 +01:00
|
|
|
ar rcs $@ $^
|
|
|
|
|
2014-09-01 05:26:55 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Build Tests
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
|
|
|
%.hex:
|
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
|
|
|
|
2016-01-28 21:15:14 +01:00
|
|
|
%.riscv.hex: %.riscv
|
2014-09-01 05:26:55 +02:00
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
2015-11-05 19:15:02 +01:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Constants Header Files
|
|
|
|
#---------------------------------------------------------------------
|
|
|
|
|
|
|
|
params_file = $(generated_dir)/$(MODEL).$(CONFIG).prm
|
|
|
|
consts_header = $(generated_dir)/consts.$(CONFIG).h
|
2016-02-18 00:23:18 +01:00
|
|
|
scr_header = $(generated_dir)/$(MODEL).$(CONFIG).scr_map.h
|
2015-11-05 19:15:02 +01:00
|
|
|
$(consts_header): $(params_file)
|
|
|
|
echo "#ifndef __CONST_H__" > $@
|
|
|
|
echo "#define __CONST_H__" >> $@
|
|
|
|
sed -r 's/\(([A-Za-z0-9_]+),([A-Za-z0-9_]+)\)/#define \1 \2/' $< >> $@
|
|
|
|
echo "#define TBFRAG \"$(MODEL).$(CONFIG).tb.cpp\"" >> $@
|
|
|
|
echo "#endif // __CONST_H__" >> $@
|
|
|
|
|
|
|
|
params_file_debug = $(generated_dir_debug)/$(MODEL).$(CONFIG).prm
|
|
|
|
consts_header_debug = $(generated_dir_debug)/consts.$(CONFIG).h
|
|
|
|
$(consts_header_debug): $(params_file_debug)
|
|
|
|
echo "#ifndef __CONST_H__" > $@
|
|
|
|
echo "#define __CONST_H__" >> $@
|
|
|
|
sed -r 's/\(([A-Za-z0-9_]+),([A-Za-z0-9_]+)\)/#define \1 \2/' $< >> $@
|
|
|
|
echo "#define TBFRAG \"$(MODEL).$(CONFIG).tb.cpp\"" >> $@
|
|
|
|
echo "#endif // __CONST_H__" >> $@
|
2016-02-20 08:13:57 +01:00
|
|
|
scr_header_debug = $(generated_dir_debug)/$(MODEL).$(CONFIG).scr_map.h
|