Add cocotb testbench for validating generated bus decoder RTL across APB3, APB4, and AXI4-Lite interfaces (#9)

* Initial plan

* Add cocotb test infrastructure and testbenches for APB3, APB4, and AXI4-Lite

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add integration tests, examples, and documentation for cocotb testbenches

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Address code review feedback: use relative imports and update installation docs

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add implementation summary document

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Merge cocotb dependencies into test group

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add optional cocotb simulation workflow with Icarus Verilog

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
This commit is contained in:
Copilot
2025-10-23 23:46:51 -07:00
committed by GitHub
parent 0b98165ccc
commit 4dc61d24ca
17 changed files with 2028 additions and 7 deletions

53
tests/cocotb/README.md Normal file
View File

@@ -0,0 +1,53 @@
# Cocotb Integration Tests
This directory contains cocotb-based integration tests that verify the functionality
of generated bus decoder RTL for different CPU interfaces.
## Overview
These tests:
1. Generate SystemVerilog decoder modules from SystemRDL specifications
2. Simulate the generated RTL using cocotb
3. Verify read/write operations work correctly for different bus protocols
## Supported CPU Interfaces
- APB3 (AMBA APB3)
- APB4 (AMBA APB4 with strobe support)
- AXI4-Lite (AMBA AXI4-Lite)
## Running the Tests
### Install Dependencies
```bash
# Using uv (recommended)
uv sync --group test
# Or using pip
pip install -e .[test]
```
### Run All Cocotb Tests
```bash
pytest tests/cocotb/testbenches/
```
### Run Specific Interface Tests
```bash
# Test APB4 interface
pytest tests/cocotb/testbenches/test_apb4_decoder.py
# Test APB3 interface
pytest tests/cocotb/testbenches/test_apb3_decoder.py
# Test AXI4-Lite interface
pytest tests/cocotb/testbenches/test_axi4lite_decoder.py
```
## Test Structure
- `common/`: Shared utilities and base classes for cocotb tests
- `testbenches/`: Individual testbenches for each CPU interface