{"id":21895837,"url":"https://github.com/donn/phi","last_synced_at":"2026-03-13T18:42:40.016Z","repository":{"id":92186342,"uuid":"141160332","full_name":"donn/Phi","owner":"donn","description":"Hardware description language that tries not to suck","archived":false,"fork":false,"pushed_at":"2022-10-29T05:31:18.000Z","size":903,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T22:23:51.357Z","etag":null,"topics":["compilers","eda","fpga","hdl","phi","systemverilog","verilog"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/donn.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,"governance":null,"roadmap":null,"authors":"Authors","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-16T15:48:33.000Z","updated_at":"2024-08-22T19:49:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"4a61811e-b2e3-41fe-b8cb-063abf1995bc","html_url":"https://github.com/donn/Phi","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donn%2FPhi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donn%2FPhi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donn%2FPhi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donn%2FPhi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donn","download_url":"https://codeload.github.com/donn/Phi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249109271,"owners_count":21214115,"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":["compilers","eda","fpga","hdl","phi","systemverilog","verilog"],"created_at":"2024-11-28T13:40:49.286Z","updated_at":"2026-03-13T18:42:34.972Z","avatar_url":"https://github.com/donn.png","language":"C++","readme":"# Φ Phi (Alpha)\n![macOS CI](https://github.com/donn/Phi/actions/workflows/mac.yml/badge.svg)\n![Linux CI](https://github.com/donn/Phi/actions/workflows/linux.yml/badge.svg)\n\nPhi is a pure-ish RTL hardware description language based on Verilog that aims to be safer and more explicit. It was my undergrad thesis project.\n\nPhi aims to have:\n* No behavioral ambiguity\n* A clear definition and meta-definition divide\n\nSyntactically, it takes a lot from C/C++/Swift. Semantically, it takes the best parts of Verilog.\n\nPhi supports Linux, macOS, and Windows with MSYS2.\n\n# Examples\n## Counter\n```phi\nmodule Counter(\n    clock: Input,\n    reset: Input,\n    enable: Input,\n    output: Output[31..0]\n) {\n    Register[31..0] counter = 32b0\n    counter.clock = clock\n    counter.reset = reset\n    counter.data = counter \u0026+ 32b1\n    counter.enable = enable\n\n    output = counter\n}\n```\n\n# Dependencies\n## Running\n* A reasonably recent libstdc++.\n\n## Building\n* A POSIX environment\n* A C++17 compiler that supports **standard** C++17\n    * No GCC or Clang specific extensions are used. Any used by accident are a bug we are interested in fixing.\n    * We still recommend Clang + LLDB for debugging.\n* Git (for submodules)\n* GNU Make 3.8.1+\n* GNU Bison 3.0.4+\n* LLVM 14.0+\n* Ruby 2.3+\n* zlib\n\n### macOS\nInstall Xcode 9.0 or higher from the App Store.\n\nFor the other dependencies, we recommend [Homebrew](https://brew.sh). Install it using the command in the link provided, then invoke:\n\n```bash\n    brew install ruby bison llvm\n```\n\nThis will take some time, llvm is big.\n\nYou will need to add bison to PATH, as brew won't. Do this however you want: a suggestion is to add this to your shell's profile:\n```sh\nexport BISON=\"/usr/local/opt/bison/bin/bison\"\n```\n\nYou will also need to expose LLVM Config to the compiler, as brew *also* won't. Again, it is suggested to add this to your shell's profile:\n```sh\nexport LLVM_CONFIG=\"/usr/local/opt/llvm/bin/llvm-config\"\n```\n\n(For the default shells, that's `~/.bash_profile` on Mojave and below, and `~/.zprofile` on Catalina and above.)\n\n### GNU/Linux\nInstall git, gcc, make and bison using your package manager.\n\nIf you have Clang and you want to use it, you can export and set the `CC` and `CXX` environment variables to `clang` and `clang++` respectively.\n\n#### Debian-based OSes (incl. Ubuntu, elementary...)\nPhi has been tested and is working on Ubuntu 18.04, 19.04 and their derivatives.\n\nUsing apt...\n\n```sh\n    sudo apt-get install -y build-essential git make llvm-11-dev zlib1g-dev bison ruby\n```\n\nIf you're into clang...\n\n```sh\n    sudo apt-get install clang lldb\n```\n\nDo note you'll need to expose LLVM Config to the compiler- it is suggested to add this to your shell's profile.\n```sh\nexport LLVM_CONFIG=\"llvm-config-11\"\n```\n\n### Windows with MSYS2\nFirst, get [MSYS2-x86_64](https://www.msys2.org/) if you haven't already.\n\n```sh\npacman -S git make mingw-w64-x86_64-gcc bison mingw-w64-x86_64-llvm ruby\n```\n\nYou can still also use Clang and lldb if you're into that:\n\n```sh\npacman -S mingw-w64-x86_64-clang lldb\n```\n\nWe are interested in supporting Visual Studio in the future.\n\n# Build Instructions\nRun `git submodule update --init --recursive --depth 1`.\n\nWe use open source libraries for various functions, and they're all imported using git submodules.\n\nYou can then invoke either `make` or `make release`. The former produces a debug binary, which is slower but packs more features. It is more suitable for doing dev work on the actual compiler. If you intend on using the Phi compiler itself, we recommend `make release`.\n\n# Usage Instructions\n`./phic` can be used to invoke Phi. It's a plain binary. You can write `./phi --help` for more information, but the short story is, to invoke it write `./phi \u003cphi source file\u003e`. Currently just the one is supported. If there are no errors returned, it creates a file with the same name as the filename given with \".sv\" appended.\n\n# ⚖️ Copyright \u0026 Licensing\n©2019-2021 The Phi Authors. Phi is available under the Apache 2.0 license, available at the root of this project as 'License'.\n\nPhi was partially developed as part of senior project coursework at the American University in Cairo.\n\n# Special Thanks\n* [Prof. Shalan](https://github.com/shalan) for consistent input and encouragement.\n* [Genivia/RE-flex](https://github.com/Genivia/RE-flex), our primary dependency, for not breaking the API and the CLI every three seconds like some libraries do.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonn%2Fphi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonn%2Fphi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonn%2Fphi/lists"}