leap-backend


Nameleap-backend JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryThe backend of the LEAP framework
upload_time2024-10-05 07:30:54
maintainerNone
docs_urlNone
authorHanyu Wang
requires_python>=3.11
licenseMIT License Copyright (c) 2024 Hanyu Wang 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 high-level synthesis verilog system verilog
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            LEAP-Backend
============

[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/Nozidoali/leap-compiler.git)
[![PyTest](https://github.com/Nozidoali/leap-backend/actions/workflows/ci.yml/badge.svg)](https://github.com/Nozidoali/leap-backend/actions/workflows/ci.yml)

<img src="./static/leap-logo2.svg" width="64" height="64" align="left" style="margin-right: 24pt;margin-left: 12pt" />
LEAP (Logic nEtwork-Aware Pipelining) is a framework for exploiting logic synthesis and technology mapping to improve the performance of high-level synthesis (HLS) tools. LEAP is implemented in Python and is open-source under the MIT license.


This is the backend for the LEAP project. It contains the folloinwg necessary algorithms to process the subject graph.
- **blif** handles the read/write of BLIF files and provides interface to manipulate the logic network.
- **cute** is a packge for cut enumeration.
- **map** is the LUT mapping algorithm with Boolean simulation.
- **milp** contains several MILP models for timing regulation whose optimization is powered by Gurobi.

Installation
------------

1. (**recommended**) Download backend as a submodule of the main project.

2. Install and use it elsewhere.

```bash
pip install -e .
```

Getting Started
---------------

The example can be executed using `python examples/mapbuf.py`. This example:
1. Takes the BLIF file `examples/add2/add2.blif` as input (synthesized from `examples/add2/add2.v`).
2. Reads the schedulability constraints from `examples/add2/add2.json`.
3. Maps the logic network to a LUT-based FPGA with `maxLeaves=3` and `clockPeriod=1ns` (1 LUT level is `0.7ns`).
4. Writes the optimized BLIF file to `examples/add2/add2_opt.blif`.

```python
if __name__ == "__main__":
    from backend import *
    
    input_file = "examples/add2/add2.blif"
    input_sched_constr = "examples/add2/add2.json"
    output_file = "examples/add2/add2_opt.blif"

    graph = read_blif(input_file)
    model = MapBufModel(graph, json.load(open(input_sched_constr)), 1, {"maxLeaves": 3})
    model.solve()
    model.dumpGraph(output_file)

    import subprocess

    # CEC check works if no buffer is inserted
    # subprocess.run(f"abc -c 'cec {input_file} {output_file}'", shell=True)
    subprocess.run(f"abc -c 'read {output_file}; print_stats'", shell=True)
```

An advanced example can be found in `examples/mem`. Where:
1. The DIP specifies `mem_addr` and `mem_rd_en` has the same label.
2. The CIP specifies the `mem_data` arrives at least 1 cycle after `mem_addr` and `mem_rd_en`.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "leap-backend",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "high-level synthesis, verilog, system verilog",
    "author": "Hanyu Wang",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/22/4f/a14929b926035a8f0a47d0a626139a21b922dea898586f3118488c21329b/leap_backend-0.1.0.tar.gz",
    "platform": null,
    "description": "LEAP-Backend\n============\n\n[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/Nozidoali/leap-compiler.git)\n[![PyTest](https://github.com/Nozidoali/leap-backend/actions/workflows/ci.yml/badge.svg)](https://github.com/Nozidoali/leap-backend/actions/workflows/ci.yml)\n\n<img src=\"./static/leap-logo2.svg\" width=\"64\" height=\"64\" align=\"left\" style=\"margin-right: 24pt;margin-left: 12pt\" />\nLEAP (Logic nEtwork-Aware Pipelining) is a framework for exploiting logic synthesis and technology mapping to improve the performance of high-level synthesis (HLS) tools. LEAP is implemented in Python and is open-source under the MIT license.\n\n\nThis is the backend for the LEAP project. It contains the folloinwg necessary algorithms to process the subject graph.\n- **blif** handles the read/write of BLIF files and provides interface to manipulate the logic network.\n- **cute** is a packge for cut enumeration.\n- **map** is the LUT mapping algorithm with Boolean simulation.\n- **milp** contains several MILP models for timing regulation whose optimization is powered by Gurobi.\n\nInstallation\n------------\n\n1. (**recommended**) Download backend as a submodule of the main project.\n\n2. Install and use it elsewhere.\n\n```bash\npip install -e .\n```\n\nGetting Started\n---------------\n\nThe example can be executed using `python examples/mapbuf.py`. This example:\n1. Takes the BLIF file `examples/add2/add2.blif` as input (synthesized from `examples/add2/add2.v`).\n2. Reads the schedulability constraints from `examples/add2/add2.json`.\n3. Maps the logic network to a LUT-based FPGA with `maxLeaves=3` and `clockPeriod=1ns` (1 LUT level is `0.7ns`).\n4. Writes the optimized BLIF file to `examples/add2/add2_opt.blif`.\n\n```python\nif __name__ == \"__main__\":\n    from backend import *\n    \n    input_file = \"examples/add2/add2.blif\"\n    input_sched_constr = \"examples/add2/add2.json\"\n    output_file = \"examples/add2/add2_opt.blif\"\n\n    graph = read_blif(input_file)\n    model = MapBufModel(graph, json.load(open(input_sched_constr)), 1, {\"maxLeaves\": 3})\n    model.solve()\n    model.dumpGraph(output_file)\n\n    import subprocess\n\n    # CEC check works if no buffer is inserted\n    # subprocess.run(f\"abc -c 'cec {input_file} {output_file}'\", shell=True)\n    subprocess.run(f\"abc -c 'read {output_file}; print_stats'\", shell=True)\n```\n\nAn advanced example can be found in `examples/mem`. Where:\n1. The DIP specifies `mem_addr` and `mem_rd_en` has the same label.\n2. The CIP specifies the `mem_data` arrives at least 1 cycle after `mem_addr` and `mem_rd_en`.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Hanyu Wang  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": "The backend of the LEAP framework",
    "version": "0.1.0",
    "project_urls": {
        "Repository": "https://github.com/Nozidoali/leap-backend"
    },
    "split_keywords": [
        "high-level synthesis",
        " verilog",
        " system verilog"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd8b7dfca27b48a42da078d4614eaa03ef59fdaf12b20ed99f1daec3ff5f1cb6",
                "md5": "b12055d702e4d7ece0e974bfea9075cb",
                "sha256": "f13e212754a1baae28ffce7f83df55e78255dbad6d83270afe94e130dbe050ec"
            },
            "downloads": -1,
            "filename": "leap_backend-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b12055d702e4d7ece0e974bfea9075cb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 26193,
            "upload_time": "2024-10-05T07:30:53",
            "upload_time_iso_8601": "2024-10-05T07:30:53.636960Z",
            "url": "https://files.pythonhosted.org/packages/fd/8b/7dfca27b48a42da078d4614eaa03ef59fdaf12b20ed99f1daec3ff5f1cb6/leap_backend-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "224fa14929b926035a8f0a47d0a626139a21b922dea898586f3118488c21329b",
                "md5": "64cd7b2b4b990cd674cb736cbdd207be",
                "sha256": "a2d178d49e0bdb70cf1c23b15363b3352a06b4a3d81f6ea04a61593fd709b531"
            },
            "downloads": -1,
            "filename": "leap_backend-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "64cd7b2b4b990cd674cb736cbdd207be",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 33289,
            "upload_time": "2024-10-05T07:30:54",
            "upload_time_iso_8601": "2024-10-05T07:30:54.606454Z",
            "url": "https://files.pythonhosted.org/packages/22/4f/a14929b926035a8f0a47d0a626139a21b922dea898586f3118488c21329b/leap_backend-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-05 07:30:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Nozidoali",
    "github_project": "leap-backend",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "leap-backend"
}
        
Elapsed time: 4.64729s