Docsity

MIPS Homework 6: Word Statistics and MIPS Programming, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
EE 3755 Homework 6 Due: TBA(After covering Note 3 and Note4)
MIPS 2:
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.
Estimated time to finish:
Prob.1 : 5 hours.
Prob.2 :1 hours.
Prob.3: 1 hours.
Total : 7 hours.
When you submit the Hw., Please write down how much time did you spend for the problems.
How to submit:
Hard copy during the class and program on your account and name it( mips1.asm) for problem 1.
Just hard copy for problem 2 and problem 3.
Problem 1: (60 pts ) hard copy
and leave your program on your account and name it mips1.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 of length x:
1 character word .= 1
2 character word .= 6.
3 ….
…..
25.character word. = 0
#############################################################
.data
textdata: .asciiz “In a distant galaxy eons before the creation of the mythical planet
known as Earth, vast civilizations have evolved, and ruling the galaxy is an
interstellar Empire created from the ruins of an Old Republic that held sway for
generations\n
pf3
pf4

Partial preview of the text

Download MIPS Homework 6: Word Statistics and MIPS Programming and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

EE 3755 Homework 6 Due: TBA(After covering Note 3 and Note4)

MIPS 2:

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. Estimated time to finish: Prob. 1 : 5 hours. Prob.2 :1 hours. Prob.3: 1 hours. Total : 7 hours. When you submit the Hw., Please write down how much time did you spend for the problems. How to submit: Hard copy during the class and program on your account and name it( mips1.asm) for problem 1. Just hard copy for problem 2 and problem 3.

Problem 1: ( 60 pts ) hard copy

and leave your program on your account and name it mips1.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 of length x: 1 character word .= 1 2 character word .= 6. 3 …. ….. 25.character word. = 0

.data textdata: .asciiz “In a distant galaxy eons before the creation of the mythical planet known as Earth, vast civilizations have evolved, and ruling the galaxy is an interstellar Empire created from the ruins of an Old Republic that held sway for generations\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 : (30 pts)

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).

Problem 3 : Explain following MIPS CODE briefly (10 pts)

What_am_I_doing: move $t0,$a srl $t0,$t0, sll $t0,$t0,2 # sub $t2,$a0,$t0 # addi $t4, $zero, mul $t3,$t2,$t4 #

.align 4

TABLE: .space 100

.text

.globl main

main:

## Write your code from here.