This workshop provides a comprehensive hands-on introduction to RISC-V processor design. By the end of the day, you will have implemented and verified a working RV32I single-cycle processor in SystemVerilog.
- Basic SystemVerilog syntax
- Digital logic fundamentals (datapath, control)
- Familiarity with simulation tools (ModelSim, Vivado, Icarus Verilog, or EDAPlayground)
By the end of this workshop, you will be able to:
- Understand the RISC-V ISA (RV32I subset)
- Convert C code to RISC-V assembly and machine code
- Build a single-cycle processor datapath and control logic
- Simulate and verify processor behavior
- Write SystemVerilog testbenches
| Time Slot | Session | Content Summary |
|---|---|---|
| 09:00 β 10:00 | Session 1 β RISC-V Introduction | ISA basics, formats, instruction types |
| 10:00 β 10:15 | Break | |
| 10:15 β 12:15 | Session 2 β Assembly Programming | C to ASM, machine code, instruction memory |
| 12:15 β 12:45 | Break | |
| 12:45 β 13:45 | Session 3 β Processor Architecture | Datapath, control unit, signal flow |
| 13:45 β 14:45 | Session 4 β RTL Implementation | RTL modules, integration, signal wiring |
| 14:45 β 15:00 | Break | |
| 15:00 β 16:00 | Session 5 β Verification & Testing | Testbenches, module testing, debugging techniques |
rv-workshop/
βββ slides/
β βββ workshop\_slides.tex / .pdf
βββ project\_(student\_name)/
β βββ rtl/
β β βββ riscv\_processor.sv
β β βββ alu.sv
β β βββ branch\_unit.sv
β β βββ control.sv
β β βββ immgen.sv
β β βββ imem.sv
β β βββ dmem.sv
β β βββ pc.sv
β β βββ register\_file.sv
β βββ testbenches/
β βββ tb\_alu.sv
β βββ tb\_register\_file.sv
β βββ tb\_control.sv
β βββ tb\_dmem.sv
β βββ tb\_imem.sv
β βββ tb\_processor.sv
βββ examples/
β βββ assembly\_examples/
β βββ c\_to\_assembly/
β βββ machine\_code/
βββ README.md
π Each student should rename their folder to
project_<yourname>before submission.
git clone https://github.com/meds-uet/rv-workshop.git
cd risc-v-workshopvlog rtl/*.sv testbenches/tb_processor.sv
vsim tb_processor
run -alliverilog -g2012 -o processor_tb rtl/*.sv testbenches/tb_processor.sv
vvp processor_tbTo run on EDAPlayground:
- Visit: https://www.edaplayground.com/
- Select SystemVerilog (IEEE 1800-2012) as language
- Choose simulator: Synopsys VCS, ModelSim, or Icarus Verilog
- Paste RTL code into the left code editor (create multiple tabs for each
.sv) - Paste the corresponding testbench in the right-hand testbench editor
- Click "Run"
π‘ You can also use EDAPlayground's "Add Design File" button to organize modules.
During the workshop, you will:
- Complete the skeleton RTL modules
- Fill in missing logic in
alu,immgen,control, and more - Write or modify testbenches to test individual modules
- Run simulations and validate outputs
- Debug and improve your design
Ensure the following before submission:
- All RTL modules compile and simulate correctly
- Testbenches verify core instructions
- Register file and memory behaviors are tested
- Your project folder is renamed to
project_<yourname> - Youβve tested at least 5 instructions end-to-end
add, sub, and, or, xor, sll, srl, sra, slt, sltu
addi, andi, ori, xori, slli, srli, srai, slti, sltiu, lw
sw
beq, bne, blt, bge, bltu, bgeu
lui, auipc
jal, jalr
- SystemVerilog simulator (ModelSim, Vivado, Icarus Verilog, or EDAPlayground)
- Code editor or IDE (VSCode, Sublime, etc.)
- Git (optional but recommended)
| Issue | Possible Cause | Suggested Fix |
|---|---|---|
| β Simulation error | Missing wires/ports | Double-check module interfaces |
| β Unexpected output | Wrong control signals | Debug control.sv, verify testbench |
| β No register update | x0 register written | Ensure wa != 5'b00000 in register file |
| β PC stuck | PC not updating | Verify reset & clock logic in pc.sv |
Found a bug or want to improve?
- Fork the repo
- Create a branch (
feature/my-fix) - Submit a pull request
This project is licensed under the Apache License 2.0. See LICENSE file for details.
- Instructor: Umer Shahid
- GitHub Issues: Please raise questions or report issues on the workshop repo
- RISC-V International for the open architecture
- SystemVerilog and open-source tool communities
- Contributors and mentors who reviewed this material
Workshop developed by Maktab e Digital Systems (MEDS)