Computer Organization Laboratory Lab 6 Solution

$30.00

Description

Objective:

In this lab you will familiarize the basics of MIPS assembly programming using the QtSpim simulator.

Problem:

Illustrate the following using QtSpim:

(1) Data transfer operations:

  1. Load all the temporary registers t0 to t9 with 4-bit hex value 0xF and saved registers s0 to s7 with the 4 bit hex value 0xA. Move data in t6 to s4 and s7 to t5

  1. Load all the temporary registers t0 to t9 with 16-bit hex value 0xFFFF and saved registers s0 to s7 with the 16 bit hex value 0xAAAA.

  1. Load all the temporary registers t0 to t9 with 32-bit hex value 0xFFFFFFFF and saved registers s0 to s7 with the 32 bit hex value 0xAAAAAAAA.

  1. Load all the temporary registers t0 to t9 and saved registers s0 to s7 with the 36 bit hex value 0x123456789.

  1. Explain your observations in each of the above 4 cases.

  1. Storage of data in the data segment using ascii/asciiz:

Store 4 strings as indicated below. Load the address of each string into registers t0, t1, t2, t3 respectively. Run step by step and note how each string is getting stored and explain the changes occuring in the data segment:

str1: .ascii “123456789abcedef”

str2: .ascii “123456789ABCDEF”

str3: .asciiz “123456789abcedef”

str4: .asciiz “123456789ABCDEF”

  1. Load and store a word, a half word and a byte: Store the strings as indicated below:

str1: .ascii “123456789abcedef”

str2: .ascii “123456789ABCDEF”

  1. Load the first 3 bytes of str1 into t0, t1, t2 and store the values in registers t3, t4, t5 into last 3 bytes of str2.

  1. Load the first 2 half words of str2 into t6, t7 and store the value in the register t8 into last halfword of str1.

  1. Load the last word of str2 into t9 and store the value in the register s1 into the last word of str1.

(4) Illustrate the use of syscall codes for the following operations:

  1. Exiting a program

  2. Printing an integer and a string:

  1. Store your roll number as memory word. Then display it on the Console. The display should be like:

My roll number is : <Your roll number>

  1. Reading and printing an integer and string:

Read your name and roll number during run time and then display the same on the Console. There should be prompts for entering the name and roll number. i.e. The display should be like:

Please enter your name: <Enter your name>

Please enter your roll no.: <Enter your roll number>

Your name is : <Your name should be displayed here>

Your roll number is : < Your roll number should be displayed here> Indicate the changes that you see in in data segment.

  1. Reading and printing a floating point number

Read a floating point number during run time and then display the same on the Console. i.e. The display should be like:

Please enter a floating point number : <Enter the number>

You have entered : <The number should be displayed here>

Post-lab:

Submit a post-lab report with your verified outputs. The report should include your well commented code snippets, snapshots of the changes observed in the registers, data segments with proper explanation. Your submissions should be clear and concise.