cocotb 2.1.dev49+r621cba2c (2026-06-15)#
Features#
Support null-ranged arrays (including
std_logic_vectorandstring) in VHDL. (#4519)Added
@cocotb.xfailto mark a test as expected to fail with an optional reason and expected exception type. (#5007)Added
@cocotb.skipifto mark a test as conditionally skipped, with an optional reason string. (#5007)Made
@cocotb.testand@cocotb.parametrizestackable. Applying the decorator multiple times to the same test will combine the values of each decoration into a single test generation. (#5007)Add support for Python 3.14. (#5057)
Added
cwdargument toRunner.build(). (#5076)Added the Pytest Plugin that enables using pytest as the regression manager for running cocotb tests. (#5090)
Added
COCOTB_RANDOM_TEST_ORDERenvironment variables to enable randomized ordering of cocotb tests within each stage. (#5106)Added support for SAIF tracing when using Verilator>=5.042 as the simulator. This is enabled by adding
--trace-saiftoEXTRA_ARGS(when using Makefiles) or tobuild_args(when using the runner). (#5114)Added
GPI_DEBUGandPYGPI_DEBUGenvironment variables to enable additional debug features, including TRACE log messages. (#5131)Added
cocotb.triggers.TaskManagerfor managing multiple concurrent tasks with automatic cleanup on completion or error. (#5163)Added
cocotb.triggers.gather()to wait for multiple awaitables concurrently and collect all results. (#5165)Added
cocotb.triggers.wait()for waiting on multiple awaitables concurrently with a configurable return condition. (#5165)Added
cocotb.triggers.select()to wait for multiple awaitables concurrently and return the first one to complete. (#5165)LogicArrayObjectnow supports indexing single elements. (#5179)Add support for
pre_cmdargument toRunner.test()for Aldec Riviera-Pro. (#5181)Add support for
guiargument toRunner.test()for Aldec Riviera-Pro. (#5182)with_timeout()now supports being passed any awaitable. (#5205)Added the
COCOTB_RESULTS_ATTACHMENTSenvironment variable that allows to attach files as attachments in generated reports like JUnit Test Report. (#5219)Added the
COCOTB_RESULTS_RELATIVE_TOenvironment variable as a hint for JUnit Test Report how to convert absolute paths to relative ones. (#5219)Generated log and waveform files from simulators will be attached in created JUnit XML tests results file. (#5219)
Added support for using underscores (
_) as visual separators instrvalues used to set the value ofLogicArrayObjectto enhance readability of long bitstrings, e.g.dut.signal.value = "1010_1101". (#5220)Added visual separator support to
LogicArraystring construction. This allows underscores (_) to be used to improve readability of long bitstrings, e.g."1010_1101". (#5220)Added the on_overflow parameter to
LogicArray.from_unsigned()andLogicArray.from_signed()to allow the user to decide how to handle values which are too large to fit in range. (#5222)Added support for constructing
LogicArrayfrom a negative integer. This assumes two’s complement representation. (#5293)Added support for comparing
LogicArraywith negative integers. This assumes two’s complement representation. (#5293)Added support for terminating a regression early when the number of test failures reaches
COCOTB_MAX_FAILURES. (#5309)Added support for
pytest.RaisesExcandpytest.RaisesGroupasraisesargument tococotb.xfail(). (#5357)Added
COCOTB_LIST_TESTSenvironment variable to list tests without running them. (#5366)Added support for
pytest.skip()andpytest.xfail()for ending the test early. (#5380)Added
cocotb.end_test()to end the test immediately from anyTaskwithout forcing a pass. (#5392)Added public variable
cocotb_tools.runner.SUPPORTED_RUNNERS, allowing external libraries to register additional simulators for theget_runner()function. (#5415)Add ability to specify a particular architecture for a toplevel entity when using NVC. (#5450)
Added support for
RisingEdgeandFallingEdgefor instances ofLogicArrayObjectwith only one bit. (#5483)Add support for
SIM_CMD_PREFIXandSIM_CMD_SUFFIXenvironment variables to the Python Runners. (#5506)Added the
as_vhdl_literal()andas_sv_literal()functions to explicitly convert Python values to VHDL or SystemVerilog literal strings. (#5534)
Bugfixes#
Improve VsimSA simulator support (adds Active-HDL support and updates Riviera-Pro support). (#5041)
Generated JUnit XML tests results file is now compatible with Jenkins xUnit schema version 2. (#5219)
cocotb.logging.default_config()no longer overwrites root handlers, but configures formatting on whatever handlers are already registered. (#5248)Fixed bug where
COCOTB_RESOLVE_Xwhen set"random"would resolve all non-0/1values in a vector to the same value. (#5306)Fixed use-after-free in
VpiSignalObjHdl::register_value_change_callbackerror handling code which caused VCS to segfault. (#5439)Fixed a segmentation fault on Icarus Verilog when VPI callbacks fired after the Python interpreter was finalized during simulator shutdown. (#5440)
Fixed memory leak of one-shot callback on VCS/Xcelium. (#5447)
Fixed
LogicArrayequality against list and tuple values containing unsupported object types. (#5596)Fixed a performance regression where the time to remove a completed
Taskscaled linearly with the number of concurrently running tasks. (#5603)
Deprecations and Removals#
Dropped support for MacOS 13 (Ventura). (#4986)
Removed Windows and Linux 32-bit release builds. (#4986)
Support for Python 3.6, 3.7, and 3.8 was removed. (#4987)
Deprecated passing
Tasks toFirstandCombinein favor of passing coroutines directly toselect()andgather(), respectively. (#5206)Removed support for undocumented
COCOTB_RESULT_TESTPACKAGEenvironment variable. The XML attributepackageis invalid in JUnit XML. (#5219)Removed support for undocumented
COCOTB_RESULT_TESTSUITEenvironment variable. Name of test suite will be based on name of the cocotb test module. (#5219)Deprecated
cocotb.pass_test(). Instead, usecocotb.skip()to skip a test or usecocotb.end_test()to end a test while respecting expected failures. (#5395)Removed the
cocotb_tools.config.lib_name()function. (#5516)Removed the
--lib-nameoption from the cocotb-config script. (#5516)
Changes#
Reimplemented the scheduler. Exact scheduling order may have changed. (#4717)
Changed
Task.cancel()to throwRuntimeErrorif attempting to cancel the currently running task. (#5162)The
LIBPYTHON_LOCenvironment variable was removed from the GPI. Instead,libpythonshould be included inGPI_USERS. Support remains in Makefiles (LIBPYTHON_LOC) and Python Runner (LIBPYTHON_LOC) for backwards-compatibility. In this case the value ofLIBPYTHON_LOCis included in the generatedGPI_USERSif and only ifGPI_USERSis not already defined. (#5207)Tests reported in generated JUnit XML tests results file will be grouped into test suites by cocotb test module. (#5219)
Added environment variable type information to all documented environment variables. (#5232)
Entry points listed in
PYGPI_USERSare no longer passed theargvobject. If you need access to command-line arguments, usecocotb.simulator.get_simulator_args()instead. (#5258)Changed input value checking on
IntegerObjectandEnumObjectto reflect the size and signedness of the underlying HDL type. Previously, both classes would accept negative values even if the underlying type was unsigned, and had a hardcoded and incorrect limit on the size of the value size that didn’t reflect the size of the underlying HDL type. (#5263)Split the random number generator (RNG) for the
COCOTB_RESOLVE_X"random"mode from the global Python RNG, so that switching from oneCOCOTB_RESOLVE_Xmode to another would not affect the random number sequence of the rest of the testbench. (#5306)pytestis no longer an optional dependency, but is required. (#5363)The Makefile target
simno longer recursively callsmake. This makes it possible to use+=with Make variables without the right hand side being added twice. (#5382)Changed the extension on the Icarus GPI implementation library from
.vplto the normal extension for shared libraries on the platform (e.g..soor.dll). (#5516)Removed implicit conversion of
definesinRunner.buildto literals. If users need to convert Python objects to literals for use indefinesorparameters, they must explicitly call the newas_vhdl_literal()oras_sv_literal()functions. (#5534)Makefile simulator recipes now use a shared
COCOTB_ENVvariable defined inMakefile.inc. (#5565)