Building a RISC-V core with HOLY CORE COURSE
Learn how to build our own RV32I(M) core, verify it and actually use it FOR FREE (.md tutorials). From scratch & with more than 200 pages of detailed tutorial with schemes & explanation.
At a glance
- What is it?
- HOLY CORE COURSE lets you trace an instruction through a SystemVerilog CPU and test the result from Python. Its FPGA chapters are especially instructive where the first cache design falls short.
- Who is it for?
- Choose HOLY CORE COURSE if you want to follow a RISC-V instruction from its encoding to a signal you can check in Python. Start with the single-cycle tests, then read the FPGA chapter when you need to understand stalls.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository last received commits 28 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Editorial analysis
Start with an instruction you can follow
A register addition gives you a way into HOLY CORE COURSE without having to understand the entire processor first. In the Single Cycle Edition, two fields of the instruction select source registers. Their contents feed the arithmetic logic unit, or ALU. For an addition, the control logic selects the arithmetic result for write-back, and a third instruction field selects the destination register. You can follow those connections in the edition's cpu.sv and then open the Python test for the ALU to see exactly what counts as a correct sum.
That division of work tells you who the course suits. A reader who already knows some RISC-V assembly can start with the instruction encoding. Someone comfortable with Python can start with the expected value in the test and work backwards into the hardware. Both paths require reading SystemVerilog. The setup guide assumes some digital design experience, so a student encountering registers and combinational logic for the first time will need a separate introduction to those concepts.
Use the single-cycle tests before buying a board
Start with a checkout of the repository and an environment with Verilator installed. The setup guide favors Linux and also suggests macOS. For a reproducible point of reference, the project's CI configuration uses Ubuntu 24.04, Python 3.10 and Verilator v5.038. With that simulator and an activated Python environment, run the CI dependency installation from the repository root.
pip install -r ./3_perf_edition/requirements.txtThe path is deliberate. CI uses the Python requirements in the Performance Edition even when the job runs the earlier chapters. That file pins cocotb and pytest among the simulation packages. After installation, run the same single-cycle test command as the CI job, starting from the repository root.
cd 0_single_cycle_edition/tb
pytest test_runner.pyExpect pytest to collect the hardware tests. The runner builds a design with Verilator and invokes its Python test module. The addition test drives pairs of random 32-bit operands, waits for the result and compares it with the low 32 bits of their sum. That mask matters on overflow because a Python integer can hold a carry beyond the hardware result. If the build fails before an assertion runs, check the Verilator installation against the CI version before changing the adder.
Follow a load from its address to write-back
An ALU test can establish that an addition gives the right bits. It leaves open whether the processor sends those bits to the right place. A load makes that distinction visible. The single-cycle CPU can select an immediate for the ALU's second operand. The result supplies the address for data memory. On the return path the write-back selector can choose the memory result, and the memory path supplies a validity signal. Following an arithmetic instruction and then a load through this selector explains how two instructions that both perform an addition end up writing different values.
The test directory mirrors this split. There are individual targets for the register file and load/store decoder as well as the CPU. When a load produces the wrong register value, the component tests give you a starting question. Did the decoder enable the byte lanes for the requested address, or did the CPU select the wrong write-back source? Those questions lead to different files even when the final register dump looks identical.
The first FPGA cache changes what a clock cycle means
The FPGA chapter removes an assumption the single-cycle design could afford to make. External memory may take longer than one core cycle to deliver a word. The chapter puts caches between the core and memory and uses AXI for external transfers. On a miss, the cache stalls the core while it obtains the required data. A signal that tells the CPU to wait now has to agree with the state of a transaction outside the CPU.
The teaching design has a table of 128 words. The chapter shows which address bits select a word and which identify the memory region held in the table. A valid flag distinguishes a filled table from its state after reset. A dirty flag records writes that still need to reach main memory. To see what these flags do, trace a read after reset, then consider what has to happen if a write has changed the resident data by the time another region is requested.
The maintainer flags bugs and poor efficiency in this first implementation and describes further cache work in the Performance Edition. A correct answer to the paper exercise therefore gives you a model against which to check the RTL. It gives you little basis for a board-level reliability claim.
What changes at the Arty S7 and in the Veryl rewrite
Once simulation works, the physical target becomes a separate decision. The hardware quickstart lists the Arty S7 as supported and says the Zybo Z720 setup needs an update. It uses Vivado to generate the bitstream. The default ROM blinks an LED, so the first observation on the board is quite different from a successful run of the arithmetic tests. Loading another program through the documented debugging route adds a JTAG adapter and a RISC-V debugger to the setup.
For someone choosing an implementation language, the related VERY HOLY CORE project offers another way to study the single-cycle design. Its author rewrote the HDL in Veryl and explains that the course text was outside the scope of the rewrite. The author also describes FPGA synthesis as unfinished. It makes sense as a second implementation to read alongside the original when learning Veryl. For the step from a Python test to a documented board demonstration, the original project's Arty S7 instructions give you a specific target.
Choose the edition and check the reuse terms
The README links directly to the Single Cycle and FPGA lessons as Markdown. It directs readers who want the SoC and Software tutorial to a supporter PDF. The repository still has a corresponding source directory. For a class, distributing a reading list built around the two public lessons is straightforward, while a later session on traps or embedded C needs an explicit choice of reading material.
There is also a difference between using the RTL in a lab and putting the repository into a training corpus. The LICENSE file calls its terms the 3-Clause BSD NON-AI License. It includes notice requirements for source and binary redistribution and adds a restriction on using the code or binaries, including modifications, to train or improve machine learning algorithms. A team carrying the design into another repository should read that fourth condition along with the notice requirements. A plain BSD identifier would omit a condition the author wrote into this project.
Editorial conclusion
Choose HOLY CORE COURSE if you want to follow a RISC-V instruction from its encoding to a signal you can check in Python. Start with the single-cycle tests, then read the FPGA chapter when you need to understand stalls. For a board project that depends on a reliable cache, the maintainer's warning about the FPGA Edition makes that particular implementation a poor starting point.
Frequently asked questions
Do I need an FPGA to start HOLY CORE COURSE?
The Single Cycle Edition runs module and CPU tests with Verilator and cocotb. The Arty S7 becomes relevant when you follow the board quickstart.
Which Python dependencies does HOLY CORE COURSE use for the single-cycle tests?
The CI job installs 3_perf_edition/requirements.txt. It includes cocotb and pytest and is used before CI runs the tests in 0_single_cycle_edition/tb.
Which HOLY CORE COURSE tutorials can I read in the repository?
The README links to the Single Cycle and FPGA editions as Markdown. It points readers to a supporter PDF for the SoC and Software tutorial.
Official sources
Was this useful?