This RISC-V processor is a simplified implementation supporting a restricted set of instructions and functionalities. It was developed as a final project for the Computer Architecture course.
The processor design represents a fundamental implementation adhering to the principles of the RISC-V architecture, specifically tailored to execute a constrained yet critical set of instructions. It encompasses a streamlined approach focusing on essential functionalities to achieve operational efficiency.
This RISC-V processor is structured with a limited instruction set, deliberately chosen to cover fundamental arithmetic, logic, memory access, and branching operations. The primary aim is to encapsulate core functionalities while maintaining simplicity in design and execution.
The processor's architecture embodies a 5-stage pipeline, allowing for sequential instruction execution through distinct stages: Instruction Fetch (IF), Instruction Decode (ID), Execute (EXE), Memory (MEM), and Write-back (WB). Each stage plays a pivotal role in processing instructions, managing data flow, and ensuring effective synchronization to enable efficient execution.
With a focus on simplicity and effectiveness, this processor design aims to demonstrate the core principles of RISC-V architecture, offering a foundational understanding of essential processor functionalities and pipeline structures.
- Instruction Set: Supports a subset of RISC-V instructions.
- Pipeline: Incorporates a basic pipeline structure, outlining the stages and their functionalities. The 5-stage pipelined RISC-V processor is designed with the following sequential stages:
- Fetches instructions from memory based on the program counter (PC).
- Determines PC values using control signals and the PC MUX.
- Writes fetched instructions onto the IF/ID Register at the negative edge.
- Contains seven modules, including the register file and immediate generator.
- Uses control signals from OpCode and funct-3 to determine further execution controls.
- Handles branching through a comparator and branch-related modules.
- Hosts the ALU (Arithmetic Logic Unit) and forwarding logic.
- Performs arithmetic/logic operations using operands obtained from preceding stages.
- Utilizes forwarding paths to mitigate Read-After-Write (RAW) hazards.
- Executes load/store instructions based on the address calculated in the EXE stage.
- Performs read/write operations on memory based on control signals (MemRead/MemWrite).
- Concludes an instruction's lifecycle.
- Uses a MUX to select data to be written into registers based on control signals (MemToReg).
Each stage is interconnected via registers, facilitating smooth information flow and synchronization between stages. Dedicated units such as the Hazard Detection Unit and Branch Controller manage hazards and mispredictions to ensure robust functionality within the pipeline.
- ALUOp: Provides simplified memory access and handling instructions.
| Operation | Description | Verilog Operation |
|---|---|---|
| 0 | AND | ALU_Result = A & B |
| 1 | OR | ALU_Result = A | B |
| 2 | ADD | ALU_Result = $signed(A) + $signed(B) |
| 3 | XOR | ALU_Result = A ^ B |
| 4 | SLL - Shift Left Logical | ALU_Result = (A << B) |
| 5 | SRL - Shift Right Logical | ALU_Result = (A >> B) |
| 6 | SUB | ALU_Result = $signed(A) - $signed(B) |
| 7 | LUI - Load Upper Immediate | ALU_Result = B |
| 8 | SLT - Set on Less Than | ALU_Result = (A < B) ? 1 : 0 |
