Computer Organization Laboratory Lab 7 Solution

$35.00 $24.00

Objective: In this lab you will familiarize with MIPS relational instructions, branching instructions, arrays, stack operations, floating point operations using the QtSpim simulator.     Problem:       Using minimum instructions do the following:     (1)  Compare two numbers A=0xFFFFFFFF, B=0x0000000F. If A<B it should set the $t1 register, else it should reset…

You’ll get a: . zip file solution

 

 
Categorys:

Description

5/5 – (2 votes)

Objective:

In this lab you will familiarize with MIPS relational instructions, branching instructions, arrays, stack operations, floating point operations using the QtSpim simulator.

 

 

Problem:

 

 

 

Using minimum instructions do the following:

 

 

(1)  Compare two numbers A=0xFFFFFFFF, B=0x0000000F.

If A<B it should set the $t1 register, else it should reset $t1 register for  the  below  cases: (a) When A & B are considered as signed numbers.

(b) When A & B are considered as unsigned numbers.

 

 

The program should print a message ‘A is less than B’ if A<B, else if A>B,  print ‘B is less than A’.

 

 

What did you observe in (a) & (b) and why? Use compare and branch instructions.

 

 

(2) Introduction to arrays:

The marks of a student in 4 subjects are stored in registers s0, s1, s2, s3. Store the marks in an array named ‘marks’. Display the elements of the array in Console window. Each element should appear on a new line. Assume that all marks are integers. Use the concept of loops to display the array elements. Register t0 should be used to keep track of the

offset from the starting address of the array which is initially 0.

 

 

(3) The ages of 6 members in a family are stored in an array.  Create  a code sequence that computes the total age in the array. Register t0 should be used to keep track of the offset from the starting address of the array which is initially 0. Register t1 should used to store the Sum.

 

(4) Introduction to stack operations:

Store the saved registers s0 to s7 with values from 1 to 7. Increment the values of all these registers by 1. Illustrate how you add the present values (ie. the  incremented values)  in

the ‘s’ registers with the corresponding previous values in these registers using the concept of stack. You are not supposed to move the previous values into any temporary registers directly. The sum after addition should be stored in registers t0 to  t7.

 

 

(5) Floating point arithmetic:

A student has stored his  SGPAs for 4 semesters as an array. The SGPAs are  floating point numbers. Display the  sum,  product, average, minimum and maximum, of the entered SGPAs. Use loops wherever possible.

 

 

All the programs should include a header section with the program title(what the program does), comments wherever required and display statements.

 

 

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.

 

 

All your submissions should be clear and concise.