Use cocotb to test and verify chip designs in Python. Productive, and with a smile.
productive, simulator-agnostic, in Python.
How cocotb works
Bring your design under test
cocotb works with any hardware design that your preferred simulator (and cocotb supports all major simulators) can simulate – be it in (System)Verilog, VHDL, a mixed language, or even a mixed-signal design!
Write a testbench in Python
With cocotb, you write testbenches and verification code in Python. In addition to all the goodies of the Python programming language and its ecosystem, cocotb provides a lean framework to efficiently write verification code .
You are ready to run your test!
Running a test has never been easier thanks to cocotb's built-in test runner with CI integration. Alternatively, you can integrate cocotb easily with your existing build and reporting system.
cocotb is all about verification productivity. Verification is software, and by writing verification code in Python, verification engineers have access to all the goodness that made software development productive and enjoyable. It allows developers to focus on the verification task itself, and stop fighting with language limitations.
Works with what you have
cocotb works with all commonly used RTL simulators: VCS, ModelSim and Questa, Xcelium, Riviera-PRO and Active-HDL, GHDL, CVC, Verilator and Icarus Verilog on Windows, Linux, and macOS. If your simulator of choice can simulate your RTL design, cocotb can verify it! cocotb is just a library, integrate it with your existing project automation.
Benefit from the ecosystem
Verification is all about productivity. With cocotb, your testbench can make use of the whole Python ecosystem: over 400,000 extension packages, answers to over two million questions on StackOverflow , and a huge pool of books (including Python for RTL Verification, a book on cocotb itself!), blog posts, tutorials, and much more.
cocotb is not an island
With cocotb, interfacing with existing infrastructure is easy. Do you want to talk to a golden model in your testbench? Or to real hardware, e.g. an FPGA or a logic analyzer? In most cases, that's just a matter of looking for existing Python bindings—like in this example, where a handful lines of code are sufficient to talk to MatLab!
CI-capable test runner included
Are you tired of writing custom test runner tooling? With cocotb, tests are automatically discovered and run. No more need for custom runners. The cocotb test runner by default produces regression results in the industry-standard Junit XML format, which is understood by most CI solutions, such as Jenkins, or Azure Pipelines.
Python is easy to learn (chances are you know it already)
Python is the most popular programming language on the planet, giving you a massive head start. It is used by more than 8 million developers around the world. With cocotb, you can grow as you go. You only need to learn a handful of conventions and you are ready to go. There is no mandatory methodology or class structure to get started! cocotb's extensive documentation and friendly user community are ready to help.
Who is behind cocotb?
cocotb is a true and independent open source project, developed by a loosely connected community of like-minded engineers which we collectively call the cocotb contributors. Everybody can be a cocotb contributor: we value providing support for other users, bug reports, feature requests, and improvements to our documentation just as much as we value code changes or help with releasing and maintaining cocotb. All development and decision making happens in the open on GitHub.
The cocotb source code licensing provides a level playing field for all. cocotb is licensed under a permissive BSD license with no Contributor License Agreement (CLA) or other copyright assignment mechanisms in place: every individual and every company can use and contribute to cocotb under the same terms.
The development of cocotb is coordinated by a group of experienced volunteers, the cocotb maintainers. Think of maintainers as the caretakers of the cocotb project: they create releases, review and approve code changes in pull requests, and often also do a fair amount of development.
cocotb is a project of the FOSSi Foundation, a UK-based not-for-profit, which provides legal, administrative, and financial support, but does not influence the technical direction the cocotb project is taking.
cocotb is free. And priceless.
cocotb is open source under the permissive BSD license. Anyone can freely use, modify, and distribute it, for any purpose, including commercial and closed-source developments.
But of course cocotb is not free to develop. We are grateful for our sponsors, who help us e.g. with licenses for proprietary EDA tools for integration testing.
Are you or your company using cocotb? Please consider becoming a sponsor to ensure that cocotb is sustainably developed and maintained. All sponsorships are handled by the FOSSi Foundation, a UK-based not-for-profit organization. Please talk to Philipp Wagner (email) to discuss how your support can help make cocotb better.
The FOSSi Foundation provides financial, technical, administrative, and legal support for the cocotb project.
Questions? Documentation? Bugs?
cocotb comes with extensive documentation at docs.cocotb.org.
Do you have questions or found a bug? A friendly user community is ready to help out! Please file an issue in our GitHub issue tracker or jump on to the Gitter chat.