forked from openhwgroup/cvw-arch-verif
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (75 loc) · 3.87 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
all:
${WALLY}/addins/cvw-arch-verif/bin/covergroupgen.py
${WALLY}/addins/cvw-arch-verif/bin/testgen.py
${WALLY}/addins/cvw-arch-verif/bin/combinetests.py
${WALLY}/addins/cvw-arch-verif/bin/csrtests.py
make -j 8 build
sim:
rm -f ${WALLY}/sim/questa/fcov_ucdb/*
#wsim rv64gc ${WALLY}/addins/cvw-arch-verif/tests/rv64/I/WALLY-COV-add.elf --fcov
#wsim rv32gc ${WALLY}/addins/cvw-arch-verif/tests/rv32/Zicond/WALLY-COV-czero.eqz.elf --fcov
#wsim rv32gc ${WALLY}/addins/cvw-arch-verif/tests/rv32/M/WALLY-COV-div.elf --fcov
wsim rv32gc ${WALLY}/addins/cvw-arch-verif/tests/rv32/I/WALLY-COV-ALL.elf --fcov
#wsim rv32gc ${WALLY}/addins/cvw-arch-verif/tests/rv32/I/WALLY-COV-lui.elf --fcov
#wsim rv32gc ${WALLY}/addins/cvw-arch-verif/tests/rv32/I/WALLY-COV-addi.elf --fcov
#wsim rv32gc ${WALLY}/addins/cvw-arch-verif/tests/rv32/I/WALLY-COV-lw.elf --fcov
#wsim rv32gc ${WALLY}/addins/cvw-arch-verif/tests/rv32/I/WALLY-COV-sw.elf --fcov
##wsim rv32gc ${WALLY}/addins/cvw-arch-verif/tests/rv32/I/WALLY-COV-beq.elf --fcov
#wsim rv32gc ${WALLY}/addins/cvw-arch-verif/tests/rv32/I/WALLY-COV-auipc.elf --fcov
#wsim rv32gc ${WALLY}/addins/cvw-arch-verif/tests/rv32/I/WALLY-COV-lui.elf --fcov
#wsim rv64gc ${WALLY}/addins/cvw-arch-verif/tests/rv64/I/WALLY-COV-add.elf --fcov
#wsim rv64gc ${WALLY}/addins/cvw-arch-verif/tests/rv64/I/WALLY-COV-addi.elf --fcov
make merge
merge:
cd ${WALLY}/addins/cvw-arch-verif && \
mkdir -p work && \
rm -f work/merge*.ucdb && \
bin/coverreport.py
CEXT := c
CPPEXT := cpp
AEXT := s
SEXT := S
SRCEXT := \([$(CEXT)$(AEXT)$(SEXT)]\|$(CPPEXT)\)
#SRCS = $(wildcard *.S)
#PROGS = $(patsubst %.S,%,$(SRCS))
BASEDIR = ${WALLY}/addins/cvw-arch-verif
SRCDIR64 = ${BASEDIR}/tests/rv64
SRCDIR32 = ${BASEDIR}/tests/rv32
SRCDIRPRIV = ${BASEDIR}/tests/priv
WALLYEXTS = $(shell find ${SRCDIR64} ${SRCDIR32} $(SRCDIRPRIV) -type d | sort)
SRCEXT = S
SOURCES ?= $(shell find $(SRCDIR32) $(SRCDIR64) $(SRCDIRPRIV) -type f -regex ".**\.$(SRCEXT)" | sort)
OBJEXT = elf
OBJECTS := $(SOURCES:.$(SEXT)=.$(OBJEXT))
build: $(OBJECTS)
%.elf.objdump: %.elf
# Some instructions get silently converted to 16-bit, this allows only Zc* instr to get converted to 16-bit
ZCA_FLAG = $(if $(findstring /Zca, $(dir $<)),_zca,)
ZCB_FLAG = $(if $(findstring /Zcb, $(dir $<)),_zcb,)
ZCD_FLAG = $(if $(findstring /Zcd, $(dir $<)),_zcd,)
ZCF_FLAG = $(if $(findstring /Zcf, $(dir $<)),_zcf,)
CMPR_FLAGS = $(ZCA_FLAG)$(ZCB_FLAG)$(ZCD_FLAG)$(ZCF_FLAG)
# Change many things if bit width isn't 64
$(SRCDIR64)/%.elf: $(SRCDIR64)/%.$(SEXT)
riscv64-unknown-elf-gcc -g -o $@ -march=rv64g$(CMPR_FLAGS)_zfa_zba_zbb_zbc_zbs_zfh_zicboz_zicbop_zicbom_zicond -mabi=lp64 -mcmodel=medany \
-nostartfiles -T${WALLY}/examples/link/link.ld $<
riscv64-unknown-elf-objdump -S -D $@ > [email protected]
riscv64-unknown-elf-elf2hex --bit-width 64 --input $@ --output [email protected]
extractFunctionRadix.sh [email protected]
$(SRCDIR32)/%.elf: $(SRCDIR32)/%.$(SEXT)
riscv64-unknown-elf-gcc -g -o $@ -march=rv32g$(CMPR_FLAGS)_zfa_zba_zbb_zbc_zbs_zfh_zicboz_zicbop_zicbom_zicond -mabi=ilp32 -mcmodel=medany \
-nostartfiles -T${WALLY}/examples/link/link.ld $<
riscv64-unknown-elf-objdump -S -D $@ > [email protected]
riscv64-unknown-elf-elf2hex --bit-width 32 --input $@ --output [email protected]
extractFunctionRadix.sh [email protected]
$(SRCDIRPRIV)/%.elf: $(SRCDIRPRIV)/%.$(SEXT) tests/priv/Zicsr-CSR-Tests.h
riscv64-unknown-elf-gcc -g -o $@ -march=rv64g_zfa_zba_zbb_zbc_zbs_zfh_zicboz_zicbop_zicbom_zicond -mabi=lp64 -mcmodel=medany \
-nostartfiles -I${WALLY}/tests/coverage -T${WALLY}/examples/link/link.ld $<
riscv64-unknown-elf-objdump -S -D $@ > [email protected]
riscv64-unknown-elf-elf2hex --bit-width 64 --input $@ --output [email protected]
extractFunctionRadix.sh [email protected]
clean:
rm -rf ${BASEDIR}/fcov/rv32/*
rm -rf ${BASEDIR}/fcov/rv64/*
rm -rf ${BASEDIR}/tests/rv*
#rm -f ${SRCDIR}/*.elf ${SRCDIR}/*.objdump ${SRCDIR}/*.addr *${SRCDIR}/.lab ${SRCDIR}/*.memfile