Microarchitecture

The default core is two-wide with a 32-entry ROB. Start with the configuration table, then follow the pipeline and block contracts below. Capacities refer to the current RTL; cycle sequences describe scalar instruction paths. The default RV32/RV64 pipeline includes V 1.0. See the ISA and profile matrix for the selected extensions and RV64 user/supervisor profiles.

Pipeline stages

En is the n-th clock edge that captures an instruction; cycle n is the logic between En and En+1. An ALU instruction passes 13 edges from fetch PC to retirement: 9 in-order edges up to ROB allocation, 1 to enter an issue queue, 1 to execute, and 2 to write back and retire. Every ordered buffer is registered without empty-queue fall-through, so each one costs an edge even when it is empty.

The numbers assume warm L1I/L1D, ready operands, free queue capacity, and no redirect. They were confirmed by tracing single instructions through the integrated core (default preset, RV32, isolated by serializing CSR writes). The other default* presets have the same stage structure: RAPT_FETCH_RESPONSE_STAGE and RAPT_IOQ_LOAD_RESPONSE_STAGE are 0 in all of them, and the integrated core always sets RegisteredDispatchPayload.

Edge Register (module) Logic in the preceding cycle Kind
E0 Fetch PC pc_ifu_q (IFU) Next-PC select: BPU prediction, IDU resteer, recovery or flush redirect, L1I data pre-read loop
E1 Fetch packet held (IFU) L1I tag compare and way select, instruction walk and RVC handling, packet cut at a control instruction logic
E2 FQU Queue write buffer
E3 IDU input Queue read and regrouping buffer
E4 RNQ (RNU) Decode; decode-time jump, return and target correction; speculative history update logic
E5 rename_pipe (RNU) Rename: map lookup, intra-group dependencies, free-list and checkpoint allocation logic
E6 rapt_operand_stage None (pipeline register) buffer
E7 UOQ (ROU) UOQ admission of tags and constants buffer
E8 ROB entry and dispatch carry lane (ROU) ROB allocation and spill write logic
E9 Issue-queue entry, or IOQ load request Dispatch window, PRF read with completion bypass, domain steering logic
E10 Completion register Issue select, execute, completion guard, local wakeup loop
E11 ROB_WB (ROU) ROB writeback, registered wakeup, recovery transaction logic
E12 Commit (ROU/CMU) In-order retirement, RAT and free-list update, CMU broadcast logic

“Kind” marks where to look first when you re-split the pipeline. Buffer cycles hold little more than a queue write or read. Loop cycles are single-cycle feedback loops: E0 feeds the fetch PC back to itself, and E10 lets a dependent issue on the next cycle. Splitting a loop cycle costs IPC directly; splitting a logic cycle adds an edge to every instruction.

Per-class edge sequences:

ALU     E0..E8 | E9 ALQ entry  | E10 completion | E11 ROB_WB | E12 commit                    13 edges
Load    E0..E8 | E9 request    | E10 L1D data   | E11 completion | E12 ROB_WB | E13 commit   14 edges
Store   E0..E8 | E9 IOQ entry  | E10 addr/perm  | E11 completion + SQ | E12 ROB_WB | E13 commit, then SQ drain
MUL     E0..E8 | E9 MDQ entry  | E10 M1 | E11 M2 | E12 completion | E13 ROB_WB | E14 commit     15 edges
Branch  E0..E8 | E9 BRQ entry  | E10 completion | E11 recovery register | E12 = target E0 on a mispredict

The load row is an aligned, cacheable Bare-mode hit whose base register is ready at dispatch, so the load enters the registered request stage directly from dispatch. The store row completes when its address and permission are checked; it drains from the SQ after commit. Divides are iterative and stay in M1 for about 2 + ceil(significant dividend bits / 2) cycles. FP units add their own latency, with the shared FMA/MUL product pipeline at eight cycles.

Dependency or event Cycles
ALU → dependent ALU or branch 1 (back to back)
Load hit → dependent ALU 2
MUL → dependent ALU 3
Result → a consumer outside ALQ/BRQ (ROU dispatch bypass, IOQ, MDQ, FEU integer sources) +1 over the rows above
Branch mispredict, from branch execute to target execute 12
Unpredicted direct jump, corrected in IDU 3 bubbles before the target reaches IDU

