OpenCores
URL https://opencores.org/ocsvn/yifive/yifive/trunk

Subversion Repositories yifive

[/] [yifive/] [trunk/] [caravel_yifive/] [verilog/] [rtl/] [syntacore/] [scr1/] [Makefile] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 dinesha
#------------------------------------------------------------------------------
2
# Makefile for SCR1
3
#------------------------------------------------------------------------------
4
 
5
# PARAMETERS
6
 
7
# CFG = 
8
# BUS = 
9
 
10
export CFG      ?= MAX
11
export BUS      ?= AHB
12
 
13
ifeq ($(CFG), MAX)
14
# Predefined configuration SCR1_CFG_RV32IMC_MAX
15
    override ARCH         := IMC
16
    override VECT_IRQ     := 1
17
    override IPIC         := 1
18
    override TCM          := 1
19
    override SIM_CFG_DEF  := SCR1_CFG_RV32IMC_MAX
20
else
21
    ifeq ($(CFG), BASE)
22
    # Predefined configuration SCR1_CFG_RV32IC_BASE
23
        override ARCH         := IC
24
        override VECT_IRQ     := 1
25
        override IPIC         := 1
26
        override TCM          := 1
27
        override SIM_CFG_DEF  := SCR1_CFG_RV32IC_BASE
28
    else
29
        ifeq ($(CFG), MIN)
30
        # Predefined configuration SCR1_CFG_RV32EC_MIN
31
            override ARCH         := EC
32
            override VECT_IRQ     := 0
33
            override IPIC         := 0
34
            override TCM          := 1
35
            override SIM_CFG_DEF  := SCR1_CFG_RV32EC_MIN
36
        else
37
        # CUSTOM configuration. Parameters can be overwritten
38
            # These options are for compiling tests only. Set the corresponding RTL parameters manually in the file scr1_arch_description.svh.
39
            # ARCH = 
40
            # VECT_IRQ = <0, 1>
41
            # IPIC = <0, 1>
42
            # TCM = <0, 1>
43
            ARCH      ?= IMC
44
            VECT_IRQ  ?= 0
45
            IPIC      ?= 0
46
            TCM       ?= 0
47
            SIM_CFG_DEF  = SCR1_CFG_$(CFG)
48
        endif
49
    endif
50
endif
51
 
52
# export all overrided variables
53
export ARCH
54
export VECT_IRQ
55
export IPIC
56
export TCM
57
export SIM_CFG_DEF
58
 
59
ARCH_lowercase = $(shell echo $(ARCH) | tr A-Z a-z)
60
BUS_lowercase  = $(shell echo $(BUS)  | tr A-Z a-z)
61
 
62
ifeq ($(ARCH_lowercase),)
63
    ARCH_tmp = imc
64
else
65
    ifneq (,$(findstring e,$(ARCH_lowercase)))
66
        ARCH_tmp   += e
67
        EXT_CFLAGS += -D__RVE_EXT
68
    else
69
        ARCH_tmp   += i
70
    endif
71
    ifneq (,$(findstring m,$(ARCH_lowercase)))
72
        ARCH_tmp   := $(ARCH_tmp)m
73
    endif
74
    ifneq (,$(findstring c,$(ARCH_lowercase)))
75
        ARCH_tmp   := $(ARCH_tmp)c
76
        EXT_CFLAGS += -D__RVC_EXT
77
    endif
78
endif
79
 
80
override ARCH=$(ARCH_tmp)
81
 
82
# Use this parameter to enable tracelog
83
TRACE ?= 0
84
 
85
ifeq ($(TRACE), 1)
86
    export SIM_TRACE_DEF = SCR1_TRACE_LOG_EN
87
else
88
    export SIM_TRACE_DEF = SCR1_TRACE_LOG_DIS
89
endif
90
 
91
 
92
# Use this parameter to pass additional options for simulation build command
93
SIM_BUILD_OPTS ?=
94
 
95
# Use this parameter to set the list of tests to run
96
# TARGETS = 
97
export TARGETS :=
98
 
99
 
100
export ABI   ?= ilp32
101
# Testbench memory delay patterns\
102
  (FFFFFFFF - no delay, 00000000 - random delay, 00000001 - max delay)
103
imem_pattern ?= FFFFFFFF
104
dmem_pattern ?= FFFFFFFF
105
 
