Skip to content

Implementation of a MIPS Deluxe design processor using FPGA.

Notifications You must be signed in to change notification settings

Fran-cio/mipsDesign

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn

Typing SVG


Logo

mipsDesign

Implementation of a MIPS Deluxe design processor using FPGA.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

About The Project

The objective of this project was to put into practice the knowledge acquired during the "Computer Architecture" course regarding the internal design of processors, components, and how they interact with assembly code.

For a comprehensive analysis of the project, it is proposed to review the academic report, which contains all the theoretical concepts, design decisions and use of the project.

(back to top)

Built With

Verilog

(back to top)

Getting Started

This project was developed using Xilinx Vivado Tool and the Nexys 4 DDR FPGA. To send the binary file to the FPGA, the software Realterm was used.

  1. Clone the repository using the command git clone git@github.com:Fran-cio/mipsDesign.git --recursive. This command not only clones the repository with the MIPS sources but also initializes the submodules used within the project.

    Submodules:

  2. Create a new project in Vivado.

    WARNING: Do not add the sources yet!

  3. Once the project is created, proceed to add the folder with the sources, as well as the simulation files if desired.

  4. Add the constraints (located in the folder FPGA-MIPS/Mips.srcs/constrs_1) and the .xci file corresponding to the IP of the clock tree (located in the folder FPGA-MIPS/Mips.srcs/ip/clk_wiz_0/clk_wiz_0.xci).

  5. Run "generate bitstream" in Vivado.

  6. Connect the board.

  7. Click on "AutoConnect".

  8. Click on "Program device". Once programmed, you should see a red light on the board.

  9. At this point, we have the MIPS synthesis loaded on the board, so we proceed to download RealTerm. This app will allow us to send data via serial to the board.

  10. In the "port" tab, set the baud rate to 9600 and choose the corresponding port.

  11. OPTIONAL: In the "send" tab, you can send a "P" to see if it returns 0 and thus check that the serial connection has been established correctly.

  12. Now we need to generate the binary. To do this, go to FPGA-MIPS/python_src. There you will find a .asm file called src_code.asm. Place the desired assembly code there. In the same folder, you will also find test files with their respective analyses.

  13. In this step, we generate the binary. Run python3 -W ignore assembler.py. This will generate a .hex file named output_code.hex.

    DISCLAIMER: You may need to install some Python modules if you don't have them. Follow the terminal logs in such case.

  14. Now we proceed to load the binary. In the "send" tab of RealTerm, send a letter 'B'.

  15. Now copy and paste the binary, or import it into the corresponding section in RealTerm.

  16. When the binary is successfully loaded, you should see a green light on the board.

  17. Now you can follow the commands and state machine presented in the report to perform the desired execution. For example, you could send a 'G' to run the entire program. In that case, you would see a blue light when the execution finishes.

DISCLAIMER: LED colors may vary depending on the board used or if constraints are modified.

(back to top)

Usage

Operation Modes

There are three additional requirements related to the interaction between the processor and the user. For this purpose, the Super Unit of Operation and Debug (SUOD) was designed. It serves as a large state machine that generates actions based on user input.

Actions of the SUOD

The SUOD (System User Operation Device) is a unit that provides a main menu type interface for project execution. It has a set of commands received via UART (Universal Asynchronous Receiver-Transmitter) and performs a set of actions.

Commands:

Command Description
"G" Run mode, executes the loaded program.
"B" Enters "BootLoader" mode to receive binary until a halt instruction is received.
"S" Advances one clock cycle.
"P" Returns the value of the Program Counter (PC).
"C" Resets the program.
"T" Increments the register pointer.
"R" Returns the value of the pointed register space.
"E" Decrements the register pointer.
"," Increments the memory pointer.
"M" Returns the value of the pointed memory space.
"N" Decrements the memory pointer.
"F" Clears the loaded program.

Implemented Instructions

Category Instruction Type Example Comment
Arithmetic ADDU R addu $s1,$s2,$s3 Unsigned addition between registers
SUBU R sub $s1,$s2,$s3 Unsigned subtraction between registers
ADDI I addi $s1,$s2,20 Immediate addition
Information Transfer LB I lb $s1,20($s2) Load Byte
LH I lh $s1,20($s2) Load Half
LW I lw $s1,20($s2) Load Word
LWU I lwu $s1,20($s2) Load Word Unsigned
LBU I lbu $s1,20($s2) Load Byte Unsigned
LHU I lhu $s1,20($s2) Load Half Unsigned
SB I sb $s1,20($s2) Store Byte
SH I sh $s1,20($s2) Store Half
SW I sw $s1,20($s2) Store Word
LUI I lui $s1,20 Load Upper Immediate
Logic SLL R sll $s1,$s2,10 Shift Left Logical
SRL R srl $s1,$s2,10 Shift Right Logical
SRA R sra $s1,$s2,10 Shift Right Arithmetic
SLLV R sllv $s1,$s2,10 Shift Left Logical Immediate
SRLV R srlv $s1,$s2,10 Shift Right Logical Immediate
SRAV R srav $s1,$s2,10 Shift Right Arithmetic Immediate
AND R and $s1,$s2,$s3 AND operation
OR R or $s1,$s2,$s3 OR operation
XOR R xor $s1,$s2,$s3 XOR operation
NOR R nor $s1,$s2,$s3 NOR operation
SLT R slt $s1,$s2,$s3 Set Less Than
ANDI I andi $s1,$s2,20 Immediate AND operation
ORI I ori $s1,$s2,20 Immediate OR operation
XORI I xori $s1,$s2,20 Immediate XOR operation
SLTI I slti $s1,$s2,20 Set Less Than Immediate
Conditional Jump BEQ I beq $s1,$s2,25 Branch if Equal
BNE I bne $s1,$s2,25 Branch if Not Equal
Unconditional Jump JR I jr $ra Jump to Register Address
JALR I jalr $s1,s10 Jump to Register Address and Link
J J j 2500 Jump to Immediate Address
JAL J jal 2500 Jump to Immediate Address and Link
HALT H halt Halt Instruction

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the Beerware License🍻. See LICENSE.txt for more information.

(back to top)

Contact

Francisco Ciordia Cantarella - francisco.ciordia.cantarella@gmail.com

Project Link: https://github.com/Fran-Cio/mipsDesign

(back to top)

Acknowledgments

Patterson, David A., and John L. Hennessy. Computer Organization and Design MIPS Edition: The Hardware/Software Interface. Edited by David A. Patterson and John L. Hennessy, Elsevier Science, 2014. Accessed 27 January 2023.

(back to top)

About

Implementation of a MIPS Deluxe design processor using FPGA.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published