The first three rows rely on local wakeup: ALQ and BRQ take integer, load, branch-link and MUL results straight from the accepted completion before it is registered. FPQ does the same for FP results. Every other consumer sees only the registered completion, so it waits one more cycle.

The mispredict row assumes the branch is at the ROB head. Its recovery transaction is registered at the branch’s E11. The target PC is captured at E12 and refetched at once, and the L1I pre-reads the target. IDU then waits until the branch retires before it accepts the target, so a branch that is not at the head adds its wait for retirement.

These are ideal sequences, not fixed latencies. Queue or operand waits, ROB_DP residence, translation, cache misses, MSHR replay, and bus responses all lengthen a path. Retirement needs the stored ROB_WB state and an owner inside the ready head prefix. Reset or flush kills a completion before it is registered.

The default*, small-cache, and middle-cache presets use L1D write-back:

Organization

Raptor is a configurable RV32/RV64 out-of-order core with a two-wide default preset. rapt_core composes rapt_frontend (prediction, fetch, FQU, decode), rapt_backend (rename, operand stage, ROB, dispatch, issue, completion, LSU, precise commit), and rapt_memory (L1I, L1D, translation, bus interface unit). The cluster top rapt places rapt_l2_subsystem between the core and device router. Every core memory/device access leaves through l2_client_if; the L2 subsystem always owns AXI and the outstanding-transaction budgets, with cache storage only when enabled by a preset. rapt_pkg::L2LinkConfig adapts the L2 macros into typed capabilities passed to the core, L1s, bus and router. The current cluster has one core/client; a multi-client arbiter is future work.

rtl/ holds only the processor. Its directories follow the instance hierarchy under the cluster top rapt:

rapt (cluster)                 rtl/rapt.sv
├─ rapt_core (per hart)        rtl/core/
│  ├─ rapt_frontend            core/frontend/       BPU (branch_predictor/), IFU, FQU, IDU
│  ├─ rapt_backend             core/backend/        rename/, rob/, dispatch/, issue/,
│  │                                                regfile/, commit/ (CMU, CSR),
│  │                                                ieu/, feu/, fpu/, vpu/, lsu/
│  └─ rapt_memory              core/memory/         icache/, dcache/, mmu/, replacement/,
│                                                   bus unit; PMP in core/pmp/
├─ rapt_l2_subsystem           rtl/uncore/          AXI master, budgets, l2cache/ if enabled
├─ rapt_router                 rtl/uncore/
├─ CLINT, PLIC                 rtl/uncore/irq/
└─ DM, DTM, debug arbiter      rtl/uncore/debug/

rtl/common/ and rtl/sram/ hold shared leaves such as queues, selectors and SRAM wrappers. Interfaces, macros and types are in rtl/include/, presets in rtl/configs/, and generated decoders in rtl/generated/. With RAPT_V_EXTENSION, rapt_backend instantiates rapt_vpu_core from core/backend/vpu/. make -C verification rtl-structure-check enforces the core/uncore dependency boundary.

Integrations that wrap the cluster live with their consumers: sim/rtl/ holds the simulation SoC tops, adapters and DPI module; fpga/ holds the board tops; synth/configs/pin-limited/rtl/ holds one tape-out integration with its pin-limited top, pads and octal link master, also used for Arty validation (chip top). Future tape-out integrations belong beside this configuration in synth/configs/.

Registers inside the blocks define the stage boundaries. Default decode, rename, dispatch and commit widths are each two; instruction queues hold individual instructions rather than fixed pairs. The core and memory synthesis scopes exclude the L2 subsystem. Historical PPA from before this split requires a matching-boundary comparison.

The pipeline explorer is an illustrative cycle model. It does not model current branch recovery, MSHR replay, or the direct integer completion path, so its cycle counts are not RTL timing or CoreMark IPC.

Frontend: Fetch, queue, and decode

