forked from lowRISC/ibex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
141 lines (125 loc) · 3.83 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
DV_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
GEN_DIR := $(realpath ${DV_DIR}/../../vendor/google_riscv-dv)
TOOLCHAIN := ${RISCV_TOOLCHAIN}
OUT := "${DV_DIR}/out"
# Run time options for the instruction generator
GEN_OPTS :=
# Run time options for ibex RTL simulation
SIM_OPTS :=
# Enable waveform dumping
WAVES := 1
# Enable coverage dump
COV := 0
# RTL simulator
SIMULATOR := "vcs"
# ISS (spike, ovpsim)
ISS := "spike"
# ISA
ISA := "rv32imc"
# Test name (default: full regression)
TEST := "all"
# Seed for instruction generator and RTL simulation
SEED := -1
# Verbose logging
VERBOSE :=
# Number of iterations for each test, assign a non-zero value to override the
# iteration count in the test list
ITERATIONS := 0
# LSF CMD
LSF_CMD :=
# Generator timeout limit in seconds
TIMEOUT := 1800
# Privileged CSR YAML description file
CSR_FILE := ${DV_DIR}/riscv_dv_extension/csr_description.yaml
# Pass/fail signature address at the end of test
SIGNATURE_ADDR := 8ffffffc
SHELL=/bin/bash
export PRJ_DIR:= $(realpath ${DV_DIR}/../../..)
.PHONY: rtl_sim clean gcc_compile iss_sim
all: clean gen gcc_compile iss_sim compile rtl_sim post_compare
clean:
rm -rf ${OUT}
# Common options for all targets
COMMON_OPTS:=--seed=${SEED} \
--test=${TEST} \
--testlist=${DV_DIR}/riscv_dv_extension/testlist.yaml \
--iterations=${ITERATIONS}
ifeq ($(VERBOSE), 1)
COMMON_OPTS+=--verbose
endif
# Options used for privileged CSR test generation
CSR_OPTS=--csr_yaml=${CSR_FILE} \
--isa=${ISA} \
--end_signature_addr=0x${SIGNATURE_ADDR}
# Generate random instructions
.SILENT gen:
mkdir -p ${OUT}
cd ${GEN_DIR}; \
python3 ./run.py \
--output=${OUT}/instr_gen ${GEN_OPTS} \
--steps=gen \
--gen_timeout=${TIMEOUT} \
--lsf_cmd="${LSF_CMD}" \
${COMMON_OPTS} \
${CSR_OPTS} \
--cmp_opts="+define+RISCV_CORE_SETTING=${DV_DIR}/riscv_dv_extension/ibex_core_setting.sv \
+define+RISCV_DV_EXT_FILE_LIST=${DV_DIR}/riscv_dv_extension/flist \
+incdir+${DV_DIR}/riscv_dv_extension/ " \
--sim_opts="+uvm_set_type_override=riscv_asm_program_gen,ibex_asm_program_gen \
+signature_addr=${SIGNATURE_ADDR}";
# Compile the generated assmebly programs to ELF/BIN
gcc_compile:
cd ${GEN_DIR}; \
python3 ./run.py \
--o=${OUT}/instr_gen ${GEN_OPTS} \
--steps=gcc_compile \
${COMMON_OPTS} \
--gcc_opts=-mno-strict-align \
--isa=${ISA} \
--mabi=ilp32
# ISS simulation
iss_sim:
cd ${GEN_DIR}; \
python3 ./run.py \
--o=${OUT}/instr_gen ${GEN_OPTS} \
--steps=iss_sim \
${COMMON_OPTS} \
--iss=${ISS} \
--isa=${ISA} \
# Compile ibex core TB
compile:
mkdir -p ${OUT}/rtl_sim
python3 ./sim.py \
--o=${OUT} \
--steps=compile \
${COMMON_OPTS} \
--simulator=${SIMULATOR} \
--en_cov=${COV} \
--en_wave=${WAVES} \
# Run ibex RTL simulation with random instructions
rtl_sim:
mkdir -p ${OUT}/rtl_sim
python3 ./sim.py \
--o=${OUT} \
--steps=sim \
${COMMON_OPTS} \
--simulator=${SIMULATOR} \
--en_cov ${COV} \
--en_wave ${WAVES} \
--sim_opts="+signature_addr=0x${SIGNATURE_ADDR}" \
${SIM_OPTS}
# Compare the regression result between ISS and RTL sim
post_compare:
rm -rf ${OUT}/regr.log
python3 ./sim.py \
--o=${OUT} \
--steps=compare \
${COMMON_OPTS} \
--simulator=${SIMULATOR} \
--iss=${ISS}
# Load verdi to review coverage
cov:
cd ${OUT}/rtl_sim; verdi -cov -covdir test.vdb &