Skip to content

A Simple 5-stage 32-bit pipelined processor with Harvard architecture and a RISC-like instruction set architecture.

License

Notifications You must be signed in to change notification settings

Passant-Abdelgalil/MIPS-Processor-Harvard-Architecture

Repository files navigation

MIPS Processor(Harvard Architecture)

A Simple 5-stage 32-bit pipelined processor with Harvard architecture and a RISC-like instruction set architecture.

In addition to an assembler to decode assembly code files to fill the instruction memory with the right data



⚙ ISA Specifications

  1. Registers:
    • R[0:7]: Eight 16-bit general purpose registers
    • PC: 32-bit program counter register
    • SP: 32-bit Stack Pointer register
    • EPC: 32-bit Exception Program Counter register
    • CCR: Condition Code Register
      • Z: zero flag
      • N: negative flag
      • C: carry flag
  2. Ports:
    • IN port: 16-bit data input port
    • OUT port: 16-bit data output port

📋 Instruction Set

One Operand Instructions Two Operand Instructions Memory Instructions Branch Instructions
NOP MOV Rsrc, Rdst PUSH Rsrc JZ Rdst
HLT ADD Rdst, Rsrc1, Rsrc2 POP Rdst JC Rdst
SETC SUB Rdst, Rsrc1, Rsrc2 LDM Rdst, Imm JN Rdst
NOT Rdst AND Rdst, Rsrc1, Rsrc2 LDD Rdst, offset(Rsrc) JMP Rdst
INC Rdst IADD Rdst, Rsrc1, Imm STD Rsrc1, offset(Rsrc2) CALL Rdst
OUT Rsrc - - RET (for call)
IN Rdst - - INT index
- - - RTI (for interrupt)

Instruction

5-bit Opcode 3-bit src1 register address 3-bit src2 register address 3-bit dst register address 1-bit for hlt 1-bit (not yet used) 16-bit offset

🎗 Features

  • reset signal

  • Successful hazards detection and handling (using full forwarding)

  • Successful Interrupts calling

  • Successful Exceptions handling

    • Exception 1: empty stack

    • Exception 2: invalid addess

🔄 Pipeline Stages

  • 1️⃣ Fetch Stage

    fetch stage schematic

  • 2️⃣ Decode Stage

    decode stage schematic
  • 2️⃣ Execute Stage

    decode stage schematic

Run

  1. cd to where you want to clone the repo
  2. run git clone https://github.com/Passant-Abdelgalil/MIPS-Processor-Harvard-Architecture.git
  3. run cd MIPS-Processor-Harvard-Architecture
  4. to run the assembler with your file, run python ./Assembler/assembler.py code_file="./Test_Cases/branch_code.asm"
  5. Create a project in modelsim, Tutorial
  6. To run Do files, in the transcript window run do ./Do_files/<do file name you want to run>
  7. Or start your own simulation :)

Contributors

About

A Simple 5-stage 32-bit pipelined processor with Harvard architecture and a RISC-like instruction set architecture.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •