{"id":13773363,"url":"https://github.com/google/xls","last_synced_at":"2026-03-07T09:24:18.242Z","repository":{"id":37081198,"uuid":"262163993","full_name":"google/xls","owner":"google","description":"XLS: Accelerated HW Synthesis","archived":false,"fork":false,"pushed_at":"2025-05-12T17:53:15.000Z","size":66008,"stargazers_count":1288,"open_issues_count":861,"forks_count":191,"subscribers_count":67,"default_branch":"main","last_synced_at":"2025-05-12T18:33:03.105Z","etag":null,"topics":["compiler","high-level-synthesis","hls","mid-level-synthesis","open-source","pipeline","verilog"],"latest_commit_sha":null,"homepage":"http://google.github.io/xls/","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/google.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-05-07T21:38:30.000Z","updated_at":"2025-05-12T17:22:36.000Z","dependencies_parsed_at":"2023-10-13T05:56:04.984Z","dependency_job_id":"9d573cee-3a18-43e7-8873-44cccabf800b","html_url":"https://github.com/google/xls","commit_stats":{"total_commits":4285,"total_committers":90,"mean_commits":"47.611111111111114","dds":0.7890315052508752,"last_synced_commit":"ce8714acefa93787fa3715a432e2d4df4afb3e65"},"previous_names":[],"tags_count":261,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fxls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fxls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fxls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fxls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/xls/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254129489,"owners_count":22019628,"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":["compiler","high-level-synthesis","hls","mid-level-synthesis","open-source","pipeline","verilog"],"created_at":"2024-08-03T17:01:14.812Z","updated_at":"2025-12-24T09:41:39.622Z","avatar_url":"https://github.com/google.png","language":"C++","funding_links":[],"categories":["Circuit Compilers","C++"],"sub_categories":[],"readme":"\u003cdiv align='center'\u003e\n\u003cimg src='https://google.github.io/xls/images/xls_logo.svg' alt='XLS Logo'\u003e\n\u003c/div\u003e\n\n# **XLS**: Accelerated HW Synthesis\n\n[**Docs**](https://google.github.io/xls/) | [**Quick Start**](https://google.github.io/xls/tools_quick_start/) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://bit.ly/learn-xls) | [**Tutorials**](https://google.github.io/xls/tutorials/)\n\n[**Conda packages**](https://anaconda.org/litex-hub/xls) [![Anaconda-Server Badge](https://anaconda.org/litex-hub/xls/badges/latest_release_date.svg)](https://anaconda.org/litex-hub/xls) [![Anaconda-Server Badge](https://anaconda.org/litex-hub/xls/badges/platforms.svg)](https://anaconda.org/litex-hub/xls)\n\n[![Ubuntu 22.04 CI](https://github.com/google/xls/workflows/Continuous%20Integration/badge.svg)](https://github.com/google/xls/actions/workflows/continuous-integration.yml) [![Ubuntu 22.04 Nightly](https://github.com/google/xls/workflows/Nightly%20Ubuntu%2022.04/badge.svg)](https://github.com/google/xls/actions/workflows/nightly-ubuntu-22.04.yml)\n\n## What is XLS?\n\nXLS implements a High Level Synthesis toolchain that produces synthesizable\ndesigns (Verilog and SystemVerilog) from flexible, high-level descriptions of\nfunctionality. It is Apache 2 licensed.\n\nXLS (Accelerated HW Synthesis) aims to be the Software Development Kit (SDK) for\nthe End of Moore's Law (EoML) era. In this \"age of specialization\", software and\nhardware engineers must do more co-design across their domain boundaries --\ncollaborate on shared artifacts, understand each other's cost models, and share\ntooling/methodology. XLS attempts to leverage automation, software engineers,\nand machine cycles to accelerate this overall process.\n\nXLS enables the rapid development of *hardware IP* that also runs as efficient\n*host software* via \"software style\" methodology. An XLS design runs at native\nspeeds for use in host software or a simulator, but that design can also\ngenerate hardware block output -- the XLS tools' correctness ensures (and\nprovides tools to help formally verify) that they are functionally identical.\n\nXLS supports both (optionally pipelined) functions with pure-wire I/O interfaces\nand\n[*concurrent processes*](https://google.github.io/xls/tutorials/what_is_a_proc/)\n(or `proc`s). Procs are stateful, allowing induction over time, and include more\ngeneral communication interfaces.\n\n## State of the Project\n\nXLS is experimental, undergoing rapid development, and not an officially\nsupported Google product. Expect bugs and sharp edges. Please help by trying it\nout, running through [some tutorials](https://google.github.io/xls/tutorials/),\n[reporting bugs](https://github.com/google/xls/issues).\n\nWe are early stage and this has some practical effects:\n\n-   We welcome your issues and PRs.\n    -   Please try to lead with an issue. Engage us in conversation if you wish\n        to upstream changes. Sending a PR without back and forth with us in an\n        issue may be a longer road to success. If you believe your PR is ready\n        and has not received a response within two business days, please ping\n        the issue with what you think are next steps.\n-   At the current point in its evolution, we regularly improve DSLX without\n    considering backward compatibility.\n    -   If you are building a corpus of hardware with XLS, please be thoughtful\n        about your process for bringing in new versions of the compiler.\n\n## Colab Notebooks\n\nFor a more setup-free and environment-independent way of trying out XLS, see our\ncolab notebooks:\n\n-   [bit.ly/learn-xls](https://bit.ly/learn-xls): a \"learn XLS in Y minutes\"\n    style walkthrough in DSLX, our Rust-inspired domain specific language (DSL).\n\n-   [bit.ly/xls-playground](https://bit.ly/xls-playground): an XLS evaluation\n    environment that can run the following interactively:\n\n    -   XLS tests\n    -   XLS→IR conversion\n    -   IR→Verilog codegen\n    -   Verilog synthesis via Yosys (using open PDKs ASAP7 and SKY130)\n    -   Place-and-Route (P\u0026R) via OpenROAD\n    -   Power/Performance/Area (PPA) metric collection\n\n## Install Latest Release\n\nThe following downloads the latest github repo release binaries for an x64 Linux\nmachine:\n\n```bash\n# Determine the url of the latest release tarball.\nLATEST_XLS_RELEASE_TARBALL_URL=$(curl -s -L \\\n  -H \"Accept: application/vnd.github+json\" \\\n  -H \"X-GitHub-Api-Version: 2022-11-28\" \\\n  https://api.github.com/repos/google/xls/releases | \\\n  grep -m 1 -o 'https://.*/releases/download/.*\\.tar\\.gz')\n\n# Download the tarball and unpack it, observe the version numbers for each of the included tools.\ncurl -O -L ${LATEST_XLS_RELEASE_TARBALL_URL}\ntar -xzvvf xls-*.tar.gz\ncd xls-*/\n./interpreter_main --version\n./ir_converter_main --version\n./opt_main --version\n./codegen_main --version\n./proto_to_dslx_main --version\n```\n\n## Building From Source\n\nAside from the binary releases (available for x64 Linux as described above), and\nthe available colab notebooks, XLS must be built from source using the Bazel\nbuild system.\n\nThe following instructions are for the Ubuntu 22.04 (Jammy Jellyfish) Linux\ndistribution.\n\nOn an average 8-core VM:\n\n-   A full initial build **without the C++ front-end (e.g., \"DSLX only\") may take\n    about 2 hours**,\n-   **Including the C++ front-end may take up to 6 hours.**\n\nPlease see the two corresponding command lines below -- we start by assuming\n[Bazel has been installed](https://bazel.build/install/ubuntu):\n\n```console\n~$ git clone https://github.com/google/xls.git\n~$ cd xls\n\n~/xls$ # Follow the bazel install instructions to install bazel 7\n~/xls$ # https://bazel.build/install/ubuntu\n\n~/xls$ # Note we're going to tell Ubuntu that `/usr/bin/env python` is actually python3\n~/xls$ # here, since that has not been the case by default on past Ubuntus.\n~/xls$ # This is important. Without this step, you may experience cryptic error messages:\n~/xls$ sudo apt install python3-dev libtinfo6 python-is-python3\n\n~/xls$ # Now build/test in optimized build mode.\n~/xls$ # If you don't plan on using the C++ front-end, which is not strictly\n~/xls$ # needed (i.e. DSLX front-end only), use this command line:\n~/xls$ bazel test -c opt -- //xls/... -//xls/contrib/xlscc/...\n\n~/xls$ # To build everything, including the C++ front-end:\n~/xls$ bazel test -c opt -- //xls/...\n```\n\n### Docker Build\n\nReference build/test environment setups are also provided via `Dockerfile`s, if\nyou have difficulty setting up the (limited set of) dependencies shown above in\nyour environment:\n\n```console\n~$ git clone https://github.com/google/xls.git\n~$ cd xls\n~/xls$ # Build and run xls tests.\n~/xls$ docker build . -f Dockerfile-ubuntu-22.04\n~/xls$ # Setup the xls build environment and allow for manual testing/building\n~/xls$ docker build . -f Dockerfile-ubuntu-22.04 \\\n                      -t xls-build-docker        \\\n                      --build-arg SKIP_TESTS=1\n...\n~/xls$ docker run -it --rm xls-build-docker /bin/bash\n...\nxls-developer@de12154edf52:~/xls$ bazel build --verbose_failures -c opt //xls/jit:jit_channel_queue_test\n...\n```\n\n### Adding Additional Build Caching\n\nMany programmers are used to using programs like `ccache` to improve caching for\na build, but Bazel actually ships with very-high quality caching layers. In\nparticular, incremental builds are more safe.\n\nHowever, there are circumstances where Bazel might decide to recompile files\nwhere the results could have been cached locally - or where it might be safe to\nreuse certain intermediate results, even after a `bazel clean`. To improve this,\nyou can tell Bazel to use a shared \"disk cache\", storing files persistently\nelsewhere on disk; just create a directory somewhere (e.g.,\n`~/.bazel_disk_cache/`), and then run:\n\n```bash\necho \"build --disk_cache=$(realpath ~/.bazel_disk_cache)\" \u003e\u003e ~/.bazelrc\necho \"test --disk_cache=$(realpath ~/.bazel_disk_cache)\" \u003e\u003e ~/.bazelrc\n```\n\n!!! WARNING\n    Bazel does not automate garbage collection of this directory, so it\n    will grow over time without bounds. You will need to clean it up periodically,\n    either manually or with an automated script.\n\nAlternatively, you can add a [remote cache](https://bazel.build/remote/caching)\nthat takes care of garbage collection for you. This can be hosted on a personal\nserver or even on the local machine. We've personally had good results with\nlocalhost instances of [bazel-remote](https://github.com/buchgr/bazel-remote/).\n\n### Getting Clangd completions\n\nThere are two ways of getting clangd completions and related features.\n\nA `compile_flags.txt` file compatible with clangd and similar\ntools can be created by running `xls/dev_tools/make-compilation-db.sh`.\nThis approach is faster but does not account for differences in the way\nindividual targets are built.\n\nAlternatively,\n[hedronvision/bazel-compile-commands-extractor](https://github.com/hedronvision/bazel-compile-commands-extractor)\ncan be used to generate a `compile_commands.json` file that\nclangd can consume. This approach is slower to setup but the\ncompiler flags are tailored for each target. The\n`compile_commands.json` file can be built by running:\n\n```bash\nbazel build -c opt //xls/... -k\nbazel run //:refresh_compile_commands\n```\n\nSee the comments in the top-level\n[BUILD](https://github.com/google/xls/blob/main/BUILD) file for more details.\n\n## Stack Diagram and Project Layout\n\nNavigating a new code base can be daunting; the following description provides a\nhigh-level view of the important directories and their intended organization /\npurpose, and correspond to the components in this XLS stack diagram:\n\n\u003cdiv align='center'\u003e\n\u003cimg src='https://google.github.io/xls/images/xls_stack_diagram.png' alt='XLS Stack Diagram'\u003e\n\u003c/div\u003e\n\n-   [`dependency_support`](https://github.com/google/xls/tree/main/dependency_support):\n    Configuration files that load, build, and expose Bazel targets for\n    *external* dependencies of XLS.\n-   [`docs_src`](https://github.com/google/xls/tree/main/docs_src): Markdown\n    file sources, rendered to `docs` via\n    [mkdocs](https://google.github.io/xls/contributing/#rendering-documentation).\n-   [`xls`](https://github.com/google/xls/tree/main/xls): Project-named\n    subdirectory within the repository, in common Bazel-project style.\n    -   [`build`](https://github.com/google/xls/tree/main/xls/BUILD): Build\n        macros that create XLS artifacts; e.g., convert DSL to IR, create test\n        targets for DSL code, etc.\n    -   [`codegen`](https://github.com/google/xls/tree/main/xls/codegen):\n        Verilog AST (VAST) support to generate Verilog/SystemVerilog operations\n        and FSMs. VAST is built up by components we call *generators* (e.g.,\n        PipelineGenerator, SequentialGenerator for FSMs) in the translation from\n        XLS IR.\n    -   [`common`](https://github.com/google/xls/tree/main/xls/common): \"base\"\n        functionality that layers on top of standard library usage. Generally we\n        use [Abseil](https://abseil.io) versions of base constructs wherever\n        possible.\n    -   [`contrib/xlscc`](https://github.com/google/xls/tree/main/xls/contrib/xlscc):\n        Experimental C++ syntax support that targets XLS IR (alternative path to\n        DSLX) developed by a sister team at Google, sharing the same open source\n        / testing flow as the rest of the XLS project. May be of particular\n        interest for teams with existing C++ HLS code bases.\n    -   [`data_structures`](https://github.com/google/xls/tree/main/xls/data_structures):\n        Generic data structures used in XLS that augment standard libraries;\n        e.g., BDDs, union find, min cut, etc.\n    -   [`delay_model`](https://github.com/google/xls/tree/main/xls/estimators/delay_model):\n        Functionality to characterize, describe, and interpolate data delay for\n        XLS IR operations on a target backend process. Already-characterized\n        descriptions are placed in `xls/estimators/delay_model/models` and can\n        be referred to via command line flags.\n    -   [`dslx`](https://github.com/google/xls/tree/main/xls/dslx): A DSL\n        (called \"DSLX\") that mimics Rust, while being an immutable\n        expression-language dataflow DSL with hardware-oriented features; e.g.,\n        arbitrary bitwidths, entirely fixed size objects, fully analyzeable call\n        graph. XLS team has found dataflow DSLs are a good fit to describe\n        hardware as compared to languages designed assume von Neumann style\n        computation.\n    -   [`fuzzer`](https://github.com/google/xls/tree/main/xls/fuzzer): A\n        whole-stack multiprocess fuzzer that generates programs at the DSL level\n        and cross-compares different execution engines (DSL interpreter, IR\n        interpreter, IR JIT, code-generated-Verilog simulator). Designed so that\n        it can easily be run on different nodes in a cluster simultaneously and\n        accumulate shared findings.\n    -   [`examples`](https://github.com/google/xls/tree/main/xls/examples):\n        Example computations that are tested and executable through the XLS\n        stack.\n    -   [`experimental`](https://github.com/google/xls/tree/main/xls/experimental):\n        Artifacts captured from experimental explorations.\n    -   [`interpreter`](https://github.com/google/xls/tree/main/xls/interpreter):\n        Interpreter for XLS IR - useful for debugging and exploration. For cases\n        needing throughput, consider using the JIT (below).\n    -   [`ir`](https://github.com/google/xls/tree/main/xls/ir): XLS IR\n        definition, text parser/formatter, and facilities for abstract\n        evaluation.\n    -   [`jit`](https://github.com/google/xls/tree/main/xls/jit): LLVM-based JIT\n        for XLS IR. Enables native-speed execution of DSLX and XLS IR programs.\n    -   [`modules`](https://github.com/google/xls/tree/main/xls/modules):\n        Hardware building block DSLX \"libraries\" (outside the DSLX standard\n        library) that may be easily reused or instantiated in a broader design.\n    -   [`netlist`](https://github.com/google/xls/tree/main/xls/netlist):\n        Libraries that parse/analyze/interpret netlist-level descriptions, as\n        are generally given in simple structural Verilog with an associated cell\n        library.\n    -   [`passes`](https://github.com/google/xls/tree/main/xls/passes): Passes\n        that run on the XLS IR as part of optimization, before scheduling / code\n        generation.\n    -   [`scheduling`](https://github.com/google/xls/tree/main/xls/scheduling):\n        Scheduling algorithms, determine when operations execute (e.g., which\n        pipeline stage) in a clocked design.\n    -   [`simulation`](https://github.com/google/xls/tree/main/xls/simulation):\n        Code that wraps Verilog simulators and generates Verilog testbenches for\n        XLS computations. [iverilog](https://github.com/steveicarus/iverilog) is\n        currently used to simulate as it supports non-synthesizable testbench\n        constructs.\n    -   [`solvers`](https://github.com/google/xls/tree/main/xls/solvers):\n        Converters from XLS IR into SMT solver input, such that formal proofs\n        can be run on XLS computations; e.g., Logical Equalence Checks between\n        XLS IR and a netlist description. [Z3](https://github.com/Z3Prover/z3)\n        is used as the solver engine.\n    -   [`synthesis`](https://github.com/google/xls/tree/main/xls/synthesis):\n        Interface that wraps backend synthesis flows, such that tools can be\n        retargeted e.g., between ASIC and FPGA flows.\n    -   [`tests`](https://github.com/google/xls/tree/main/xls/tests):\n        Integration tests that span various top-level components of the XLS\n        project.\n    -   [`tools`](https://github.com/google/xls/tree/main/xls/tools):\n        [Many tools](https://google.github.io/xls/tools/) that work with the XLS\n        system and its libraries in a decomposed way via command line\n        interfaces.\n    -   [`visualization`](https://github.com/google/xls/tree/main/xls/visualization):\n        Visualization tools to inspect the XLS compiler/system interactively.\n        See [IR visualization](https://google.github.io/xls/ir_visualization/).\n\n## Community\n\nDiscussions about XLS - development, debugging, usage, etc.:\n\n-   Ideally happen in\n    [XLS repo GitHub discussions](https://github.com/google/xls/discussions)\n-   But, if you feel email is a better venue for the discussion, there is also\n    an [xls-dev mailing list](https://groups.google.com/g/xls-dev) -- please\n    prefer GitHub discussions if possible as they are searchable and can be\n    easily cross-referenced and converted to an issue in the issue tracker\n\n## Contributors\n\nThe following are\n[contributors](https://github.com/google/xls/graphs/contributors) to the XLS\nproject; see our\n[contributing documentation](https://google.github.io/xls/contributing/) and\n[good first issues](https://github.com/google/xls/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)\nif you're interested in contributing, or reach out via\n[GitHub discussions](https://github.com/google/xls/discussions)!\n\n-   [Aidan Kirk](https://github.com/aidankirk12)\n-   [Albert Magyar](https://github.com/albert-magyar)\n-   [Alex Light](https://github.com/allight)\n-   [Amin Kalantar](https://github.com/aminiok1)\n-   [Angelo Matni](https://github.com/angelomatni1)\n-   [Balint Christian](https://github.com/cbalint13)\n-   [Blaok](https://github.com/Blaok)\n-   [Brandon Jiang](https://github.com/brajiang)\n-   [Brian Searls](https://github.com/briansrls)\n-   [Chen-hao Chang](https://github.com/cchao)\n-   [Chris Drake](https://github.com/cjdrake)\n-   [Chris Leary](https://github.com/cdleary)\n-   [Conor McCullough](https://github.com/crmymh)\n-   [David Plass](https://github.com/dplassgit)\n-   [Dan Killebrew](https://github.com/dkillebrew-g)\n-   [Derek Lockhart](https://github.com/dmlockhart)\n-   [Eric Astor](https://github.com/ericastor)\n-   [Ethan Mahintorabi](https://github.com/QuantamHD)\n-   [Felix Zhu](https://github.com/felixzhuologist)\n-   [Georges Rotival](https://github.com/grotival)\n-   [Hanchen Ye](https://github.com/hanchenye)\n-   [Hans Montero](https://github.com/hmontero1205)\n-   [Henner Zeller](https://github.com/hzeller)\n-   [Iliyan Malchev](https://github.com/malchev)\n-   [Johan Euphrosine](https://github.com/proppy)\n-   [Jonathan Bailey](https://github.com/jbaileyhandle)\n-   [Josh Varga](https://github.com/JoshVarga)\n-   [Julian Viera](https://github.com/julianviera99)\n-   [Kevin Harlley](https://github.com/kevineharlley)\n-   [Leonardo Romor](https://github.com/lromor)\n-   [Manav Kohli](https://github.com/manav-kohli)\n-   [Mark Heffernan](https://github.com/meheff)\n-   [Paul Rigge](https://github.com/grebe)\n-   [Per Grön](https://github.com/per-gron)\n-   [Philipp Schilk](https://github.com/schilkp)\n-   [Ravi Nanavati](https://github.com/nanavati)\n-   [Rebecca Chen (Pytype)](https://github.com/rchen152)\n-   [Remy Goldschmidt](https://github.com/taktoa)\n-   [Robert Hundt](https://github.com/rhundt)\n-   [Rob Springer](https://github.com/RobSpringer)\n-   [Sameer Agarwal](https://github.com/sandwichmaker)\n-   [Sean Purser-Haskell](https://github.com/spurserh)\n-   [Simone Campanoni](https://github.com/scampanoni)\n-   [Ted Hong](https://github.com/hongted)\n-   [Ted Xie](https://github.com/ted-xie)\n-   [Tim Callahan](https://github.com/tcal-x)\n-   [Vincent Mirian](https://github.com/vincent-mirian-google)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fxls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fxls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fxls/lists"}