Summary 2: Unlocking cocotb 2.
0 - Modern Python-Based RTL Verification
This document explores cocotb 2.0, a Python framework for creating verification environments around RTL
designs. It highlights major upgrades in the 2.0 release, demonstrates hands-on use cases, and provides
guidance for transitioning from earlier versions.
Core Topics:
- What is cocotb? A Python testbench framework interfacing with simulators like Icarus, Questa, Verilator,
and Xcelium.
- New in Version 2.0:
- Replaces 'yield' with 'await'
- Moves from BinaryValue to LogicArray
- Deprecates 'raise TestFailure'
- Introduces Clock() API for efficient clock generation
- Examples:
- Directed and randomized adder tests
- Parameter sweeps using pytest
- FIFO verification using coroutine agents
- Python Runner: Simplifies build/test flows, replacing Makefiles with scriptable, simulator-independent
runners
Advantages:
- High productivity through Python syntax
- Multi-simulator support with minimal configuration
- Improved task and coroutine handling in modern Python style
- Easier testing and debugging