Giter Site home page Giter Site logo

mips's Introduction

MIPS

VHDL implementation of Single-Cycle 32-bits MIPS Processor

An implementation of a single cycle MIPS processor. This project has been tested on a Digilent Basys 2 FPGA

If you are a FICH student, then read this

Changelog

Software

Block Diagram

Block diagram

As a component:

Block diagram

References:

  • readdata: Data in (32 bits)
  • clk: Clock signal
  • reset: Reset signal
  • address: Address to write data (on a FIFO buffer, external memory, UART).
  • writedata: Data to write (32 bits)
  • memwrite: Logic signal to write the data from writedata port

How I can load my own firmware?

The firmware must be placed on the Instruction_Memory.vhd file. The format is: Four hexadecimal tuples to describe one assembly instruction.

So, the instruction

addi $s1, $0, 6 is

x"20",x"11",x"00",x"06",.

I strongly recommend to use MARS software to export your code in hexadecimal format.

Remember: The Instruction Memory is an array with 512 elements. Each instruction is composed by four hexadecimal tuples. So the maximum number of instructions allowed is: 512/4 = 128 instructions. You can modify this value according to the size of the FPGA memory.

Example

For example, if you want to implement an unit than can multiply 6x4, you can write the code in assembler language, like this:

# Set operands. In this example, multiplies 6x4
# So, in fact, this algorithm sums 6 times 4
addi $s1, $0, 6
addi $s2, $0, 4
# Set counters
addi $s0, $0, 0
addi $s3, $0, 0
for:
beq $s0, $s1, continue
  add $s3, $s3, $s2
  addi $s0, $s0, 1
  j for
continue:
# The result is stored in $s3 memory position

Then export it in hexadecimal code and write in the required mode:

x"20",x"11",x"00",x"06",
x"20",x"12",x"00",x"04",
x"20",x"10",x"00",x"00",
x"20",x"13",x"00",x"00",
x"12",x"11",x"00",x"03",
x"02",x"72",x"98",x"20",
x"22",x"10",x"00",x"01",
x"08",x"00",x"00",x"04",

NOTE! If you use MARS software, watch out all the jump instructions. The software always export the line like x"08",x"10" when the second tuple MUST be x"00". So, always replace in the text x"08",x"10" by x"08",x"00". Otherwise the jump on this MIPS implementation will don't work.

Another notice: The Data Memory module is not implemented here with the rest of the microarchitecture. This is because I prefer to implement it as another module outside the processor (as a memory block, FIFO buffer, UART or another component). This is the reason of address, readdata, writedata and memwrite ports.

Bibliography

  • Digital Design and Computer Architecture - David Money Harris & Sarah L. Harris (2007 Elsiever)
  • Computer Organization and Design - David A. Patterson & John L. Hennessy (2012 Morgan Kauffman)

About

Developed by Cristian Bottazzi cbottazzi @ ful.unl.edu.ar

If you are a FICH student, then read this

Computer Organization - Computer Engineering

Facultad de Ingeniería y Ciencias Hídricas - Universidad Nacional del Litoral

mips's People

Contributors

cristian1604 avatar then0b0dy 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.