MIPS 2 - Computer Organization - Assignment | EE 3755, Assignments of Electrical and Electronics Engineering

Material Type: Assignment; Professor: Skavantzos; Class: COMPUTER ORGANIZATIO; Subject: Electrical Engineering; University: Louisiana State University; Term: Fall 2005;

Typology: Assignments

Pre 2010

Uploaded on 08/30/2009

koofers-user-fo3-1
koofers-user-fo3-1 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EE 3755 MIPS 2 Due: TBA
You should know how to use “xspim”
Use “ main” at the beginning instead of “__start ” and assume no delayed branch when you are using
xspim.
Problem 1: Hard copy and leave your program on your account
and name it mips2.asm .
Write a MIPS program to show word statistics for a paragraph(textdata)
Assume the longest word length is 25
output format:
Occurrences of word contains :
A .= 6 //{ A, DISTANT, GALAXY, CREATION, MYTHICAL, PLANET} so 6
B =
…..
Z =
#############################################################
.data
textdata: .asciiz “IN A DISTANT GALAXY EONS BEFORE THE CREATION OF THE
MYTHICAL PLANET KNOWN \n
Table: .space 100
#Hint) Words are separated by the space or spaces.
# ASCII value for the space is 32(decimal) and ASCII value for the null(\n)
# 0(this is for end of the sentence).
Problem 2:
2.1) Write MIPS programs for the following c programs ,
.. # REGISTER USAGE ..SUM , $s0, i, $t0,
1)...for(i = 1; i<5 ;++1)
{
sum = sum + i;
}
2.1.1.1) assume Delayed branch without delay slot
2.1.1.2) assume Delayed branch with delay slot
2)...for(i = 1; i<5;i = i+2)
{
sum = sum + i;
sum = sum + i + 1;
}
2.1.2.1) assume Delayed branch without delay slot
2.1.2.2) assume Delayed branch with delay slot
2-2)Count the total numbers of instructions(running instruction count) to
compute sum for the 4 programs (2.1.1.1, 2.1.1.2, 2.1.2.1 and 2.1.2.2).
pf2

Partial preview of the text

Download MIPS 2 - Computer Organization - Assignment | EE 3755 and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

EE 3755 MIPS 2 Due: TBA

You should know how to use “xspim” Use “ main” at the beginning instead of “_start ” and assume no delayed branch when you are using xspim. Problem 1: Hard copy and leave your program on your account and name it mips2.asm. Write a MIPS program to show word statistics for a paragraph(textdata) Assume the longest word length is 25 output format: Occurrences of word contains : A .= 6 //{ A, DISTANT, GALAXY, CREATION, MYTHICAL, PLANET} so 6 B = ….. Z = ############################################################# .data textdata: .asciiz “IN A DISTANT GALAXY EONS BEFORE THE CREATION OF THE MYTHICAL PLANET KNOWN \n Table: .space 100 **#Hint) Words are separated by the space or spaces.

ASCII value for the space is 32(decimal) and ASCII value for the null(\n)

0(this is for end of the sentence)._**

Problem 2: 2.1) Write MIPS programs for the following c programs , .. # REGISTER USAGE ..SUM , $s0, i, $t0, 1)...for(i = 1; i<5 ;++1) { sum = sum + i; } 2.1.1.1) assume Delayed branch without delay slot 2.1.1.2) assume Delayed branch with delay slot 2 )...for(i = 1; i<5;i = i+2) { sum = sum + i; sum = sum + i + 1; } 2.1.2.1) assume Delayed branch without delay slot 2.1.2.2) assume Delayed branch with delay slot 2-2)Count the total numbers of instructions(running instruction count) to compute sum for the 4 programs (2.1.1.1, 2.1.1.2, 2.1.2.1 and 2.1.2.2).

###################### Template for program 1 ######################

$t0 = location of the string

$t1 = hold scanned character

$t2 = holds the ascii value for a space(32)

$t3 = used for address computation

$s1 = holds the address for TABLE

.data string: .asciiz "IN A DISTANT GALAXY EONS BEFORE THE CREATION OF THE MYTHICAL PLANET KNOWN" return: .asciiz "\n" newline: .asciiz "\n" .align 4 TABLE: .space 100 .text .globl main main: