52 karma · joined Aug 29, 2026 (3mo ago) · 8 submissions
comment 2w ago · link · parent
On microarchitecture balance and performance modeling: there is no standalone cycle-accurate C++ simulator, mainly because once the Verilator RTL was running fast enough to boot Linux in minutes, maintaining a separate C++ timing model for a solo project would have just created model-vs-RTL drift. Early sizing came from static BusyBox disassembly register-pressure checks and an offline trace-driven sweep (tools/analysis/slice1_arch_model.py, starting from a 48-entry ROB / 80 Int PRFs), and once the pipeline was up, Stage 2/3 parameters were tuned directly in RTL using fursoy_s1_hpm.sv (mcycle, minstret, and 8 mutually exclusive CPI buckets). Expanding to 160 Int PRFs (32 architectural + 128 speculative) and a 128-entry ROB was mainly to preserve the invariant that the free list can never exhaust before the ROB fills. It is admittedly ROB/PRF-heavy for a 2-wide fetch/decode/retire core compared to something like K8, and on the 89.86M-cycle Linux 6.6.50 boot, branch/flush recovery (C_br_recover at 16.72%) matters much more than rename capacity (C_be_rename at 6.35%).
For execution resources: the 2-wide frontend feeds five scalar issue ports across three OoO queues (IntIQ -> Port 0 ALU0/BRU/CSR/I2F + Port 1 ALU1/MUL/DIV; MemIQ -> Port 2 AGU0 for loads/stores/AMOs/fences + Port 3 AGU1 for loads only; FPIQ -> Port 4 FMA/FDIV/FSQRT/FCONV), plus vecq_q[8] executing fetched RVV instructions sequentially over the VRF via a core FSM. That limits it to max 1 branch/cycle (Port 0 only) and up to 2 loads/cycle or 1 load + 1 store AGU/cycle across an 8-bank (PA[5:3]) L1D. Linux boot also barely exercises RVV/FP compared to the integer and Sv39 paths, though those instructions are now checked against sail-riscv differential cosim.
On conflict misses: fursoy_s1_hpm doesn't split conflict misses out from capacity misses yet, so I don't have an exact conflict fraction. What we measure on the Linux + BusyBox boot is total memory stalls (C_mem_stall, combining L1D misses, bank conflicts, and DTLB/PTW) at 6.18% of cycles and frontend starvation (C_fe_starve) at 0.56%. Since L1I and L1D are already 16 KiB 4-way VIPT with 4 MSHRs and 2 writeback buffers, a victim cache didn't seem worth the extra tag/bypass complexity for that slice of stalls.
On the standalone STA numbers:
- fursoy_s1_agu.sv (1.901 ns): as you noticed in your follow-up, it just writes base_i + imm_i, which Yosys maps to a plain 64-bit ripple-carry chain (~30 AOI/OAI logic levels) instead of the Kogge-Stone adders in alu.sv (1.133 ns) and branch_unit.sv (0.629 ns). Once it cleared 500 MHz (+0.099 ns slack) I left it alone, though sharing one Kogge-Stone adder across all three is an obvious cleanup. - fursoy_s1_csr.sv (1.663 ns): the critical path is mstatus_i feeding a ~25-level combinational trap/privilege/delegation cone (1,790 DFFs, 26.75 kGE). Splitting fast vs. slow CSRs or going 2-cycle would easily buy headroom if pushing frequency higher; at 500 MHz (+0.298 ns slack), single-cycle kept trap/CSR serialization straightforward. - fursoy_s1_itlb / fursoy_s1_dtlb (1.198 ns / 1.249 ns): because Nangate45 open synthesis here uses standard-cell flip-flops instead of compiled SRAM macros (6,304 / 6,515 DFFs, 77 / 100 kGE), STA sees a wide VA buffer tree feeding a 4-level MUX2 set-read plus 4-way tag compare, 8-entry 2M/1G superpage CAM, and hit-way mux—on top of a 0.40 ns (0.20 ns input + 0.20 ns output) standalone port budget.
If you want a visual block diagram, there is also an interactive version on the project page at https://cpu.fursoy.com — though the README diagram and tables remain the primary reference in the repo.
comment 2w ago · link · parent
At a high level, the core is 2-wide fetch/decode/rename/retire with a 128-entry ROB, 160-entry integer PRF, 8 branch checkpoints for single-cycle speculative RAT rollback, and separate Int/Mem/FP/Vec issue queues. On the memory side, it has a dual-port Sv39 DTLB (64-entry 4-way Tree-PLRU + 8-entry 2 MiB/1 GiB superpage CAM), ITLB, and a 16 KiB 8-bank non-blocking L1D. Instead of flushing dirty lines on every page-table walk, the hardware PTW snoops dirty L1D sets non-destructively so Linux page-table updates are visible directly, paired with store-queue drain on SFENCE.VMA.
In Verilator, it boots mainline Linux 6.6.50 and BusyBox userspace in ~89.8M cycles (~76.2M retired instructions, 2,255 page faults handled) while checking an 8-bucket single-owner CPI conservation invariant every cycle with 0 cycle leakage. Synthesizing the 8 main core logic blocks standalone with sv2v + Yosys + OpenSTA on Nangate 45nm (SRAMs/PRFs black-boxed, pre-P&R) meets 500 MHz across all 8/8 blocks at ~219 kGE, after rebuilding the ALU and branch unit as Kogge-Stone prefix trees and balancing high-fanout CSR/TLB paths.
I used an AI-agent-assisted workflow for RTL iteration and verification scaffolding while driving the microarchitecture, timing closure, and debugging myself. The nastiest late bug was a Linux boot livelock around ~90M cycles: per RISC-V Priv Spec §3.1.9, CSR read-modify-write instructions on `mip` have to operate on the software-writable `mip_q[9]` bit rather than the live `irq_seip_i` wire—our CSR block was feeding `mip_val` back into RMW, so whenever SBI cleared `STIP` while a PLIC IRQ was high, it permanently latched `SEIP` and trapped the kernel in `plic_handle_irq`.
For folks who have built Sv39 cores or open-source ASIC flows: do you prefer letting the PTW snoop dirty L1D lines directly like this, or forcing a clean/drain path? Also curious what people would tackle next on a single-core tree like this—an inclusive L2 cache or jumping straight to dual-core coherency.
5.
Show HN: Fursoy – Out-of-order RV64IMAFDV core in SystemVerilog (Linux 6.6)(github.com ↗)
86 points · by fursoy · 2w ago · 40 comments
comment 2mo ago · link · parent
The server-side path permissions are more interesting, but that also seems like the hard part. I’m curious how the blob allowlist behaves across renames/history, or when the same blob is reachable through different paths.
Also not sure the natural-language agent adds much here. It makes the project feel more complicated than the core idea needs to be.
For game repos I’d be more interested in a comparison against Git LFS + sparse checkout, or Perforce, rather than plain Git.