FEA-Bench / testbed /cocotb__cocotb /docs /source /library_reference.rst
hc99's picture
Add files using upload-large-folder tool
cb65407 verified
raw
history blame
5.7 kB
*****************
Library Reference
*****************
.. spelling:word-list::
AXIProtocolError
BusDriver
De
Re
ReadOnly
args
cbNextSimTime
ing
sim
stdout
un
.. _api-runner:
Python Test Runner
==================
.. warning::
Python runners and associated APIs are an experimental feature and subject to change.
.. automodule:: cocotb.runner
:members:
:member-order: bysource
:synopsis: Build HDL and run cocotb tests.
Test Results
============
The exceptions in this module can be raised at any point by any code and will terminate the test.
.. automodule:: cocotb.result
:members:
:member-order: bysource
:synopsis: Exceptions and functions for simulation result handling.
.. _writing-tests:
Writing and Generating tests
============================
.. autofunction:: cocotb.test
.. autofunction:: cocotb.external
.. autofunction:: cocotb.function
.. autofunction:: cocotb.parameterize
.. autoclass:: cocotb.regression.TestFactory
:members:
:member-order: bysource
Interacting with the Simulator
==============================
.. _task-management:
Task Management
---------------
.. autofunction:: cocotb.start_soon
.. autofunction:: cocotb.start
.. autofunction:: cocotb.create_task
.. autoclass:: cocotb.task.Task
:members:
HDL Datatypes
-------------
These are a set of datatypes that model the behavior of common HDL datatypes.
.. versionadded:: 1.6.0
.. autoclass:: cocotb.types.Logic
.. autoclass:: cocotb.types.Range
:members:
:exclude-members: count, index
.. autofunction:: cocotb.types.concat
.. autoclass:: cocotb.types.Array
:members:
:inherited-members:
.. autoclass:: cocotb.types.LogicArray
:members:
:inherited-members:
Triggers
--------
See :ref:`simulator-triggers` for a list of sub-classes. Below are the internal
classes used within ``cocotb``.
.. currentmodule:: cocotb.triggers
.. autoclass:: Trigger
:members:
:member-order: bysource
.. autoclass:: GPITrigger
:members:
:member-order: bysource
.. autoclass:: Waitable
:members:
:member-order: bysource
:private-members:
Testbench Structure
===================
Clock
-----
.. autoclass:: cocotb.clock.Clock
:members:
:member-order: bysource
Utilities
=========
.. automodule:: cocotb.utils
:members:
:member-order: bysource
:synopsis: Various utilities for testbench writers.
.. _logging-reference-section:
Logging
-------
.. currentmodule:: cocotb.log
.. autofunction:: default_config
.. autoclass:: SimLogFormatter
:show-inheritance:
:no-members:
.. autoclass:: SimColourLogFormatter
:show-inheritance:
:no-members:
.. autoclass:: SimTimeContextFilter
:show-inheritance:
:no-members:
.. currentmodule:: None
.. attribute:: logging.LogRecord.created_sim_time
The result of :func:`~cocotb.utils.get_sim_time` at the point the log was created
(in simulator units). The formatter is responsible for converting this
to something like nanoseconds via :func:`~cocotb.utils.get_time_from_sim_steps`.
This is added by :class:`cocotb.log.SimTimeContextFilter`.
Simulation Object Handles
=========================
.. image:: diagrams/svg/inheritance-cocotb.handle.svg
:alt: The class inheritance diagram for cocotb.handle
.. currentmodule:: cocotb.handle
.. automodule:: cocotb.handle
:members:
:member-order: bysource
:show-inheritance:
:synopsis: Classes for simulation objects.
:exclude-members: Deposit, Force, Freeze, Release
:special-members: __len__
..
Excluding the Assignment Methods that are getting their own section below
.. _assignment-methods:
Assignment Methods
------------------
.. currentmodule:: cocotb.handle
.. autoclass:: Deposit
.. autoclass:: Force
.. autoclass:: Freeze
.. autoclass:: Release
Other Handle Methods
--------------------
.. currentmodule:: None
.. function:: len(handle)
Return the "length" (the number of elements) of the underlying object.
For vectors this is the number of bits.
.. function:: dir(handle)
Return a list of the sub-handles of *handle*,
that is, the instances, signals, constants etc. of a certain hierarchy level in the DUT.
Miscellaneous
=============
Asynchronous Queues
-------------------
.. automodule:: cocotb.queue
:members:
:member-order: bysource
Other Runtime Information
-------------------------
.. autodata:: cocotb.argv
.. autodata:: cocotb.SIM_NAME
.. autodata:: cocotb.SIM_VERSION
.. autodata:: cocotb.RANDOM_SEED
.. autodata:: cocotb.plusargs
.. autodata:: cocotb.packages
.. autodata:: cocotb.LANGUAGE
.. autodata:: cocotb.top
Implementation Details
======================
.. note::
In general, nothing in this section should be interacted with directly -
these components work mostly behind the scenes.
The Scheduler
-------------
.. currentmodule:: cocotb.scheduler
.. autodata:: cocotb.scheduler
.. autoclass:: Scheduler
:members:
:member-order: bysource
The Regression Manager
----------------------
.. currentmodule:: cocotb.regression
.. autodata:: cocotb.regression_manager
.. autoclass:: RegressionManager
:members:
:member-order: bysource
The ``cocotb.simulator`` module
-------------------------------
This module is a Python wrapper to libgpi.
It should not be considered public API, but is documented here for developers
of cocotb.
.. automodule:: cocotb.simulator
:members:
:undoc-members:
:member-order: bysource
The ``cocotb-config`` script
----------------------------
.. sphinx_argparse_cli::
:module: cocotb.config
:func: get_parser
:prog: cocotb-config