yasnakateb / PipelinedMIPS

๐Ÿ”ฎ A 16-bit MIPS Processor Implementation in Verilog HDL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PipelinedMIPS

In this project, a 16-bit pipelined MIPS processor is implemented in Verilog HDL.

Implementation

Stages

MIPS pipeline has five stages, with one step per stage:

โ€ข IF: Instruction fetch from memory.

โ€ข ID: Instruction decode & register read.

โ€ข EX: Execute operation or calculate address.

โ€ข MEM: Access memory operand.

โ€ข WB: Write result back to register.

Each stage takes in data from that buffer, processes it and write into the next buffer. Also note that as an instruction moves down the pipeline from one buffer to the next, its relevant information also moves along with it.

Instructions

  1. Add : R[rd] = R[rs] + R[rt]
  2. Subtract : R[rd] = R[rs] - R[rt]
  3. And: R[rd] = R[rs] & R[rt]
  4. Or : R[rd] = R[rs] | R[rt]
  5. SLT: R[rd] = 1 if R[rs] < R[rt] else 0
  6. SLTI: R[rt] = 1 if R[rs] < SignExtImm else 0
  7. Lw: R[rt] = M[R[rs]+SignExtImm]
  8. Sw : M[R[rs]+SignExtImm] = R[rt]
  9. Beq : if(R[rs]==R[rt]) PC=PC+1+BranchAddr
  10. J : PC=JumpAddr

observations

  • With pipelining, multiple instructions are overlapped during execution.
  • Latency is the same, but throughput improves.
  • Pipeline rate limited by slowest pipeline stage.
  • Potential speedup = Number of pipe stages.

Dependencies

macOS

This project needs Icarus-Verilog and a VCD viewer.

Building on macOS

  1. Icarus-Verilog can be installed via Homebrew : $ brew install icarus-verilog

  2. Download Scansion from here.

  3. Clone the repository.

  4. Run $ make and type MIPS code to see it in binary form in rams_init_file.hex file.

  5. $ make simulate will:

  • compile design+TB
  • simulate the verilog design
  1. $ make display will:
  • display waveforms.

๐Ÿ“Œ๐Ÿ“Œ๐Ÿ“Œ You should use a for loop to dump array words in your test bench. Check out these articles!

  1. Verilog Portability Notes
  2. Icarus verilog dump memory array

Data Path

About

๐Ÿ”ฎ A 16-bit MIPS Processor Implementation in Verilog HDL


Languages

Language:Verilog 77.8%Language:Python 20.1%Language:Makefile 2.1%