Skip to content

Commit a1286da

Browse files
author
liweiwei
committed
add support for cbo.zero in cmo extension
1 parent 307c77b commit a1286da

File tree

11 files changed

+940
-0
lines changed

11 files changed

+940
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
TARGET_SIM ?= riscv_sim_RV32 -V
2+
TARGET_FLAGS ?= $(RISCV_TARGET_FLAGS)
3+
BLOCKSZ ?= 16
4+
ifeq ($(shell command -v $(TARGET_SIM) 2> /dev/null),)
5+
$(error Target simulator executable '$(TARGET_SIM)` not found)
6+
endif
7+
8+
RUN_CMD=\
9+
$(TARGET_SIM) $(TARGET_FLAGS) -B $(BLOCKSZ) \
10+
--test-signature=$(*).signature.output \
11+
$(<)
12+
13+
RISCV_PREFIX ?= riscv32-unknown-elf-
14+
RISCV_GCC ?= $(RISCV_PREFIX)gcc
15+
RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump
16+
RISCV_GCC_OPTS ?= -g -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles $(RVTEST_DEFINES)
17+
18+
COMPILE_CMD = $$(RISCV_GCC) $(1) $$(RISCV_GCC_OPTS) \
19+
-I$(ROOTDIR)/riscv-test-suite/env/ \
20+
-I$(TARGETDIR)/$(RISCV_TARGET)/ \
21+
-T$(TARGETDIR)/$(RISCV_TARGET)/link.ld \
22+
$$(<) -o $$@
23+
OBJ_CMD = $$(RISCV_OBJDUMP) $$@ -D > [email protected]; \
24+
$$(RISCV_OBJDUMP) $$@ --source > [email protected]
25+
26+
27+
COMPILE_TARGET=\
28+
$(COMPILE_CMD); \
29+
if [ $$$$? -ne 0 ] ; \
30+
then \
31+
echo "\e[31m$$(RISCV_GCC) failed for target $$(@) \e[39m" ; \
32+
exit 1 ; \
33+
fi ; \
34+
$(OBJ_CMD); \
35+
if [ $$$$? -ne 0 ] ; \
36+
then \
37+
echo "\e[31m $$(RISCV_OBJDUMP) failed for target $$(@) \e[39m" ; \
38+
exit 1 ; \
39+
fi ;
40+
41+
RUN_TARGET=\
42+
$(RUN_CMD)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
TARGET_SIM ?= riscv_sim_RV64 -V
2+
TARGET_FLAGS ?= $(RISCV_TARGET_FLAGS)
3+
BLOCKSZ ?= 16
4+
ifeq ($(shell command -v $(TARGET_SIM) 2> /dev/null),)
5+
$(error Target simulator executable '$(TARGET_SIM)` not found)
6+
endif
7+
8+
RUN_CMD=\
9+
$(TARGET_SIM) $(TARGET_FLAGS) -B $(BLOCKSZ)\
10+
--test-signature=$(*).signature.output \
11+
$(<)
12+
13+
RISCV_PREFIX ?= riscv64-unknown-elf-
14+
RISCV_GCC ?= $(RISCV_PREFIX)gcc
15+
RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump
16+
RISCV_GCC_OPTS ?= -g -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles $(RVTEST_DEFINES)
17+
18+
COMPILE_CMD = $$(RISCV_GCC) $(1) $$(RISCV_GCC_OPTS) \
19+
-I$(ROOTDIR)/riscv-test-suite/env/ \
20+
-I$(TARGETDIR)/$(RISCV_TARGET)/ \
21+
-T$(TARGETDIR)/$(RISCV_TARGET)/link.ld \
22+
$$(<) -o $$@
23+
OBJ_CMD = $$(RISCV_OBJDUMP) $$@ -D > [email protected]; \
24+
$$(RISCV_OBJDUMP) $$@ --source > [email protected]
25+
26+
27+
28+
COMPILE_TARGET=\
29+
$(COMPILE_CMD); \
30+
if [ $$$$? -ne 0 ] ; \
31+
then \
32+
echo "\e[31m$$(RISCV_GCC) failed for target $$(@) \e[39m" ; \
33+
exit 1 ; \
34+
fi ; \
35+
$(OBJ_CMD); \
36+
if [ $$$$? -ne 0 ] ; \
37+
then \
38+
echo "\e[31m $$(RISCV_OBJDUMP) failed for target $$(@) \e[39m" ; \
39+
exit 1 ; \
40+
fi ;
41+
42+
RUN_TARGET=\
43+
$(RUN_CMD)

riscv-test-suite/env/arch_test.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,13 @@ inst rs2, imm_val(rs1) ;\
781781
nop ;\
782782
nop
783783

784+
#define TEST_CBO_ZERO(swreg,rs1,inst,imm_val,offset) ;\
785+
LI(rs1, offset*(BLOCKSZ*8/XLEN)+(imm_val&(BLOCKSZ-1))) ;\
786+
add rs1,swreg,rs1 ;\
787+
inst rs1 ;\
788+
nop ;\
789+
nop
790+
784791
#define TEST_LOAD(swreg,testreg,index,rs1,destreg,imm_val,offset,inst,adj) ;\
785792
LA(rs1,rvtest_data+(index*4)+adj-imm_val) ;\
786793
inst destreg, imm_val(rs1) ;\
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include ../../Makefile.include
2+
3+
$(eval $(call compile_template,-march=rv32i -mabi=ilp32 -DXLEN=$(XLEN) -DBLOCKSZ=$(BLOCKSZ)))
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# RISC-V Architecture Test RV32I Makefrag
2+
#
3+
# Copyright (c) 2017, Codasip Ltd.
4+
# All rights reserved.
5+
#
6+
# Redistribution and use in source and binary forms, with or without
7+
# modification, are permitted provided that the following conditions are met:
8+
# * Redistributions of source code must retain the above copyright
9+
# notice, this list of conditions and the following disclaimer.
10+
# * Redistributions in binary form must reproduce the above copyright
11+
# notice, this list of conditions and the following disclaimer in the
12+
# documentation and/or other materials provided with the distribution.
13+
# * Neither the name of the Codasip Ltd. nor the
14+
# names of its contributors may be used to endorse or promote products
15+
# derived from this software without specific prior written permission.
16+
#
17+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18+
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Codasip Ltd. BE LIABLE FOR ANY
21+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24+
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26+
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
#
28+
# Description: Makefrag for RV32I architectural tests
29+
30+
rv32i_sc_tests = \
31+
cbo.zero-01
32+
33+
rv32i_tests = $(addsuffix .elf, $(rv32i_sc_tests))
34+
35+
target_tests += $(rv32i_tests)
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
00000000
2+
00000000
3+
00000000
4+
00000000
5+
00000000
6+
00000000
7+
00000000
8+
00000000
9+
00000000
10+
00000000
11+
00000000
12+
00000000
13+
00000000
14+
00000000
15+
00000000
16+
00000000
17+
00000000
18+
00000000
19+
00000000
20+
00000000
21+
00000000
22+
00000000
23+
00000000
24+
00000000
25+
00000000
26+
00000000
27+
00000000
28+
00000000
29+
00000000
30+
00000000
31+
00000000
32+
00000000
33+
00000000
34+
00000000
35+
00000000
36+
00000000
37+
00000000
38+
00000000
39+
00000000
40+
00000000
41+
00000000
42+
00000000
43+
00000000
44+
00000000
45+
00000000
46+
00000000
47+
00000000
48+
00000000
49+
00000000
50+
00000000
51+
00000000
52+
00000000
53+
00000000
54+
00000000
55+
00000000
56+
00000000
57+
00000000
58+
00000000
59+
00000000
60+
00000000
61+
00000000
62+
00000000
63+
00000000
64+
00000000
65+
00000000
66+
00000000
67+
00000000
68+
00000000
69+
00000000
70+
00000000
71+
00000000
72+
00000000
73+
00000000
74+
00000000
75+
00000000
76+
00000000
77+
00000000
78+
00000000
79+
00000000
80+
00000000
81+
00000000
82+
00000000
83+
00000000
84+
00000000
85+
00000000
86+
00000000
87+
00000000
88+
00000000
89+
00000000
90+
00000000
91+
00000000
92+
00000000
93+
00000000
94+
00000000
95+
00000000
96+
00000000
97+
00000000
98+
00000000
99+
00000000
100+
00000000
101+
00000000
102+
00000000
103+
00000000
104+
00000000
105+
00000000
106+
00000000
107+
00000000
108+
00000000
109+
00000000
110+
00000000
111+
00000000
112+
00000000
113+
00000000
114+
00000000
115+
00000000
116+
00000000
117+
00000000
118+
00000000
119+
00000000
120+
00000000
121+
00000000
122+
00000000
123+
00000000
124+
00000000
125+
00000000
126+
00000000
127+
00000000
128+
00000000
129+
00000000
130+
00000000
131+
00000000
132+
00000000
133+
00000000
134+
00000000
135+
00000000
136+
00000000

0 commit comments

Comments
 (0)