openflex


Nameopenflex JSON
Version 0.1.4 PyPI version JSON
download
home_pageNone
SummaryFramework for Logic Synthesis and EXploration
upload_time2024-03-24 05:02:05
maintainerNone
docs_urlNone
authorGreg Stitt, Wesley Piard
requires_pythonNone
licenseMIT License Copyright (c) 2024 Greg Stitt, Wesley Piard, University of Florida Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords rtl hdl fpga
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# OpenFLEX

[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![PyPI version](https://img.shields.io/pypi/v/openflex.svg)](https://pypi.python.org/pypi/openflex/)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/mit)

A python module/CLI **F**ramework for **L**ogic Synthesis and **EX**ploration

## Installation

The easiest way to install OpenFLEX is using `pip`. To install OpenFLEX in a Python virtual environment, you can run the following commands:

```bash
python -m venv .venv      # this will create a `.venv` directory in your current directory
source .venv/bin/activate # activate the virtual environment
pip install -U pip        # update the default pip version
pip install openflex      # install OpenFLEX and its dependencies inside venv
```

To de-activate the environment (if you need to delete it, or are switching to another one), simply run the following command:

```bash
deactivate
```

## Usage

The following usage instructions will use files from the `examples/` directory of this repository. Currently, there are two examples:

1) `examples/mult/` : simple combinational logic multiplier with a testbench
2) `examples/blinky/` : classic `blinky` counter/LED example without a testbench

Each example directory contains two types of files: (1) RTL modules and (2) YAML configuration files. The YAML configuration files are used to contain the details/parameters required to simulate or synthesize the RTL modules, e.g., file list, EDA tool, top-level module/testbench parameters, etc.

### Multiplier Simulation Example

Examine the `mult_sim.yml` YAML configuration file contents:

```yaml
mode: sim
tool: questa
top: mult_tb

files:
  - ./mult.sv
  - ./mult_tb.sv

parameters:
  NUM_TESTS: [1000]
  IS_SIGNED: [0, 1]
  INPUT_WIDTH: [8, 16]
```

With this configuration, OpenFLEX will run the `mult_tb` testbench four times (Cartesian product of the `IS_SIGNED` and `INPUT_WIDTH` parameters).

To run a simulation using the `mult` example, make sure any relevant virtual environment is loaded, and run the following commands:

```bash
cd examples/mult
openflex mult_sim.yml
```

This will create a `build_questa` directory that contains the build artifacts, logs, etc.

### Blinky Synthesis Example

To run synthesis/PnR/STA on the blinky module, similarly, you can run the following:

```bash
cd examples/blinky
openflex blinky_synth.yml -c blinky.csv
```

Notice the `-c blinky.csv` argument passed. This specifies the name for the CSV file that the results are output to (fMax, resource utilization, etc.). Note that the CSV file is appended to, not overwritten.

### Custom Flexible Parameter Generation

You are not limited to the rigid parameter combinations that you supply via the YAML configuration. It is also possible to utilize the `FlexConfig()` class from your own custom Python scripts to utilize the power of Python to generate some extremely precise parameter combinations that would be tedious to do manually or through basic filelists/configurations.

An example of this is provided in the blinky example directory: [`blinky.py`](examples/blinky/blinky.py)

The `FlexConfig()` class has an `add_parameter()` method that allows a custom function to be passed which is used to insert new parameters into the parameter list.

For example, in [`blinky.py`](examples/blinky/blinky.py), we create a `generate_count()` function that simply picks a random value between 1k and 100k. This is a trivial use-case, of course.

```python
def generate_count():
    count = random.randint(1e3, 1e7)

    params = []
    params.append(count)
    return list(set(params))
```

Later, we instantiate an instance of `FlexConfig()` by passing the YAML configuration, and call the `add_parameter()` method to add the random `count` parameter value. We could also add more random (or specific) `count` values and add them to the return of this `generate_count()` function:

```python
dut = config.FlexConfig("./blinky_synth.yml")
dut.add_parameter("COUNT", generate_count)
```

Additionally, it is possible to **read** existing parameters inside these `generate()` functions to use them as variables when calculating new pararmeters to prevent "illegal" combinations.

## Contributing