The predictor query PC is ifu_bpu.nextpc. IFU and IDU report accepted branch-history events through history_valid, history_taken, and history_pc_bit; IDU also supplies history_recover for decode corrections.

Backend: Rename, dispatch, and execution

Vector execution

Decode marks vector operations as serializing system instructions. The integer system port issues the raw encoding and resolved scalar operands to the VPU. Its adapter retains the ROB slot and allocation generation, and execution starts only with authorization from the matching head. Scalar/FPR results, accrued FP flags and exceptions use the guarded integer system completion port.

Vector memory drains older writes and fills, then takes ownership of the shared data MMU and L1D interfaces. Translation and PMP/PMA checks apply to each request. The VPU holds its owner through the final load/store response. Traps retain vstart, so completed elements remain visible and the faulting instruction can resume. In an RV64 guest, the same data path applies both translation stages and returns guest page-fault metadata. See the VPU manual.

Memory: LSU, L1D, translation, and bus

Load scheduling conservatively waits behind older stores with unresolved addresses. There is no learned memory-dependence predictor or speculative RAW-violation rollback, and there is no independent data hardware prefetcher. MSHR miss replay, branch-target SRAM read-ahead, and Zicbop hints serve different purposes.

RV64 guest translation and traps

With H enabled, the core runs a hypervisor in HS-mode and a guest in VS/VU-mode. For guest fetches and data accesses, vsatp selects Sv39 or Bare for the VS-stage translation. hgatp selects Sv39x4 or Bare for the G-stage. When both stages are active, the walker also translates each VS-stage PTE access through the G-stage. Svnapot permits 64 KiB leaf mappings.

Guest misses bypass the shared L2 TLB. The instruction and data L1 TLBs distinguish native, two-stage, and G-stage-only translations and retain G-stage permissions for hits. The hgatp VMID field reads as zero. A write to hgatp flushes the L1 translation caches. HFENCE and HINVAL invalidate cached guest translations.

HLV, HLVX and HSV access guest memory from the hypervisor. Guest page faults carry the faulting address and indicate whether the fault occurred while reading a VS-stage PTE. The CSR block reports guest-physical fault information through htval or mtval2 for traps delivered to HS or M. Delegation controls which traps and interrupts reach VS.

Recovery and platform control

A nonfaulting branch misprediction produces a registered oldest-owner recovery transaction containing its ROB slot, allocation generation, target, and checkpoint identity. The announcement does three things at once:

Fetch then continues down the target path into FQU. While recovery.pending is set, IDU, RNQ, rename_pipe and the operand stage stay empty, so no new ROB allocation occurs; older ROB work continues until the mispredicted instruction reaches the head. Retirement then performs the precise whole-pipe flush and rebuilds rename state from committed state. When the announced owner retires cleanly, IFU and FQU keep the target stream they already fetched (recovery.preserve_fetch). An older exception, interrupt, serializing operation or superseding recovery discards that stream. The announcement selectively cancels younger integer/branch issue entries, issue packets, and MUL/DIV owners. Younger MUL pipeline and iterative DIV owners are cancelled before their MDQ slots can be reused; older operations and the recovery owner survive. ROB/IOQ/SQ and rename still use the retirement-time precise flush, so correct-path execution cannot restart at the announcement. Correct branch resolutions release checkpoints independently, and completion ownership guards reject stale generations. The 4-bit generation guard is used together with producer cancellation and flush ownership; its finite width alone does not establish safety for arbitrarily late completions.

The CSR file holds privilege, trap delegation, translation, and counter state. On RV64 with H it also holds the guest status, trap and translation CSRs. Sstc compares stimecmp with CLINT time and vstimecmp with guest time (time + htimedelta). The Sscofpmf path raises a local overflow interrupt for mhpmcounter3 and filters that counter by execution mode. Eight PMP entries implement TOR and NAPOT at the default 4 KiB granularity across 16 architectural CSR slots; slots 8–15 read as zero and ignore writes. NA4 is available only with an explicit four-byte-grain configuration. The cluster routes CLINT timer/software interrupts and PLIC external interrupts to the core. CLINT supplies mtime, mtimecmp, and msip; PLIC has 31 sources and M/S contexts by default. The PLIC window accepts naturally aligned 32-bit ordinary loads/stores; other ordinary widths fault before a device access.

