Entries from 2026-03-01 to 1 month

Having AI Build a RISC-V CPU from Scratch (5. Cross-Checking Register Values with Verilator and Spike)

https://msyksphinz-en.hatenablog.com/entry/2026/03/18/040000msyksphinz-en.hatenablog.com Last time, I integrated the CPU core and confirmed that the Verilator build goes through. This time it is finally functional verification. I run the s…

Having AI Build a RISC-V CPU from Scratch (4. Integrating the Single-Cycle CPU Core and Verilator's Combinational Loop Problem)

https://msyksphinz-en.hatenablog.com/entry/2026/03/17/040000msyksphinz-en.hatenablog.com Last time, I implemented the decoder and the ALU. This time I integrate the modules into rv64i_core.sv to complete the single-cycle CPU, and record th…

Having AI Build a RISC-V CPU from Scratch (3. SystemVerilog Implementation of the Decoder and ALU)

https://msyksphinz-en.hatenablog.com/entry/2026/03/16/040000msyksphinz-en.hatenablog.com Last time, I implemented the firmware side. This time I implement the core of the RTL, the "decoder" and the "ALU", in SystemVerilog. In addition to 6…

Having AI Build a RISC-V CPU from Scratch (2. Building the Bare-Metal Firmware)

https://msyksphinz-en.hatenablog.com/entry/2026/03/15/040000msyksphinz-en.hatenablog.com Last time, I settled on the project's design policy. This time I record the firmware implementation in the sw/ directory. I write the three-piece set …

Having AI Build a RISC-V CPU from Scratch (1. Project Overview and Fixing the Design Approach)

I decided to implement an RV64I RISC-V CPU from scratch in SystemVerilog. The toolchain is riscv64-unknown-elf-gcc, the simulator is Verilator, and Spike (the RISC-V ISS) serves as the reference model for verification. This post records ho…

Learning About the aBTB (Ahead-BTB) Implemented in XiangShan

Judging from the public slides, XiangShan's aBTB (Ahead-BTB) is a large look-ahead BTB placed at the BP1/S1 stage. The BPU as a whole consists of a 3-stage prediction pipeline. BP1: uBTB + aBTB BP3: mBTB + RAS + TAGE + ITTAGE are placed th…

Learning About TAGE (4. The Tags Used at Lookup Time)

Previously: https://msyksphinz-en.hatenablog.com/entry/2026/03/12/040000msyksphinz-en.hatenablog.com Reading the TAGE implementation in gem5, there is a FoldedHistory for each table, and in addition there are two for the tag. 1. There is o…

Learning About TAGE (3. Understanding How Lookup Works)

Previously: https://msyksphinz-en.hatenablog.com/entry/2026/03/11/040000msyksphinz-en.hatenablog.com Before getting to the update rules, let's first sort out "what happens at prediction time". This is essential for understanding TAGE. 1. I…

Learning About TAGE (2. Summarizing the Structures of gshare / O-GEHL / TAGE)

Previously: https://msyksphinz-en.hatenablog.com/entry/2026/03/10/040000msyksphinz-en.hatenablog.com Here I line up the three predictors in "diagrams of the same granularity" and pin down the differences. gshare: a single table, PC ⊕ GHR E…

Learning About TAGE (1. The Problem TAGE Solves)

A branch predictor has to handle both short-history correlation (recent locality) and long-history correlation (long-range dependence) at the same time. This requirement naturally leads to a predictor with multiple components (multiple tab…

Reading the UDP: Utility-Driven Fetch Directed Instruction Prefetching Paper (3. The Idea Behind UDP)

Previously: https://msyksphinz-en.hatenablog.com/entry/2026/03/08/040000msyksphinz-en.hatenablog.com Key points of UFTQ and UDP To break the dilemma above (timeliness vs. pollution, and off-path cannot simply be discarded), the UDP paper p…

Reading the UDP: Utility-Driven Fetch Directed Instruction Prefetching Paper (2. The Idea Behind UFTQ)

Continuing from last time: https://msyksphinz-en.hatenablog.com/entry/2026/03/07/040000msyksphinz-en.hatenablog.com Key Points of UFTQ and UDP To break the dilemma above (timeliness vs. pollution, and the fact that off-path prefetches cann…

Reading the UDP: Utility-Driven Fetch Directed Instruction Prefetching Paper (1. About FDIP)

I read a paper called UDP: Utility-Driven Fetch Directed Instruction Prefetching, and decided to learn about FDIP (Fetch Directed Instruction Prefetching). What is FDIP (Fetch Directed Instruction Prefetching)? FDIP is a technique for impr…