cocotb is a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python.
Latest release available source
- Read the documentation
- Get involved: Raise a bug / request an enhancement (Requires a GitHub account)
- Get in contact: E-mail us
- Follow us on Twitter: @PVCocotb
VHDL and Verilog are both unsuitable for writing complex testbenches. eRM, SystemVerilog and the various SV based methodologies have emerged to address this deficiency. These verification methodologies are large and cumbersome, requiring specialist knowledge, significant time investment and expensive toolchains to achieve satisfactory verification. The overhead of setting up testbenches is onerous so often designers write small throwaway testbenches at a block level and defer the majority of verification to a large system level testbench.
Cocotb bridges this gap in order to make block-level testing useful, reusable, fast and accessible to a much wider skill-set. The net effect is that bugs will be discovered earlier in the design cycle which equate to significant time and cost savings.
Cocotb is ideally suited to FPGA development but also scales to ASIC environments. A testbench can be as simple as basic directed tests, through to a complex constrained random verification environment. Cocotb provides similar capabilities to UVM but with the productivity benefit of a higher-level language.
Cocotb is complete open-source, licensed under the BSD license and compatible with the Icarus Verilog simulator.
- It's easy to interface to other languages from Python
- Python has a huge library of existing code to re-use like constraint solvers packet parsing/generation libraries.
- Python is interpreted. Tests can be edited and re-run without having to recompile the design or even exit the simulator GUI.
- Writing Python is fast, it's easy to understand and learn.
For further details refer to the documentation.
Slides from the Potential Ventures presentation at the NMI FPGA Verification event:
MyHDL seeks to displace VHDL and Verilog with a Python framework that can generate synthesiable RTL.
Several examples exist of projects providing a VPI interface into a language other than C:
Cocotb tries to build on the advances made by these projects while learning from the direction of UVM and other verification standards.