Dayan(大衍)is an open-source NPU (Neural Processing Unit). This repository is the SoC that integrates Dayan: a RISC-V scalar core and a Dayan tensor core (matrix/vector/DMA), connected through an AXI-based on-chip interconnect.
中文说明在此。
Copyright (c) 2026 Institute of Computing Technology, Chinese Academy of Sciences.
Dayan is licensed under the Mulan Permissive Software License, Version 2 (Mulan PSL v2). See LICENSE for the full license text.
Dayan is a heterogeneous NPU. Each Dayan NPU core pairs a scalar core (for control flow and instruction issue) with a tensor core (for matrix, vector and DMA computation). The SoC exposes a front (slave) AXI port for the host to push work and a master AXI port to reach external memory, while an internal system crossbar routes traffic between the cores, the control block and the outside world.
The scalar core (WiredRV) and the tensor core (Dayan-Core) are developed in standalone repositories and pulled in as submodules.
The micro-architecture overview of the Dayan SoC is shown below.
For more documentation, see the Dayan-Doc repository.
Some of the key directories are shown below.
.
├── src
│ ├── main/scala # design files
│ │ └── rvtsoc
│ │ ├── blackbox # empty stubs used when a submodule is absent
│ │ ├── config # CDE configurations
│ │ ├── devices # AXI DPI and auxiliary devices for simulation
│ │ ├── subsystem # NPU core, control block and system crossbar
│ │ ├── top # top module (Rvtsoc) and simulation wrapper
│ │ └── utils # shared utilities
│ ├── main/csrc # C/C++ sources for the simulation harness
│ └── main/resources # boot ROM and other resources
├── sim # Verilator-based co-simulation environment
│ ├── src # simulator host code, elf loader, DPI devices
│ └── third_party # spdlog, dotenv-cpp
├── scripts # scripts for agile development
├── deps # git submodules (rocket-chip, AxiInfra, etc.)
└── build.mill # mill build definition
Dayan relies on several git submodules (e.g. rocket-chip, AxiInfra, WiredRV, the tensor core rvt, and difftest). After cloning, initialize and update them recursively:
make depsscripts/update-submodules.py also recurses into the nested submodules of each dependency.
- Run
make(the default target isverilog) to generate SystemVerilog for simulation. Output is written togenerated/${VERILOG_TOP}-${CONFIG}/, i.e.generated/TestRvtsoc-VerifRvtsocConfig/. Wrapper submodules (sequential RAMs,EICG_wrapper) are moved into awrappers/subdirectory, and generation metadata (config.txt,version.txt, and, when enabled,mem.conf) is written undergenerated/<top>-<config>/info/. - Run
make verilog-fpgato generate the FPGA wrapperRvtsocWrapperinstead. It disables the verification logic (-D dis-verif=true) and writes togenerated/RvtsocWrapper-RvtsocConfig/. - Refer to
makefileandbuild.millfor the availableCONFIG/ top-module options.make verilogpasses-D abs-path=trueso paths in the generated filelist are absolute.
- Install
mill. Refer to the mill installation guide. - Clone this project and run
make depsto initialize the submodules. - Install Verilator, the open-source Verilog simulator. If it is not on the default path, set the
VERILATOR_ROOTenvironment variable. - The simulator also depends on
cmake,clang/clang++, and the system librariesfuse3,libzstdandzlib.
-
make sim-configconfigures the simulation build with CMake. Common overrides (defined inmakefile):Variable Default Description CONFIGVerifRvtsocConfigCDE configuration used for RTL generation SIM_C_COMPILERclangC compiler for the simulation harness SIM_CXX_COMPILERclang++C++ compiler for the simulation harness SIM_THREADS16Number of threads passed to Verilator SIM_TRACE_FSTONToggle FST waveform tracing SIM_TOP_NAMETestRvtsocTop-level module to simulate SIM_CONFIGVerifRvtsocConfigCDE config passed to CMake; must match CONFIGso the RTL is loaded fromgenerated/<top>-<config>/ -
make sim -jbuilds the simulator and runs it. -
The compiled executable is
sim/build/TestRvtsoc; waveform files are written tosim/logs/*.fst. SetSIM_CONFIGto the config used for RTL generation (defaults toVerifRvtsocConfig) so CMake finds the generated RTL.
Example:
make sim-config
make sim -jExtra C/C++ sources and include paths can be attached to the generated simulation from Scala via ExtraFiles:
import dayan.rvtsoc.utils.ExtraFiles
ExtraFiles.add("test.sv") // test.sv
ExtraFiles.add("test.c") // test.c
ExtraFiles.addResource("/rvtsoc/test.c") // src/main/resources/rvtsoc/test.c
ExtraFiles.addIncludePath("include") // include
ExtraFiles.addResourceIncludePath("/rvtsoc") // src/main/resources/rvtsocThis repository is licensed under Mulan PSL v2 (see LICENSE). The standalone license-header.txt is only the header snippet prepended to each Scala source file; it is not the license itself. To verify or apply the header:
./mill __.license.check # verify all Scala files carry the header
./mill __.license.create # add the header where it is missing