The cocotb project is proud to announce the release of its new version 1.4.0. cocotb is a COroutine based COsimulation TestBench environment for verifying VHDL/Verilog RTL using Python.
Cocotb can be installed and updated from PyPi through pip:
pip install --upgrade cocotb
For full installation instructions refer to the documentation at https://docs.cocotb.org/en/v1.4.0/install.html.
This release concluces a six month development period, similar to its predecessors in recent history. A major focus of this release was stability and ease of use.
Writing testbench code is now more intuitive than ever thanks to full support for async functions.
In a nutshell: all async functions can now be used as coroutines, they no longer need to be annotated with
And instead of using
yield to wait for coroutines to complete, the more descriptive
await can be used.
Important: the old syntax is still fully supported and can be used along with the new async syntax.
Head over to https://docs.cocotb.org/en/latest/coroutines.html#async-functions for more details on the syntax and the new usage scenarios it enables.
Here’s an example:
@cocotb.test() async def my_first_test(dut): """Try accessing the design.""" dut._log.info("Running test!") for cycle in range(10): dut.clk = 0 await Timer(1, units='ns') dut.clk = 1 await Timer(1, units='ns') dut._log.info("Running test!")
The second major improvement in this release is our build system. Since its beginning, cocotb has shipped a make-based build system. This build system serves two goals: It compiles and installs cocotb-internal support libraries, as well as the VPI/VHPI/FLI library which is linked into the simulator at runtime. And, as a second step, the build system calls the simulator in the right way to load the cocotb libraries, pass the RTL source files, and start the simulation. All cocotb users had to do to make use of this functionality is include two makefile fragments, Makefile.inc, and Makefile.sim.
With the 1.4.0 release we made building and running cocotb simulations even simpler. First of all, users now only need to include the Makefile.sim file; Makefile.inc no longer needs to be included. Under the hood, a more significant change took place: the compilation step for the binary libraries is no longer performed when running a simulation. Instead, libraries are compiled during the installation of cocotb with “pip install cocotb”. Thanks to this change, integrating cocotb into in-house build systems is easier than ever, startup times when running simulations have been reduced, and there’s no need any more for a compiler to be present when running simulations. Even more importantly, this change paves the way to provide a better way to run cocotb simulations without make; doing so has for a long time been requested from our Windows users.
In other news, cocotb now supports deposit/force/release/freeze actions on simulator handles, exposing functionality similar to the respective Verilog/VHDL assignments. And as usual, support for various simulators has been improved. For the first time in this release, Aldec Active HDL has become a supported simulator. And also as usual, the documentation has been significantly improved.
Great care has been taken to provide all these new features in a backwards-compatible way, and no changes to existing testbenches should be needed in almost all cases. However, there are two important changes users need to be aware of:
Python 3 is now required. As widely announced, Python 2 has reached its end-of-life in the beginning of this year. Cocotb follows this development; cocotb version 1.4 requires at least Python 3.5 to run. Users are strongly encouraged to switch to the latest version of Python 3 to enjoy many improvements in syntax and execution speed. Users who cannot switch to Python 3 can continue using cocotb 1.3.
Cocotb must now be installed through pip. The 1.3 release deprecated the use of cocotb without installing it first; with the 1.4.0 release, the deprecated functionality has been removed. Installing cocotb is done in the same way as any other Python package, providing users an installation process they’re most likely familiar with.
A much more detailed description of all changes in this first 1.4 release can be found in the release notes at https://docs.cocotb.org/en/v1.4.0/release_notes.html.
Cocotb is a community project under the umbrella of the FOSSi Foundation. Thanks to all sponsors of the FOSSi Foundation the cocotb project can now make use of a continuous integration system which runs proprietary simulators in a compliant way. We are also thankful to Aldec for providing a license of Riviera-PRO, ensuring that Riviera-PRO and cocotb continue to be well integrated.
Please reach out to Philipp at email@example.com if you or your company want to support cocotb, either financially to help pay for costs such as running our continuous integration setup, or with in-kind donations, such as simulator licenses.
To close this rather long release announcement, here are some statistics:
- 346 files changed, 14012 insertions(+), 10356 deletions(-)
- 554 commits
- 31 code contributors
- 2 new maintainers: Colin Marquardt and Kaleb Barrett
These numbers are impressive and showcase the power of the free and open source collaboration model. To be able to sustain this amount of change and the high-quality review process behind it, we are happy that two trusted community members have stepped up and volunteered to become maintainer. Thank you, and thanks to the whole cocotb community for coming together to create this unique piece of software.
And now, go and enjoy the best release of cocotb so far!
If you have questions or issues with this release head over to the issue tracker at https://github.com/cocotb/cocotb/issues with your question.