106
VCS_OPTS       ?=
107
MODELSIM_OPTS  ?=
108
NCSIM_OPTS     ?=
109
VERILATOR_OPTS ?=
110
 
111
current_goal := $(MAKECMDGOALS:run_%=%)
112
ifeq ($(current_goal),)
113
    current_goal := verilator
114
endif
115
 
116
# Paths
117
export root_dir := $(shell pwd)
118
export tst_dir  := $(root_dir)/sim/tests
119
export inc_dir  := $(tst_dir)/common
120
export bld_dir  := $(root_dir)/build/$(current_goal)_$(BUS)_$(CFG)_$(ARCH)_IPIC_$(IPIC)_TCM_$(TCM)_VIRQ_$(VECT_IRQ)_TRACE_$(TRACE)
121
 
122
test_results := $(bld_dir)/test_results.txt
123
test_info    := $(bld_dir)/test_info
124
sim_results  := $(bld_dir)/sim_results.txt
125
 
126
todo_list    := $(bld_dir)/todo.txt
127
# Environment
128
export CROSS_PREFIX  ?= riscv64-unknown-elf-
129
export RISCV_GCC     ?= $(CROSS_PREFIX)gcc
130
export RISCV_OBJDUMP ?= $(CROSS_PREFIX)objdump -D
131
export RISCV_OBJCOPY ?= $(CROSS_PREFIX)objcopy -O verilog
132
export RISCV_READELF ?= $(CROSS_PREFIX)readelf -s
133
#--
134
ifneq (,$(findstring axi,$(BUS_lowercase)))
135
export rtl_top_files := axi_top.files
136
export rtl_tb_files  := axi_tb.files
137
export top_module    := scr1_top_tb_axi
138
else
139
export rtl_top_files := ahb_top.files
140
export rtl_tb_files  := ahb_tb.files
141
export top_module    := scr1_top_tb_ahb
142
endif
143
 
144
ifneq (,$(findstring e,$(ARCH_lowercase)))
145
# Tests can be compiled for RVE only if gcc version 8.0.0 or higher
146
    GCCVERSIONGT7 := $(shell expr `$(RISCV_GCC) -dumpfullversion | cut -f1 -d'.'` \> 7)
147
    ifeq "$(GCCVERSIONGT7)" "1"
148
        ABI := ilp32e
149
    endif
150
endif
151
 
152
#--
153
ifeq (,$(findstring e,$(ARCH_lowercase)))
154
# These tests cannot be compiled for RVE
155
 
156
    # Comment this target if you don't want to run the riscv_isa
157
    TARGETS += riscv_isa
158
 
159
    # Comment this target if you don't want to run the riscv_compliance
160
    TARGETS += riscv_compliance
161
endif
162
 
163
# Comment this target if you don't want to run the isr_sample
164
TARGETS += isr_sample
165
 
166
# Comment this target if you don't want to run the coremark
167
TARGETS += coremark
168
 
169
# Comment this target if you don't want to run the dhrystone
170
TARGETS += dhrystone21
171
 
172
# Comment this target if you don't want to run the hello test
173
TARGETS += hello
174
 
175
# Targets
176
.PHONY: tests run_modelsim run_vcs run_ncsim run_verilator run_verilator_wf
177
 
178
default: clean_test_list run_verilator
179
 
180
clean_test_list:
181
        rm -f $(test_info)
182
 
183
echo_out: tests
184
        @echo "                          Test               | build | simulation " ;
185
        @echo "$$(cat $(test_results))"
186
 
187
tests: $(TARGETS)
188
 
189
$(test_info): clean_hex tests
190
        cd $(bld_dir)
191
 
192
isr_sample: | $(bld_dir)
193
        $(MAKE) -C $(tst_dir)/isr_sample ARCH=$(ARCH) IPIC=$(IPIC) VECT_IRQ=$(VECT_IRQ)
194
 
195
dhrystone21: | $(bld_dir)
196
        $(MAKE) -C $(tst_dir)/benchmarks/dhrystone21 EXT_CFLAGS="$(EXT_CFLAGS)" ARCH=$(ARCH)
197
 
198
coremark: | $(bld_dir)
199
        -$(MAKE) -C $(tst_dir)/benchmarks/coremark EXT_CFLAGS="$(EXT_CFLAGS)" ARCH=$(ARCH)
200
 
201
riscv_isa: | $(bld_dir)
202
        $(MAKE) -C $(tst_dir)/riscv_isa ARCH=$(ARCH)
