Hugo McNally | f6298b3 | 2023-02-12 14:47:22 +0000 | [diff] [blame^] | 1 | # Chip-Level Tests |
Timothy Trippel | cb8a47e | 2021-09-07 21:57:22 +0000 | [diff] [blame] | 2 | |
| 3 | # Overview |
| 4 | |
Hugo McNally | aef0a66 | 2023-02-11 19:44:55 +0000 | [diff] [blame] | 5 | This 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 Trippel | cb8a47e | 2021-09-07 21:57:22 +0000 | [diff] [blame] | 6 | These 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. |
| 10 | These tests consist of: smoke, IP integration, and system-level tests. |
| 11 | While 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 Lees | b77d06d | 2022-11-22 18:19:12 +0000 | [diff] [blame] | 25 | * Smoke tests will be placed in (one per IP): |
Timothy Trippel | cb8a47e | 2021-09-07 21:57:22 +0000 | [diff] [blame] | 26 | * (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 |
| 35 | Ideally all smoke, IP integration, and system-level tests should be target agnostic. |
| 36 | However, 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 McNally | aef0a66 | 2023-02-11 19:44:55 +0000 | [diff] [blame] | 37 | Eventually, 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 Lees | 9657fb8 | 2022-11-18 17:04:53 +0000 | [diff] [blame] | 38 | However, until then, host emulation depends on the target (e.g., DV vs. Verilator simulation). |
Timothy Trippel | cb8a47e | 2021-09-07 21:57:22 +0000 | [diff] [blame] | 39 | Therefore, chip-level tests that require external stimulation from the host, will be subfoldered by target, under the appropriate toplevel folder above. |
| 40 | One 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 McNally | aef0a66 | 2023-02-11 19:44:55 +0000 | [diff] [blame] | 43 | For instructions on how to write a chip-level test, refer to the [on-device test framework](../lib/testing/test_framework/README.md) page. |
Timothy Trippel | cb8a47e | 2021-09-07 21:57:22 +0000 | [diff] [blame] | 44 | |
| 45 | # List of Tests |
| 46 | |
| 47 | ## Smoke |
| 48 | |
| 49 | TBD |
| 50 | |
| 51 | ## IP Integration |
| 52 | {{< incGenFromIpDesc "/hw/top_earlgrey/data/chip_testplan.hjson" "testplan" >}} |
| 53 | |
| 54 | ## System-Level (Use Case) |
| 55 | |
| 56 | TBD |