Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions boards/openhwgroup/cv32a6_testbench/Kconfig.cv32a6_testbench
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
# SPDX-License-Identifier: Apache-2.0
config BOARD_CV32A6_TESTBENCH
select SOC_CV32A6
select SOC_FAMILY_CVA6_PROVIDE_TEST_POWEROFF
7 changes: 7 additions & 0 deletions boards/openhwgroup/cv32a6_testbench/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
# SPDX-License-Identifier: Apache-2.0
board:
name: cv32a6_testbench
vendor: openhwgroup
socs:
- name: cv32a6
45 changes: 45 additions & 0 deletions boards/openhwgroup/cv32a6_testbench/cv32a6_testbench.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright(c) 2024, CISPA Helmholtz Center for Information Security
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;

#include <openhwgroup/cv32a6.dtsi>

/ {
model = "CVA6 CPU in testbench";
compatible = "ariane,cv32a6_testbench";

chosen {
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,sram = &memory0;
};
};

&uart0 {
status = "okay";
};

&spi0 {
status = "okay";
};

&clint{
status = "okay";
};


&dma0 {
status = "disabled";
};



&mdio0{
status = "disabled";
};

&eth0 {
status = "disabled";
};
40 changes: 40 additions & 0 deletions boards/openhwgroup/cv32a6_testbench/cv32a6_testbench_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
# SPDX-License-Identifier: Apache-2.0
CONFIG_BASE64=y
CONFIG_INCLUDE_RESET_VECTOR=y
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_NS16550=y
CONFIG_UART_NS16550_ACCESS_WORD_ONLY=y
CONFIG_CONSOLE_HANDLER=y
CONFIG_XIP=n
CONFIG_INIT_STACKS=y
CONFIG_SYS_CLOCK_TICKS_PER_SEC=25000000
CONFIG_FPU=y
CONFIG_POWEROFF=y

# RNG
CONFIG_TIMER_RANDOM_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y

# IRQs
CONFIG_MULTI_LEVEL_INTERRUPTS=y
CONFIG_2ND_LEVEL_INTERRUPTS=y
# 1 PLIC
CONFIG_NUM_2ND_LEVEL_AGGREGATORS=1
CONFIG_PLIC=y
CONFIG_3RD_LEVEL_INTERRUPTS=n


# logging
CONFIG_LOG=y
# immediate is required so it is not lost on test failure
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_THREAD_NAME=y

CONFIG_ISR_STACK_SIZE=32768
CONFIG_MAIN_STACK_SIZE=32768
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=32768
CONFIG_IDLE_STACK_SIZE=32768
5 changes: 5 additions & 0 deletions boards/openhwgroup/cv64a6_testbench/Kconfig.cv64a6_testbench
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
# SPDX-License-Identifier: Apache-2.0
config BOARD_CV64A6_TESTBENCH
select SOC_CV64A6_IMAFDC
select SOC_FAMILY_CVA6_PROVIDE_TEST_POWEROFF
7 changes: 7 additions & 0 deletions boards/openhwgroup/cv64a6_testbench/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
# SPDX-License-Identifier: Apache-2.0
board:
name: cv64a6_testbench
vendor: openhwgroup
socs:
- name: cv64a6
45 changes: 45 additions & 0 deletions boards/openhwgroup/cv64a6_testbench/cv64a6_testbench.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright(c) 2024, CISPA Helmholtz Center for Information Security
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;

#include <openhwgroup/cv64a6.dtsi>

/ {
model = "CVA6 CPU in testbench";
compatible = "ariane,cv64a6_testbench";

chosen {
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,sram = &memory0;
};
};

&uart0 {
status = "okay";
};

&spi0 {
status = "okay";
};

&clint{
status = "okay";
};


&dma0 {
status = "disabled";
};



&mdio0{
status = "disabled";
};

&eth0 {
status = "disabled";
};
40 changes: 40 additions & 0 deletions boards/openhwgroup/cv64a6_testbench/cv64a6_testbench_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
# SPDX-License-Identifier: Apache-2.0
CONFIG_BASE64=y
CONFIG_INCLUDE_RESET_VECTOR=y
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_NS16550=y
CONFIG_UART_NS16550_ACCESS_WORD_ONLY=y
CONFIG_CONSOLE_HANDLER=y
CONFIG_XIP=n
CONFIG_INIT_STACKS=y
CONFIG_SYS_CLOCK_TICKS_PER_SEC=25000000
CONFIG_FPU=y
CONFIG_POWEROFF=y

