|
1 | | -# scvpi |
2 | | -Provides a stub implementation of (System)Verilog VPI functions for SystemC. |
3 | | -Currently, this is just enough to allow cocotb to schedule coroutines. |
4 | | -Access to signals, and other RTL-like things is not currently implemented. The purpose |
5 | | -of this package is to enable running a Python testbench with high-level SystemC |
6 | | -models. |
| 1 | +# SCVPI |
7 | 2 |
|
| 3 | +SCVPI is a VPI-compatible interface for SystemC that enables **cocotb** |
| 4 | +and cocotb-based frameworks such as **PyUVM** to run on SystemC models. |
8 | 5 |
|
9 | | -## Using scvpi |
| 6 | +By providing a VPI-compatible layer, SCVPI allows Python-based |
| 7 | +verification environments to be reused across both RTL and SystemC, |
| 8 | +eliminating duplicated verification infrastructure and enabling a |
| 9 | +unified verification flow. |
10 | 10 |
|
11 | | -- Compile scvpi with your SystemC model |
12 | | - - Add <scvpi>/src/scvpi.cpp to your SystemC files |
13 | | - - Add <scvpi>/src as an include path |
14 | | - |
15 | | -- Specify VPI libraries to load at runtime |
16 | | - - Add +vpi=<path_to_so> to the SystemC command line |
17 | | - |
| 11 | +--- |
18 | 12 |
|
| 13 | +## Motivation |
| 14 | + |
| 15 | +Python-based verification frameworks such as cocotb and PyUVM are widely |
| 16 | +used for RTL verification due to their productivity and reusability. |
| 17 | +However, these frameworks rely on the Verilog Procedural Interface (VPI) |
| 18 | +and therefore cannot be applied directly to SystemC models. |
| 19 | + |
| 20 | +SystemC is commonly used for high-level modeling and virtual prototyping. |
| 21 | +This separation often leads to duplicated testbenches and inconsistent |
| 22 | +verification behavior between RTL and high-level models. |
| 23 | + |
| 24 | +SCVPI bridges this gap by exposing a VPI-compatible interface for |
| 25 | +SystemC, allowing cocotb and PyUVM testbenches to execute on SystemC |
| 26 | +models without modification. |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## What SCVPI Provides |
| 31 | + |
| 32 | +- A VPI-compatible interface for SystemC |
| 33 | +- Coroutine scheduling support required by cocotb |
| 34 | +- Signal access and callback mechanisms required by PyUVM |
| 35 | +- Reuse of Python testbenches without modification |
| 36 | +- A unified verification flow across RTL and SystemC models |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## Supported SystemC Signal Types |
| 41 | + |
| 42 | +SCVPI currently supports direct value access for a subset of SystemC |
| 43 | +signal types, including: |
| 44 | + |
| 45 | +- `sc_signal<bool>` |
| 46 | +- `sc_signal<int>` (treated as 32-bit) |
| 47 | +- `sc_signal<sc_int<4>>` |
| 48 | +- `sc_signal<sc_uint<3>>` |
| 49 | +- `sc_signal<sc_uint<8>>` |
| 50 | +- `sc_signal<sc_uint<16>>` |
| 51 | + |
| 52 | +Signals with unsupported types are reported as unknown. |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | +## Examples |
| 57 | + |
| 58 | +The repository includes several examples demonstrating different usage |
| 59 | +scenarios: |
| 60 | + |
| 61 | +- **examples/basic** |
| 62 | + Minimal sanity check demonstrating cocotb coroutine scheduling on a |
| 63 | + SystemC model. |
| 64 | + |
| 65 | +- **examples/adder** |
| 66 | + A simple functional example with deterministic and randomized tests. |
| 67 | + |
| 68 | +- **examples/TinyALU_SystemC** |
| 69 | + A SystemC implementation of the official PyUVM TinyALU example. |
| 70 | + The original PyUVM testbench is reused unchanged, demonstrating |
| 71 | + verification reuse between RTL and SystemC using SCVPI. |
| 72 | + |
| 73 | +These examples serve as reference implementations for integrating SCVPI |
| 74 | +with SystemC models and reusing Python-based verification environments. |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## Scope and Limitations |
| 79 | + |
| 80 | +SCVPI is intended for verification of high-level SystemC models. |
| 81 | +It does not aim to replace RTL simulators or provide full Verilog |
| 82 | +compatibility. Performance characteristics may differ from RTL-based |
| 83 | +verification flows. |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +## License |
| 88 | + |
| 89 | +This project is released under the applicable open-source license. |
| 90 | +Third-party examples and testbenches retain their original licenses. |
0 commit comments