Giter VIP home page Giter VIP logo

mips-processor's Introduction

MIPS Processor

Summary

Implementation of 32-bit Single-Cycle MIPS processor based on Harvard architecture, MIPS processor is from the RISC family, It supports 3 different types of instructions such as: R-Type, I-type, and J-type. It is supported with a CLA Adder -Carry Look Ahead Adder- for fast computations. The architecture relys on 3 main components:

  • Control Unit.
  • Data Path.
  • Data/Instruction Memory.

Table of contents

Top

  • Full Architecture:

As illustrated in the figure bellow, the MIPS processor has four inputs: clk, reset_n, instruction, and read_data -Data to be read-. it also has three outputs: pc -Program Counter-, alu_out, write_data -Data to be written-.

Top2

Architecture

  • The figure below illustrates the harvard MIPS architecture in details:

TopArch

Control Unit

The control unit is composed of two decoders: Main decoder and ALU decoder.

  • Main Decoder:
    • Takes the opcode as input to determine eight control signals:
      • MemtoReg: determines which data to be passed to the Register File either from Data Memory or ALU result.
      • MemWrite: an enable signal for the Data Memory to be written in.
      • Branch: this signal is ANDed with Zero flag to determine if there is a branch, thus determines the PC source.
      • RegDest: Determines which field to be written in, in the Register File.
      • RegWrite: an enable signal for the Register File to be written into.
      • Jump: determines the source of the jump PC.
      • ALUSrc: determines which source will be input for the ALU.
      • ALUOp: input signal for the ALU decoder.
  • ALU Decoder:
    • Takes the funct as input along side with ALUOp to determine the operation of the ALU:
      • ALUControl: determines the operation of the ALU, whether it is ADD, SUB, MUL, SLT, AND, OR...etc.

Control

Data Path

The Data Path is composed of several separate components, each is well designed and parametrized for re-useability.

  • Data Path Units:
    • Five MUXs.
    • Two Adders.
    • Two Shifters.
    • One SignExtend unit.
    • One Register.
    • An ALU.

Data Memory

  • It can be read from combinationally but written into sequentially at the rising edge of the clock.
  • It has a write enable which uses the A -ALU OUT- input as an adrress, and the data to be written is the WD -RD2-
  • In case the write enable is disabled, thus it uses the A -ALU OUT- input as an adrress to get the ReadData output from the memory.

Instruction Memory

  • Its input is the PC it is fed to it at the rising edge, but the reading is combinaionally.

Test Programs

  • Used three programs to test the functionality of the processor:
    • Factorial of a number.
    • The GCD of teo numbers.
    • AD-HOC test fromt the reference.

Factorial!

  • Given the machine code for the factorial test for [7]:
  • The test's simulation:

Factorial

GCD

  • Given the machine code for the GCD test for [120, 180]:
  • The test: GCD
  • The test's simulation:

GCD

ad-hoc

  • Given the assembly code for the ad-hoc test:
  • Given the machine code for the ad-hoc test:
  • The test's simulation:

adhoc

External Modules

  • Each of these module is parameterized and re-useable, there are more of them in the BasicBlock repo.

About The Author

Author: Mohamed Maged Elkholy

Personal Email: [email protected]

Education: Electronics and communication department, Senior-1 student.

College: Faculty of Engineering, Alexandria university, Egypt.

Brief info.: Interested in Digital IC Design and Verification, seeking any chance to enhance my knowledge and empower my skills.

FPGA Implementaion

Vivado

Soon!!

Reference

  • Used the very handful, useful, and simple book Digital Design and Computer Architecture by David Money Harris and Sarah L. Harris

mips-processor's People

Contributors

muhammadmajiid avatar

Stargazers

 avatar  avatar Aly Elruby avatar Maaz Mahmood avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.