203
 
204
riscv_compliance: | $(bld_dir)
205
        $(MAKE) -C $(tst_dir)/riscv_compliance ARCH=$(ARCH)
206
 
207
hello: | $(bld_dir)
208
        -$(MAKE) -C $(tst_dir)/hello EXT_CFLAGS="$(EXT_CFLAGS)" ARCH=$(ARCH)
209
 
210
clean_hex: | $(bld_dir)
211
        $(RM) $(bld_dir)/*.hex
212
 
213
$(bld_dir):
214
        mkdir -p $(bld_dir)
215
 
216
run_vcs: $(test_info)
217
        $(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);
218
        printf "" > $(test_results);
219
        cd $(bld_dir); \
220
        $(bld_dir)/simv  -V \
221
        +test_info=$(test_info) \
222
        +test_results=$(test_results) \
223
        +imem_pattern=$(imem_pattern) \
224
        +dmem_pattern=$(dmem_pattern) \
225
        $(VCS_OPTS) | tee $(sim_results)  ;\
226
        printf "                          Test               | build | simulation \n" ; \
227
        printf "$$(cat $(test_results)) \n"
228
run_modelsim: $(test_info)
229
        $(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); \
230
        printf "" > $(test_results); \
231
        cd $(bld_dir); \
232
        vsim -c -do "run -all" +nowarn3691 \
233
        +test_info=$(test_info) \
234
        +test_results=$(test_results) \
235
        +imem_pattern=$(imem_pattern) \
236
        +dmem_pattern=$(dmem_pattern) \
237
        work.$(top_module) \
238
        $(MODELSIM_OPTS) | tee $(sim_results)  ;\
239
        printf "Simulation performed on $$(vsim -version) \n" ;\
240
        printf "                          Test               | build | simulation \n" ; \
241
        printf "$$(cat $(test_results)) \n"
242
 
243
run_ncsim: $(test_info)
244
        $(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);
245
        printf "" > $(test_results);
246
        cd $(bld_dir); \
247
        irun \
248
        -R \
249
        -64bit \
250
        +test_info=$(test_info) \
251
        +test_results=$(test_results) \
252
        +imem_pattern=$(imem_pattern) \
253
        +dmem_pattern=$(dmem_pattern) \
254
        $(NCSIM_OPTS) | tee $(sim_results)  ;\
255
        printf "Simulation performed on $$(irun -version) \n" ;\
256
        printf "                          Test               | build | simulation \n" ; \
257
        printf "$$(cat $(test_results)) \n"
258
 
259
run_verilator: $(test_info)
260
        $(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);
261
        printf "" > $(test_results);
262
        cd $(bld_dir); \
263
        echo $(top_module) | tee $(sim_results); \
264
        $(bld_dir)/verilator/V$(top_module) \
265
        +test_info=$(test_info) \
266
        +test_results=$(test_results) \
267
        +imem_pattern=$(imem_pattern) \
268
        +dmem_pattern=$(dmem_pattern) \
269
        $(VERILATOR_OPTS) | tee -a $(sim_results) ;\
270
        printf "Simulation performed on $$(verilator -version) \n" ;\
271
        printf "                          Test               | build | simulation \n" ; \
272
        printf "$$(cat $(test_results)) \n"
273
 
274
run_verilator_wf: $(test_info)
275
        $(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);
276
        printf "" > $(test_results);
277
        cd $(bld_dir); \
278
        echo $(top_module) | tee $(sim_results); \
279
        $(bld_dir)/verilator/V$(top_module) \
280
        +test_info=$(test_info) \
281
        +test_results=$(test_results) \
282
        +imem_pattern=$(imem_pattern) \
283
        +dmem_pattern=$(dmem_pattern) \
284
        $(VERILATOR_OPTS) | tee -a $(sim_results)  ;\
285
        printf "Simulation performed on $$(verilator -version) \n" ;\
286
        printf "                          Test               | build | simulation \n" ; \
287
        printf "$$(cat $(test_results)) \n"
288
clean:
289
        $(MAKE) -C $(tst_dir)/benchmarks/dhrystone21 clean
290
        $(MAKE) -C $(tst_dir)/riscv_isa clean
291
        $(MAKE) -C $(tst_dir)/riscv_compliance clean
292
        $(RM) -R $(root_dir)/build/*
293
        $(RM) $(test_info)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.