
지금까지 시간이 없어 포스팅은 제대로 하지 못했지만, 어느 정도 마음에 들게 구현했다. 구현 결과는 다음 링크에 있다.
https://github.com/liquetxnx/RV32I_single_cycle_processor
This project is clear.
2025/10 ~ 2026/1/15
LinuxGoals
None Goals
Harvard Architecture
Block Diagaram

Top module
- Control unit
- Data path
- PC(register)
- PC_next
- Instruction Memory(IM)
- Register File
- ALU
- ALU_Control
- Immediate Generation(ImmGen)
- Memory
- Branch_Unit
- Mux 2 to 1
- Mux 4 to 1
Instrution is stored by 1-byte little endians in IM.
- For example, Instruction 0x01020304 is stored by 04 03 02 01 in IM
Data Memory is stored by 1-word, so do not considered endians.
mem[8192][8] )8KBmem[word_index])16KBmem[4096][32]Note: Only word load/store are implemented:
lw,sw
Byte/halfword memory ops are not supported:lb/lh/lbu/lhu/sb/sh
| Type | Instructions | Status | Notes |
|---|---|---|---|
| R | add, sub, sll, slt, sltu, xor, srl, sra, or, and | ✅ | Full RV32I R-type ALU ops |
| I (ALU) | addi, slti, sltiu, xori, ori, andi, slli, srli, srai | ✅ | Shift-immediate included |
| I (Load) | lw | ✅ | Word only |
| S (Store) | sw | ✅ | Word only |
| B | beq, bne, blt, bge, bltu, bgeu | ✅ | Branch compare + PC redirect |
| U | lui, auipc | ✅⚠️ | Large constant / PC-relative AUIPC verification is not contained on verification |
| J | jal | ✅ | Link register writeback |
| I (Jump) | jalr | ✅ | Target = (rs1 + imm) & ~1 |
| RV32M | mul/div/rem* | ❌ | Not implemented |
Operate cpu by simple c code(prog.c) to verification.
All command except AUIPC is verified on tb_cpu.vcd
It is difficult to indicate AUIPC on C code in small memory(16KB)
Load and Store and JAL command are verified if verification are all passed.
To verify the CPU behavior without relying on waveform inspection, I used a memory-mapped signature array (sig[]) as a verification output buffer.
The program writes the results of key operations (ALU instructions, branches, loads/stores, jumps, etc.) into sig[], which is fixed at address 0x200 in data memory.
The stack pointer is initialized to 0x4000, so the stack grows downward while keeping the signature region safe from being overwritten.
With this setup, the testbench can simply monitor this small memory region and perform a direct comparison:
Deterministic and scalable testing: Instead of manually tracing internal signals, I can validate many instructions by checking a compact, fixed memory window.
Fast debugging: If a mismatch occurs, the failing signature index immediately shows which step or instruction sequence is incorrect, avoiding long waveform debugging sessions.
Overall, the signature array turns CPU verification into a simple PASS/FAIL memory comparison, making regression testing much more efficient and reproducible.
Verification_results

- **Target files** indicated verification is corrected. It store simple PASS/FAIL memory comparison.
trace.log

- prints register writeback events: pc(hex), reg_indx(deci), wdata(deci)
- prints store events: pc(hex), mem_addr(hex), wdata(deci)
- (cycle count is not printed)
waves_cpu.vcd

- waveform dump for debugging in GTKWave
First of all, you have to install gtkwave, iverilog, gcc compiler.
OS is Ubuntu.
makemake dumpprog.c code.make cleangtkwave waves_cpu_vcdmake command, open simulation wave form.Can't be runned on modern computer
- not implemented any CSRS command
- Limited memory (16KB)
- Not Piped-line and single core (too slow)
Next Goal
- To implement pipe-line, forwarding and hazard control cpu
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2026 Eunsang(liquetxnx)