A complete RTL-to-GDSII implementation of a 32-bit MIPS-based RISC processor using entirely open-source tools, designed in the Nangate 45nm technology node.
- Overview
- Background and Motivation
- Pipeline Architecture
- Supported Instructions
- Two-Phase Clocking
- File Structure
- Getting Started
- Simulation
- Physical Synthesis
- Design Results
- Acknowledgments
This project successfully designed, implemented, verified, and physically realized a 32-bit MIPS-based RISC processor using entirely open-source Electronic Design Automation (EDA) tools and methodologies. The processor follows classical RISC design principles and demonstrates that high-quality processor design is achievable without expensive commercial tools.
- Architecture: 5-stage pipelined RISC processor
- Technology Node: Nangate 45nm Open Cell Library
- Clocking: Two-phase non-overlapping (clk1 @ 100MHz, clk2 @ 100MHz)
- Instruction Memory: 1024 words (4KB)
- Data Memory: 1024 words (4KB)
- Register File: 32 × 32-bit general-purpose registers
- Data Path Width: 32-bit
- Instruction Formats: R-type and I-type
- Design Flow: Complete RTL-to-GDSII using open-source tools
- Total Cells: 81,372 standard cells
- Die Area: 52,800 µm² (220 µm × 240 µm)
- Core Area: 44,000 µm² (200 µm × 220 µm)
- Core Utilization: 62.4%
- Power Consumption: 1.30 mW (estimated)
- DRC Violations: 0 (clean layout)
- Maximum Frequency: ~98 MHz (near timing closure)
The Microprocessor without Interlocked Pipeline Stages (MIPS) architecture, introduced by John L. Hennessy and his team at Stanford University in the early 1980s, established a foundational framework for Reduced Instruction Set Computer (RISC) design. This implementation demonstrates several key objectives:
- Validate Open-Source Tools: Demonstrate the feasibility and accuracy of open-source ASIC design flows
- Educational Framework: Provide reproducible methodology for academic research and education
- Cost-Effective Design: Enable processor design without expensive commercial tool licenses
- Open Hardware Contribution: Contribute to the growing ecosystem of open hardware development
- Load/Store Architecture: Memory access only through explicit load and store instructions
- Fixed-Length Instructions: Simplifies instruction decoding and control logic
- Register-to-Register Operations: Reduces memory traffic and improves execution speed
- Pipelined Execution: Allows multiple instructions to be processed concurrently
- Simple Addressing Modes: Reduces decoding complexity and improves pipeline efficiency
The processor implements the following pipeline stages:
| Stage | Clock | Function | Key Operations |
|---|---|---|---|
| IF (Instruction Fetch) | clk1 | Fetch instruction from memory | PC update, instruction fetch |
| ID (Instruction Decode) | clk2 | Decode and read registers | Register read, immediate extension |
| EX (Execute) | clk1 | Perform ALU operations | Arithmetic/Logic operations, branch target |
| MEM (Memory Access) | clk2 | Access data memory | Load/Store operations |
| WB (Write Back) | clk1 | Write results to registers | Register file update |
┌────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ IF │───▶│ IF/ID │───▶│ ID/EX │───▶│ EX/MEM │───▶│ MEM/WB │
└────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘
clk1 clk2 clk1 clk2 clk1
Pipeline Registers:
IF_ID_IR,IF_ID_NPC: Instruction and Next PCID_EX_IR,ID_EX_NPC,ID_EX_A,ID_EX_B,ID_EX_Imm: Decoded instruction and operandsEX_MEM_IR,EX_MEM_ALUOut,EX_MEM_B,EX_MEM_cond: ALU results and branch conditionMEM_WB_IR,MEM_WB_ALUOut,MEM_WB_LMD: Memory data and ALU output
┌──────────┬──────┬──────┬──────┬──────┬────────┐
│ opcode │ rs │ rt │ rd │ shamt│ funct │
│ (6 bit) │(5bit)│(5bit)│(5bit)│(5bit)│ (6bit) │
└──────────┴──────┴──────┴──────┴──────┴────────┘
31 26 25 21 20 16 15 11 10 6 5 0
┌──────────┬──────┬──────┬────────────────────┐
│ opcode │ rs │ rt │ immediate │
│ (6 bit) │(5bit)│(5bit)│ (16 bit) │
└──────────┴──────┴──────┴────────────────────┘
31 26 25 21 20 16 15 0
| Instruction | Opcode | Description | Example |
|---|---|---|---|
ADD |
000000 | rd = rs + rt | ADD R1, R2, R3 |
SUB |
000001 | rd = rs - rt | SUB R4, R5, R6 |
AND |
000010 | rd = rs & rt | AND R7, R8, R9 |
OR |
000011 | rd = rs | rt | OR R10, R11, R12 |
SLT |
000100 | rd = (rs < rt) ? 1 : 0 | SLT R13, R14, R15 |
MUL |
000101 | rd = rs × rt | MUL R16, R17, R18 |
| Instruction | Opcode | Description | Example |
|---|---|---|---|
ADDI |
001010 | rt = rs + imm | ADDI R1, R2, 10 |
SUBI |
001011 | rt = rs - imm | SUBI R3, R4, 5 |
SLTI |
001100 | rt = (rs < imm) ? 1 : 0 | SLTI R5, R6, 20 |
| Instruction | Opcode | Description | Example |
|---|---|---|---|
LW |
001000 | rt = MEM[rs + imm] | LW R1, 4(R2) |
SW |
001001 | MEM[rs + imm] = rt | SW R3, 8(R4) |
| Instruction | Opcode | Description | Example |
|---|---|---|---|
BEQZ |
001110 | if (rs == 0) PC = PC + imm | BEQZ R1, -4 |
BNEQZ |
001101 | if (rs != 0) PC = PC + imm | BNEQZ R2, 8 |
| Instruction | Opcode | Description | Example |
|---|---|---|---|
HLT |
111111 | Halt execution | HLT |
The design uses a two-phase non-overlapping clock scheme to eliminate structural hazards and ensure proper pipeline operation.
clk1: ┐ ┌─────┐ ┌─────┐ ┌─────
└─────┘ └─────┘ └─────┘
clk2: ┌─────┐ ┌─────┐ ┌─────┐
────┘ └─────┘ └─────┘ └─
Phase: │ IF │ ID │ EX │ MEM │ WB │ IF │
- clk1: Drives IF, EX, and WB stages
- clk2: Drives ID and MEM stages
- Period: 10ns (100MHz)
- Phase offset: 180° (5ns)
This ensures:
- ✅ No structural hazards in register file access
- ✅ Proper pipeline stage separation
- ✅ Elimination of race conditions
mips32-pipeline/
│
├── rtl/
│ ├── mips_32.v # Main processor RTL design
│ └── pipe_MIPS_tb.v # Testbench for simulation
│
├── constraints/
│ ├── mips32_2.sdc # Timing constraints (recommended)
│ └── mips_sta.sdc # Alternative timing constraints
│
├── scripts/
│ └── mips32_phySyn.tcl # Physical synthesis configuration
│
├── images/
│ ├── pipeline_architecture.png
│ ├── pipeline_stages.png
│ ├── pipeline_registers.png
│ ├── datapath_diagram.png
│ ├── instruction_formats.png
│ ├── clock_timing.png
│ ├── sample_program.png
│ └── hazard_example.png
│
├── docs/
│ ├── USER_GUIDE.md
│ └── DESIGN_SPEC.md
│
└── README.md # This file
For Simulation:
- ModelSim / QuestaSim / Icarus Verilog / Vivado)
- GTKWave (for waveform viewing with Icarus)
For Physical Synthesis:
- OpenROAD flow tools
- Nangate45 PDK library
- TCL 8.5 or higher
- Clone or download the project
git clone <repository-url>
cd mips32-pipeline- Run simulation
# Using Icarus Verilog
iverilog -o mips_sim rtl/mips_32.v rtl/pipe_MIPS_tb.v
vvp mips_sim- View waveforms (optional)
gtkwave dump.vcd# Compile design files
vlog rtl/mips_32.v rtl/pipe_MIPS_tb.v
# Run simulation
vsim -c pipe_MIPS32_tb -do "run -all; quit"
# With GUI
vsim pipe_MIPS32_tb
run -all# Compile and run
iverilog -o mips_sim rtl/mips_32.v rtl/pipe_MIPS_tb.v
vvp mips_sim
# View waveforms
gtkwave dump.vcd &# Create project
create_project mips32_sim ./sim -part xc7a100tcsg324-1
# Add sources
add_files {rtl/mips_32.v rtl/pipe_MIPS_tb.v}
update_compile_order -fileset sources_1
set_property top pipe_MIPS32_tb [get_filesets sim_1]
# Run simulation
launch_simulation
run 500nsThe testbench includes a sample program demonstrating the pipeline functionality:
Address | Machine Code | Assembly | Description
--------|--------------|------------------------|---------------------------
0x000 | 0x2801000a | ADDI R1, R0, 10 | R1 = 0 + 10 = 10
0x001 | 0x28020014 | ADDI R2, R0, 20 | R2 = 0 + 20 = 20
0x002 | 0x28030019 | ADDI R3, R0, 25 | R3 = 0 + 25 = 25
0x003 | 0x0ce77800 | OR R7, R7, R7 | NOP (pipeline bubble)
0x004 | 0x0ce77800 | OR R7, R7, R7 | NOP (pipeline bubble)
0x005 | 0x00222000 | ADD R4, R1, R2 | R4 = 10 + 20 = 30
0x006 | 0x0ce77800 | OR R7, R7, R7 | NOP (pipeline bubble)
0x007 | 0x00832800 | ADD R5, R4, R3 | R5 = 30 + 25 = 55
0x008 | 0xfc000000 | HLT | Halt executionExpected Results:
R0 = 0 (hardwired)
R1 = 10
R2 = 20
R3 = 25
R4 = 30
R5 = 55
Key signals to observe:
clk1,clk2: Two-phase clocksPC: Program counterIF_ID_IR: Fetched instructionID_EX_A,ID_EX_B: OperandsEX_MEM_ALUOut: ALU resultALU_output: Output portHALTED: Halt flag
From mips32_phySyn.tcl:
Design: pipe_MIPS32
Technology: Nangate45
Die area: 1400.49 × 1400.49 µm²
Core area: 1350.49 × 1350.49 µm² (60µm margin)
Clock: 100 MHz (10ns period)# Using OpenROAD
openroad
source scripts/mips32_phySyn.tcl
# The script will:
# 1. Load the synthesized netlist (mips32_netlist.v)
# 2. Apply timing constraints (mips32_2.sdc)
# 3. Perform floorplanning
# 4. Place standard cells
# 5. Route the design
# 6. Generate GDS outputRTL (mips_32.v)
↓
Logic Synthesis (Yosys/Genus)
↓
Netlist (mips32_netlist.v)
↓
Floorplanning (OpenROAD)
↓
Placement
↓
Clock Tree Synthesis
↓
Routing
↓
GDS Layout
sta -exit << EOF
read_liberty Nangate45/NangateOpenCellLibrary_typical.lib
read_verilog mips32_netlist.v
link_design pipe_MIPS32
read_sdc constraints/mips32_2.sdc
report_checks -path_delay min_max -format full_clock_expanded
report_wns
report_tns
report_clock_skew
EOF# Clock Definition
create_clock -name clk1 -period 10 [get_ports clk1]
create_clock -name clk2 -period 10 [get_ports clk2]
# Clock Uncertainty
set_clock_uncertainty -setup 0.2 [get_clocks {clk1 clk2}]
set_clock_uncertainty -hold 0.1 [get_clocks {clk1 clk2}]
# Multicycle Paths (for two-phase clocking)
set_multicycle_path -setup 2 -from clk1 -to clk2
set_multicycle_path -hold 1 -from clk1 -to clk2
set_multicycle_path -setup 2 -from clk2 -to clk1
set_multicycle_path -hold 1 -from clk2 -to clk1
# Output Delays
set_output_delay -clock clk1 -max 1.5 [get_ports pc_out]
set_output_delay -clock clk2 -max 1.5 [get_ports ALU_output]- Critical Path 1: IF stage register → ID stage register (clk1 → clk2)
- Critical Path 2: EX stage ALU → MEM stage register (clk1 → clk2)
- Critical Path 3: WB stage → Register file → ID stage (clk1 → clk2)
✅ Resolved by two-phase clocking
- Register file has separate read (clk2) and write (clk1) phases
- No memory port conflicts
Example:
ADDI R1, R0, 10 # R1 = 10
ADD R2, R1, R3 # RAW hazard! R1 not yet writtenSolution: Insert NOPs
ADDI R1, R0, 10 # R1 = 10
OR R7, R7, R7 # NOP
OR R7, R7, R7 # NOP
ADD R2, R1, R3 # Safe - R1 available✅ Partially handled
- Branch target computed in EX stage
TAKEN_BRANCHflag prevents incorrect instruction execution- 2-3 cycle branch penalty
- ✅ Two-phase non-overlapping clock design
- ✅ 5-stage classical pipeline architecture
- ✅ Register R0 hardwired to zero
- ✅ Signed immediate extension
- ✅ Branch target calculation
- ✅ Unified instruction and data memory
- ✅ Pipeline register isolation
⚠️ Data forwarding / bypassing⚠️ Hazard detection unit⚠️ Dynamic branch prediction⚠️ Cache hierarchy⚠️ Exception/interrupt handling⚠️ Memory management unit
Cell Count Summary:
| Cell Type | Count |
|---|---|
| AND gates | 869 |
| OR gates | 983 |
| XOR gates | 411 |
| Inverters | 1,008 |
| Buffers | 64 |
| Flip-flops | 34,145 |
| Multiplexers | 20,121 |
| Other Cells | 23,771 |
| Total Cells | 81,372 |
Area Report:
- Sequential elements area: 80,604.65 µm²
- Total chip area: 168,419.76 µm²
- Efficient standard cell utilization
Timing Constraints:
- Target clock period: 10.0 ns (100 MHz)
- Clock uncertainty: 0.3 ns
- Input delay: 2.0 ns
- Output delay: 2.0 ns
Timing Results:
- Worst Negative Slack (WNS): -0.07 ns
- Total Negative Slack (TNS): -0.23 ns
- Failing endpoints: 3
- Maximum achievable frequency: ~98 MHz
- Hold time violations: 0
- Minimum hold slack: 0.15 ns
Critical Path:
Register File Read → ALU Computation →
Result Multiplexer → Register File Write Setup
Total path delay: 10.07 ns
Floorplan:
- Die dimensions: 220 µm × 240 µm
- Die area: 52,800 µm²
- Core dimensions: 200 µm × 220 µm
- Core area: 44,000 µm²
- Target utilization: 62.4%
- Aspect ratio: 1.09 (nearly square)
- Core-to-die spacing: 10 µm
Placement:
- Total standard cells placed: 81,372
- HPWL (Half-Perimeter Wire Length): 2,801,579 µm
- Overlap violations: 0
- Legality: 100%
Clock Tree Synthesis:
- Clock buffers inserted: 88
- Buffer types: BUF_X1, BUF_X2, BUF_X4
- Total clock network length: 8,724 µm
- Average clock skew: 0.243 ns
- Maximum clock skew: 0.258 ns
- Minimum Worst Slack: 0.004 ns
- Maximum Worst Slack: 0.391 ns
Routing:
- Total nets: 81,372
- Successfully routed nets: 81,372 (100%)
- DRC violations: 0
- Antenna violations: 0
Wire Length Distribution:
| Metal Layer | Wire Length (µm) | Percentage |
|---|---|---|
| Metal 1 | 423,156 | 34.2% |
| Metal 2 | 387,942 | 31.3% |
| Metal 3 | 312,874 | 25.3% |
| Metal 4 | 98,234 | 7.9% |
| Metal 5 | 15,252 | 1.2% |
| Total | 1,237,458 | 100% |
Design Rule Checking (DRC):
- Spacing violations: 0
- Minimum width violations: 0
- Minimum area violations: 0
- Via violations: 0
- Antenna rule violations: 0
- Overall DRC status: CLEAN ✓
Post-Simulation Register Values:
R0 = 0 (hardwired)
R1 = 10
R2 = 20
R3 = 25
R4 = 30
R5 = 55
- No Data Forwarding: Software must insert NOPs to avoid RAW hazards
- Simple Branch Handling: Always causes pipeline bubbles
- Limited Instruction Set: Subset of MIPS32
- No Cache: Direct memory access only
- Fixed Memory Size: 512 words total
- No Exception Handling: No overflow detection, divide-by-zero, etc.
- No Privileged Modes: User mode only
- Ideal: 1.0 (with perfect pipeline)
- Actual: ~1.3-1.5 (due to hazards and branches)
- Clock Frequency: 100 MHz
- Theoretical MIPS: 100 MIPS
- Effective MIPS: ~65-75 MIPS (accounting for hazards)
- Add data forwarding logic
- Implement hazard detection unit
- Expand instruction set (shifts, jumps)
- Add branch prediction (1-bit predictor)
- Implement cache hierarchy (L1 I-cache, D-cache)
- Add exception handling
- Support for multiply-divide unit with proper latency
- Implement TLB for virtual memory
- Add performance counters
- Register file read/write
- ALU operations
- Memory access
- Branch logic
- Full pipeline execution
- Hazard scenarios
- Branch taken/not-taken
- Memory operations
# Run all tests
./run_tests.sh
# Run specific test
./run_test.sh arithmetic_test
./run_test.sh branch_test
./run_test.sh memory_testIssue: Simulation hangs
- Cause:
HLTinstruction not executed - Solution: Verify program memory initialization and PC updates
Issue: Wrong register values
- Cause: Data hazards
- Solution: Insert NOPs between dependent instructions
Issue: Timing violations in synthesis
- Cause: Critical path too long
- Solution: Reduce clock frequency or add pipeline stages
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new features
- Submit a pull request
- Computer Architecture: A Quantitative Approach by Hennessy & Patterson
- Computer Organization and Design by Patterson & Hennessy
- Digital Design and Computer Architecture by Harris & Harris
This project was completed as part of the Project I - EC(4201) course requirement for the Bachelor of Technology degree in Electronics and Communication Engineering with specialization in VLSI and Embedded Systems at the Indian Institute of Information Technology Senapati, Manipur.
Special Thanks:
- Department of ECE, IIIT Manipur - For providing resources and infrastructure
- Open-Source Community - For developing and maintaining the tools that made this project possible
Tools and Resources Used:
- Yosys - Open-source synthesis framework
- OpenSTA - Static timing analyzer
- OpenROAD - Complete RTL-to-GDSII platform
- Nangate - 45nm Open Cell Library
- Icarus Verilog - Verilog simulation
- GTKWave - Waveform viewer
- Python/Matplotlib - Documentation diagram generation
-
J. L. Hennessy and D. A. Patterson, Computer Organization and Design: The Hardware/Software Interface, Morgan Kaufmann, 5th Edition, 2014.
-
M. D. Hill and D. A. Patterson, Computer Architecture: A Quantitative Approach, Morgan Kaufmann, 6th Edition, 2019.
-
C. E. Vick, R. Gonzalez, and J. L. Hennessy, "The MIPS RISC Architecture," IEEE Computer, Vol. 21, No. 6, pp. 30–45, June 1988.
-
M. Topiwala, A. Tiwari, and S. Singh, "Design and Implementation of a 32-bit MIPS Processor Using Verilog HDL," in Proc. IEEE International Conference on Advanced Computing and Communication Systems (ICACCS), pp. 1–6, 2014.
-
C. Venkatesan and M. Chandrasekar, "Design and Simulation of a 16-bit Harvard Architecture RISC Processor," in Proc. IEEE International Conference on Communication and Signal Processing (ICCSP), pp. 0572–0576, 2019.
-
A. K. Sahu, B. K. Swain, and D. P. Mishra, "Design of a 16-bit Harvard Structure RISC Processor Using Verilog," International Journal of Computer Applications, Vol. 172, No. 9, pp. 1–6, 2017.
-
N. K. Reddy, A. G. Rao, and P. V. V. Kumar, "Implementation of RISC-V SoC from RTL to GDSII Using Open-Source EDA Tools," in Proc. IEEE International Symposium on Electronic System Design (ISED), pp. 146–151, 2022.
-
O. Simola, "Physical Implementation of a RISC-V Processor Using OpenROAD," Master's Thesis, Tampere University, Finland, 2023.
-
The OpenROAD Project, "OpenROAD: Fully Autonomous, Open-Source RTL-to-GDSII Flow," https://theopenroadproject.org/, 2023.
-
A. Waterman and K. Asanović, The RISC-V Instruction Set Manual, Volume I: User-Level ISA, Version 2.2, University of California, Berkeley, 2017.
-
A. Waterman, Y. Lee, D. Patterson, and K. Asanović, "The RISC-V Instruction Set Architecture: An Open Standard for Next-Generation Processors," Technical Report UCB/EECS-2014-146, University of California, Berkeley, 2014.
-
Y. Chen, T. Zhang, and H. Wu, "Design and Analysis of a 32-bit RISC-V Processor Core," in Proc. IEEE 9th International Conference on Industrial Technology and Management (ICITM), pp. 60–64, 2020.
-
F. J. Mesa-Martinez and J. Renau, "Effective Management of Pipeline Resources in RISC Processors," IEEE Transactions on Computers, Vol. 62, No. 1, pp. 62–76, 2013.
-
D. Greaves and S. Moore, "OpenRISC and Open Hardware: Enabling Free and Reproducible Processor Design," University of Cambridge, Technical Report UCAM-CL-TR-857, 2016.
-
P. K. Lala, Digital Circuit and Logic Design, Springer, 2013.
-
M. Mano and M. D. Ciletti, Digital Design: With an Introduction to the Verilog HDL, VHDL, and SystemVerilog, Pearson Education, 6th Edition, 2017.
-
N. H. E. Weste and D. M. Harris, CMOS VLSI Design: A Circuits and Systems Perspective, Pearson Education, 4th Edition, 2011.
- D. Gajski, N. Dutt, A. Wu, and S. Lin, High-Level Synthesis: Introduction to Chip and System Design, Springer, 2012.
- MIPS32 Architecture Manual
- OpenROAD Documentation
- Nangate45 PDK
- MIPS Instruction Set
- Pipeline Hazards
This project is released under the MIT License for educational and research purposes.
MIT License
Copyright (c) 2025 Aryan Singh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Aryan Singh
B.Tech in Electronics and Communication Engineering
Specialization: VLSI and Embedded Systems
Indian Institute of Information Technology Senapati, Manipur
Mail: aryansingh220104@gmail.com
For questions, issues, or contributions, please open an issue on the project repository.
This project validates the vision of open hardware and democratized chip design. By proving that complete ASIC implementation is achievable using entirely open-source tools, it removes financial barriers and enables broader participation in hardware innovation.
The foundation established provides numerous opportunities for future enhancement and research. Whether extending the processor with additional features, optimizing for specific metrics, or transitioning to modern architectures like RISC-V, the modular design and comprehensive documentation facilitate continued development.
As open-source EDA tools continue maturing and more open PDKs become available, the future of accessible chip design looks increasingly promising. This project serves as a practical demonstration of what is possible today with open-source methodologies.




