URL
https://opencores.org/ocsvn/yifive/yifive/trunk
Subversion Repositories yifive
[/] [yifive/] [trunk/] [caravel_yifive/] [verilog/] [rtl/] [syntacore/] [scr1/] [Makefile] - Rev 11
Compare with Previous | Blame | View Log
#------------------------------------------------------------------------------# Makefile for SCR1#------------------------------------------------------------------------------# PARAMETERS# CFG = <MAX, BASE, MIN, CUSTOM># BUS = <AHB, AXI>export CFG ?= MAXexport BUS ?= AHBifeq ($(CFG), MAX)# Predefined configuration SCR1_CFG_RV32IMC_MAXoverride ARCH := IMCoverride VECT_IRQ := 1override IPIC := 1override TCM := 1override SIM_CFG_DEF := SCR1_CFG_RV32IMC_MAXelseifeq ($(CFG), BASE)# Predefined configuration SCR1_CFG_RV32IC_BASEoverride ARCH := ICoverride VECT_IRQ := 1override IPIC := 1override TCM := 1override SIM_CFG_DEF := SCR1_CFG_RV32IC_BASEelseifeq ($(CFG), MIN)# Predefined configuration SCR1_CFG_RV32EC_MINoverride ARCH := ECoverride VECT_IRQ := 0override IPIC := 0override TCM := 1override SIM_CFG_DEF := SCR1_CFG_RV32EC_MINelse# CUSTOM configuration. Parameters can be overwritten# These options are for compiling tests only. Set the corresponding RTL parameters manually in the file scr1_arch_description.svh.# ARCH = <IMC, IC, IM, I, EMC, EM, EC, E># VECT_IRQ = <0, 1># IPIC = <0, 1># TCM = <0, 1>ARCH ?= IMCVECT_IRQ ?= 0IPIC ?= 0TCM ?= 0SIM_CFG_DEF = SCR1_CFG_$(CFG)endifendifendif# export all overrided variablesexport ARCHexport VECT_IRQexport IPICexport TCMexport SIM_CFG_DEFARCH_lowercase = $(shell echo $(ARCH) | tr A-Z a-z)BUS_lowercase = $(shell echo $(BUS) | tr A-Z a-z)ifeq ($(ARCH_lowercase),)ARCH_tmp = imcelseifneq (,$(findstring e,$(ARCH_lowercase)))ARCH_tmp += eEXT_CFLAGS += -D__RVE_EXTelseARCH_tmp += iendififneq (,$(findstring m,$(ARCH_lowercase)))ARCH_tmp := $(ARCH_tmp)mendififneq (,$(findstring c,$(ARCH_lowercase)))ARCH_tmp := $(ARCH_tmp)cEXT_CFLAGS += -D__RVC_EXTendifendifoverride ARCH=$(ARCH_tmp)# Use this parameter to enable tracelogTRACE ?= 0ifeq ($(TRACE), 1)export SIM_TRACE_DEF = SCR1_TRACE_LOG_ENelseexport SIM_TRACE_DEF = SCR1_TRACE_LOG_DISendif# Use this parameter to pass additional options for simulation build commandSIM_BUILD_OPTS ?=# Use this parameter to set the list of tests to run# TARGETS = <riscv_isa, riscv_compliance, coremark, dhrystone21, hello, isr_sample>export TARGETS :=export ABI ?= ilp32# Testbench memory delay patterns\(FFFFFFFF - no delay, 00000000 - random delay, 00000001 - max delay)imem_pattern ?= FFFFFFFFdmem_pattern ?= FFFFFFFFVCS_OPTS ?=MODELSIM_OPTS ?=NCSIM_OPTS ?=VERILATOR_OPTS ?=current_goal := $(MAKECMDGOALS:run_%=%)ifeq ($(current_goal),)current_goal := verilatorendif# Pathsexport root_dir := $(shell pwd)export tst_dir := $(root_dir)/sim/testsexport inc_dir := $(tst_dir)/commonexport bld_dir := $(root_dir)/build/$(current_goal)_$(BUS)_$(CFG)_$(ARCH)_IPIC_$(IPIC)_TCM_$(TCM)_VIRQ_$(VECT_IRQ)_TRACE_$(TRACE)test_results := $(bld_dir)/test_results.txttest_info := $(bld_dir)/test_infosim_results := $(bld_dir)/sim_results.txttodo_list := $(bld_dir)/todo.txt# Environmentexport CROSS_PREFIX ?= riscv64-unknown-elf-export RISCV_GCC ?= $(CROSS_PREFIX)gccexport RISCV_OBJDUMP ?= $(CROSS_PREFIX)objdump -Dexport RISCV_OBJCOPY ?= $(CROSS_PREFIX)objcopy -O verilogexport RISCV_READELF ?= $(CROSS_PREFIX)readelf -s#--ifneq (,$(findstring axi,$(BUS_lowercase)))export rtl_top_files := axi_top.filesexport rtl_tb_files := axi_tb.filesexport top_module := scr1_top_tb_axielseexport rtl_top_files := ahb_top.filesexport rtl_tb_files := ahb_tb.filesexport top_module := scr1_top_tb_ahbendififneq (,$(findstring e,$(ARCH_lowercase)))# Tests can be compiled for RVE only if gcc version 8.0.0 or higherGCCVERSIONGT7 := $(shell expr `$(RISCV_GCC) -dumpfullversion | cut -f1 -d'.'` \> 7)ifeq "$(GCCVERSIONGT7)" "1"ABI := ilp32eendifendif#--ifeq (,$(findstring e,$(ARCH_lowercase)))# These tests cannot be compiled for RVE# Comment this target if you don't want to run the riscv_isaTARGETS += riscv_isa# Comment this target if you don't want to run the riscv_complianceTARGETS += riscv_complianceendif# Comment this target if you don't want to run the isr_sampleTARGETS += isr_sample# Comment this target if you don't want to run the coremarkTARGETS += coremark# Comment this target if you don't want to run the dhrystoneTARGETS += dhrystone21# Comment this target if you don't want to run the hello testTARGETS += hello# Targets.PHONY: tests run_modelsim run_vcs run_ncsim run_verilator run_verilator_wfdefault: clean_test_list run_verilatorclean_test_list:rm -f $(test_info)echo_out: tests@echo " Test | build | simulation " ;@echo "$$(cat $(test_results))"tests: $(TARGETS)$(test_info): clean_hex testscd $(bld_dir)isr_sample: | $(bld_dir)$(MAKE) -C $(tst_dir)/isr_sample ARCH=$(ARCH) IPIC=$(IPIC) VECT_IRQ=$(VECT_IRQ)dhrystone21: | $(bld_dir)$(MAKE) -C $(tst_dir)/benchmarks/dhrystone21 EXT_CFLAGS="$(EXT_CFLAGS)" ARCH=$(ARCH)coremark: | $(bld_dir)-$(MAKE) -C $(tst_dir)/benchmarks/coremark EXT_CFLAGS="$(EXT_CFLAGS)" ARCH=$(ARCH)riscv_isa: | $(bld_dir)$(MAKE) -C $(tst_dir)/riscv_isa ARCH=$(ARCH)riscv_compliance: | $(bld_dir)$(MAKE) -C $(tst_dir)/riscv_compliance ARCH=$(ARCH)hello: | $(bld_dir)-$(MAKE) -C $(tst_dir)/hello EXT_CFLAGS="$(EXT_CFLAGS)" ARCH=$(ARCH)clean_hex: | $(bld_dir)$(RM) $(bld_dir)/*.hex$(bld_dir):mkdir -p $(bld_dir)run_vcs: $(test_info)$(MAKE) -C $(root_dir)/sim build_vcs SIM_CFG_DEF=$(SIM_CFG_DEF) SIM_TRACE_DEF=$(SIM_TRACE_DEF) SIM_BUILD_OPTS=$(SIM_BUILD_OPTS);printf "" > $(test_results);cd $(bld_dir); \$(bld_dir)/simv -V \+test_info=$(test_info) \+test_results=$(test_results) \+imem_pattern=$(imem_pattern) \+dmem_pattern=$(dmem_pattern) \$(VCS_OPTS) | tee $(sim_results) ;\printf " Test | build | simulation \n" ; \printf "$$(cat $(test_results)) \n"run_modelsim: $(test_info)$(MAKE) -C $(root_dir)/sim build_modelsim SIM_CFG_DEF=$(SIM_CFG_DEF) SIM_TRACE_DEF=$(SIM_TRACE_DEF) SIM_BUILD_OPTS=$(SIM_BUILD_OPTS); \printf "" > $(test_results); \cd $(bld_dir); \vsim -c -do "run -all" +nowarn3691 \+test_info=$(test_info) \+test_results=$(test_results) \+imem_pattern=$(imem_pattern) \+dmem_pattern=$(dmem_pattern) \work.$(top_module) \$(MODELSIM_OPTS) | tee $(sim_results) ;\printf "Simulation performed on $$(vsim -version) \n" ;\printf " Test | build | simulation \n" ; \printf "$$(cat $(test_results)) \n"run_ncsim: $(test_info)$(MAKE) -C $(root_dir)/sim build_ncsim SIM_CFG_DEF=$(SIM_CFG_DEF) SIM_TRACE_DEF=$(SIM_TRACE_DEF) SIM_BUILD_OPTS=$(SIM_BUILD_OPTS);printf "" > $(test_results);cd $(bld_dir); \irun \-R \-64bit \+test_info=$(test_info) \+test_results=$(test_results) \+imem_pattern=$(imem_pattern) \+dmem_pattern=$(dmem_pattern) \$(NCSIM_OPTS) | tee $(sim_results) ;\printf "Simulation performed on $$(irun -version) \n" ;\printf " Test | build | simulation \n" ; \printf "$$(cat $(test_results)) \n"run_verilator: $(test_info)$(MAKE) -C $(root_dir)/sim build_verilator SIM_CFG_DEF=$(SIM_CFG_DEF) SIM_TRACE_DEF=$(SIM_TRACE_DEF) SIM_BUILD_OPTS=$(SIM_BUILD_OPTS);printf "" > $(test_results);cd $(bld_dir); \echo $(top_module) | tee $(sim_results); \$(bld_dir)/verilator/V$(top_module) \+test_info=$(test_info) \+test_results=$(test_results) \+imem_pattern=$(imem_pattern) \+dmem_pattern=$(dmem_pattern) \$(VERILATOR_OPTS) | tee -a $(sim_results) ;\printf "Simulation performed on $$(verilator -version) \n" ;\printf " Test | build | simulation \n" ; \printf "$$(cat $(test_results)) \n"run_verilator_wf: $(test_info)$(MAKE) -C $(root_dir)/sim build_verilator_wf SIM_CFG_DEF=$(SIM_CFG_DEF) SIM_TRACE_DEF=$(SIM_TRACE_DEF) SIM_BUILD_OPTS=$(SIM_BUILD_OPTS);printf "" > $(test_results);cd $(bld_dir); \echo $(top_module) | tee $(sim_results); \$(bld_dir)/verilator/V$(top_module) \+test_info=$(test_info) \+test_results=$(test_results) \+imem_pattern=$(imem_pattern) \+dmem_pattern=$(dmem_pattern) \$(VERILATOR_OPTS) | tee -a $(sim_results) ;\printf "Simulation performed on $$(verilator -version) \n" ;\printf " Test | build | simulation \n" ; \printf "$$(cat $(test_results)) \n"clean:$(MAKE) -C $(tst_dir)/benchmarks/dhrystone21 clean$(MAKE) -C $(tst_dir)/riscv_isa clean$(MAKE) -C $(tst_dir)/riscv_compliance clean$(RM) -R $(root_dir)/build/*$(RM) $(test_info)
