cocotbext-dvi


Namecocotbext-dvi JSON
Version 0.5.0 PyPI version JSON
download
home_pagehttps://github.com/daxzio/cocotbext-dvi
SummaryDVI and RGB modules for cocotb
upload_time2025-01-27 00:04:53
maintainerNone
docs_urlNone
authorDave Keeshan
requires_python>=3.8
licenseMIT
keywords dvi cocotb
VCS
bugtrack_url
requirements cocotb cocotb-bus pytest pyflakes ruff mypy opencv-python
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DVI and RGB interface modules for Cocotb

[![Build Status](https://github.com/daxzio/cocotbext-dvi/actions/workflows/regression-tests.yml/badge.svg?branch=main)](https://github.com/daxzio/cocotbext-dvi/actions/)
[![PyPI version](https://badge.fury.io/py/cocotbext-dvi.svg)](https://pypi.org/project/cocotbext-dvi)
[![Downloads](https://pepy.tech/badge/cocotbext-dvi)](https://pepy.tech/project/cocotbext-dvi)

GitHub repository: https://github.com/daxzio/cocotbext-dvi

## Introduction

DVI and RGB simulation models for [cocotb](https://github.com/cocotb/cocotb).

## Installation

Installation from pip (release version, stable):

    $ pip install cocotbext-dvi

Installation from git (latest development version, potentially unstable):

    $ pip install https://github.com/daxzio/cocotbext-dvi/archive/master.zip

Installation for active development:

    $ git clone https://github.com/daxzio/cocotbext-dvi
    $ pip install -e cocotbext-dvi

## Documentation and usage examples

See the `tests` directory for complete testbenches using these modules.

## RGB

It is important to understand that DVI is a serially encoded version of 24-bit RGB or sometimes called RGB888.

RGB888 is a color encoding system that represents colors using a combination of red, green, and blue components, each of which has 8 bits of information. This means that there are 256 possible values for each component, resulting in a total of 16,777,216 possible color combinations.

Typically, due to the high speed of DVI, most digitial designs will convert to 24 bit RGB to use internally, or if transmitting generte images as RGB before being converted to DVI on the TX pins.

As such there is a fully functionally RGB interfaces (Driver and Sink) in this module.  They are actually used by the module to generate the DVI Driver and Sink too.

### RGB Bus

The `RGBBus` is used to map to a RGB interface on the `dut`.  These hold instances of bus objects for the individual channels, which are currently extensions of `cocotb_bus.bus.Bus`.  Class methods `from_entity` and `from_prefix` are provided to facilitate signal default name matching. 

#### Required:
* _vsync_
* _hsync_
* _de_
* _data_

#### Optional:
* _vblank_
* _hblank_
* _field_id_

#### Example

```python
    from cocotbext.dvi import RGBBus
    rgb_in_bus = RGBBus.from_prefix(dut, prefix="vid_in")
```

or 
    
```python
    signals_in = {
        "vsync": "vid_in_vsync",
        "hsync": "vid_in_hsync",
        "de": "vid_in_de",
        "data": "vid_in_data",
    }
    rgb_in_bus = RGBBus(dut, signals=signals_in)
```

### RGB Driver

The `RGBDriver` class implement a RGB driver and is capable of generating RGB888 signals to be supplied to a RGB input.

```python
    from cocotbext.dvi import RGBBus, RGBDriver
    rgb_in_bus = RGBBus.from_prefix(dut, prefix="vid_in")
    rgb_in = RGBDriver(
        dut.clk,
        rgb_in_bus,
        image_file="./images/320x240.bmp",
    )
```

* _frequency_: Frame frequency images, default `60` Hz
* _height_: Truncated image height, use this height instead if image height is positive, default `-1`
* _width_: Truncated image width, use this width instead if image width is positive, default `-1`
* _logging_enabled_: Logging enable, default `True`

#### Methods

* `await_start()`: Return when an image has begun (if already begun return immediatly)
* `await_image(num)`: Return then a full number of image, `num`, image, frames, has been complete. `num` default `1`  

### RGB Sink

The `RGBSink` class implement a RGB sink and is capable of receiving RGB888 signals, decoding it to image data, vsync, hsync and comparing it against a supplied image, `image_file.`

```python
    from cocotbext.dvi import RGBBus, RGBSink
    rgb_out_bus = RGBBus.from_prefix(dut, prefix="vid_out")
    rgb_out = RGBSink(
        dut.clk,
        rgb_out_bus,
        image_file="./images/320x240.bmp",
    )
```

* _image_file_: Image to compare receoved against. Raise error is there is a mismatch in image content but also column and row counts, default `None` (no comparison)
* _expected_frequency_: Frame frequency images, default `60` Hz
* _height_: Truncated image height, use this height instead if image height is positive, default `-1`
* _width_: Truncated image width, use this width instead if image width is positive, default `-1`
* _logging_enabled_: Logging enable, default `True`
* _clk_freq_: Test receveied clock frequency, default `25.0` Mhz

#### Methods

* `frame_finished(num)`: Return then a full number of image, `num`, image, frames, has been received. `num` default `1` 

## DVI

### DVI Bus

The `DVIBus` is used to map to a DVI interface on the `dut`.  These hold instances of bus objects for the individual channels, which are currently extensions of `cocotb_bus.bus.Bus`.  Class methods `from_entity` and `from_prefix` are provided to facilitate signal default name matching. 

#### Required:
* _clk_p_
* _data_p_

#### Optional:
* _clk_n_
* _data_n_

#### Example

```python
    dvi_in_bus = DVIBus.from_prefix(dut, prefix="tmds_in")
```

or 
    

```python
    signals_in = {
        "clk_p": "tmds_in_clk_p",
        "clk_n": "tmds_in_clk_n",
        "data_p": "tmds_in_data_p",
        "data_n": "tmds_in_data_n",
    }
    dvi_in_bus = DVIBus(dut, signals=signals_in)
```


## DVI



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/daxzio/cocotbext-dvi",
    "name": "cocotbext-dvi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "dvi, cocotb",
    "author": "Dave Keeshan",
    "author_email": "dave.keeshan@daxzio.com",
    "download_url": "https://files.pythonhosted.org/packages/09/55/42b1716cab1d266a88d18f0427258d6ea3d63a669eec0ca4bf54feb15acb/cocotbext_dvi-0.5.0.tar.gz",
    "platform": "any",
    "description": "# DVI and RGB interface modules for Cocotb\n\n[![Build Status](https://github.com/daxzio/cocotbext-dvi/actions/workflows/regression-tests.yml/badge.svg?branch=main)](https://github.com/daxzio/cocotbext-dvi/actions/)\n[![PyPI version](https://badge.fury.io/py/cocotbext-dvi.svg)](https://pypi.org/project/cocotbext-dvi)\n[![Downloads](https://pepy.tech/badge/cocotbext-dvi)](https://pepy.tech/project/cocotbext-dvi)\n\nGitHub repository: https://github.com/daxzio/cocotbext-dvi\n\n## Introduction\n\nDVI and RGB simulation models for [cocotb](https://github.com/cocotb/cocotb).\n\n## Installation\n\nInstallation from pip (release version, stable):\n\n    $ pip install cocotbext-dvi\n\nInstallation from git (latest development version, potentially unstable):\n\n    $ pip install https://github.com/daxzio/cocotbext-dvi/archive/master.zip\n\nInstallation for active development:\n\n    $ git clone https://github.com/daxzio/cocotbext-dvi\n    $ pip install -e cocotbext-dvi\n\n## Documentation and usage examples\n\nSee the `tests` directory for complete testbenches using these modules.\n\n## RGB\n\nIt is important to understand that DVI is a serially encoded version of 24-bit RGB or sometimes called RGB888.\n\nRGB888 is a color encoding system that represents colors using a combination of red, green, and blue components, each of which has 8 bits of information. This means that there are 256 possible values for each component, resulting in a total of 16,777,216 possible color combinations.\n\nTypically, due to the high speed of DVI, most digitial designs will convert to 24 bit RGB to use internally, or if transmitting generte images as RGB before being converted to DVI on the TX pins.\n\nAs such there is a fully functionally RGB interfaces (Driver and Sink) in this module.  They are actually used by the module to generate the DVI Driver and Sink too.\n\n### RGB Bus\n\nThe `RGBBus` is used to map to a RGB interface on the `dut`.  These hold instances of bus objects for the individual channels, which are currently extensions of `cocotb_bus.bus.Bus`.  Class methods `from_entity` and `from_prefix` are provided to facilitate signal default name matching. \n\n#### Required:\n* _vsync_\n* _hsync_\n* _de_\n* _data_\n\n#### Optional:\n* _vblank_\n* _hblank_\n* _field_id_\n\n#### Example\n\n```python\n    from cocotbext.dvi import RGBBus\n    rgb_in_bus = RGBBus.from_prefix(dut, prefix=\"vid_in\")\n```\n\nor \n    \n```python\n    signals_in = {\n        \"vsync\": \"vid_in_vsync\",\n        \"hsync\": \"vid_in_hsync\",\n        \"de\": \"vid_in_de\",\n        \"data\": \"vid_in_data\",\n    }\n    rgb_in_bus = RGBBus(dut, signals=signals_in)\n```\n\n### RGB Driver\n\nThe `RGBDriver` class implement a RGB driver and is capable of generating RGB888 signals to be supplied to a RGB input.\n\n```python\n    from cocotbext.dvi import RGBBus, RGBDriver\n    rgb_in_bus = RGBBus.from_prefix(dut, prefix=\"vid_in\")\n    rgb_in = RGBDriver(\n        dut.clk,\n        rgb_in_bus,\n        image_file=\"./images/320x240.bmp\",\n    )\n```\n\n* _frequency_: Frame frequency images, default `60` Hz\n* _height_: Truncated image height, use this height instead if image height is positive, default `-1`\n* _width_: Truncated image width, use this width instead if image width is positive, default `-1`\n* _logging_enabled_: Logging enable, default `True`\n\n#### Methods\n\n* `await_start()`: Return when an image has begun (if already begun return immediatly)\n* `await_image(num)`: Return then a full number of image, `num`, image, frames, has been complete. `num` default `1`  \n\n### RGB Sink\n\nThe `RGBSink` class implement a RGB sink and is capable of receiving RGB888 signals, decoding it to image data, vsync, hsync and comparing it against a supplied image, `image_file.`\n\n```python\n    from cocotbext.dvi import RGBBus, RGBSink\n    rgb_out_bus = RGBBus.from_prefix(dut, prefix=\"vid_out\")\n    rgb_out = RGBSink(\n        dut.clk,\n        rgb_out_bus,\n        image_file=\"./images/320x240.bmp\",\n    )\n```\n\n* _image_file_: Image to compare receoved against. Raise error is there is a mismatch in image content but also column and row counts, default `None` (no comparison)\n* _expected_frequency_: Frame frequency images, default `60` Hz\n* _height_: Truncated image height, use this height instead if image height is positive, default `-1`\n* _width_: Truncated image width, use this width instead if image width is positive, default `-1`\n* _logging_enabled_: Logging enable, default `True`\n* _clk_freq_: Test receveied clock frequency, default `25.0` Mhz\n\n#### Methods\n\n* `frame_finished(num)`: Return then a full number of image, `num`, image, frames, has been received. `num` default `1` \n\n## DVI\n\n### DVI Bus\n\nThe `DVIBus` is used to map to a DVI interface on the `dut`.  These hold instances of bus objects for the individual channels, which are currently extensions of `cocotb_bus.bus.Bus`.  Class methods `from_entity` and `from_prefix` are provided to facilitate signal default name matching. \n\n#### Required:\n* _clk_p_\n* _data_p_\n\n#### Optional:\n* _clk_n_\n* _data_n_\n\n#### Example\n\n```python\n    dvi_in_bus = DVIBus.from_prefix(dut, prefix=\"tmds_in\")\n```\n\nor \n    \n\n```python\n    signals_in = {\n        \"clk_p\": \"tmds_in_clk_p\",\n        \"clk_n\": \"tmds_in_clk_n\",\n        \"data_p\": \"tmds_in_data_p\",\n        \"data_n\": \"tmds_in_data_n\",\n    }\n    dvi_in_bus = DVIBus(dut, signals=signals_in)\n```\n\n\n## DVI\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "DVI and RGB modules for cocotb",
    "version": "0.5.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/daxzio/cocotbext-dvi/issues",
        "Download": "https://github.com/daxzio/cocotbext-dvi/tarball/master",
        "Homepage": "https://github.com/daxzio/cocotbext-dvi",
        "Source Code": "https://github.com/daxzio/cocotbext-dvi"
    },
    "split_keywords": [
        "dvi",
        " cocotb"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "095542b1716cab1d266a88d18f0427258d6ea3d63a669eec0ca4bf54feb15acb",
                "md5": "3c48765b069f19c67e98c3737c58f270",
                "sha256": "01c5f201f6d94d2fa5f407ae7e1ca6c4b4aaef1443a934d4dc909aacf6c1965a"
            },
            "downloads": -1,
            "filename": "cocotbext_dvi-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3c48765b069f19c67e98c3737c58f270",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 18583,
            "upload_time": "2025-01-27T00:04:53",
            "upload_time_iso_8601": "2025-01-27T00:04:53.810539Z",
            "url": "https://files.pythonhosted.org/packages/09/55/42b1716cab1d266a88d18f0427258d6ea3d63a669eec0ca4bf54feb15acb/cocotbext_dvi-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-27 00:04:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "daxzio",
    "github_project": "cocotbext-dvi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "cocotb",
            "specs": []
        },
        {
            "name": "cocotb-bus",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "pyflakes",
            "specs": []
        },
        {
            "name": "ruff",
            "specs": []
        },
        {
            "name": "mypy",
            "specs": []
        },
        {
            "name": "opencv-python",
            "specs": []
        }
    ],
    "lcname": "cocotbext-dvi"
}
        
Elapsed time: 2.85168s