
Build your own single-cycle RISC-V CPU from scratch. Explore instruction flow, data path, and control logic, and learn to run a simple C program in Verilog.
Explore how RISC-V, an open, royalty-free instruction set architecture, enables modular CPU design. Learn how data path and control flow handle instructions, convert C to hex, and run on RV32i.
Learn to set up free tools to build and simulate a single-cycle RISC-V CPU: VS Code for Verilog, Icarus Verilog for simulation, and GTKwave for waveform visualization.
Explore the RISC-V execution flow from instruction fetch through decode, execute, memory, to write back, showing how A and B are added and stored in registers and memory.
Explore how a 32-bit RISC-V instruction is encoded by formats like R, I, S, and B type, using a 7-bit opcode, 5-bit registers, and function fields.
Explore the architecture of a single-cycle RISC-V CPU, detailing the program counter, instruction memory, control unit, register file, ALU, data memory, and immediate generator, and how signals drive execution.
Design core components by starting with the program counter and instruction memory, then the register file. Implement an immediate generator with sign extension for I-type and JAL/U-type instructions.
Design the control unit to generate reg write, memory read/write, and ALU signals from opcodes, coordinating ALU, memory, and write-back for r-type, i-type, load, store, branch, u-type, and j-type instructions.
Design the ALU and its control unit. The ALU uses inputs A and B and a control signal from the ALU control to perform add, subtract, or logic operations.
Design the data memory and write-back mux for the risc-v CPU, using the ALU result as the memory address and selecting memory data or the ALU result for the register.
Design PC branch logic with a PC increment adder for PC+4, a branch adder using the immediate value, and an AND-gate feeding the MUX to select the next PC.
Explore how multiplexers route register and immediate values through the alu and pc with control unit signals, detailing auipc, jal, lui, and j-type and u-type operations.
Connect and instantiate the top module by wiring PC, PC increment adder, instruction memory, register file, control unit, immediate generator, muxes, and branch adder.
Add the immediate generator, ALU and ALU control, wiring opcode, function 3/7, and build the PC, branch adder, memory, and write-back path with MUXes, including LUI handling.
Design and connect the module of a single-cycle riscv cpu using four muxes around the alu to select rd1/auipc and rd2/immediate, guiding pc and jal paths with the control unit.
Create a topTB test bench, instantiate the top module, initialize clock and reset, preload the instruction memory with hex instructions, and load them using readmemh from a C-generated hex file.
Execute the hex-encoded C instructions in the instruction memory to test the single-cycle RISC-V CPU; compile with iverilog, run vvp, and verify the register output.
Debug and verify a single-cycle RISC-V CPU by wiring a mux to select between adder and branch paths, testing with the waveform and validating register updates and C code execution.
You completed a single cycle disk vcore, built your own cpu, and ran c code on it. Learn to build a pipelined cpu core with upcoming disk vdesign.
Ever wondered how a CPU works at the signal level — not just conceptually, but truly inside?
This course is your step-by-step guide to building your own Single-Cycle RISC-V processor from scratch, using Verilog and industry-style RTL design methods.
We’ll start from the fundamentals — understanding the RISC-V ISA, instruction formats, and architecture flow — and gradually move toward creating a complete working CPU core capable of executing instructions, handling memory, and performing control operations.
By the end of this course, you’ll not only have a fully functional single-cycle RISC-V CPU, but also a deep understanding of processor internals — knowledge that directly translates into real-world RTL design and verification roles.
What You’ll Learn
Design and implement a Single-Cycle RISC-V processor in Verilog
Understand the RISC-V instruction formats and dataflow architecture
Create and integrate key modules — ALU, Control Unit, Register File, Memory, and more
Write testbenches to simulate and verify your CPU’s functionality
Gain industry-level exposure to RTL design flow and debugging techniques
Tools & Environment
Verilog (any simulator: ModelSim, Vivado, or online tools like EDA Playground)
RISC-V ISA reference
A text editor and logic-level curiosity
Who Is This Course For
Students and engineers interested in VLSI, RTL design, or computer architecture
Anyone who wants to build, not just learn about, a CPU
Beginners looking for a clear, hands-on start in RISC-V and digital design
Hardware enthusiasts who want to connect architecture theory with real implementation