# RNG
CONFIG_TIMER_RANDOM_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y

# IRQs
CONFIG_MULTI_LEVEL_INTERRUPTS=y
CONFIG_2ND_LEVEL_INTERRUPTS=y
# 1 PLIC
CONFIG_NUM_2ND_LEVEL_AGGREGATORS=1
CONFIG_PLIC=y
CONFIG_3RD_LEVEL_INTERRUPTS=n


# logging
CONFIG_LOG=y
# immediate is required so it is not lost on test failure
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_THREAD_NAME=y

CONFIG_ISR_STACK_SIZE=32768
CONFIG_MAIN_STACK_SIZE=32768
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=32768
CONFIG_IDLE_STACK_SIZE=32768
9 changes: 9 additions & 0 deletions samples/boards/openhwgroup/sim_fail/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(cv64a6_sim_fail)

target_sources(app PRIVATE src/main.c)
32 changes: 32 additions & 0 deletions samples/boards/openhwgroup/sim_fail/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. _hello_world:

Failing test
###########

Overview
********

A simple sample that can be used in the cv64a6 simulator.
Prints "Test failure" to the console and indicates failure to the testbench.

Building and Running
********************

This application can be built and executed in the cv64a6 testbench as follows:

.. code-block:: console
west build -p always -b cv64a6_testbench samples/boards/openhwgroup/cva6/sim_fail/
ln -s $(pwd)/build/zephyr/zephyr.elf build/zephyr/zephyr.o
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


To build for another board, change "cv64a6_testbench" above to that board's name.

Sample Output
=============

.. code-block:: console

Test Failure x86

Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
1 change: 1 addition & 0 deletions samples/boards/openhwgroup/sim_fail/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# nothing here
17 changes: 17 additions & 0 deletions samples/boards/openhwgroup/sim_fail/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
# SPDX-License-Identifier: Apache-2.0
sample:
description: Test failure sample adapted for CVA6 testbench
name: Test failure test
common:
tags: introduction
integration_platforms:
- native_sim
harness: console
harness_config:
type: one_line
regex:
- "Test Failure (.*)"
tests:
sample.basic.helloworld:
tags: introduction
16 changes: 16 additions & 0 deletions samples/boards/openhwgroup/sim_fail/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright(c) 2024, CISPA Helmholtz Center for Information Security
* SPDX - License - Identifier : Apache-2.0
*/
#include <cv64a6.h>
#include <stdio.h>


int main(void)
{
printf("Test failure %s\n", CONFIG_BOARD_TARGET);

z_cv64a6_finish_test(0xdead);

return 0;
}
9 changes: 9 additions & 0 deletions samples/boards/openhwgroup/sim_hello_world/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(hello_world_cv64a6_sim)

target_sources(app PRIVATE src/main.c)
32 changes: 32 additions & 0 deletions samples/boards/openhwgroup/sim_hello_world/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. _hello_world:

Hello World
###########

Overview
********

A simple sample that can be used in the cv64a6 simulator.
Prints "Hello World" to the console and indicates success to the testbench.

Building and Running
********************

This application can be built and executed in the cv64a6 testbench as follows:

.. code-block:: console
west build -p always -b cv64a6_testbench samples/boards/openhwgroup/sim_hello_world/
ln -s $(pwd)/build/zephyr/zephyr.elf build/zephyr/zephyr.o
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_OPTSreset


To build for another board, change "cv64a6_testbench" above to that board's name.

Sample Output
=============

.. code-block:: console

Hello World! x86

Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
1 change: 1 addition & 0 deletions samples/boards/openhwgroup/sim_hello_world/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# nothing here
17 changes: 17 additions & 0 deletions samples/boards/openhwgroup/sim_hello_world/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
# SPDX-License-Identifier: Apache-2.0
sample:
description: Hello World sample adapted for CVA6 testbench
name: hello world test
common:
tags: introduction
integration_platforms:
- native_sim
harness: console
harness_config:
type: one_line
regex:
- "Hello World! (.*)"
tests:
sample.basic.helloworld:
tags: introduction
17 changes: 17 additions & 0 deletions samples/boards/openhwgroup/sim_hello_world/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
*
* Copyright(c) 2024, CISPA Helmholtz Center for Information Security
* SPDX - License - Identifier : Apache-2.0
*/
#include <cv64a6.h>
#include <stdio.h>


int main(void)
{
printf("Hello World! %s\n", CONFIG_BOARD_TARGET);

z_cv64a6_finish_test(0);

return 0;
}
Loading