Quick Start

Build and simulate Raptor in a few commands. Run everything from the project rootsource env.sh is not required, the Makefile exports all variables.

Prerequisites

1. Install Dependencies

git clone https://github.com/Kingfish404/raptor-chip
cd raptor-chip

# One-line setup (installs all dependencies)
make setup

# Show all available targets
make help

2. Run NEMU (Software ISS)

make run-nemu32                 # configure + build + run, RV32

Or step by step:

make config-nemu32              # riscv32_defconfig
make build-nemu32
make run-nemu32
make menuconfig-nemu32          # interactive Kconfig

3. Run NPC (Verilator Simulation)

# Full pipeline: Chisel -> SystemVerilog -> configure -> build -> run
make sim-rv32

# Or step by step
make verilog                    # Chisel -> SystemVerilog
make config-rv32               # o2_defconfig
make build-rv32
make run-rv32

# Common runtime flags
make run-rv32 ARGS="-b -n"     # -b batch mode (default) · -n no wave trace
make run-rv32 IMG=path/to.bin  # load a custom image
make menuconfig-rv32           # interactive Kconfig

RV64 Mode

The core supports RV64 via the compile-time switch -DRAPT_RV64. Switching between RV32 and RV64 automatically invalidates the build cache — no manual make clean needed.

make build-rv64
make run-rv64   ARGS="-b -n"
make lint-rv64
# or pass VFLAGS explicitly
make run-rv32 VFLAGS="-DRAPT_RV64" ARGS="-b -n"

4. Benchmarks

# NPC standalone
make coremark-rv32        ARGS="-b -n"
make microbench-rv32      ARGS="-b -n"

# NPC with difftest (vs NEMU reference model)
make coremark-rv32-difftest     ARGS="-b -n"
make microbench-rv32-difftest   ARGS="-b -n"

# raptSoC
make coremark-ysyxsoc      ARGS="-b -n"
make microbench-ysyxsoc    ARGS="-b -n"

# NEMU
make coremark-nemu32       ARGS="-b -n"
make microbench-nemu32     ARGS="-b -n"

Detailed results: PROFILE.

5. Apps on riscv-pk

make app-hello-rv32                        # hello world
make app-coremark-rv32    ARGS="-b -n"     # CoreMark on pk
make app-embench-rv32     ARGS="-b -n"     # Embench-IoT
make app-pk-build                           # build OpenSBI + pk
make app-clean

6. Linux Kernel

make linux-boot-nemu32              # NEMU
make linux-boot-rv32               # NPC (Verilator)
make linux-boot-rv32-difftest      # NPC + difftest vs NEMU

Details: Linux Kernel Boot.

7. FPGA

make fpga-syn                       # synth (Gowin Tang Nano 20K)
make fpga-pnr                       # place & route
# See fpga/gowin-tang-nano-20k/README.md and fpga/litex/README.md

8. Utilities

make pack     # pack all SV into one file
make lint     # Verilator lint (RV32)
make sta      # static timing analysis (yosys-opensta)
make clean    # clean all build artifacts

Command Reference

Task Command
Show all targets make help
Setup environment make setup
Generate RTL make verilog
Build & run NEMU make run-nemu32
Full NPC simulation make sim-rv32
NPC simulation (batch, no wave) make run-rv32 ARGS="-b -n"
NPC RV64 mode make run-rv64 ARGS="-b -n"
CPU tests on NPC make cpu-tests-rv32 ARGS="-b -n"
Run CoreMark on NPC make coremark-rv32 ARGS="-b -n"
Run MicroBench on NPC make microbench-rv32 ARGS="-b -n"
Run nanos-lite on NEMU make nanos-nemu32
Boot Linux on NEMU make linux-boot-nemu32
Boot Linux on NPC w/ difftest make linux-boot-rv32-difftest
FPGA synthesis make fpga-syn
Pack SV / Lint / STA make pack / make lint / make sta
Clean all make clean

Key overridable variables: ARGS (runtime), VFLAGS (RTL defines), IMG (custom binary), MAINARGS (benchmark mode).

Manual Workflow

The same actions using the environment directly:

source ./env.sh

# 1. NEMU
cd $NEMU_HOME && make riscv32_defconfig && make && make run

# 2. NPC
cd $RAPTOR_HOME/hdl/chisel && make verilog
cd $NSIM_HOME && make o2_defconfig && make && make run

# 3. nanos-lite on NEMU (with VME)
cd $RAPTOR_HOME/abstract-machine/app/nanos-lite \
  && make ARCH=$ISA-nemu update run ARGS="-b" VME=1