MIPS assembly language programming tutorials

MIPS assembly language programming tutorials. This article contains a list of assembly language programming tutorials. So now lets start with a introduction of MIPS. It stands for Microprocessor without Interlocked Pipelined Stages.  It has reduced instruction set architecture. It offer simple and lower number of instructions. It is available in both 32 bit and 64 bit. If you have searched about this article, so you surely know about ASM programming. Computer only understands bits representation of data.  This bits representation of data is known as machine language. Machine language is a low level language. ASM is slightly higher language than machine language.  But it is not possible to write code in machine language. So ASM is used to avoid this issue. Assemblers are responsible for converting asm codes to machine language codes.  MIPS control instructions

So the main advantage of programming in assembler level programming is that it is more understandable to humans. It is like a instructions written in English language in a specified format which is in rough words known as instruction set architecture. Every processor has its specific instruction set architecture. So the complete list of tutorials are given below. Description of each article is also provided. Check these according to the order in which they are mentioned.

  • Tutorial one  Getting started with MIPS assembly language programming using PCSPIM : To learn MIPS assembly language programming, you need a simulator to simulate assembly or machine instructions, in this first guide you will learn about how to use PCSpim simulator for MISP and how to write your first assembly language program for MIPS.  How to debug a program? How to execute program step by step? How to Pcspim to view registers values? And different getting started programs in MIPS assembly language.
  • Tutorial two  MIPS control instructions  and arrays programming in assembly language : In this guide, you will see how to use control instructions of MIPS like branch instructions and jump instructions etc.  You will learn these concepts by making three examples. First example includes summing of first ten numbers and some of sequences. After reading this tutorial, you will be easily able to use branch instruction like loops and jumps instructions in your MIPS assembly language programs.
  • Tutorial three MIPS systems calls programming : In this mips assembly language tutorial, you will learn to use MIPS systems calls, procedure calls and stacks in MIPS. First you will see, how to use system calls to prints strings on display console of PCspim. After that you will learn, how to display integer values on console using system calls. You will also see examples of procedural calls with example making function in assembly language. At the end of article, we will get to use stack in MIPS.
  • Tutorial four Multiplication and division in MIPS assembly language : It is very easy to perform multiplication and division in c language. Performing multiplication and division in MIPS assembly language is also a easy process. Because MIPS provide assembly instructions to perform multiplication and division. MIPS offers both signed and unsigned multiplication and division instructions. You can perform only integer types multiplication and division using these instructions. Because MIPS assembly language offers separate functional unit for floating point multiplication and division.
  • Tutorial five Recursion and sorting in MIPS assembly language : In this fifth guide on series of tutorials on MIPS assembly language programming , you know about example of recursion and sorting of data using assembly language. First example is about how to calculate factorial of a given number. And then you will see how to perform recursive factorial using Pcspim. At the end, article provides an example of sorting numbers. It will test your knowledge of all previous tutorials.
  • Tutorial six  MIPS floating point programming in assembly : Floating point architecture of millions of instructions per second. All previous guides were about integer type data. We have not talked about floating point data. But in practice , we mostly deal with floating point data.  So it have separate special 32 registers for floating point computation. So you will learn about floating point instructions to perform multiplication, addition, division and all other operations which we performed on integer type data.

We’re  going to start talking in more detail about MIPS instructions in particular so we’re going to spend some time looking at the memory organization of MIPS.  we’re going to talk about the register file which is small and fast versus the main memory which is large and slow then going to go through three important classes of instructions the first one are data operations this is addition subtraction multiplication these are the operations or the instructions that actually do the computation the next class are data transfers these are instructions that move data around in the processor in particular they’re going to move data from the main memory to the register file and back then going to talk about the last class of instructions for sequencing instructions these are the instructions that are used to control the flow of the program so if then Alice and loops so today we’re going to cover the instructions in general and then talk in detail about three particular types of instructions so before we get into that let’s review how a processor is programmed.

so here we have a C program it’s a simple loop while I is not equal to two we’re going to increment I so the first thing that happens to were on this program is you need to compile it so the compiler is going to take this description of the program and convert it into a low-level assembly description so the assembly code is using the instructions of the processor to define the program this is then put into an operating system loader which loads the program into memory and here you can see the instructions have been loaded into particular addresses in the memory of the computer now let’s take a look at what the compiler did here so we’ve got one instruction that we wrote in our code in our C program which is I equals I plus 1 and here’s how the compiler converted it it converted it to ours zero equals r0 plus one this r0 is a register file entry so the compiler decided to take the variable I that we named and put it into the register zero for the process of the program there’s another part of the program to look at the loop part while I does not equal two so the compiler took that and it converted it to two instructions converted it to one instruction which subtracts two from register zero or I and then another instruction which checks if the result is zero so this is checking if I equals two by first subtracting two and then checking to see if it’s zero so if it is zero this then jumps to done so it jumps to the end of the program down here which is what we want so if I equals two we want to go to the end of the program here we check if I is two and we go to the end of the program if that’s not the case then we go on and do the 0 R 0 plus CR 0 R 0 equals R 0 plus 1 again that’s the I equals I plus 1 again and we jump back up and repeat our loop so let’s now walk through a little bit of how the processor actually executes the program so here the main parts of our processor we’ve got our memory.

you can see here has our program in it and some of our data we’ve got a place to store current instruction we’ve got some logic which decodes the current instruction and controls the rest of the processor we have some data registers or register file which can hold a little bit of data to work on and we have some compute logic which is responsible for doing additions traction multiply the sort of the work of the processor so let’s walk through what we do and we execute so the first thing we do is we load the instruction so we’re going to access the main memory we’re going to load the instruction into our current instruction register then we’re going to figure out what to do that is we’re going to take that instruction and ascend it to the control logic which is going to decode the instruction so that it can tell the rest of the processor what to do we then use that control logic to figure out what data to use that is we control the data registers to figure out what data they should use and do the computation so the control logic then controls the compute part here and tells it what data to use and what operation to do so maybe it’s doing an add or subtract finally the result of this computation goes back to the control to allow to determine what the next instruction is and the whole process repeats itself over.So these are the assembly language programming tutorials for MIPS. We will add more articles in this guide in future.

Leave a Comment