cohdl


Namecohdl JSON
Version 0.2.3 PyPI version JSON
download
home_pageNone
SummaryA Python to VHDL compiler
upload_time2024-08-25 15:43:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CoHDL

CoHDL is a hardware description language embedded in Python. It translates a subset of Python into synthesizable VHDL.

---

## examples/introduction

You can find an introduction and many examples in this [documentation repository](https://github.com/alexander-forster/cohdl_documentation).

## features

At its core CoHDLs language model is very similar to VHDL. Designs are made up of signals and variables built from types like `Bit` and `BitVector`. There are concurrent contexts, for expressions that would appear in the architecture scope of VHDL entities and sequential contexts equivalent to VHDL processes.

Code that uses only basic features also found in VHDL (if-statements, signal/variable assignments, arithmetic operators and so on) essentially looks like VHDL written in Python syntax. On top of that CoHDL supplies many additional features


### coroutines

The initial motivation for CoHDL was to explore how well coroutines, found in many modern programming languages, translate to the domain of hardware description languages.

CoHDL turns Pythons async/await style coroutines into VHDL state machines. This process is completely deterministic and allows clock accurate modeling of sequential processes. The main advantage over explicit state machine implementations is, that coroutines are reusable.

Common sequences such as AXI transactions can be defined once and instantiated whenever needed.

### supported Python subset

The following is an incomplete list of Python constructs supported in synthesizable contexts

* statements
    * if
    * for
    * if expressions
    * generator expressions
    * most operators
* functions
    * arbitrary argument types
    * default arguments
    * keyword arguments
    * variadic arguments
    * compile time recursion
    * compile time evaluated builtin functions
* classes
    * member access
    * methods
    * operator overloading
    * inheritance
    * overriding methods
* python container types
    * list
    * dict
* coroutines

### meta programming

Since CoHDL is embedded in Python, it is possible to run arbitrary code before and after the compilation. This can be used to load configuration files or run external programs like simulators or synthesis tools on the generated VHDL.

For a working example of this checkout [cohdl_xil](https://github.com/alexander-forster/cohdl_xil). It generates Makefile projects for CoHDL designs targeting Xilinx FPGAs.

---
## getting started

CoHDL requires Python3.10 or higher and has no further dependencies. You can install it by running

```shell
python3 -m pip install cohdl
```

in a terminal window. You should then be able to run the code snippets, found in the [introduction repository](https://github.com/alexander-forster/cohdl_documentation) and implement own designs.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cohdl",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Alexander Forster <alexander.forster123@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b3/06/3db7d581193a03718de79c10f2b1a16ba4f1abf5a9370c7e2fbf1ef58bd9/cohdl-0.2.3.tar.gz",
    "platform": null,
    "description": "# CoHDL\n\nCoHDL is a hardware description language embedded in Python. It translates a subset of Python into synthesizable VHDL.\n\n---\n\n## examples/introduction\n\nYou can find an introduction and many examples in this [documentation repository](https://github.com/alexander-forster/cohdl_documentation).\n\n## features\n\nAt its core CoHDLs language model is very similar to VHDL. Designs are made up of signals and variables built from types like `Bit` and `BitVector`. There are concurrent contexts, for expressions that would appear in the architecture scope of VHDL entities and sequential contexts equivalent to VHDL processes.\n\nCode that uses only basic features also found in VHDL (if-statements, signal/variable assignments, arithmetic operators and so on) essentially looks like VHDL written in Python syntax. On top of that CoHDL supplies many additional features\n\n\n### coroutines\n\nThe initial motivation for CoHDL was to explore how well coroutines, found in many modern programming languages, translate to the domain of hardware description languages.\n\nCoHDL turns Pythons async/await style coroutines into VHDL state machines. This process is completely deterministic and allows clock accurate modeling of sequential processes. The main advantage over explicit state machine implementations is, that coroutines are reusable.\n\nCommon sequences such as AXI transactions can be defined once and instantiated whenever needed.\n\n### supported Python subset\n\nThe following is an incomplete list of Python constructs supported in synthesizable contexts\n\n* statements\n    * if\n    * for\n    * if expressions\n    * generator expressions\n    * most operators\n* functions\n    * arbitrary argument types\n    * default arguments\n    * keyword arguments\n    * variadic arguments\n    * compile time recursion\n    * compile time evaluated builtin functions\n* classes\n    * member access\n    * methods\n    * operator overloading\n    * inheritance\n    * overriding methods\n* python container types\n    * list\n    * dict\n* coroutines\n\n### meta programming\n\nSince CoHDL is embedded in Python, it is possible to run arbitrary code before and after the compilation. This can be used to load configuration files or run external programs like simulators or synthesis tools on the generated VHDL.\n\nFor a working example of this checkout [cohdl_xil](https://github.com/alexander-forster/cohdl_xil). It generates Makefile projects for CoHDL designs targeting Xilinx FPGAs.\n\n---\n## getting started\n\nCoHDL requires Python3.10 or higher and has no further dependencies. You can install it by running\n\n```shell\npython3 -m pip install cohdl\n```\n\nin a terminal window. You should then be able to run the code snippets, found in the [introduction repository](https://github.com/alexander-forster/cohdl_documentation) and implement own designs.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python to VHDL compiler",
    "version": "0.2.3",
    "project_urls": {
        "Homepage": "https://github.com/alexander-forster/cohdl"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aa384d383626bda97a384aad04736bc2b617d91c112bb6f0ca912b203d088892",
                "md5": "e7131dba7c49d6c5a946fbacd4db2d47",
                "sha256": "d6044c1511a896d8afa3e9f6d4f78f6c384c5f3ffae34701416fc6ca8ff367cd"
            },
            "downloads": -1,
            "filename": "cohdl-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e7131dba7c49d6c5a946fbacd4db2d47",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 213869,
            "upload_time": "2024-08-25T15:42:58",
            "upload_time_iso_8601": "2024-08-25T15:42:58.899029Z",
            "url": "https://files.pythonhosted.org/packages/aa/38/4d383626bda97a384aad04736bc2b617d91c112bb6f0ca912b203d088892/cohdl-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b3063db7d581193a03718de79c10f2b1a16ba4f1abf5a9370c7e2fbf1ef58bd9",
                "md5": "040767ece54efb831223e2be0fd4bb93",
                "sha256": "52e88737457cc6089537f4bfb1fae50563386d3a9238c20f90bbb6eb169af76f"
            },
            "downloads": -1,
            "filename": "cohdl-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "040767ece54efb831223e2be0fd4bb93",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 186394,
            "upload_time": "2024-08-25T15:43:01",
            "upload_time_iso_8601": "2024-08-25T15:43:01.076307Z",
            "url": "https://files.pythonhosted.org/packages/b3/06/3db7d581193a03718de79c10f2b1a16ba4f1abf5a9370c7e2fbf1ef58bd9/cohdl-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-25 15:43:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alexander-forster",
    "github_project": "cohdl",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cohdl"
}
        
Elapsed time: 0.37814s