├── .github └── workflows │ └── release.yml ├── .gitignore ├── CONTRIBUTING.md ├── Cargo.toml ├── LICENSE.md ├── README.md ├── install.sh ├── installer.iss └── src ├── cmd ├── cmd.rs ├── config.rs ├── docs.rs ├── dotf.rs ├── include.rs ├── install.rs ├── list.rs ├── load.rs ├── mod.rs ├── remove.rs ├── run.rs ├── sim.rs ├── synth.rs ├── update.rs └── upgrade.rs ├── config_man.rs ├── error.rs ├── main.rs └── toml.rs /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | on: 3 | push: 4 | workflow_dispatch: 5 | env: 6 | CARGO_INCREMENTAL: 0 7 | permissions: 8 | contents: write 9 | jobs: 10 | release: 11 | name: ${{ matrix.target }} 12 | runs-on: ${{ matrix.os }} 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | include: 17 | - os: ubuntu-latest 18 | target: x86_64-unknown-linux-musl 19 | deb: true 20 | - os: ubuntu-latest 21 | target: arm-unknown-linux-musleabihf 22 | - os: ubuntu-latest 23 | target: armv7-unknown-linux-musleabihf 24 | deb: true 25 | - os: ubuntu-latest 26 | target: aarch64-unknown-linux-musl 27 | deb: true 28 | - os: ubuntu-latest 29 | target: i686-unknown-linux-musl 30 | deb: true 31 | - os: ubuntu-latest 32 | target: aarch64-linux-android 33 | - os: macos-latest 34 | target: x86_64-apple-darwin 35 | - os: macos-latest 36 | target: aarch64-apple-darwin 37 | - os: windows-latest 38 | target: x86_64-pc-windows-msvc 39 | - os: windows-latest 40 | target: i686-pc-windows-msvc 41 | - os: windows-latest 42 | target: aarch64-pc-windows-msvc 43 | steps: 44 | - name: Checkout repository 45 | uses: actions/checkout@v4 46 | with: 47 | fetch-depth: 0 48 | 49 | - name: Get version 50 | id: get_version 51 | uses: SebRollen/toml-action@v1.2.0 52 | with: 53 | file: Cargo.toml 54 | field: package.version 55 | 56 | - name: Install Rust 57 | uses: actions-rs/toolchain@v1 58 | with: 59 | toolchain: stable 60 | profile: minimal 61 | override: true 62 | target: ${{ matrix.target }} 63 | 64 | - name: Setup cache 65 | uses: Swatinem/rust-cache@v2.7.3 66 | with: 67 | key: ${{ matrix.target }} 68 | 69 | - name: Install cross 70 | if: ${{ runner.os == 'Linux' }} 71 | uses: actions-rs/cargo@v1 72 | with: 73 | command: install 74 | args: --color=always --git=https://github.com/cross-rs/cross.git --locked --rev=02bf930e0cb0c6f1beffece0788f3932ecb2c7eb --verbose cross 75 | 76 | - name: Build binary 77 | uses: actions-rs/cargo@v1 78 | env: 79 | POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} 80 | DOCS_KEY: ${{ secrets.DOCS_KEY }} 81 | with: 82 | command: build 83 | args: --release --target=${{ matrix.target }} --color=always --verbose 84 | use-cross: ${{ runner.os == 'Linux' }} 85 | 86 | - name: Install cargo-deb 87 | if: ${{ matrix.deb == true }} 88 | uses: actions-rs/install@v0.1 89 | with: 90 | crate: cargo-deb 91 | 92 | - name: Build deb 93 | if: ${{ matrix.deb == true }} 94 | uses: actions-rs/cargo@v1 95 | with: 96 | command: deb 97 | args: --no-build --no-strip --output=. --target=${{ matrix.target }} 98 | 99 | - name: Package (*nix) 100 | if: ${{ runner.os != 'Windows' }} 101 | run: | 102 | tar -cv LICENSE README.md \ 103 | -C target/${{ matrix.target }}/release/ vpm | 104 | gzip --best > \ 105 | vpm-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.tar.gz 106 | 107 | - name: Create variable files 108 | if: ${{ runner.os == 'Windows' }} 109 | run: | 110 | echo "${{ steps.get_version.outputs.value }}" > version.txt 111 | echo "${{ matrix.target }}" >> target.txt 112 | 113 | - name: Package (Windows) 114 | if: ${{ runner.os == 'Windows' }} 115 | uses: Minionguyjpro/Inno-Setup-Action@v1.2.4 116 | with: 117 | path: installer.iss 118 | options: /O+ 119 | 120 | - name: Upload artifact 121 | uses: actions/upload-artifact@v4 122 | with: 123 | name: ${{ matrix.target }} 124 | path: | 125 | *.deb 126 | *.tar.gz 127 | *.zip 128 | *.exe 129 | 130 | - name: Create release 131 | if: | 132 | github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'chore(release)') 133 | uses: softprops/action-gh-release@v2 134 | with: 135 | draft: true 136 | files: | 137 | *.deb 138 | *.tar.gz 139 | *.zip 140 | *.exe 141 | name: ${{ steps.get_version.outputs.value }} 142 | tag_name: '' 143 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | target/ 5 | 6 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 7 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 8 | Cargo.lock 9 | 10 | # These are backup files generated by rustfmt 11 | **/*.rs.bk 12 | 13 | # MSVC Windows builds of rustc generate these, which store debugging information 14 | *.pdb 15 | 16 | # RustRover 17 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 18 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 19 | # and can be added to the global gitignore or merged into this file. For a more nuclear 20 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 21 | #.idea/ 22 | 23 | vpm_modules/ 24 | Vpm.toml 25 | vpm.toml 26 | vpm.lock 27 | .svlangserver/ 28 | .env 29 | 30 | .DS_Store 31 | .vscode/launch.json 32 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | First off, thank you for considering contributing to the Verilog Package Manager (VPM). It's people like you that make VPM such a great tool. 4 | 5 | Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests. 6 | 7 | ## Getting started 8 | Anybody is welcome to contribute—we encourage anybody who is interested in this project to join the VPM discord. We'll discuss upcoming changes, user suggesions, and roadmaps. 9 | 10 | _For something that is bigger than a one or two line fix:_ 11 | 1. Create your own fork of the code 12 | 2. Do the changes in your fork (be sure to follow the code style of the project) 13 | 3. If you like the change and think the project could use it, send a pull request indicating that you have a CLA on file (for these larger fixes, try to include an update on the discord as well) 14 | 15 | _For small or "obvious" fixes..._ 16 | * Small contributions such as fixing spelling errors, where the content is small enough to not be considered intellectual property, can be submitted by a contributor as a patch 17 | 18 | **As a rule of thumb, changes are obvious fixes if they do not introduce any new functionality or creative thinking.** As long as the change does not affect functionality, some likely examples include the following: 19 | - Spelling / grammar fixes 20 | - Typo correction, white space and formatting changes 21 | - Comment clean up 22 | - Bug fixes that change default return values or error codes stored in constants 23 | - Adding logging messages or debugging output 24 | - Changes to ‘metadata’ files like Gemfile, .gitignore, build scripts, etc. 25 | - Moving source files from one directory or package to another 26 | 27 | ## How to report a bug 28 | **Security Disclosure** 29 | If you find a security vulnerability, do **NOT** open an issue. Email jag.maddipatla@gmail.com or sathvik.redrouthu@gmail.com instead. Any security issues should be submitted here directly. 30 | In order to determine whether you are dealing with a security issue, ask yourself these two questions: 31 | * Can I access something that's not mine, or something I shouldn't have access to? 32 | * Can I disable something for other people? 33 | If the answer to either of those two questions are "yes", then you're probably dealing with a security issue. Note that even if you answer "no" to both questions, you may still be dealing with a security issue, so if you're unsure, just email us. 34 | 35 | ## Code review process 36 | Once you submit a contribution, it will be signed off by either @Jag-M or @sathvikr prior to being implemented. Interested contributors should join our discord to get commit access. 37 | We also hold weekly triage meetings in a public google meet that all contributors/interested persons may join. Any community feedback will be implemented as soon as possible (usually within a couple of hours). 38 | 39 | ## Philosophy 40 | Our philosophy is to provide robust tooling to make chip design as intuitive as possible. 41 | 42 | If you find yourself wishing for a feature that doesn't exist in VPM, you are probably not alone. There are bound to be others out there with similar needs. Many of the features that VPM has today have been added because our users saw the need. Open an issue on our issues list on GitHub which describes the feature you would like to see, why you need it, and how it should work. 43 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | description = "A powerful package manager for Verilog projects, streamlining IP core management and accelerating hardware design workflows" 3 | documentation = "https://github.com/getinstachip/vpm#readme" 4 | homepage = "https://getinstachip.com" 5 | repository = "https://github.com/getinstachip/vpm" 6 | name = "vpm" 7 | version = "0.2.18" 8 | edition = "2021" 9 | license = "MIT" 10 | copyright = "Copyright (c) 2024 Instachip" 11 | authors = ["Instachip "] 12 | 13 | [dependencies] 14 | clap = { version = "4.5.13", features = ["derive"] } 15 | tokio = { version = "1.39.2", features = ["full"] } 16 | openssl = { version = "0.10", features = ["vendored"] } 17 | reqwest = { version = "0.12.5", features = ["json", "blocking"] } 18 | serde = { version = "1.0.208", features = ["derive"] } 19 | tree-sitter-verilog = { git = "https://github.com/tree-sitter/tree-sitter-verilog" } 20 | tree-sitter = "0.20.6" 21 | anyhow = "1.0.86" 22 | serde_json = "1.0.125" 23 | walkdir = "2.5.0" 24 | once_cell = "1.19.0" 25 | tempfile = "3.12.0" 26 | cargo-lock = "9.0.0" 27 | fastrand = "2.1.1" 28 | fancy-regex = "0.13.0" 29 | dialoguer = "0.11.0" 30 | fuzzy-matcher = "0.3.7" 31 | indicatif = "0.17.8" 32 | which = "6.0.3" 33 | regex = "1.10.6" 34 | toml_edit = "0.22.20" 35 | imara-diff = "0.1.7" 36 | uuid = { version = "1.10.0", features = ["v7"] } 37 | directories = "5.0.1" 38 | ring = "0.17.8" 39 | base64 = "0.22.1" 40 | hex = "0.4.3" 41 | rand = "0.8.5" 42 | sha2 = "0.10.8" 43 | sys-info = "0.9.1" 44 | 45 | [build-dependencies] 46 | cc="*" 47 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2024 Instachip 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Verilog Package Manager (VPM) 2 | 3 | VPM is a powerful package manager for Verilog projects, currently being piloted at Stanford and UC Berkeley. It's designed to streamline the management, reuse, and communication of IP cores and dependencies in hardware design workflows, significantly accelerating your design process. 4 | 5 | ## Features 6 | 7 | - **Module Management**: Easily include, update, and remove modules in your project. 8 | - **Documentation Generation**: Automatically create comprehensive documentation for your Verilog modules. 9 | - **Dependency Handling**: Manage project dependencies with ease. 10 | - **Simulation Support**: Simulate your Verilog files directly through VPM. 11 | - **Tool Integration**: Seamlessly install and set up open-source tools for your project. 12 | - **File Generation**: Automatically generate necessary files like .f, .svh, .xcd, and .tcl. 13 | 14 | ## Installation 15 | 16 | VPM is designed for easy installation with no additional dependencies. 17 | 18 | ### Default Installation (Linux/MacOS): 19 | ```bash 20 | curl -f https://getinstachip.com/install.sh | sh 21 | ``` 22 | 23 | ### Default Installation (Windows): 24 | 1. Download the `.zip` file matching your Windows architecture from the [latest release page](https://github.com/getinstachip/vpm/releases/latest) 25 | 2. Extract and run the `.exe` file 26 | 27 | If installation doesn't work, try the following: 28 | 29 | ### Linux alternative: 30 | We support Snap 31 | 32 | ```bash 33 | snap download instachip-vpm 34 | alias vpm='instachip-vpm.vpm' 35 | ``` 36 | 37 | ### MacOS alternative: 38 | ```bash 39 | brew tap getinstachip/vpm 40 | brew install vpm 41 | ``` 42 | 43 | After installation, the vpm command will be available in any terminal. 44 | 45 | ## Commands 46 | 47 | - `vpm include `: Include any module from a repo (and all its submodules). 48 | - `vpm docs `: Generate documentation for any module (highlighting bugs and edge cases) 49 | - `vpm install `: Auto-integrate an open-source tool without manual setup 50 | - `vpm update `: Update module to the latest version 51 | - `vpm remove `: Remove a module from your project 52 | - `vpm list`: List all modules in our standard library 53 | - `vpm dotf `: Generate a `.f` filelist when exporting your project 54 | - `vpm sim `: Simulate Verilog module using iVerilog 55 | 56 | ### vpm include 57 | Include a module or repository in your project. 58 | 59 | This command: 60 | - Downloads the specified module or repository 61 | - Analyzes the module hierarchy 62 | - Includes all necessary submodules and generates appropriate header files 63 | - Updates the vpm.toml file with new module details 64 | 65 | This command comes in two forms: 66 | 1. Include a module and all its submodules: 67 | ```bash 68 | vpm include 69 | ``` 70 | `URL_TO_TOP_MODULE`: Full GitHub URL to the top module to include. The URL should come in the format of `https://github.com///blob/branch/`. 71 | 72 | Example: 73 | ```bash 74 | vpm include https://github.com/ZipCPU/zipcpu/blob/master/rtl/core/prefetch.v 75 | ``` 76 | 77 | ![](https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExY3Jmbmw0NWlva3F2bHdyY2h0NGZwNGlvNXRjZTY2bXB4ODRzOXd6eiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/KwHCr2ifmIZzSkpfjv/giphy.gif) 78 | 79 | 2. Include a repository: 80 | ```bash 81 | vpm include --repo 82 | ``` 83 | 84 | Press tab to select multiple modules and press ENTER to install. If no modules are selected, all modules in the repository will be installed. 85 | 86 | Example: 87 | ```bash 88 | vpm include --repo ZipCPU/zipcpu 89 | ``` 90 | ![](https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExMG5uaHJ1N2twd2JiY2pucjlwbjNjNm02NjRycDlocDF5bnB2eHNvYiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/QJ2sIDYIftEgu5uNAg/giphy.gif) 91 | ### vpm docs 92 | Generate comprehensive documentation for a module. 93 | 94 | This command generates a Markdown README file containing: 95 | - Overview and module description 96 | - Pinout diagram 97 | - Table of ports 98 | - Table of parameters 99 | - Important implementation details 100 | - Simulation output and GTKWave waveform details (Coming soon!) 101 | - List of any major bugs or caveats if they exist 102 | 103 | ```bash 104 | vpm docs 105 | ``` 106 | 107 | ``: Name of the module to generate documentation for. Include the file extension. 108 | 109 | `[URL]`: Optional URL of the repository to generate documentation for. If not specified, VPM will assume the module is local, and will search for the module in the vpm_modules directory. 110 | 111 | Examples: 112 | ```bash 113 | vpm docs pfcache.v 114 | vpm docs pfcache.v https://github.com/ZipCPU/zipcpu 115 | ``` 116 | ![](https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExOXc5NWpmYnV5eGxtYzRud2tid3poYTZyYXEwdmpqaGF3MjZwdW5leiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/C8nFHwNq0qBpXRF9pP/giphy.gif) 117 | 118 | ### vpm update 119 | Update a package to the latest version. 120 | 121 | This command: 122 | - Checks for the latest version of the specified module 123 | - Downloads and replaces the current version with the latest 124 | - Updates all dependencies and submodules 125 | - Modifies the vpm.toml file to reflect the changes 126 | 127 | ```bash 128 | vpm update 129 | ``` 130 | 131 | ``: Full module path of the package to update 132 | 133 | Example: 134 | ```bash 135 | vpm update my_project/modules/counter 136 | ``` 137 | 138 | ### vpm remove 139 | Remove a package from your project. 140 | 141 | This command: 142 | - Removes the specified module from your project 143 | - Updates the vpm.toml file to remove the module entry 144 | - Cleans up any orphaned dependencies 145 | 146 | ```bash 147 | vpm remove 148 | ``` 149 | 150 | ``: Full module path of the package to remove 151 | 152 | Example: 153 | ```bash 154 | vpm remove my_project/modules/unused_module 155 | ``` 156 | 157 | ### vpm dotf 158 | Generate a .f file list for a Verilog or SystemVerilog module. 159 | 160 | ```bash 161 | vpm dotf 162 | ``` 163 | 164 | ``: Path to the top module to generate the file list for. File should be local. 165 | 166 | Example: 167 | ```bash 168 | vpm dotf ./vpm_modules/pfcache/fwb_master.v 169 | ``` 170 | ![](https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExMHhkdjQ1bnl0cTA3cW1lOHVuNjkxaW1ydzFndXNnaDZlMHFiMWRpNSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/mafBT4PURloV52oLFP/giphy.gif) 171 | 172 | This command: 173 | - Analyzes the specified top module 174 | - Identifies all submodules and dependencies 175 | - Generates a .f file containing all necessary file paths 176 | - Includes all locally scoped defines for submodules 177 | 178 | ### vpm install 179 | Install and set up an open-source tool for integration into your project. 180 | 181 | This command: 182 | - Downloads the specified tool 183 | - Configures the tool for your system 184 | - Integrates it with your VPM project setup 185 | 186 | ```bash 187 | vpm install 188 | ``` 189 | ``: Name of the tool to install 190 | 191 | Example: 192 | ```bash 193 | vpm install verilator 194 | ``` 195 | ![](https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExNjFhc2t1ZTBwM29xdm10dThubWN3ZGhvOWhjeXJjNnQ0dWVqd2szdSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/737P65RSHVlu2dxXVu/giphy.gif) 196 | 197 | Currently supported tools: 198 | - Verilator 199 | - Chipyard 200 | - OpenROAD 201 | - Edalize 202 | - Icarus Verilog 203 | 204 | Coming soon: 205 | - Yosys (with support for ABC) 206 | - RISC-V GNU Toolchain 207 | 208 | ### vpm sim 209 | Simulate Verilog files. 210 | 211 | This command: 212 | - Compiles the specified Verilog files 213 | - Runs the simulation 214 | - Provides output and analysis of the simulation results 215 | 216 | ```bash 217 | vpm sim ... 218 | ``` 219 | ``: List of Verilog files to simulate using Icarus Verilog. 220 | 221 | Example: 222 | ```bash 223 | vpm sim testbench.v module1.v module2.v 224 | ``` 225 | ![](https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExcnhiaDNwZmRhazVlODAxanlqaW1yaXdpazVmNTVwanJ4c2V3a3RscSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/6ImXOh4OVsjrWYrikf/giphy.gif) 226 | 227 | ### vpm list 228 | List all modules in VPM's standard library. 229 | 230 | This command displays all available modules in the standard Verilog library, including: 231 | - Common modules 232 | - RISC-V modules 233 | 234 | ```bash 235 | vpm list 236 | ``` 237 | 238 | ### vpm config 239 | Configure VPM settings. 240 | 241 | This command allows you to enable or disable anonymous usage data collection. 242 | 243 | ```bash 244 | vpm config