If you would like to make live modifications to the OpenFLEX source code, then you will need to clone this repository and install it in [`editable`](https://setuptools.pypa.io/en/latest/userguide/development_mode.html) mode.

Start by cloning the repository, and then from its root directory, run the following:

```bash
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -e .  # install OpenFLEX locally as editable
```

Now, any modifications you make to the OpenFLEX source code should be reflected the next time you run or use `openflex`.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "openflex",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "rtl, hdl, fpga",
    "author": "Greg Stitt, Wesley Piard",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/52/c8/898f27d5a03a2f4033b22ce18fc861f76725753faf96041a2789b8a9c210/openflex-0.1.4.tar.gz",
    "platform": null,
    "description": "\n# OpenFLEX\n\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![PyPI version](https://img.shields.io/pypi/v/openflex.svg)](https://pypi.python.org/pypi/openflex/)\n[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/mit)\n\nA python module/CLI **F**ramework for **L**ogic Synthesis and **EX**ploration\n\n## Installation\n\nThe easiest way to install OpenFLEX is using `pip`. To install OpenFLEX in a Python virtual environment, you can run the following commands:\n\n```bash\npython -m venv .venv      # this will create a `.venv` directory in your current directory\nsource .venv/bin/activate # activate the virtual environment\npip install -U pip        # update the default pip version\npip install openflex      # install OpenFLEX and its dependencies inside venv\n```\n\nTo de-activate the environment (if you need to delete it, or are switching to another one), simply run the following command:\n\n```bash\ndeactivate\n```\n\n## Usage\n\nThe following usage instructions will use files from the `examples/` directory of this repository. Currently, there are two examples:\n\n1) `examples/mult/` : simple combinational logic multiplier with a testbench\n2) `examples/blinky/` : classic `blinky` counter/LED example without a testbench\n\nEach example directory contains two types of files: (1) RTL modules and (2) YAML configuration files. The YAML configuration files are used to contain the details/parameters required to simulate or synthesize the RTL modules, e.g., file list, EDA tool, top-level module/testbench parameters, etc.\n\n### Multiplier Simulation Example\n\nExamine the `mult_sim.yml` YAML configuration file contents:\n\n```yaml\nmode: sim\ntool: questa\ntop: mult_tb\n\nfiles:\n  - ./mult.sv\n  - ./mult_tb.sv\n\nparameters:\n  NUM_TESTS: [1000]\n  IS_SIGNED: [0, 1]\n  INPUT_WIDTH: [8, 16]\n```\n\nWith this configuration, OpenFLEX will run the `mult_tb` testbench four times (Cartesian product of the `IS_SIGNED` and `INPUT_WIDTH` parameters).\n\nTo run a simulation using the `mult` example, make sure any relevant virtual environment is loaded, and run the following commands:\n\n```bash\ncd examples/mult\nopenflex mult_sim.yml\n```\n\nThis will create a `build_questa` directory that contains the build artifacts, logs, etc.\n\n### Blinky Synthesis Example\n\nTo run synthesis/PnR/STA on the blinky module, similarly, you can run the following:\n\n```bash\ncd examples/blinky\nopenflex blinky_synth.yml -c blinky.csv\n```\n\nNotice the `-c blinky.csv` argument passed. This specifies the name for the CSV file that the results are output to (fMax, resource utilization, etc.). Note that the CSV file is appended to, not overwritten.\n\n### Custom Flexible Parameter Generation\n\nYou are not limited to the rigid parameter combinations that you supply via the YAML configuration. It is also possible to utilize the `FlexConfig()` class from your own custom Python scripts to utilize the power of Python to generate some extremely precise parameter combinations that would be tedious to do manually or through basic filelists/configurations.\n\nAn example of this is provided in the blinky example directory: [`blinky.py`](examples/blinky/blinky.py)\n\nThe `FlexConfig()` class has an `add_parameter()` method that allows a custom function to be passed which is used to insert new parameters into the parameter list.\n\nFor example, in [`blinky.py`](examples/blinky/blinky.py), we create a `generate_count()` function that simply picks a random value between 1k and 100k. This is a trivial use-case, of course.\n\n```python\ndef generate_count():\n    count = random.randint(1e3, 1e7)\n\n    params = []\n    params.append(count)\n    return list(set(params))\n```\n\nLater, we instantiate an instance of `FlexConfig()` by passing the YAML configuration, and call the `add_parameter()` method to add the random `count` parameter value. We could also add more random (or specific) `count` values and add them to the return of this `generate_count()` function:\n\n```python\ndut = config.FlexConfig(\"./blinky_synth.yml\")\ndut.add_parameter(\"COUNT\", generate_count)\n```\n\nAdditionally, it is possible to **read** existing parameters inside these `generate()` functions to use them as variables when calculating new pararmeters to prevent \"illegal\" combinations.\n\n## Contributing\n\nIf you would like to make live modifications to the OpenFLEX source code, then you will need to clone this repository and install it in [`editable`](https://setuptools.pypa.io/en/latest/userguide/development_mode.html) mode.\n\nStart by cloning the repository, and then from its root directory, run the following:\n\n```bash\npython -m venv .venv\nsource .venv/bin/activate\npip install -U pip\npip install -e .  # install OpenFLEX locally as editable\n```\n\nNow, any modifications you make to the OpenFLEX source code should be reflected the next time you run or use `openflex`.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Greg Stitt, Wesley Piard, University of Florida  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Framework for Logic Synthesis and EXploration",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/wespiard/openflex"
    },
    "split_keywords": [
        "rtl",
        " hdl",
        " fpga"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9796a985a97efb39bcef0ad02d77a2b7fc69b13c15768395569331995a9edeea",
                "md5": "8ba12aa47b461ead45353effec4ef50f",
                "sha256": "8a9bba0112e2aafe7b6a27f5176b5b699d7a801c07d32ad4d26aa16702fbb8ec"
            },
            "downloads": -1,
            "filename": "openflex-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8ba12aa47b461ead45353effec4ef50f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17311,
            "upload_time": "2024-03-24T05:02:03",
            "upload_time_iso_8601": "2024-03-24T05:02:03.873541Z",
            "url": "https://files.pythonhosted.org/packages/97/96/a985a97efb39bcef0ad02d77a2b7fc69b13c15768395569331995a9edeea/openflex-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "52c8898f27d5a03a2f4033b22ce18fc861f76725753faf96041a2789b8a9c210",
                "md5": "e74c580b89f749172d3880ea1e9c62d4",
                "sha256": "c58f9d75653a61acdef7c5db5e748419998b82a0ef6ea6436cf2d41b7bf791e6"
            },
            "downloads": -1,
            "filename": "openflex-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "e74c580b89f749172d3880ea1e9c62d4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14780,
            "upload_time": "2024-03-24T05:02:05",
            "upload_time_iso_8601": "2024-03-24T05:02:05.563792Z",
            "url": "https://files.pythonhosted.org/packages/52/c8/898f27d5a03a2f4033b22ce18fc861f76725753faf96041a2789b8a9c210/openflex-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-24 05:02:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wespiard",
    "github_project": "openflex",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "openflex"
}
        
Elapsed time: 0.29079s