$24
Note
Create a directory called <rollno-<labno. Store all relevant files to this lab in that directory.
For a MIPS assembly program, you need to specify a “text” section, which indicates a region in memory where the instructions are stored (recall the stored program concept)
And for spim, you need to specify a “main” label, from which execution will begin
Cut-paste the following lines into a file using a text editor; you can name the file anything, but we will assume below that you have named it “add.s”
.text
main:
Your code starts from the line below
Load the program in xspim using the load button. Identify your part of the program on the screen.
Run the program by clicking the “run” button. Observe the result of your instructions to load/add in the appropriate register(s).
Q1. Write a program to add the integers 1 and 2; you can use the “li” or “load immediate” instruction, and any other appropriate instruction(s). Use appropriate registers for the instructions.
Q2. Change the “add.s” instruction to be able to load and add the following two 32-bit values: 0x10000001 and 0x20000002. You should not use any pseudo-instruction for this. You will have to find out how to load a 32-bit value onto a register. Hint: you have to use two instructions for this.
Q3. i) Show how you step through the instructions.
After reloading “add.s”, set an appropriate breakpoint for your program.