Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
830d5b0
feat: initial commit, module file setup
tpcannon7 Nov 7, 2025
1230bd8
feat: semi skeleton code beginning for instruction cache, added L2 ca…
tpcannon7 Nov 12, 2025
b3fe5b3
feat: added i-cache module brief, changed branch name
tpcannon7 Nov 14, 2025
9d5671b
fix: put i-cache brief into correct folder in docs/ip-briefs
tpcannon7 Nov 14, 2025
4d72ecd
docs: axi_crossbar.md
XyzalAxel Nov 14, 2025
90012f9
feat: semi skeleton code for axi_crossbar
XyzalAxel Nov 14, 2025
56f419f
feat: semi skeleton with TODOs for axi_async_fifo.sv
XyzalAxel Nov 14, 2025
c503570
feat: init of axi_dcache_port.sv file setup
XyzalAxel Nov 14, 2025
5d28689
feat: added comments for axi_dcache_port.sv
XyzalAxel Nov 14, 2025
10011d8
feat: init of axi_dma.sv
XyzalAxel Nov 14, 2025
8ec9cff
feat: init of axi_icache_port.sv
XyzalAxel Nov 14, 2025
20d5698
feat: init of axi_to_axi_lite.sv
XyzalAxel Nov 14, 2025
f1ac2e4
Update axi_crossbar.sv
Skye135 Nov 14, 2025
34e5526
feat: update axi_crossbar.sv
XyzalAxel Nov 14, 2025
8973f64
feat: update axi_crossbar.sv
XyzalAxel Nov 14, 2025
a9cf7e7
Add files via upload
gavinwiese Nov 14, 2025
09aa41c
Add initial sv32_mmu module skeleton
sebasthechill Nov 14, 2025
4672c35
Update plic.sv
gavinwiese Nov 14, 2025
f87fa24
DMA Controller: Initial subsystem implementation
AirPodsRed Nov 15, 2025
96c5a00
feat: refined cache state machine, started with cache lookup block
tpcannon7 Nov 15, 2025
f246ea6
feat: added cache output logic
tpcannon7 Nov 15, 2025
1259ec1
fix: instruction output not registered, fixed from combinational to s…
tpcannon7 Nov 16, 2025
a2551d9
Merge pull request #32 from IEEE-UCF/mmu
Meowcaroni Nov 17, 2025
db09af9
Merge pull request #40 from IEEE-UCF/cache_branch
Meowcaroni Nov 17, 2025
0efc5f9
Merge pull request #42 from IEEE-UCF/RAM_Handler
Meowcaroni Nov 17, 2025
bcbdae4
Add pull request template
Meowcaroni Nov 17, 2025
12840a3
Merge pull request #44 from IEEE-UCF/I/O
Meowcaroni Nov 17, 2025
57aa62f
feat: updated axi_async_fifo.sv per request
XyzalAxel Nov 20, 2025
d67d77d
feat: update axi_crossbar.sv per requests
XyzalAxel Nov 20, 2025
e3dcd4e
Update plic.sv 2
gavinwiese Nov 21, 2025
0659bba
Update clint.sv
gavinwiese Nov 21, 2025
d6203e2
feat: rtl design for axi_async_fifo.sv
XyzalAxel Nov 26, 2025
42ad5aa
Add CPU Documentation
Meowcaroni Jan 13, 2026
443e827
Update plic.sv
gavinwiese Jan 23, 2026
3344a46
Update plic_module_brief_v0.2.md
gavinwiese Jan 23, 2026
5e7936b
Update clint_module_brief_v0.2.md
gavinwiese Jan 23, 2026
c3603cd
Add negedge reset in clint module
Meowcaroni Jan 26, 2026
80ebb82
Merge pull request #41 from IEEE-UCF/interrupts
Meowcaroni Jan 26, 2026
1574ae0
Add CPU Core One-Pagers
Meowcaroni Jan 29, 2026
dff810b
Update to axi_crossbar.sv
XyzalAxel Jan 29, 2026
a760112
Merge branch 'main' into bus_system
XyzalAxel Jan 29, 2026
0a5ca87
Fixes to axi_async_fifo.sv
XyzalAxel Jan 29, 2026
0b3ce18
Merge pull request #31 from IEEE-UCF/bus_system
Meowcaroni Jan 29, 2026
4a37b45
Add files via upload
ryanhansen640 Feb 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Description
Describe the changes made and why they were made.

