Skip to content

Commit 7d1cae9

Browse files
boards: openhwgroup: add CVA6 Testbench
Adds support for the CVA6 CPU in the hardware simulation / testbench environment. Especially, configurations are added that allow the application to indicate success or error to the testbench. The SoC currently contains the CVA CPU, interrupt controllers (CLINT and PLIC), UART, a SPI for booting from SD, a boot ROM, a GPIO and the lowRISC ethernet subsystem (which is currently without a driver in zephyr). Two sample applications are provided, demonstrating how to indicate success or failure to the testbench. Signed-off-by: Eric Ackermann <[email protected]>
1 parent 494f880 commit 7d1cae9

File tree

18 files changed

+345
-0
lines changed

18 files changed

+345
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
config BOARD_CV32A6_TESTBENCH
4+
select SOC_CV32A6
5+
select SOC_FAMILY_CVA6_PROVIDE_TEST_POWEROFF
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
board:
4+
name: cv32a6_testbench
5+
vendor: openhwgroup
6+
socs:
7+
- name: cv32a6
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright(c) 2024, CISPA Helmholtz Center for Information Security
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
/dts-v1/;
6+
7+
#include <openhwgroup/cv32a6.dtsi>
8+
9+
/ {
10+
model = "CVA6 CPU in testbench";
11+
compatible = "ariane,cv32a6_testbench";
12+
13+
chosen {
14+
zephyr,console = &uart0;
15+
zephyr,shell-uart = &uart0;
16+
zephyr,sram = &memory0;
17+
};
18+
};
19+
20+
&uart0 {
21+
status = "okay";
22+
};
23+
24+
&spi0 {
25+
status = "okay";
26+
};
27+
28+
&clint{
29+
status = "okay";
30+
};
31+
32+
33+
&dma0 {
34+
status = "disabled";
35+
};
36+
37+
38+
39+
&mdio0{
40+
status = "disabled";
41+
};
42+
43+
&eth0 {
44+
status = "disabled";
45+
};
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
CONFIG_BASE64=y
4+
CONFIG_INCLUDE_RESET_VECTOR=y
5+
CONFIG_CONSOLE=y
6+
CONFIG_SERIAL=y
7+
CONFIG_UART_CONSOLE=y
8+
CONFIG_UART_NS16550=y
9+
CONFIG_UART_NS16550_ACCESS_WORD_ONLY=y
10+
CONFIG_CONSOLE_HANDLER=y
11+
CONFIG_XIP=n
12+
CONFIG_INIT_STACKS=y
13+
CONFIG_SYS_CLOCK_TICKS_PER_SEC=25000000
14+
CONFIG_FPU=y
15+
CONFIG_POWEROFF=y
16+
17+
# RNG
18+
CONFIG_TIMER_RANDOM_GENERATOR=y
19+
CONFIG_TEST_RANDOM_GENERATOR=y
20+
21+
# IRQs
22+
CONFIG_MULTI_LEVEL_INTERRUPTS=y
23+
CONFIG_2ND_LEVEL_INTERRUPTS=y
24+
# 1 PLIC
25+
CONFIG_NUM_2ND_LEVEL_AGGREGATORS=1
26+
CONFIG_PLIC=y
27+
CONFIG_3RD_LEVEL_INTERRUPTS=n
28+
29+
30+
# logging
31+
CONFIG_LOG=y
32+
# immediate is required so it is not lost on test failure
33+
CONFIG_LOG_MODE_IMMEDIATE=y
34+
CONFIG_LOG_DEFAULT_LEVEL=4
35+
CONFIG_THREAD_NAME=y
36+
37+
CONFIG_ISR_STACK_SIZE=32768
38+
CONFIG_MAIN_STACK_SIZE=32768
39+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=32768
40+
CONFIG_IDLE_STACK_SIZE=32768
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
config BOARD_CV64A6_TESTBENCH
4+
select SOC_CV64A6_IMAFDC
5+
select SOC_FAMILY_CVA6_PROVIDE_TEST_POWEROFF
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
board:
4+
name: cv64a6_testbench
5+
vendor: openhwgroup
6+
socs:
7+
- name: cv64a6
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright(c) 2024, CISPA Helmholtz Center for Information Security
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
/dts-v1/;
6+
7+
#include <openhwgroup/cv64a6.dtsi>
8+
9+
/ {
10+
model = "CVA6 CPU in testbench";
11+
compatible = "ariane,cv64a6_testbench";
12+
13+
chosen {
14+
zephyr,console = &uart0;
15+
zephyr,shell-uart = &uart0;
16+
zephyr,sram = &memory0;
17+
};
18+
};
19+
20+
&uart0 {
21+
status = "okay";
22+
};
23+
24+
&spi0 {
25+
status = "okay";
26+
};
27+
28+
&clint{
29+
status = "okay";
30+
};
31+
32+
33+
&dma0 {
34+
status = "disabled";
35+
};
36+
37+
38+
39+
&mdio0{
40+
status = "disabled";
41+
};
42+
43+
&eth0 {
44+
status = "disabled";
45+
};
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
CONFIG_BASE64=y
4+
CONFIG_INCLUDE_RESET_VECTOR=y
5+
CONFIG_CONSOLE=y
6+
CONFIG_SERIAL=y
7+
CONFIG_UART_CONSOLE=y
8+
CONFIG_UART_NS16550=y
9+
CONFIG_UART_NS16550_ACCESS_WORD_ONLY=y
10+
CONFIG_CONSOLE_HANDLER=y
11+
CONFIG_XIP=n
12+
CONFIG_INIT_STACKS=y
13+
CONFIG_SYS_CLOCK_TICKS_PER_SEC=25000000
14+
CONFIG_FPU=y
15+
CONFIG_POWEROFF=y
16+
17+
# RNG
18+
CONFIG_TIMER_RANDOM_GENERATOR=y
19+
CONFIG_TEST_RANDOM_GENERATOR=y
20+
21+
# IRQs
22+
CONFIG_MULTI_LEVEL_INTERRUPTS=y
23+
CONFIG_2ND_LEVEL_INTERRUPTS=y
24+
# 1 PLIC
25+
CONFIG_NUM_2ND_LEVEL_AGGREGATORS=1
26+
CONFIG_PLIC=y
27+
CONFIG_3RD_LEVEL_INTERRUPTS=n
28+
29+
30+
# logging
31+
CONFIG_LOG=y
32+
# immediate is required so it is not lost on test failure
33+
CONFIG_LOG_MODE_IMMEDIATE=y
34+
CONFIG_LOG_DEFAULT_LEVEL=4
35+
CONFIG_THREAD_NAME=y
36+
37+
CONFIG_ISR_STACK_SIZE=32768
38+
CONFIG_MAIN_STACK_SIZE=32768
39+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=32768
40+
CONFIG_IDLE_STACK_SIZE=32768
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
cmake_minimum_required(VERSION 3.20.0)
5+
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
7+
project(cv64a6_sim_fail)
8+
9+
target_sources(app PRIVATE src/main.c)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.. _hello_world:
2+
3+
Failing test
4+
###########
5+
6+
Overview
7+
********
8+
9+
A simple sample that can be used in the cv64a6 simulator.
10+
Prints "Test failure" to the console and indicates failure to the testbench.
11+
12+
Building and Running
13+
********************
14+
15+
This application can be built and executed in the cv64a6 testbench as follows:
16+
17+
.. code-block:: console
18+
west build -p always -b cv64a6_testbench samples/boards/openhwgroup/cva6/sim_fail/
19+
ln -s $(pwd)/build/zephyr/zephyr.elf build/zephyr/zephyr.o
20+
python3 $CVA6_ROOT/verif/sim/cva6.py --elf_tests $ZEPHYR_ROOT/build/zephyr/zephyr.o --iss_yaml cva6.yaml --target cv64a6_imafdc_sv39 --iss=veri-testharness --spike_params="/top/max_steps_enabled=y" $DV_OPTS
21+
22+
23+
To build for another board, change "cv64a6_testbench" above to that board's name.
24+
25+
Sample Output
26+
=============
27+
28+
.. code-block:: console
29+
30+
Test Failure x86
31+
32+
Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.

0 commit comments

Comments
 (0)