UART interface modules for Cocotb
GitHub repository: https://github.com/alexforencich/cocotbext-uart
Introduction
UART simulation models for cocotb.
Installation
Installation from pip (release version, stable):
$ pip install cocotbext-uart
Installation from git (latest development version, potentially unstable):
$ pip install https://github.com/alexforencich/cocotbext-uart/archive/master.zip
Installation for active development:
$ git clone https://github.com/alexforencich/cocotbext-uart
$ pip install -e cocotbext-uart
Documentation and usage examples
See the tests directory, taxi, and verilog-uart for complete testbenches using these modules.
UART
The UartSource and UartSink classes can be used to drive, receive, and monitor asynchronous serial data.
To use these modules, import the one you need and connect it to the DUT:
from cocotbext.uart import UartSource, UartSink
uart_source = UartSource(dut.rxd, baud=115200, bits=8)
uart_sink = UartSink(dut.rxd, baud=115200, bits=8)
To send data into a design with a UartSource, call write() or write_nowait(). Accepted data types are iterables of ints, including lists, bytes, bytearrays, etc. Optionally, call wait() to wait for the transmit operation to complete. Example:
await uart_source.send(b'test data')
# wait for operation to complete (optional)
await uart_source.wait()
To receive data with a UartSink, call read() or read_nowait(). Optionally call wait() to wait for new receive data. read() will block until at least 1 data byte is available. Both read() and read_nowait() will return up to count bytes from the receive queue, or the entire contents of the receive queue if not specified.
data = await uart_sink.recv()
Constructor parameters:
- data: data signal
- baud: baud rate in bits per second (optional, default 9600)
- bits: bits per byte (optional, default 8)
- stop_bits: length of stop bit in bit times (optional, default 1)
Attributes:
- baud: baud rate in bits per second
- bits: bits per byte
- stop_bits: length of stop bit in bit times
Methods
write(data): send data (blocking) (source)write_nowait(data): send data (non-blocking) (source)read(count): read count bytes from buffer (blocking) (sink)read_nowait(count): read count bytes from buffer (non-blocking) (sink)count(): returns the number of items in the queue (all)empty(): returns True if the queue is empty (all)idle(): returns True if no transfer is in progress (all) or if the queue is not empty (source)clear(): drop all data in queue (all)wait(): wait for idle (source)wait(timeout=0, timeout_unit='ns'): wait for data received (sink)
Metadata
Release files for cocotbext-uart 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cocotbext_uart-0.1.4.tar.gz | 7.9 kB | Without provenance | Details for cocotbext_uart-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cocotbext_uart-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for cocotbext_uart-0.1.4-py3-none-any.whl |
Total release size: 14.6 kB
Release files / cocotbext_uart-0.1.4.tar.gz
| Download URL | cocotbext_uart-0.1.4.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
574643c82067be5e1dd6e2e830f46b8803c07fc1f27b7f75bf25066fd6d06798
|
|
BLAKE2b-256 checksum How to use checksums |
0d14150453a9113885a93f8be7a4f21b89e8c67f91369e808d4e16ad8ec35869
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / cocotbext_uart-0.1.4-py3-none-any.whl
| Download URL | cocotbext_uart-0.1.4-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be78f266449765a1cb7877a733f796bbfdbe492e7205051c4cc413e2e0c4727f
|
|
BLAKE2b-256 checksum How to use checksums |
2432351045b5ac3feb65c3b54153a20ffb882a5445297572d67752ac755791c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for cocotbext-uart 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.