## Related Issue(s)
Link or list the issue(s) this PR addresses (e.g., #123).

## Type
- [ ] Bug fix
- [ ] New feature
- [ ] Enhancement
- [ ] Documentation update
34 changes: 34 additions & 0 deletions FIFO_MANAGEMENT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

/***FIFO MANAGEMENT**/
// Internal FIFO memory, pointers, and counter
localparam ADDR_WIDTH = $clog2(FIFO_DEPTH);
reg [7:0] fifo_mem [0:FIFO_DEPTH-1];
reg [ADDR_WIDTH-1:0] waddr_ptr;
reg [ADDR_WIDTH-1:0] raddr_ptr;
reg [ADDR_WIDTH:0] count;
wire fifo_full = (count == FIFO_DEPTH);
wire fifo_empty = (count == 0);

// FIFO Push (write) and Pop (read) logic
always @(posedge clk or posedge rst) begin
if (rst) begin
waddr_ptr <= 0;
raddr_ptr <= 0;
count <= 0;
end
else begin
// Push data to FIFO (CPU write)
if (wvalid && awvalid && !fifo_full) begin
fifo_mem[waddr_ptr] <= wdata; // Write CPU data into FIFO
waddr_ptr <= waddr_ptr + 1; // Increment write pointer
count <= count + 1; // Increment FIFO count
end

// Pop data from FIFO (CPU read)
if (rready && arvalid && !fifo_empty) begin
RBR <= fifo_mem[raddr_ptr]; // Load data to read register
raddr_ptr <= raddr_ptr + 1; // Increment read pointer
count <= count - 1; // Decrement FIFO count
end
end
end
Binary file added docs/Gaming CPU Documentation & Style Guide.pdf
Binary file not shown.
85 changes: 85 additions & 0 deletions docs/ip-briefs/CPU_Core_Brief_(v1.0).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
**Author:** Sebastian Candelaria
**RTL:** *rtl/cpu/core/rv32_core.sv*

---
#### **Purpose & Role**
- The CPU Core is the main processing unit of the SoC, in charge of running all instructions from a given program and storing/loading memory data as needed
- 5-stage pipeline in RV32IMA (ISA-format) with M/S-mode (privilege levels)
- Built for a single-core system
---
#### **Parameters**
- Parameters in Verilog/SystemVerilog are similar to constants and #define directives seen in C/C++ that are reused many times across a module to avoid magic numbers and promote reusability

| Name | Default | Description |
| --------- | --------------- | ------------------------------------------------------------------------------------------------------ |
| HAS_M | 1 | Enable RV32M mul/div instructions |
| HAS_A | 1 | Enable LR/SC atomic instructions |

---
#### **Interfaces (Ports)**
- Any external input or output signal that will be used by the IF stage
- AXI, IRQ, and debug signal sizes must be defined
- Subject to change

| Signal Name | Direction | Width | Description |
| ------------------------ | --------- | ----- | ---------------------------------------------------------------------- |
| **Global Signals** | | | |
| clk_i | In | 1 | Main clock input |
| rst_ni | In | 1 | Active-low reset |
| | | | |
| **PLIC/CLINT Interface** | | | |
| irq_ext_i | In | 1 | Interrupt request from external device(s) (controller, keyboard, etc.) |
| irq_timer_i | In | 1 | Interrupt request from timer |
| irq_soft_i | In | N/A | |
| | | | |
| **AXI Interface** | | | |
| i_axi_* | I/O | N/A | Instruction AXI: Communicates with instruction cache |
| d_axi_* | I/O | N/A | Data AXI: Communicates with data cache |
| | | | |
| **Debug Interface** | | | |
| dbg_* | I/O | N/A | JTAG Signals for checking CPU behavior (Test Clock, Test Data, etc.) |
| | | | |

---
#### **Reset/Init**
- When performing a reset, the signal rst_ni becomes LOW (0), the CPU enters its default program ready state
- The program counter (PC) is set to the BootROM's beginning instruction
- The control-status registers (CSRs) are set to initial values, such as # of cycles elapsed = 0
- All data in the pipeline, including intermediate registers and the register file, is flushed (cleared)
---
#### **Behavior & Timing**
- Instruction Execution Order: The pipeline executes the instructions in-order, or in the sequence given by the program
- Data forwarding, consisting of signals backtracking to Decode (ID) stage, is used to handle dependencies between instructions (EX: Instruction 2 needs data provided by Instruction 1)
- Hazard/flush control is needed for when hazards become issues, such as an instruction
- Control Components: The core needs to minimize cycle losses from control flow changes (i.e. jumping instructions)
- Branch Target Buffer (BTB, optional): Table of instruction addresses recently visited, indicating whether they are more likely to be visited again upon a branch (if condition is true, jump to instruction) instruction
- Trap Vector Exception: Upon encountering a trap/error (EX: Division by zero), the CPU should immediately execute a subroutine at a vector (function's address) given by a table
---
#### **Programming Model**
- CLINT: *specs/registers/clint.yaml*
- PLIC: *specs/registers/plic.yaml*
---
#### **Errors/IRQs**
- Trap Vector Handling
- Exception Causes
- MCAUSE/MEPC Behavior
---
#### **Performance Targets**
- CPI: Average number of clock cycles taken to execute an instruction (>= 1)
- Goal: <= 2 cycles per instruction
- MIPS: # of millions of instructions per second
- Dependent on CPI and clock frequency
- Goal: >= 126.5 MIPS
---
#### **Dependencies**
- AXI: *rtl/bus/axi/axi_crossbar.sv*
- AXI connection to fetch instructions and data from memory hierarchy (ideally cache, main memory upon miss)
- PLIC/CLINT: *rtl/irq/clint.sv*, *rtl/irq/plic.sv*
- PLIC/CLINT send interrupts, signals for CPU to temporarily switch to execution of a function's instructions in the program, based on controller inputs, timer values, etc.
- MMU: *rtl/cpu/mmu/sv32_mmu.sv*
- Controls where/how instructions and data are loaded and stored
- RV32 Package: *rtl/cpu/pkg/rv32_pkg.sv*
---
#### **Verification Links**
- *sim/uvm/test_core.sv*
- SystemVerilog simulation environment to verify CPU core
67 changes: 67 additions & 0 deletions docs/ip-briefs/Decode_Stage_Brief_(v1.0).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
**Author:** Sebastian Candelaria
**RTL:** *rtl/cpu/core/decode.sv*

---
#### **Purpose & Role**
- The Instruction Decode (ID) stage is the 2nd stage in a standard 5-stage RISC-V pipeline. At each clock cycle, the decode stage translates an instruction into data values and control signals to direct the rest of the pipeline
- For any instructions involving register-reading, the decode stage will retrieve the data from the register file (RF)
- Any instruction operation codes (opcodes) or encoded immediate/constant values (imm values) are translated into control signals and real, usable values

---
#### **Parameters**
- Parameters in Verilog/SystemVerilog are similar to constants and #define directives seen in C/C++ that are reused many times across a module to avoid magic numbers and promote reusability
- Note: Inherited from `rv32_pkg.sv` and `rv32_core` top-level. See CPU Core Brief for HAS_M/HAS_A configuration.

| Name | Default | Description |
|-------------|---------|------------------------------------------------------|
| HAS_M | 1 | Enable RV32M instruction decoding |
| HAS_A | 1 | Enable RV32A instruction decoding |
| DATA_WIDTH | 32 | Operand width |

---
#### **Interfaces (Ports)**
- Any external input or output signal that will be used by the ID stage
- Subject to change

| Signal Name | Direction | Width | Description |
| ------------------------ | --------- | ----- | ---------------------------------------------------------------------- |
| **Global Signals** | | | |
| clk_i | In | 1 | Main clock input |
| rst_ni | In | 1 | Active-low asynchronous reset |
| | | | |
| **Semi-Global Signals** | | | |
| inst_i | In | 32 | Fetched instruction |
| rf_a_i | In | 32 | Register A operand (data) from RF |
| rf_b_i | In | 32 | Register B operand (data) from RF |
| rf_a_o | Out | 32 | Register A operand to execute (EX) stage |
| rf_b_o | Out | 32 | Register B operand to execute (EX) stage |
| ctrl_*_o | Out | N/A | Control signals to execute |
| | | | |

---
#### **Reset/Init**
- When performing a reset, the signal rst_ni becomes LOW (0), the CPU enters its default state
- All registers are flushed
- Control signals enter default values
---
#### **Behavior & Timing**
- One-Cycle Decode: Entire decode process should occur within one cycle
- Control Signals: Decode stage must produce control signals for following stages based on given instruction, likely through a control unit (CU) or FSM if needed
- Hazard/Flush: Upon encountering a pipeline hazard, such as branch calculation, decode should flush execute/memory stage
- Illegal instructions should raise a trap(error) cause, leading into trap subroutine execution
- Data Forwarding: Read output values from execute (EX) and memory (MM) stages and, if meant for register needed to read from, substitute values for next instruction's register data output. If data cannot be forwarded yet (EX: waiting on memory cache), stall until it can
---
#### **Errors/IRQs**
- Illegal Instruction Trap
---
#### **Performance Targets**
- 1-cycle execution
---
#### **Dependencies**
- Execute (EX): *rtl/bus/core/execute.sv*
- Memory (MM): *rtl/bus/core/mem_stage.sv*
- RV32 Package: *rtl/cpu/pkg/rv32_pkg.sv*
---
#### **Verification Links**
- *sim/uvm/test_decode.sv*
- SystemVerilog simulation environment to verify decode stage
71 changes: 71 additions & 0 deletions docs/ip-briefs/Execute_Stage_Brief_(v1.0).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
**Author:** Sebastian Candelaria
**RTL:** *rtl/cpu/core/execute.sv*

---
#### **Purpose & Role**
- The Execute (EX) stage is the 3rd stage in a standard 5-stage RISC-V pipeline. At each clock cycle, the execute stage performs arithmetic and logic operations on operand values.
- Conditional statement evaluation (thus redirects) occurs here
- Contains Arithmetic & Logic Unit (ALU) for basic operations (add, sub, shift, etc.) + multiplier and divider

---
#### **Parameters**
- Parameters in Verilog/SystemVerilog are similar to constants and #define directives seen in C/C++ that are reused many times across a module to avoid magic numbers and promote reusability
- Note: Inherited from `rv32_pkg.sv` and `rv32_core` top-level. See CPU Core Brief for HAS_M/HAS_A configuration.

| Name | Default | Description |
|-------------|---------|------------------------------------------------------|
| MUL_CYCLES | 3 | Multiplier latency in cycles |
| DIV_CYCLES | 5 | Divider latency in cycles |
| HAS_M | 1 | Enable mul/div hardware |

---
#### **Interfaces (Ports)**
- Any external input or output signal that will be used by the EX stage
- Subject to change

| Signal Name | Direction | Width | Description |
| ------------------------ | --------- | ----- | ---------------------------------------------------------------------- |
| **Global Signals** | | | |
| clk_i | In | 1 | Main clock input |
| rst_ni | In | 1 | Active-low asynchronous reset |
| | | | |
| **Local Signals** | | | |
| ctrl_*_i | In | N/A | Control signals to execute |
| op_a_i | In | 32 | Register A operand (data) from RF |
| op_b_i | In | 32 | Register B operand (data) from RF |
| alu_res_o | Out | 32 | ALU result from processing operands |
| branch_taken_o | Out | 1 | Control signal for whether branch should be taken |
| branch_target_o | Out | N/A | Address for branch to redirect program counter (PC) to |
| | | | |

---
#### **Reset/Init**
- When performing a reset, the signal rst_ni becomes LOW (0), the CPU enters its default state
- All registers are flushed
- Control signals enter default values
---
#### **Behavior & Timing**
- One-Cycle ALU: All ALU outputs should be available within one cycle of processing request
- Multi-Cycle Mul/Div: Multiplier and divider should take multiple cycles, requiring stalls until processing is finished
- Stalls should occur under busy/ready internal handshake signals (aka while working on operation, stall)
- Unique-Case FSM: A finite state machine (FSM), a sequential logic model for paths of outputs depending on inputs, should control output signals depending on specific operationctrl_*_os, such as initiating stalls upon multiply/divide and releasing at operation finish
- Redirect Signal: Upon determining branch output in one cycle, EX should send the result directly back to the fetch stage (IF) for the redirect to occur on the next cycle
- Memory Operations: All memory control signals and operations, unless needing execute, should bypass to MM stage on next cycle
- FENCE.I Side-Effects: Since FENCE.I replaces old instructions with new ones, this instruction should bypass to MM stage
---
#### **Errors/IRQs**
- Division By Zero
- Overflow Handling
---
#### **Performance Targets**
- CPU should stall for at most five cycles due to EX
- 1-cycle ALU, <= 5-cycle Mul/Div
---
#### **Dependencies**
- Memory (MM): *rtl/bus/core/mem_stage.sv*
- Writeback (WB): *rtl/bus/core/writeback.sv*
- RV32 Package: *rtl/cpu/pkg/rv32_pkg.sv*
---
#### **Verification Links**
- *sim/uvm/test_execute.sv*
- SystemVerilog simulation environment to verify execute stage
Loading