Welcome to cocotb#

What is cocotb?#

cocotb enables users to test and verify their chip designs in Python as opposed to VHDL, (System)Verilog, or other EDA-specific languages.

Why cocotb?#

cocotb was specifically designed to lower the overhead of creating a testbench. But it is still capable of – and encourages – reuse and randomized testing for building larger, more complex testbenches.

Python offers many advantages over languages traditionally used for test and verification, such as VHDL or (System)Verilog.

  • Writing Python is fast - it’s a very productive language.

  • It’s easy to interface to other languages from Python.

  • Python has a huge library of existing code to reuse.

  • Python is interpreted - tests can be edited and re-run without having to recompile the design or the testbench.

  • Python is popular - far more engineers know Python than SystemVerilog or VHDL.

cocotb supports most popular simulators on most relevant platforms.

When writing cocotb testbenches, users will typically not have to write any HDL.

cocotb has built-in support for integrating with continuous integration systems, such as Jenkins, GitLab, etc. through standardized, machine-readable test reporting formats.

cocotb is provided free of charge under the BSD License and is hosted publicly on GitHub.

How does cocotb work?#

cocotb is a coroutine-based cosimulation testbench environment.

This means that when the design is simulated, cocotb runs as a cosimulation using one of the procedural interfaces (VPI, VHPI, or FLI). A Python interpreter is embedded into the running simulator process to provide a Python execution environment. A Python library and coroutine-based concurrency system are built on top of the procedural interfaces to interact with the simulated design in a Pythonic way.

_images/cocotb_overview.svg

Who is cocotb?#

cocotb is a Free and Open Source project and is developed collaboratively by its contributors and Maintainers. cocotb has many serious commercial users and sponsors. See cocotb.org for more details.

How do I get started?#

Read the Installation instructions to get cocotb installed and set up. Then follow the First Steps tutorial to get a simple test running.