Release Notes

All releases are available from the GitHub Releases Page.

cocotb 1.7.0 (2022-09-06)

Features

  • Removed the need for ModelSim or Questa being installed when building cocotb. Similar to the approach taken with VPI and VHPI, cocotb now includes all C header files to build the FLI interface. This improvement was done in close collaboration with Siemens EDA, who changed the license of the relevant source code file. (#2948)

  • With Questa 2022.3 VHPI support is now fully working and no longer experimental. cocotb still defaults to using the FLI interface for VHDL toplevels with Questa. Users can choose VHPI instead by setting the VHDL_GPI_INTERFACE environment variable to vhpi before running cocotb. (#2803)

  • cocotb tests are now more reproducible. (#2721)

  • Force, Freeze, and Release are now supported when using the FLI, Questa’s traditional method to access VHDL. (#2775)

  • cocotb binaries now statically link libstdc++ on Linux, which prevents library load errors even if the simulator ships its own libstdc++. (#3002)

Bugfixes

  • Fixed write scheduling to apply writes oldest to newest. (#2792)

  • Fixed Riviera makefile error for mixed-language simulation when VHDL is the top-level. This bug prevented the VPI library from loading correctly, and was a regression in 1.5.0. (#2912)

  • Fixed FLI issue where unprimed triggers were still firing. (#3010)

Deprecations and Removals

Changes

  • Passing coroutines to with_timeout() is now supported. (#2494)

  • Renamed RunningTask to Task. (#2876)

  • Made Task interface more like asyncio.Task’s. (#2876)

  • When code coverage is enabled with COVERAGE and a configuration file is specified with COVERAGE_RCFILE, default coverage configuration is not applied to avoid overriding the user-defined configuration. (#3014)

cocotb 1.6.2 (2022-02-07)

Bugfixes

  • Fix regression in TestFactory when using generator-based test coroutines. (#2839)

Changes

  • Change how PYTHONHOME is populated to work with broken mingw environments. (#2739)

cocotb 1.6.1 (2021-12-07)

Bugfixes

cocotb 1.6.0 (2021-10-20)

Features

Bugfixes

  • VHDL signals that are zero bits in width now read as the integer 0, instead of raising an exception. (#2294)

  • Correctly parse plusargs with =s in the value. (#2483)

  • COCOTB_RESULTS_FILE now properly communicates with the Regression Manager to allow overloading the result filename. (#2487)

  • Fixed several scheduling issues related to the use of cocotb.scheduler.start_soon. (#2504)

  • Verilator and Icarus now support running without specifying a TOPLEVEL. (#2547)

  • Fixed discovery of signals inside SystemVerilog interfaces. (#2683)

Improved Documentation

  • The analog_model example has been added, showing how to use Python models for analog circuits together with a digital part. (#2438)

Deprecations and Removals

Changes

  • Assigning out-of-range Python integers to signals will now raise an OverflowError. (#2316)

  • cocotb now requires Python 3.6+. (#2422)

  • Selecting tests using TESTCASE will now search for the first occurrence of a test of that name in order of modules listed in MODULEs, and not just the first module in that list. (#2434)

  • The environment variable COCOTB_LOG_LEVEL now supports TRACE value, which is used for verbose low-level logging that was previously in DEBUG logs. (#2502)

  • Improves formatting on test-related logging outputs. (#2564)

  • Shorter log lines (configurable with COCOTB_REDUCED_LOG_FMT) are now the default. For wider log output, similar to previous cocotb releases, set the COCOTB_REDUCED_LOG_FMT environment variable to 0. (#2564)

cocotb 1.5.2 (2021-05-03)

Bugfixes

  • Change some makefile syntax to support GNU Make 3 (#2496)

  • Fix behavior of cocotb-config --libpython when finding libpython fails (#2522)

cocotb 1.5.1 (2021-03-20)

Bugfixes

  • Prevent pytest assertion rewriting (#2028) from capturing stdin, which causes problems with IPython support (#1649). (#2462)

  • Add dependency on cocotb_bus to prevent breaking users that were previously using the bus and testbenching objects. (#2477)

  • Add back functionality to cocotb.binary.BinaryValue that allows the user to change binaryRepresentation after object creation. (#2480)

cocotb 1.5.0 (2021-03-11)

Features

Bugfixes

  • Assigning Python integers to signals greater than 32 bits wide will now work correctly for negative values. (#913)

  • Fix GHDL’s library search path, allowing libraries other than work to be used in simulation. (#2038)

  • Tests skipped by default (created with skip=True) can again be run manually by setting the TESTCASE variable. (#2045)

  • In Icarus Verilog, generate blocks are now accessible directly via lookup without having to iterate over parent handle. (#2079, #2143)

    # Example pseudo-region
    dut.genblk1       #<class 'cocotb.handle.HierarchyArrayObject'>
    
  • Fixed an issue with VHPI on Mac OS and Linux where negative integers were returned as large positive values. (#2129)

Improved Documentation

Deprecations and Removals

  • The contents of cocotb.generators have been deprecated. (#2047)

  • The outdated “Sorter” example has been removed from the documentation. (#2049)

  • Passing bool values to expect_error option of cocotb.test is deprecated. Pass a specific Exception or a tuple of Exceptions instead. (#2117)

  • The system task overloads for $info, $warn, $error and $fatal in Verilog and mixed language testbenches have been removed. (#2133)

  • TestError has been deprecated, use Built-in Exceptions. (#2177)

  • The undocumented class cocotb.xunit_reporter.File has been removed. (#2200)

  • Deprecated cocotb.hook and COCOTB_HOOKS. See the documentation for cocotb.hook for suggestions on alternatives. (#2201)

  • Deprecate pack() and unpack() and the use of ctypes.Structure in signal assignments. (#2203)

  • The outdated “ping” example has been removed from the documentation and repository. (#2232)

  • Using the undocumented custom format dict object in signal assignments has been deprecated. (#2240)

  • The access modes of many interfaces in the cocotb core libraries were re-evaluated. Some interfaces that were previously public are now private and vice versa. Accessing the methods through their old name will create a DeprecationWarning. In the future, the deprecated names will be removed. (#2278)

  • The bus and testbenching components in cocotb have been officially moved to the cocotb-bus package. This includes Bus, Scoreboard, everything in cocotb_bus.drivers, and everything in cocotb_bus.monitors. Documentation will remain in the main cocotb repository for now. Old names will continue to exist, but their use will cause a DeprecationWarning, and will be removed in the future. (#2289)

Changes

  • Assigning negative Python integers to handles does an implicit two’s compliment conversion. (#913)

  • Updated Driver, Monitor, and all their subclasses to use the async/await syntax instead of the yield syntax. (#2022)

  • The package build process is now fully PEP 517 compliant. (#2091)

  • Improved support and performance for Verilator (version 4.106 or later now required). (#2105)

  • Changed how libraries are specified in GPI_EXTRA to allow specifying libraries with paths, and names that don’t start with “lib”. (#2341)

Cocotb 1.4.0 (2020-07-08)

Features

  • Lock can now be used in async with statements. (#1031)

  • Add support for distinguishing between net (vpiNet) and reg (vpiReg) type when using the VPI interface. (#1107)

  • Support for dropping into pdb upon failure, via the new COCOTB_PDB_ON_EXCEPTION environment variable (#1180)

  • Simulators run through a Tcl script (Aldec Riviera Pro and Mentor simulators) now support a new RUN_ARGS Makefile variable, which is passed to the first invocation of the tool during runtime. (#1244)

  • Cocotb now supports the following example of forking a non-decorated async coroutine.

    async def example():
        for i in range(10):
            await cocotb.triggers.Timer(10, "ns")
    
    cocotb.fork(example())
    

    Issue (#1255)

  • The cocotb log configuration is now less intrusive, and only configures the root logger instance, logging.getLogger(), as part of cocotb.log.default_config() (#1266).

    As such, it is now possible to override the default cocotb logging behavior with something like:

    # remove the cocotb log handler and formatting
    root = logging.getLogger()
    for h in root.handlers[:]:
        root.remove_handler(h)
        h.close()
    
    # add your own
    logging.basicConfig()
    
  • Support for vpiRealNet (#1282)

  • The colored output can now be disabled by the NO_COLOR environment variable. (#1309)

  • Cocotb now supports deposit/force/release/freeze actions on simulator handles, exposing functionality similar to the respective Verilog/VHDL assignments.

    from cocotb.handle import Deposit, Force, Release, Freeze
    
    dut.q <= 1            # A regular value deposit
    dut.q <= Deposit(1)   # The same, higher verbosity
    dut.q <= Force(1)     # Force value of q to 1
    dut.q <= Release()    # Release q from a Force
    dut.q <= Freeze()     # Freeze the current value of q
    

    Issue (#1403)

  • Custom logging handlers can now access the simulator time using logging.LogRecord.created_sim_time, provided the SimTimeContextFilter filter added by default_config() is not removed from the logger instance. (#1411)

  • Questa now supports PLUSARGS. This requires that tcl.h be present on the system. This is likely included in your installation of Questa, otherwise, specify CFLAGS=-I/path/to/tcl/includedir. (#1424)

  • The name of the entry point symbol for libraries in GPI_EXTRA can now be customized. The delimiter between each library in the list has changed from : to ,. (#1457)

  • New methods for setting the value of a NonHierarchyIndexableObject (HDL arrays). (#1507)

    # Now supported
    dut.some_array <= [0xAA, 0xBB, 0xCC]
    dut.some_array.value = [0xAA, 0xBB, 0xCC]
    
    # For simulators that support n-dimensional arrays
    dut.some_2d_array <= [[0xAA, 0xBB], [0xCC, 0xDD]]
    dut.some_2d_array.value = [[0xAA, 0xBB], [0xCC, 0xDD]]
    
  • Added support for Aldec’s Active-HDL simulator. (#1601)

  • Including Makefile.inc from user makefiles is now a no-op and deprecated. Lines like include $(shell cocotb-config --makefiles)/Makefile.inc can be removed from user makefiles without loss in functionality. (#1629)

  • Support for using await inside an embedded IPython terminal, using cocotb.ipython_support. (#1649)

  • Added is_set(), so users may check if an Event has fired. (#1723)

  • The cocotb.simulator.is_running() function was added so a user of cocotb could determine if they are running within a simulator. (#1843)

Bugfixes

  • Tests which fail at initialization, for instance due to no yield being present, are no longer silently ignored (#1253)

  • Tests that were not run because predecessors threw cocotb.result.SimFailure, and caused the simulator to exit, are now recorded with an outcome of cocotb.result.SimFailure. Previously, these tests were ignored. (#1279)

  • Makefiles now correctly fail if the simulation crashes before a results.xml file can be written. (#1314)

  • Logging of non-string messages with colored log output is now working. (#1410)

  • Getting and setting the value of a NonHierarchyIndexableObject now iterates through the correct range of the simulation object, so arrays that do not start/end at index 0 are supported. (#1507)

  • The XGMII monitor no longer crashes on Python 3, and now assembles packets as bytes instead of str. The XGMII driver has expected bytes since cocotb 1.2.0. (#1545)

  • signal <= value_of_wrong_type no longer breaks the scheduler, and throws an error immediately. (#1661)

  • Scheduling behavior is now consistent before and after the first await of a GPITrigger. (#1705)

  • Iterating over for generate statements using VHPI has been fixed. This bug caused some simulators to crash, and was a regression in version 1.3. (#1882)

  • The XGMII driver no longer emits a corrupted word on the first transfer. (#1905)

Improved Documentation

  • If a makefile uses cocotb’s Makefile.sim, make help now lists the supported targets and variables. (#1318)

  • A new section Rotating Log Files has been added. (#1400)

  • The documentation at http://docs.cocotb.org/ has been restructured, making it easier to find relevant information. (#1482)

Deprecations and Removals

  • cocotb.utils.reject_remaining_kwargs() is deprecated, as it is no longer needed now that we only support Python 3.5 and newer. (#1339)

  • The value of cocotb.handle.StringObjects is now of type bytes, instead of str with an implied ASCII encoding scheme. (#1381)

  • ReturnValue is now deprecated. Use a return statement instead; this works in all supported versions of Python. (#1489)

  • The makefile variable VERILATOR_TRACE that was not supported for all simulators has been deprecated. Using it prints a deprecation warning and points to the documentation section Simulator Support explaining how to get the same effect by other means. (#1495)

  • BinaryValue.get_hex_buff produced nonsense and has been removed. (#1511)

  • Passing str instances to cocotb.utils.hexdump() and cocotb.utils.hexdiffs() is deprecated. bytes objects should be passed instead. (#1519)

  • Makefile.pylib, which provided helpers for building C extension modules for Python, has been removed. Users of the PYTHON_LIBDIR and PYTHON_INCLUDEDIR variables will now have to compute these values themselves. See the endian_swapper example for how to do this. (#1632)

  • Makefile and documentation for the NVC simulator which has never worked have been removed. (#1693)

Changes

  • Cocotb no longer supports Python 2, at least Python 3.5 is now required. Users of Python 2.7 can still use cocotb 1.3, but are heavily encouraged to update. It is recommended to use the latest release of Python 3 for improved performance over older Python 3 versions. (#767)

  • Mentor Questa, Aldec Riviera-PRO and GHDL are now started in the directory containing the Makefile and also save results.xml there, bringing them in line with the behavior used by other simulators. (#1598) (#1599) (#1063)

  • Tests are now evaluated in order of their appearance in the MODULE environment variable, their stage, and the order of invocation of the cocotb.test decorator within a module. (#1380)

  • All libraries are compiled during installation to the cocotb/libs directory. The interface libraries libcocotbvpi and libcocotbvhpi have been renamed to have a _simulator_name postfix. The simulator module has moved to cocotb.simulator. The LD_LIBRARY_PATH environment variable no longer needs to be set by the makefiles, as the libraries now discover each other via RPATH settings. (#1425)

  • Cocotb must now be installed before it can be used. (#1445)

  • cocotb.handle.NonHierarchyIndexableObject.value is now a list in left-to-right range order of the underlying simulation object. Previously the list was always ordered low-to-high. (#1507)

  • Various binary representations have changed type from str to bytes. These include:

    Code working with these objects may find it needs to switch from creating str objects like "this" to bytes objects like b"this". This change is a consequence of the move to Python 3. (#1514)

  • There’s no longer any need to set the PYTHON_BIN makefile variable, the Python executable automatically matches the one cocotb was installed into. (#1574)

  • The SIM setting for Aldec Riviera-PRO has changed from aldec to riviera. (#1691)

  • Certain methods on the cocotb.simulator Python module now throw a RuntimeError when no simulator is present, making it safe to use cocotb without a simulator present. (#1843)

  • Invalid values of the environment variable COCOTB_LOG_LEVEL are no longer ignored. They now raise an exception with instructions how to fix the problem. (#1898)

cocotb 1.3.2

Released on 08 July 2020

Notable changes and bug fixes

  • Iterating over for generate statements using VHPI has been fixed. This bug caused some simulators to crash, and was a regression in version 1.3.1. (#1882)

cocotb 1.3.1

Released on 15 March 2020

Notable changes and bug fixes

  • The Makefiles for the Aldec Riviera and Cadence Incisive simulators have been fixed to use the correct name of the VHPI library (libcocotbvhpi). This bug prevented VHDL designs from being simulated, and was a regression in 1.3.0. (#1472)

cocotb 1.3.0

Released on 08 January 2020

This will likely be the last release to support Python 2.7.

New features

  • Initial support for the Verilator simulator (version 4.020 and above). The integration of Verilator into cocotb is not yet as fast or as powerful as it is for other simulators. Please use the latest version of Verilator, and report bugs if you experience problems.

  • New makefile variables COCOTB_HDL_TIMEUNIT and COCOTB_HDL_TIMEPRECISION for setting the default time unit and precision that should be assumed for simulation when not specified by modules in the design. (#1113)

  • New timeout_time and timeout_unit arguments to cocotb.test(), for adding test timeouts. (#1119)

  • cocotb.triggers.with_timeout(), for a shorthand for waiting for a trigger with a timeout. (#1119)

  • The expect_error argument to cocotb.test() now accepts a specific exception type. (#1116)

  • New environment variable COCOTB_RESULTS_FILE, to allow configuration of the xUnit XML output filename. (#1053)

  • A new bus_separator argument to cocotb.drivers.BusDriver. (#1160)

  • A new start_high argument to cocotb.clock.Clock.start(). (#1036)

  • A new cocotb.__version__ constant, which contains the version number of the running cocotb. (#1196)

Notable changes and bug fixes

  • DeprecationWarnings are now shown in the output by default.

  • Tracebacks are now preserved correctly for exceptions in Python 2. The tracebacks in all Python versions are now a little shorter.

  • cocotb.external() and cocotb.function() now work more reliably and with fewer race conditions.

  • A failing assert will be considered a test failure. Previously, it was considered a test error.

  • drivers() and loads() now also work correctly in Python 3.7 onwards.

  • cocotb.triggers.Timer can now be used with decimal.Decimal instances, allowing constructs like Timer(Decimal('1e-9'), units='sec') as an alternate spelling for Timer(100, units='us'). (#1114)

  • Many (editorial) documentation improvements.

Deprecations

  • cocotb.result.raise_error and cocotb.result.create_error are deprecated in favor of using Python exceptions directly. TestError can still be used if the same exception type is desired. (#1109)

  • The AvalonSTPktsWithChannel type is deprecated. Use the report_channel argument to AvalonSTPkts instead.

  • The colour attribute of log objects like cocotb.log or some_coro.log is deprecated. Use cocotb.utils.want_color_output() instead. (#1231)

Other news

cocotb 1.2.0

Released on 24 July 2019

New features

  • cocotb is now built as Python package and installable through pip. (#517, #799, #800, #803, #805)

  • Support for async functions and generators was added (Python 3 only). Please have a look at Coroutines and Tasks for an example how to use this new feature.

  • VHDL block statements can be traversed. (#850)

  • Support for Python 3.7 was added.

Notable changes and bug fixes

  • The heart of cocotb, its scheduler, is now even more robust. Many small bugs, inconsistencies and unreliable behavior have been ironed out.

  • Exceptions are now correctly propagated between coroutines, giving users the “natural” behavior they’d expect with exceptions. (#633)

  • The setimmediatevalue() function now works for values larger than 32 bit. (#768)

  • The documentation was cleaned up, improved and extended in various places, making it more consistent and complete.

  • Tab completion in newer versions of IPython is fixed. (#825)

  • Python 2.6 is officially not supported any more. cocotb supports Python 2.7 and Python 3.5+.

  • The cocotb GitHub project moved from potentialventures/cocotb to cocotb/cocotb. Redirects for old URLs are in place.

Deprecations

  • The bits argument to BinaryValue, which is now called n_bits.

  • The logger attribute of log objects like cocotb.log or some_coro.log, which is now just an alias for self.

  • The cocotb.utils.get_python_integer_types function, which was intended to be private.

Known issues

  • Depending on your simulation, cocotb 1.2 might be roughly 20 percent slower than cocotb 1.1. Much of the work in this release cycle went into fixing correctness bugs in the scheduler, sometimes at the cost of performance. We are continuing to investigate this in issue #961. Independent of the cocotb version, we recommend using the latest Python 3 version, which is shown to be significantly faster than previous Python 3 versions, and slightly faster than Python 2.7.

Please have a look at the issue tracker for more outstanding issues and contribution opportunities.

cocotb 1.1

Released on 24 January 2019.

This release is the result of four years of work with too many bug fixes, improvements and refactorings to name them all. Please have a look at the release announcement on the mailing list for further information.

cocotb 1.0

Released on 15 February 2015.

New features

  • FLI support for ModelSim

  • Mixed Language, Verilog and VHDL

  • Windows

  • 300% performance improvement with VHPI interface

  • WaveDrom support for wave diagrams.

cocotb 0.4

Released on 25 February 2014.

New features

  • Issue #101: Implement Lock primitive to support mutex

  • Issue #105: Compatibility with Aldec Riviera-Pro

  • Issue #109: Combine multiple results.xml into a single results file

  • Issue #111: XGMII drivers and monitors added

  • Issue #113: Add operators to BinaryValue class

  • Issue #116: Native VHDL support by implementing VHPI layer

  • Issue #117: Added AXI4-Lite Master BFM

Bugs fixed

  • Issue #100: Functional bug in endian_swapper example RTL

  • Issue #102: Only 1 coroutine wakes up of multiple coroutines wait() on an Event

  • Issue #114: Fix build issues with Cadence IUS simulator

New examples

  • Issue #106: TUN/TAP example using ping

cocotb 0.3

Released on 27 September 2013.

This contains a raft of fixes and feature enhancements.

cocotb 0.2

Released on 19 July 2013.

New features

  • Release 0.2 supports more simulators and increases robustness over 0.1.

  • A centralized installation is now supported (see documentation) with supporting libraries build when the simulation is run for the first time.

cocotb 0.1

Released on 9 July 2013.

  • The first release of cocotb.

  • Allows installation and running against Icarus, VCS, Aldec simulators.