{"id":13398807,"url":"https://github.com/cornell-brg/pymtl","last_synced_at":"2025-03-14T02:31:35.524Z","repository":{"id":13554173,"uuid":"16246284","full_name":"cornell-brg/pymtl","owner":"cornell-brg","description":"Python-based hardware modeling framework","archived":false,"fork":false,"pushed_at":"2019-10-27T14:22:13.000Z","size":4205,"stargazers_count":235,"open_issues_count":81,"forks_count":83,"subscribers_count":44,"default_branch":"master","last_synced_at":"2024-07-31T19:17:01.663Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cornell-brg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-26T04:06:09.000Z","updated_at":"2024-07-26T13:20:21.000Z","dependencies_parsed_at":"2022-08-30T07:31:57.883Z","dependency_job_id":null,"html_url":"https://github.com/cornell-brg/pymtl","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cornell-brg%2Fpymtl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cornell-brg%2Fpymtl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cornell-brg%2Fpymtl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cornell-brg%2Fpymtl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cornell-brg","download_url":"https://codeload.github.com/cornell-brg/pymtl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243511660,"owners_count":20302595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:00:31.808Z","updated_at":"2025-03-14T02:31:34.838Z","avatar_url":"https://github.com/cornell-brg.png","language":"Python","funding_links":[],"categories":["Projects (sorted by year)","Meta HDL and Transpilers","工具分类"],"sub_categories":["2012","硬件建模与描述语言（HDL/DSL）"],"readme":" ![PyMTL](docs/pymtl_logo.png)\n==========================================================================\n\n[![Build Status](https://travis-ci.org/cornell-brg/pymtl.svg?branch=master)](https://travis-ci.org/cornell-brg/pymtl)\n\nPyMTL is an open-source, Python-based framework for multi-level hardware\nmodeling. It was introduced at MICRO-47 in December, 2014.\n\n#### DEPRECATION NOTE: We will not be maintaining this PyMTL version 2 repo. We are instead working very hard on the new PyMTL3 version 3 repo [pymtl3](https://github.com/cornell-brg/pymtl3). PyMTLv3 has been significantly rewritten to improve both the performance and productivity of FL, CL, and RTL modeling. While we will still provide limited support for PyMTLv2, we encourage new users to start experimenting with PyMTLv3. Also note that PyMTLv2 only works with Python 2.7 (which will not be maintained past January 1, 2020). PyMTLv3 takes advantage of many new and exciting Python 3.6+ features.\n\nTutorials\n--------------------------------------------------------------------------\n\nIf you are interested in learning more about the PyMTL framework, we\nrecommend you take a look at two tutorials that have been developed for\nCornell ECE 4750. This is a course on computer architecture targeting\nseniors and first-year graduate students. Throughout the semester,\nstudents gradually design, implement, test, and evaluate a basic\nmulticore system capable of running simple parallel applications at the\nregister-transfer level. This year, students are using the PyMTL\nframework for all functional-level modeling and testing. Students have\nthe option of using PyMTL or Verilog for the RTL design portion of the\nlab assignments. The first tutorial focuses on the PyMTL framework, while\nthe second tutorial illustrates how PyMTL's Verilog import feature can\nenable applying PyMTL's powerful functional-level and testing features to\nRTL designs written in Verilog.\n\n - [PyMTL Hardware Modeling Framework Tutorial](http://www.csl.cornell.edu/courses/ece4750/handouts/ece4750-tut3-pymtl.pdf)\n   ([github](https://github.com/cornell-ece4750/ece4750-tut3-pymtl))\n - [Verilog Hardware Description Language Tutorial](http://www.csl.cornell.edu/courses/ece4750/handouts/ece4750-tut4-verilog.pdf)\n   ([github](https://github.com/cornell-ece4750/ece4750-tut4-verilog))\n\nWe have also developed tutorials specifically on PyMTL CL modeling,\nintegrating PyMTL with the Xilinx Vivado High-Level Synthesis (HLS) tool,\nand using PyMTL to drive a Synopys-based ASIC EDA toolflow.\n\n - [PyMTL CL Modeling Tutorial](https://github.com/cornell-ece5745/ece5745-sec-pymtl-cl/blob/master/README.md)\n   ([github](https://github.com/cornell-ece5745/ece5745-sec-pymtl-cl))\n - [PyMTL/HLS Tutorial](https://github.com/cornell-brg/pymtl-tut-hls/blob/master/README.md)\n   ([github](https://github.com/cornell-brg/pymtl-tut-hls))\n - [PyMTL-Based ASIC Toolflow Tutorial](http://www.csl.cornell.edu/courses/ece5745/handouts/ece5745-tut-asic-new.pdf)\n\nLicense\n--------------------------------------------------------------------------\n\nPyMTL is offered under the terms of the Open Source Initiative BSD\n3-Clause License. More information about this license can be found here:\n\n - http://choosealicense.com/licenses/bsd-3-clause\n - http://opensource.org/licenses/BSD-3-Clause\n\nPublications\n--------------------------------------------------------------------------\n\nIf you use PyMTL in your research, please cite our [MICRO'14 paper][3]:\n\n```\n  @inproceedings{lockhart-pymtl-micro2014,\n    title     = {PyMTL: A Unified Framework for Vertically Integrated\n                 Computer Architecture Research},\n    author    = {Derek Lockhart and Gary Zibrat and Christopher Batten},\n    booktitle = {47th IEEE/ACM Int'l Symp. on Microarchitecture (MICRO)},\n    month     = {Dec},\n    year      = {2014},\n    pages     = {280--292},\n    doi       = {10.1109/MICRO.2014.50},\n  }\n```\n\n [3]: http://dx.doi.org/10.1109/MICRO.2014.50\n\nInstallation\n--------------------------------------------------------------------------\n\nPyMTL requires Python2.7 and has the following additional prerequisites:\n\n - verilator, pkg-config\n - git, Python headers, and libffi\n - virtualenv\n\nThe steps for installing these prerequisites and PyMTL on a fresh Ubuntu\ndistribution are shown below. They have been tested with Ubuntu Trusty\n14.04.\n\n### Install Verilator\n\n[Verilator][4] is an open-source toolchain for compiling Verilog RTL\nmodels into C++ simulators. PyMTL uses Verilator for both Verilog\ntranslation and Verilog import. You can install Verilator using the\nstandard package manager but the version available in the package\nrepositories is several years old. This means you will need to build and\ninstall Verilator from source using the following commands:\n\n```\n % sudo apt-get install git make autoconf g++ libfl-dev bison\n % mkdir -p ${HOME}/src\n % cd ${HOME}/src\n % wget http://www.veripool.org/ftp/verilator-4.008.tgz\n % tar -xzvf verilator-4.008.tgz\n % cd verilator-4.008\n % ./configure\n % make\n % sudo make install\n```\n\nVerify that Verilator is on your path as follows:\n\n```\n % cd $HOME\n % which verilator\n % verilator --version\n```\n\nPyMTL uses `pkg-config` to find the Verilator source files when\nperforming both Verilog translation and Verilog import. Install\n`pkg-config` and verify that it is setup correctly as follows:\n\n```\n % sudo apt-get install pkg-config\n % pkg-config --print-variables verilator\n```\n\nIf `pkg-config` cannot find information about verilator, then you can\nalso explicitly set the following special environment variable:\n\n```\n % export PYMTL_VERILATOR_INCLUDE_DIR=\"/usr/local/share/verilator/include\"\n```\n\n [4]: http://www.veripool.org/wiki/verilator\n\n### Install git, Python headers, and libffi\n\nWe need to install the Python headers and libffi in order to be able to\ninstall the cffi Python package. cffi provides an elegant way to call C\nfunctions from Python, and PyMTL uses cffi to call C code generated by\nVerilator. We will use git to grab the PyMTL source. The following\ncommands will install the appropriate packages:\n\n```\n % sudo apt-get install git python-dev libffi-dev\n```\n\n### Install virtualenv\n\nWhile not strictly necessary, we strongly recommend using [virtualenv][5]\nto install PyMTL and the Python packages that PyMTL depends on.\nvirtualenv enables creating isolated Python environments. The following\ncommands will install virtualenv:\n\n```\n % sudo apt-get install python-virtualenv\n```\n\nNow we can use the `virtualenv` command to create a new virtual\nenvironment for PyMTL, and then we can use the corresponding `activate`\nscript to activate the new virtual environment:\n\n```\n % mkdir ${HOME}/venvs\n % virtualenv --python=python2.7 ${HOME}/venvs/pymtl\n % source ${HOME}/venvs/pymtl/bin/activate\n```\n\n [5]: https://virtualenv.pypa.io/en/latest/\n\n### Install PyMTL\n\nWe can now use git to clone the PyMTL repo, and pip to install PyMTL and\nits dependencies. Note that we use pip in editable mode so that we can\nactively work in the PyMTL git repo.\n\n```\n % mkdir -p ${HOME}/vc/git-hub/cornell-brg\n % cd ${HOME}/vc/git-hub/cornell-brg\n % git clone https://github.com/cornell-brg/pymtl.git\n % pip install --editable ./pymtl\n % pip install --upgrade pytest\n```\n\nTesting\n--------------------------------------------------------------------------\n\nBefore running any tests, we first create a build directory inside the\nPyMTL repo to hold any temporary files generated during simulation:\n\n```\n % mkdir -p ${HOME}/vc/git-hub/cornell-brg/pymtl/build\n % cd ${HOME}/vc/git-hub/cornell-brg/pymtl/build\n```\n\nAll Python simulation tests can be easily run using py.test (warning:\nthere are a lot of tests!):\n\n```\n % py.test ..\n```\n\nThe Verilog simulation tests are only executed if the `--test-verilog`\nflag is provided. For Verilog testing to work, PyMTL requires that\nVerilator is on your `PATH` and that the `PYMTL_VERILATOR_INCLUDE_DIR`\nenvironment:\n\n```\n % py.test .. --test-verilog\n```\n\nWhen you're done testing/developing, you can deactivate the virtualenv::\n\n```\n % deactivate\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcornell-brg%2Fpymtl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcornell-brg%2Fpymtl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcornell-brg%2Fpymtl/lists"}