RNU owns the speculative register map and free-register state. CSR observers read the machine trap-vector base through csr_bcast.mtvec.

Default configuration

These values refer to rtl/configs/default/rapt_config.svh, shared defaults in rtl/include/rapt.svh, and top-level parameter defaults; other presets and command-line overrides can differ.

small-cache and middle-cache each have 128 KiB L1I and L1D caches with 64-byte lines. L1I uses 1024 sets and two ways; L1D uses 64 sets and 32 ways to keep its index within a 4 KiB page. small-cache retains the one-wide small core, ROB 4, integer PRF 48, SQ 4, and bimodal prediction. It enables L1D write-back, 16-entry fully associative L1 TLBs, and a 64-entry shared L2 TLB. middle-cache uses two-wide ordered stages, ROB 16, integer PRF 64, SQ 8, TAGE, write-back L1D, and 8-entry L1 TLBs without an L2 TLB. Both disable the L2 data cache. Select the preset explicitly; FPGA timing and utilization depend on the board and build constraints.

Item Default
XLEN RV32; -DRAPT_RV64 selects RV64
Physical address 32 bits by default in both modes; RV64 RAPT_PADDR_BITS supports 32–38
Stored PC 32 bits (RV32); 40 bits sign-extended to RV64 (RAPT_PC_FULL_WIDTH retains 64)
Ordered widths Decode 2, rename 2, dispatch 2, commit 2
Integer issue 2 ports; CSR/system on port 0; 6 completion endpoints (N+4)
Fetch Six-halfword L1I lookahead; no IFU response register
Ordered buffers FQU 4, RNQ 8, rename_pipe 4, operand stage 2, UOQ 8
Window ROB 32 (4-bit generation), integer PRF 64, operand spill 16, dispatch window 12 lanes, branch checkpoints 16
Execution queues ALQ 8, BRQ 8, MDQ 4, FPQ 8, IOQ 8, unified SQ 16
Floating point Renamed F/D/Zfhmin and RV64 Zfa; ROB-backed results; 32 × 64-bit committed FPRs
Vector V 1.0, VLEN=128, ELEN=64 in both XLENs; single ROB-head owner
RV64 supervisor profile RVA23S64 with Sha/H, Sv39 and Sv39x4 guest translation
Branch prediction TAGE (1024 bimodal + 3 x 1024 tagged), side conditional query of the same TAGE, 512-entry four-way BTB, 16-entry RAS
L1I 16 KiB, four-way, 64 sets, 64-byte lines, 32-byte refill sector, same-4KB-page next-line prefetcher
L1D 16 KiB, four-way, 64 sets, 64-byte lines, write-back, 4 MSHRs, 2 writeback buffers, 16-entry IP-stride prefetcher, Sv32/Sv39 miss replay
TLB ITLB 16 (fully associative), DTLB 64 (two-way, replicated load/store lookup); shared four-way L2 TLB 512 (1024 in default-w3/default-w4)
L2 No cache: the L2 subsystem only bridges to AXI (default-l2 adds the cache)
AXI master In rapt_l2_subsystem: 4-bit ID, XLEN-bit data, up to 8 reads; up to 4 eligible cacheable writes without L2; buffered writebacks complete on B
PMP / PLIC 8 PMP entries in 16 CSR slots; 31 PLIC sources, M/S contexts

The default* presets use a 16-entry fully associative ITLB and 64-entry, two-way DTLB replicas. large uses ITLB 32 and DTLB 64/two-way. small/formal use 4 entries and middle/middle-cache use 8 entries in both levels of L1 translation. small-cache uses 16 entries. All of these presets use fully associative DTLBs (WAYS=0).

The instruction and data miss paths share one 512-entry, four-way L2 TLB (1024 entries in default-w3/default-w4; 256-entry direct-mapped in default-l2/default-cache), implemented by rapt_l2tlb and the rapt_cached_ptw adapters. It is enabled in all default* presets, large, and formal; small-cache uses a 64-entry instance. small, middle, and middle-cache set RAPT_L2TLB_ENTRIES=0 and bypass it. This setting is independent of the L2 data-cache enable.

