blob: 9dd98f18b7017e47b8120c67b3847d039c9c0abc [file] [log] [blame] [view]
Hugo McNallyf6298b32023-02-12 14:47:22 +00001# Chip-Level Tests
Timothy Trippelcb8a47e2021-09-07 21:57:22 +00002
3# Overview
4
Hugo McNallyaef0a662023-02-11 19:44:55 +00005This subtree contains three types of chip-level tests that are capable of running across all OpenTitan verification targets, using the [on-device test framework](../lib/testing/test_framework/README.md).
Timothy Trippelcb8a47e2021-09-07 21:57:22 +00006These targets include: DV simulation, Verilator simulation, FPGA, and eventually silicon.
7
8# Test Types
9- **Chip-level Tests** - A collection of software level tests that run on OpenTitan hardware, whose main purpose is pre-silicon verification and post-silicon bringup.
10These tests consist of: smoke, IP integration, and system-level tests.
11While most of these tests are top-level agnostic, some are not.
12 - **Smoke Tests** - A software level test, written in C using DIFs, that performs a minimal set of operations on a given IP block to verify that it is alive and functioning.
13 - **IP Integration Tests** - A software level test, written in C, that exercises some specific functionality specific to a given IP and toplevel.
14 - **System-level Scenario Test** - A software level test, written in C, that mimics complex system level use case scenarios.
15 Such a test is designed to encompass multiple pieces of functionality tested by the IP integration tests.
16
17# Organization and Style Guide
18
19## File Naming Conventions
20* Smoke tests: **{IP name}\_smoketest.c**
21* IP Integration tests: **{IP name}[\_{feature}]\_test.c**
22* System-level tests: **{use case}\_systemtest.c**
23
24## Subfoldering Rules
Adrian Leesb77d06d2022-11-22 18:19:12 +000025* Smoke tests will be placed in (one per IP):
Timothy Trippelcb8a47e2021-09-07 21:57:22 +000026 * (generic) **sw/device/tests/**
27 * (earlgrey-specific) **sw/device/tests/earlgrey/**
28 * ({toplevel}-specific) **sw/device/tests/{toplevel}/**
29* IP Integration tests will be placed in the same folders as above.
30* System-level tests will be placed in the same folders as above.
31* IP Integration Test data (some tests, e.g. OTBN, load data files): **sw/device/tests/{IP}\_data/**
32* Target-specific tests will be subfoldered by target (see below).
33
34### Subfoldering Target-Specific Tests
35Ideally all smoke, IP integration, and system-level tests should be target agnostic.
36However, some tests require emulation of host capabilities, such as an external SPI or I2C host, an external host to encrypt/decrypt data, or an external host that toggles GPIO pins.
Hugo McNallyaef0a662023-02-11 19:44:55 +000037Eventually, host-side test initiation tools and the [on-device test framework](../lib/testing/test_framework/README.md) will make host emulation opaque to each chip-level test.
Adrian Lees9657fb82022-11-18 17:04:53 +000038However, until then, host emulation depends on the target (e.g., DV vs. Verilator simulation).
Timothy Trippelcb8a47e2021-09-07 21:57:22 +000039Therefore, chip-level tests that require external stimulation from the host, will be subfoldered by target, under the appropriate toplevel folder above.
40One example of such a test is the [`sw/device/tests/sim_dv/gpio_test.c`](https://github.com/lowRISC/opentitan/blob/master/sw/device/tests/sim_dv/gpio_test.c), which is subfoldered under `../sim_dv/` to indicate it is a target-specific test.
41
42# Writing a Chip-Level Test
Hugo McNallyaef0a662023-02-11 19:44:55 +000043For instructions on how to write a chip-level test, refer to the [on-device test framework](../lib/testing/test_framework/README.md) page.
Timothy Trippelcb8a47e2021-09-07 21:57:22 +000044
45# List of Tests
46
47## Smoke
48
49TBD
50
51## IP Integration
52{{< incGenFromIpDesc "/hw/top_earlgrey/data/chip_testplan.hjson" "testplan" >}}
53
54## System-Level (Use Case)
55
56TBD