
Explore how a RISC-V RV32i CPU is implemented in VHDL from scratch, covering ISA concepts, hardware design, and the full software stack from bare metal C firmware to SoC integration.
Identify the tools and environment to reproduce the project: spartan 6 fpga, riscv gcc toolchain, python scripts, simulator and wave viewer, and uart and eight leds.
Learn how a CPU, a deterministic hardware core with a control unit and arithmetic and logic unit, interfaces memory and input and output, and implements the RISC-V instruction set architecture.
Define the instruction set architecture (ISA) as a specification of instructions, registers, memory model, and control behavior independent of CPU implementation, covering data formats and bitwidth in RISC-V RV32i.
Explore the rv32i base ISA of RISC-V, a 32-bit word size with 32 registers, a load-store architecture, fixed 32-bit little-endian instructions, and optional extensions such as m, a, f, c.
Explore the program counter in rv32i: a 32-bit, byte-addressed register that holds next instruction address, must be 4-byte aligned, and increments by 4 or redirects via branches, jumps, and traps.
Explore RV32i registers as fast storage for data and intermediate results. Learn about 32 32-bit integer registers x0 to x31 and the zero register that always reads zero.
Explore the RV32i memory model: byte addressable, 32-bit address space, little-endian, and a load-store architecture where only load and store instructions access memory, with byte, half, and word accesses.
Explore RV32i fixed 32-bit encoding and regular field placement to simplify decoding, learn instruction types and how opcode, rs1, rs2, funct3, funct7, and immediates define operations with 4-byte alignment.
Discover assembly syntax for a risc-v design, cover the general instruction format, registers x0 to x31, immediates, memory operands with offset and base address, labels, and comments.
Explore R-type instructions in RV32i, performing register-to-register operations using rs1, rs2, and rd, including add, sub, xor, or, and, shifts, and set less than and set less than unsigned variants.
Demonstrate how i-type instructions perform operations between a register and a 12-bit sign-extended immediate in rv32i, including addi, loads, jalr, ecall, and ebreak.
Explain store type instructions for data memory: byte, half, word. Show rs1 as the address, rs2 as the data, and the alu computes address as rs1 plus the sign-extended immediate.
explain branch instructions in a riscv-like design, cover branch types such as equal, not equal, less than, greater or equal, and unsigned variants, and show counter updates using split-immediate reconstruction.
Explore the rv32i jump instruction (j type) that updates the pc with an immediate, stores the return address in rd, and requires reloading that value to continue after function call.
Use upper-type instructions to access 32-bit addresses. LUI loads the upper 20 bits; AUIPC adds them to PC to enable jumps to far addresses and work with big numbers.
Analyze an rv32i assembly exercise step by step, practicing add and immediate types, branch not equal, store and load word, and memory verification to ensure compliance with the rv32i isa.
Explains rv32i exceptions and interrupts, synchronous versus asynchronous events, saving state in CSR like MEPC, MCAUSE, MSTATUS, and resuming from the saved PC after a brief handler.
Learn how rv32i multiplies numbers using a shifts-and-add algorithm when the m extension is unavailable, including decomposing y into powers of two and a software mulsi3 helper.
Learn how RV32i forms the minimum RISC-V base, with open modular isa and optional extensions, while rtl faithfully implements the isa and maps to a system-on-chip.
Explore the top-level design of a RISC-V RV32i CPU in VHDL, detailing its interface to instruction and data memory, the PC, decoder, register file, and control unit.
Explore how the instruction memory is built in Vhdl, using the memory package and auto-generated instruction and data rom files, with word-addressing, 32-bit alignment, and nop handling.
Examine data memory operation in a RISC-V CPU: byte, half-word, and word access, address-relative calculations, and how RAM and ROM outputs are selected and aligned for reads and writes.
Learn how the decoder extracts a 32-bit instruction into opcode, rd, rs1, rs2, funct3, funct7, and the sign-extended immediate across r-type, i-type, u-type, s-type, branch, j-type, and g-type formats.
Examine the register file and memories, including the 32x32 register array, reset logic to zero, one-cycle writes to rd, and zero-cycle reads from rs1 and rs2.
Describe the arithmetic and logic unit as combinational module controlled by the control unit, performing add, subtract, less-than (signed and unsigned), and, or, xor, shifts with 5-bit amount, and pass-through.
Explain the control unit implementation using the cpu package to produce jump, branch, and ALU signals from opcode, function3, function7, and ALU results.
Implement the full CPU top level in VHDL, wiring the decoder, control unit, reg file, and ALU with PC logic and instruction and data memory interfaces.
Explore the application binary interface, learn how software uses registers, passes arguments, and handles function calls, stack frames, and binary interfaces in a RISC-V context.
Clarify the register usage convention defined by the ABI, mapping A0-A7 to X10-X17 and X5-X7, X28-X31 as temporaries, and X1 as the return address.
Explore data representation under the ABI, including type sizes, alignment, and endianness, and examine structure layout with padding in a RISC-V context.
Understand how memory layout organizes code and data into text, read-only data, data, and bss, with heap and stack in a 32-bit rv32i address space.
Learn to write a linker script that defines memory regions and places sections like text and data. Understand vma and lma, and how startup code copies data between them.
Startup code runs after reset, sets the stack pointer, copies data from ROM to RAM, and zeroes bss before calling main, dependent on the linker script and correct VMA/LMA.
Explore how the stack supports function calls in a RISC-V ABI, detailing the stack pointer SP, downward-growing memory, stack frames, and saved registers for arguments and return addresses.
Explore how the RISC-V ABI defines the function call convention. Apply the caller and callee responsibilities, including argument placement in A0–A7, 16-byte stack alignment, and returning values in A0.
Demonstrate stack usage as a main calls f with three arguments, detailing prologue and epilogue, stack frame setup, argument passing, and return address management.
Understand how stack overflow happens in a RISC-V CPU as stack frames grow downward, driven by recursion or large locals, and prevent it with canaries and monitoring.
Inspect a RISC-V program with objdump, nm, readelf, and size to view section sizes, symbols, addresses, and disassembly, then separate text from read-only data for memory planning.
Explore how RV32i unit tests are integrated into a VHDL testbench, using semi-hosting calls to report pass or fail and validating instructions like add across a 32-bit RV32i CPU.
this lecture explains unit testing the riscv add instruction, using a test macro, and generating elf and bin outputs via a shared linker script and makefile for the test bench.
Explore how a VHDL-based RISC-V CPU testbench validates instruction execution, decodes mnemonics, dumps nonzero registers, and detects pass or fail via timeout, using a makefile for automated tests.
Navigate the RISC-V testbench by executing tests, updating x3, x11, x12, and x7, and verifying x14 equals x7 with a fail branch, using waves to debug or ALU operations.
Explore a unit test simulation of a RISC-V CPU in VHDL, focusing on test 3 and tracing register writes, ALU operations, and instruction flow.
Explore how a system-on-chip combines a CPU core, memory, interconnect, and peripherals on a single chip, enabling software to run with memory mapped IO and interrupts.
Build a 32-bit riscv rv32i soc with instruction and data roms, a custom bus, uart, and gpio LEDs, and integrate a prebuilt uart ip into the project.
This lecture presents the firmware for the cpu demonstration, detailing the startup code that toggles a 0400 led and the print booting routine that bridges software and hardware.
Implement a system on chip as a bridge between the CPU and peripherals, mapping memory to data memory, instruction memory, UART, and LEDs via a configurable I/O memory interface.
Explore how UART, a two-port serial interface, enables debugging and prints by transmitting a start bit, eight data bits, and a stop bit at a defined baud rate.
Implement the top level for the SoC with clock, reset, and serial TX/RX interfaces. Specify synthesis constraints and the constraint file, and explain clock wizard usage, FPGA mode, and simulation.
simulate a system-on-chip with a test bench for UART at 19200 baud. monitor LEDs and UART in ModelSim, and observe booting text and memory ready timing before FPGA deployment.
Demonstrates synthesizing a soc on an fpga with ise, generating the bitstream, and notes memories inferred as lookup tables from asynchronous reads, highlighting timing concerns and a 10 mhz clock.
Demonstrates loading a bitstream, switching the FPGA to serial mode, and running a C program on a rv32i cpu that prints boot messages via uart at 19200 baud.
This course guides you from the riscv isa to hardware, showing how the rv32i cpu is defined by its isa and realized as real hardware on a system-on-chip.
Design a RISC-V CPU from scratch — and run it on FPGA.
This course takes you step by step through the complete design of a RISC-V CPU in VHDL, starting from RISC-V specification and ending with a fully working System on Chip built around the RISC-V CPU and running C firmware on FPGA.
You will start by implementing a RISC-V CPU from scratch, learning how instructions are decoded, executed, and connected to memory at the RTL level. The design then evolves into a complete System-on-Chip, where you will integrate peripherals, define the memory map, and connect hardware to software.
A key focus of the course is the hardware–software interface. You will learn how bare-metal software actually works, including stack initialization, linker scripts, startup code, and C firmware integration. To ensure correctness and confidence, the CPU is validated using unit tests and simulations before moving to FPGA.
By the end of this course, you will be able to:
Design a RISC-V CPU in VHDL from scratch
Verify your design with unit tests and simulation
Build and understand a complete RISC-V SoC
Write and run C firmware on your own processor
Use linker scripts, stack setup, and startup code
Deploy and test your design on FPGA
This course is ideal for:
FPGA and ASIC engineers seeking deep CPU design knowledge
Embedded software engineers wanting to understand what runs below C
Students aiming to build a strong, differentiating hardware project
Anyone who wants a true end-to-end RISC-V learning experience