The low VPN bits index the set table (7 bits for 512-entry/4-way; 8 bits for 1024-entry/4-way or 256-entry direct-mapped). A single synchronous payload port arbitrates instruction/data lookups and fills in round-robin order. An L1 host translation miss first probes this table. A hit refills the requesting L1 TLB, and a miss starts its page-table walker. Superpage results are cached as resolved 4 KiB subpages. Tags include ASID (ignored for global mappings), page-table root, PBMTE and SBE. Keeping the root in global tags conservatively prevents reuse across different roots. Cached PTE flags and the full architectural PPN preserve permission, Svade A/D, PBMT and physical-address checks. Access faults and page faults are not cached.

Committed SFENCE.VMA and SINVAL.VMA use address/ASID-selective invalidation in both L1 TLBs and the shared L2 TLB by default (RAPT_SFENCE_SELECTIVE=1). An ASID-specific fence preserves global mappings; an address-specific fence also matches every cached fragment of the corresponding superpage. Full fences and RAPT_SFENCE_SELECTIVE=0 invalidate all entries. Invalidation takes priority over fills. RAPT_SFENCE_KEEP_STATE=3 independently preserves caches and predictor state across translation fences; it does not weaken translation invalidation or ordering. A cancelled walk drains an already accepted PTE read without refilling either level. The dedicated per-word IO instruction-fetch translation path continues to use its own walker directly. Standalone L1 cache instances default to L2Tlb=0; rapt_memory enables and connects the shared table according to the preset. No frequency, area or workload improvement is implied by these capacity settings.

Optional L1D capacities

The standard presets keep their cache capacities. Override the default preset’s RAPT_L1D_N_WAYS and RAPT_L1D_NRU defines to select these variants:

Defines with RAPT_CONFIG=default Capacity Ways Replacement 64-bit data banks Rows per bank
none 16 KiB 4 tree PLRU 8 256
RAPT_L1D_N_WAYS=8 32 KiB 8 tree PLRU 8 512
RAPT_L1D_N_WAYS=16 64 KiB 16 tree PLRU 16 512
RAPT_L1D_N_WAYS=8, RAPT_L1D_NRU=1 32 KiB 8 NRU 8 512
RAPT_L1D_N_WAYS=16, RAPT_L1D_NRU=1 64 KiB 16 NRU 16 512

All use 64 sets and 64-byte lines in RV32 and RV64, so the set index stays in the 4 KiB page offset. RAPT_L1D_WAYS overrides a preset’s way count; without it the existing RAPT_L1D_N_WAYS applies. RAPT_L1D_NRU=1 selects NRU; zero keeps the existing replacement policy, including RAPT_CACHE_LRU when set.

NRU keeps one recent bit per way. An A-channel tag hit or installation marks its way recent; when every way becomes recent, only the latest way stays marked. Replacement chooses the first cold way after checking matching and invalid entries. Hit and installation updates are mutually exclusive, so one indexed write port suffices. B probes keep the existing read-only replacement behavior.

The data array reads one 64-bit chunk across ways, or a complete line of one way, on the next clock edge; RV32 selects either half of the chunk. Every bank uses rapt_sram_1rw, including byte write enables and blocked-write address reservation. The four-way geometry compacts chunk rows modulo four to avoid unused SRAM rows. Use a distinct BUILD_PROFILE for each define combination so simulator artifacts stay isolated:

make build-rv64 RAPT_CONFIG=default BUILD_PROFILE=l1d64-nru \
  VFLAGS="-DRAPT_L1D_N_WAYS=16 -DRAPT_L1D_NRU=1"
make -C synth/yosys structure-check MODULE=l1d RAPT_CONFIG=default \
  EXTRA_DEFINES="-DRAPT_L1D_N_WAYS=16 -DRAPT_L1D_NRU=1"

Focused checks are verilator-l1d-data, verilator-l1d-shared-tags, verilator-l1d-nru, and the existing L1D writeback/refill families in verification/Makefile.

command lookup Makefile + RTL reference