How abhinavtiwari32/risc-v works
Project type and purpose
• This is a hardware‐design project: a 32-bit RISC-V processor implementing a pipelined datapath in Verilog.
• Its purpose is to fetch, decode, execute, access memory, and write back RISC-V instructions in hardware, including forwarding logic.
File structure
• Top-level files:
• RISCV_TOP.v – the top-level wrapper that instantiates and wires together all submodules
• RISC_V_tb.v – testbench for functional verification
• inst.hex – instruction memory contents
• Compute units and helpers:
• ALU.v, ALU_Control.v, AND_logic.v, ImmGen.v, Mux.v, 3_to_1_mux.v
• Pipeline registers:
• IFID_Reg.v, IDEXE_Reg.v, EXMEM_Reg.v, MEMWB_Reg.v
• Control and hazard units:
• Control_Unit.v, Forwarding_unit.v
• Memories and register file:
• Instruction_Memory.v, Data_Memory.v, Program_Counter.v, PCplus4.v, Register_File.v
• Simulation artifacts (.vcd, .out) and configuration (inst.hex)
Key insights from the README
• Confirms a 32-bit single-cycle RISC-V architecture, though the presence of pipeline registers and a forwarding unit indicates a pipelined implementation.
a. Main components to show as blocks
1. Instruction Fetch Stage
– Program Counter (PC)
– PCplus4 unit
– Instruction Memory
– IF/ID pipeline register
2. Instruction Decode Stage
– Register File
– Immediate Generator
– Control Unit
– Hazard detection/Forwarding Unit inputs (for control signals)
– ID/EX pipeline register
3. Execute Stage
– ALU (with inputs from muxes and ALU Control)
– ALU Control submodule
– MUXes for selecting register/immediate/forwarded operands
– EX/MEM pipeline register
4. Memory Stage
– Data Memory
– EX/MEM outputs feeding memory address/data
– MEM/WB pipeline register
5. Write-Back Stage
– MUX selecting memory data vs. ALU result
– Register File write port
b. Relationships and data/control flow
– Overlay control paths: Control Unit outputs go to mux select lines, memory enable, reg file write enable.
– Show forwarding unit tapping EX/MEM and MEM/WB outputs back to mux inputs in the Execute stage.
c. Architectural patterns and design principles
– Five-stage pipeline (IF, ID, EX, MEM, WB)
– Hazard mitigation through forwarding
– Single instruction per cycle throughput after pipeline fill
d. Technologies, frameworks, libraries
– Verilog modules, hierarchical instantiation
– Testbench for functional verification (likely run with Icarus/ModelSim)
– inst.hex used to initialize instruction memory