{"id":13640833,"url":"https://github.com/pulp-platform/spatz","last_synced_at":"2026-02-07T23:35:40.398Z","repository":{"id":195971117,"uuid":"692096021","full_name":"pulp-platform/spatz","owner":"pulp-platform","description":"Spatz is a compact RISC-V-based vector processor meant for high-performance, small computing clusters.","archived":false,"fork":false,"pushed_at":"2024-03-12T16:26:30.000Z","size":6445,"stargazers_count":37,"open_issues_count":1,"forks_count":6,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-03-13T15:35:09.220Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2309.10137","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/pulp-platform.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-09-15T14:48:39.000Z","updated_at":"2024-03-20T15:55:22.981Z","dependencies_parsed_at":"2024-03-20T16:05:30.004Z","dependency_job_id":null,"html_url":"https://github.com/pulp-platform/spatz","commit_stats":null,"previous_names":["pulp-platform/spatz"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulp-platform%2Fspatz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulp-platform%2Fspatz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulp-platform%2Fspatz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulp-platform%2Fspatz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pulp-platform","download_url":"https://codeload.github.com/pulp-platform/spatz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223821933,"owners_count":17208763,"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-08-02T01:01:14.871Z","updated_at":"2026-02-07T23:35:40.306Z","avatar_url":"https://github.com/pulp-platform.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"![CI](https://github.com/pulp-platform/spatz/actions/workflows/ci.yml/badge.svg)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n# Spatz\n\nSpatz is a compact vector processor based on [RISC-V's Vector Extension (RVV) v1.0](https://github.com/riscv/riscv-v-spec/releases/tag/v1.0). Spatz acts as a coprocessor of [Snitch](https://github.com/pulp-platform/snitch), a tiny 64-bit scalar core. It is developed as part of the PULP project, a joint effort between ETH Zurich and the University of Bologna.\n\n## Getting started\n\nMake sure you download all necessary dependencies:\n\n```bash\nmake all\n```\n\nThe Makefile target will automatically download and compile tested versions of LLVM, GCC, Spike, and Verilator. It might take a while. If you have issues cloning the GitHub modules, you might need to remove the folders in `sw/toolchain`.\n\nETH users can source the toolchains and initialize the environment by doing:\n\n```bash\n\nsource util/iis-env.sh\n\nmake init\n```\n\nThe Spatz cluster system (hw/system/spatz_cluster) is a fundamental system around a Snitch core and a Spatz coprocessor. The cluster can be configured using a config file. The configuration parameters are documented using JSON schema, and documentation is generated for the schema. The cluster testbench simulates an infinite memory. The RISC-V ELF file is preloaded using RISC-V's Front-end Server (`fesvr`).\n\n### Simulating the system\n\nIn `hw/system/spatz_cluster`:\n\n- Compile the software and the binaries:\n  - Verilator:\n```bash\n    make sw.vlt\n```\n  - QuestaSim:\n```bash\n    make sw.vsim\n```\n  - VCS:\n```bash\n    make sw.vcs\n```\n- Run a binary on the simulator:\n  - Verilator:\n```bash\nbin/spatz_cluster.vlt path/to/riscv/binary\n```\n  - QuestaSim:\n```bash\n# Headless\nbin/spatz_cluster.vsim path/to/riscv/binary\n# GUI\nbin/spatz_cluster.vsim.gui path/to/riscv/binary\n```\n  - VCS\n```bash\nbin/spatz_cluster.vcs path/to/riscv/binary\n```\n- Build the traces in `.logs/trace_hart_X.txt` with the help of `spike-dasm`:\n```bash\nmake traces\n```\n- Annotate the traces in `.logs/trace_hart_X.s` with the source code related to the retired instructions:\n```bash\nmake annotate\n```\n- Get an overview of all Makefile targets:\n```bash\nmake help\n```\n\n### Configure the Cluster\n\nTo configure the cluster with a different configuration, either edit the configuration files in the `cfg` folder or create a new configuration file and pass it to the Makefile:\n\n```bash\nmake bin/spatz_cluster.vlt CFG=cfg/spatz_cluster.default.hjson\n```\n\nThe default config is in `cfg/spatz_cluster.default.hjson`. Alternatively, you can also set your `CFG` environment variable, the Makefile will pick it up and override the standard config.\n\n## Architecture\n\n### Spatz cluster\n\nSpatz was _not_ designed for full compliance with RVV. Check [Ara](https://github.com/pulp-platform/ara) for an open-source vector processor fully compliant with RVV (and by the same authors!). Instead, Spatz implements some instructions of the vector extension, enough to build a compact and highly efficient embedded vector processor. Thanks to its small size, Spatz is highly scalable, and we rely on multi-core vector processing to scale up the system.\n\n![Spatz cluster](./docs/fig/spatz_cluster.png)\n\nThe default Spatz cluster has two Snitch-Spatz core complexes (CCs), each with 2 KiB of latch-based VRF. Each CC has four [trans-precision FPUs](https://github.com/openhwgroup/cvfpu) with support for Spatz-specific SDOTP extensions for low-precision computing. The two Spatz-based CCs share access to 128 KiB of L1 scratchpad memory, divided into 16 SRAM banks.\n\n### Spatz core\n\nEach Spatz has three functional units:\n- The Vector Arithmetic Unit (VAU), hosting `F` trans-precision FPUs and an integer computation unit. Each FPU supports fp8, fp16, fp32, and fp64 computation. Each IPU supports 8, 16, 32, and 64-bit computation. All units maintain a throughput of 64 bit/cycle regardless of the current Selected Element Width. The VAU also supports integer and floating-point reductions.\n- The Vector Load/Store Unit (VLSU), with support for unit-strided, constant-strided, and indexed memory accesses. The VLSU supports a parametric number of 64-bit-wide memory interfaces. Thanks to the multiple narrow interfaces, Spatz can accelerate memory operations. By default, the number of 64-bit memory interfaces matches the number of FPUs in the design. **Important**, Spatz' VLSU cannot access the cluster's L2 memory. Ensure that all vector memory requests go to the local L1 memory (we provide the `snrt_l1alloc` and `snrt_dma_start_1d` functions for L1 initialization).\n- The Vector Slide Unit (VSLDU) executes vector permutation instructions. As of now, we support vector slide up/down and vector moves.\n\n![Spatz' architecture](./docs/fig/spatz_arch.png)\n\n### Supported instructions\n\nThe most up-to-date list of supported vector instructions can be found in `sw/riscvTests/CMakeLists.txt`. Spatz does not yet understand vector masking (although this is a work in progress), or fixed-point computation. It also does not understand many of the shuffling and permutation instructions of RVV (e.g., `vrgather`), and users are asked to shuffle data in memory through indexed memory operations. We very much welcome contributions that expand Spatz' capabilities as a vector coprocessor!\n\n## License\n\nSpatz is being made available under permissive open-source licenses.\n\nThe following files are released under Apache License 2.0 (`Apache-2.0`) see `LICENSE`:\n\n- `sw/`\n- `util/`\n- `docs/schema`\n\nThe following files are released under Solderpad v0.51 (`SHL-0.51`) see `hw/LICENSE`:\n\n- `hw/`\n\nThe following files are released under Creative Commons BY 4.0 (`CC-BY-4.0`) see `docs/fig/LICENSE`:\n\n- `docs/fig`\n\nThe following directories contains third-party sources that come with their licenses. See the respective folder for the licenses used.\n\n- `sw/snRuntime/vendor`\n- `sw/toolchain/`\n- `util/vendor`\n\n## Publications\n\nIf you want to use Spatz, you can cite us:\n\n```bibtex\n@Article{Spatz2023,\n  title         = {Spatz: Clustering Compact RISC-V-Based Vector Units to Maximize Computing Efficiency},\n  author        = {Matheus Cavalcante and Matteo Perotti and Samuel Riedel and Luca Benini},\n  year          = {2023},\n  month         = sep,\n  eprint        = {2309.10137},\n  archivePrefix = {arXiv},\n  primaryClass  = {cs.AR}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpulp-platform%2Fspatz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpulp-platform%2Fspatz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpulp-platform%2Fspatz/lists"}