EEL3801: Computer Organization Project #2: Part A

Description

.data
input_string: .space 256 # Space to store input string
counts: .space 8 # Space to store counts for each letter

Don't use plagiarized sources. Get Your Custom Assignment on
EEL3801: Computer Organization Project #2: Part A
From as Little as $13/Page

prompt: .asciiz “Enter a sentence: ”
output_format: .asciiz “%c: %dn”

.text
.globl main

main:
# Print prompt
li $v0, 4
la $a0, prompt
syscall

# Read input string
li $v0, 8
la $a0, input_string
li $a1, 256
syscall

# Initialize counts to 0
li $t0, 0 # ‘K’ count
li $t1, 0 # ‘N’ count
li $t2, 0 # ‘I’ count
li $t3, 0 # ‘G’ count
li $t4, 0 # ‘H’ count
li $t5, 0 # ‘T’ count
li $t6, 0 # ‘R’ count
li $t7, 0 # ‘O’ count

# Loop through the input string
la $t8, input_string # Pointer to input string
li $t9, 0 # Loop counter
loop:
lb $t8, ($t8) # Load byte from input string
beqz $t8, endloop # If end of string, exit loop

# Convert character to uppercase
li $t9, 32 # ‘a’ – ‘A’
addu $t8, $t8, $t9 # Convert to uppercase

# Check if it’s one of the specified letters
li $t9, ‘K’
beq $t8, $t9, update_K_count
li $t9, ‘N’
beq $t8, $t9, update_N_count
li $t9, ‘I’
beq $t8, $t9, update_I_count
li $t9, ‘G’
beq $t8, $t9, update_G_count
li $t9, ‘H’
beq $t8, $t9, update_H_count
li $t9, ‘T’
beq $t8, $t9, update_T_count
li $t9, ‘R’
beq $t8, $t9, update_R_count
li $t9, ‘O’
beq $t8, $t9, update_O_count

# Continue looping if not one of the specified letters
j next_iteration

update_K_count:
addi $t0, $t0, 1
j next_iteration
update_N_count:
addi $t1, $t1, 1
j next_iteration
update_I_count:
addi $t2, $t2, 1
j next_iteration
update_G_count:
addi $t3, $t3, 1
j next_iteration
update_H_count:
addi $t4, $t4, 1
j next_iteration
update_T_count:
addi $t5, $t5, 1
j next_iteration
update_R_count:
addi $t6, $t6, 1
j next_iteration
update_O_count:
addi $t7, $t7, 1
j next_iteration

next_iteration:
addi $t8, $t8, 1 # Move to next character in input string
j loop

endloop:
# Output the counts
li $t9, ‘K’
li $v0, 11
move $a0, $t9
syscall
li $v0, 1
move $a0, $t0
syscall
li $v0, 4
la $a0, output_format
syscall

# Repeat the same for other letters…

# Exit
li $v0, 10
syscall


Unformatted Attachment Preview

EEL3801: Computer Organization
Project 2 Report Submission Guidelines
1.0 Submission Requirements
1.1 Preface
As when responding to a professional work solicitation/submission, we gain practice with the protocol
that Submission Requirements must be met for the submission to be considered for credit. Most
companies set this standard, and most government agencies uphold such requirements per their legal
contracting and acquisition processes. So we learn these conventions in our course projects and gain
practice with formal “Project Solicitation”-style Task Definitions.
1.2 Submission Mechanism
Please upload the submissions identified below to webcourses using the Assignments tab. No other form
of submission can be accepted.
1.3 Project Report file
For your project report, submit a single file in .pdf, .doc, or .docx format with the filename Project-2Report–.doc where the fields – are replaced
with your last name and first name, or else .pdf or .docx extensions as appropriate. This submission will
be a single file containing your entire report for the project. If your file is not already a single .doc,
.docx , or .pdf file, please convert it using free online tools such as http://www.convert-jpg-to-pdf.net/
or merge it using http://www.pdfmerge.com/
1.4 Incremental Submission
Upload your submissions as you progress in creating results, which will overwrite previous partial
submissions. Only the last submission received before the due date/time will be graded.
2.0Grading Rubric
Project Report submission: 100 points total as follows:
 Professional preparation: [5 points total] as follows:
i.e. Typed document with text of the paragraphs in Times New Roman 11 pt font, clear and
grammatically well-formed explanations, cover sheet provided, page numbering and document
heading numbering (1.0, 2.0, 3.0, etc to identify the required sections listed below). [5 points]
 Report Content: [95 points total] as follows having the following numbered section headings:
1.0 Project Description: project name, narrative description of at least 4 sentences, including
identification of program inputs and outputs. [5 points]
2.0 Program Design: narrative description of how your code operates, and a flowchart with
sufficient explanation about the program design for someone else familiar with MIPS to be
able replicate your design [20 points for detailed narrative per below items and 10 points for
high quality flowchart per below items]
2.1 Detailed explanation on the assembly code. [10 points]
2.2 Detailed explanation on code optimizations in Part B. [10 points]
2.3 High quality flowchart for the assembly codes mentioned in Section 2.1 & 2.2.
[10 points]
3.0 Symbol Table: a 2-column Table describing all Registers used and their specific Purpose in
the code, where each register is listed on a separate row and identified by register name $t0,
$s0, etc., as well as any Labels used and their purpose on separate rows. [5 points for register
table per below items and 5 points for label table per below items]
3.1 Register table for registers used in the assembly code [5 points]
3.2 Label table for labels used in the assembly code [5 points]
4.0 Project 2 Part B: Please include all the data analysis and calculations in Project 2 Part B in
this section, along with explanation of your adopted optimization strategy. [5 points]
5.0 Learning Coverage: provide a meaningful list of at least 5 technical topics learned from
this project that you could mention in a job interview. [20 points]
6.0 Prototype in C-language: paste the C-code in the report as you do not need to submit a .c
file and do not need to provide a screenshot of the C-language output for this project. However,
the .c code shall be a viable fully working prototype for all parts to receive credit. [10 points]
7.0 Test Plan: provide details in sentences identifying the inputs chosen to test the program and
why these were selected, and justification why they provide adequate test coverage. [6 points]
8.0 Test Results: provide screen shot(s) of at least 3 proper MIPS code executions in MARS
for your Test Plan inputs. [6 points]
9.0 References: provide a list of all reference materials you used in the project. [3 point]
Project 2 Part B document Template
PLESE NOTE: The values and calculations used in this file
vary from the values in the assignment. This has only been
provided to guide students to a Positive example template to
understand the submission requirements of Project 2 Part B
document file.
Pre-Optimization:
1. Provide a graph of the dynamic instruction count for at least 5 sentences of varying
length for Project 2 Part A Unoptimized Code.
a. Sentence 1.
b. Sentence 2.
c. Sentence 3.
d. Sentence 4.
e. Sentence 5.
f. Graph of dynamic instruction count for sentences of 10, 20, 30, 40, and 50
characters in length. (please choose your own char count)
Project 2 Part A Unoptimized Instruction Count
2000
1876
Number of instructions
1800
Instruction Count
1600
1558
1400
1240
1200
1000
906
800
600
568
400
200
0
10
20
30
40
50
Character Count
2. Provide calculations for the CPI of the above 5 sentences as well as a graph of their
respective CPIs for Project 2 Part A Unoptimized Code.
a. CPI Calculations for sentences of 10, 20, 30, 40, and 50 characters in length.
i.
((4×83)+(2×458)+(1×26))
568
= 2.243
ii. Same for sentence 2
iii. Same for sentence 3
iv. Same for sentence 4
v. Same for sentence 5
b. Graph of CPI for sentences of 10, 20, 30, 40, and 50 characters in length.
CPI
Project 2 Part A Unoptimized CPI
2.26
2.24
2.22
2.2
2.18
2.16
2.14
2.12
2.1
2.08
2.06
2.04
2.242957746
2.174392936
2.143548387
2.127086008
2.116204691
10
20
30
Character Count
40
50
3. Calculate and plot a graph of Energy consumption for 5 different sentences of different
lengths prior to optimization assuming ALU = 4 fj, Jump = 3 fj, Branch = 6 fj, Memory =
100 fj, and Other = 8 fj.
a. Calculations of Energy Consumption for sentences of 10, 20, 30, 40, and 50
characters in length.
i. (3 × 301) + (2 × 26) + (5 × 134) + (100 × 23) + (6 × 83) = 4423
ii. Calculation for Sentence 2.
iii. Calculation for Sentence 2.
iv. Calculation for Sentence 3.
v. Calculation for Sentence 4.
b. Graph of Energy Consumption for sentences of 10, 20, 30, 40, and 50 characters
in length.
Energy Consumed (fJ)
Project 2 Part A Energy Consumption
20000
18000
16000
14000
12000
10000
8000
6000
4000
2000
0
18920
15500
12080
8565
5025
10
20
30
40
50
Character Count
Post-Optimization:
4. Optimize your code to consume less energy based on the above assumptions.
a. Write about what was your strategy that you applied to reduce the energy
consumption? And mention what was the reasoning behind choosing that strategy.
b. Re-calculate energy consumption for all sentences you choose after optimization.
(3 × 360) + (2 × 16) + (5 × 195) + (100 × 11) + (6 × 63) = 3565
c. (3 × 574) + (2 × 30) + (5 × 397) + (100 × 21) + (6 × 65) = 6257
d. (3 × 777) + (2 × 46) + (5 × 587) + (100 × 31) + (6 × 68) = 8866
e. (3 × 955) + (2 × 68) + (5 × 749) + (100 × 41) + (6 × 74) = 11,290
f. (3 × 1131) + (2 × 90) + (5 × 909) + (100 × 51) + (6 × 80) = 13,698
g. Graph of Energy Consumption for Optimized Code
Project 2 Part B Optimized Energy Consumption
16000
Energy Consumed (fJ)
14000
13698
12000
11290
10000
8866
8000
6257
6000
4000
3565
2000
0
10
20
30
40
50
Character Count
Calculate MIPS/mW for the optimized code for each of the 5 different sentences.
EEL3801: Computer Organization
Project #2: Part A
Purpose of this project is to increase your understanding of data, address, memory contents, and
strings. You will be expected to apply selected MIPS assembly language instructions, assembler
directives and system calls sufficient enough to handle string manipulation tasks. You are tasked to find
the number of selected letters present in a string. Specifically, the number of the occurrences of the
letters K, N, I, G, H, T, R, and O (upper and lower cases both to be counted) within an input sentence,
and then output the result using the format shown below:
Sample Input for Part A is:
In 1980, UCF decided to revamp the mascot to motivate the crowd and draw attention to the new
football program. That brought the debut of Sir Wins-a-lot, a knight-themed mascot featuring a
large smiling face made of plastic. Sir Wins-a-lot was eventually retired in favor of a horse and
rider.
Sample output for Part A is:
K: 1
N: 13
I: 16
G: 6
H: 9
T: 27
R: 16
O: 19
Output a histogram of the number of the occurrences of the letters K, N, I, G, H, T, R and O within an
input sentence:
K: #
N: #############
I: ################
G: ######
H: #########
T: ###########################
R: ################
O: ###################
The submitted program shall provide outputs in exactly the sequence and format shown above. To
receive full credit, no additional superfluous outputs shall occur. (10 points for correct formatting of
code output, including spaces and new lines, 10 points for code commenting, 10 points for code
checkoff QA, 70 points for correctness of output.)
EEL3801: Computer Organization
Project #2 Part B
Project Functionality Overview:
Purpose of this project is to increase your understanding of data, address, memory contents, and strings.
You will be expected to apply selected MIPS assembly language instructions, assembler directives and
system calls sufficient enough to handle string manipulation tasks. Your task is to make changes to the
Project 2 Part A code in order to optimize it for energy consumption using the below assumptions, to
achieve appreciably less energy consumption(>=5% energy savings of the unoptimized version for 5
user input sentences:
Description and Grading Rubric
The MIPS P5600 CPU is based on the MIPS32 ISA architecture, supporting up to six cores achieving the
industry’s leading CoreMark/MHz score per core. It supports high performance data parallel operations
such as DSP, imaging and media.
Dynamic Instruction Count and CPI: 20 points]
Dynamic Instruction Count will be evaluated by the MARS4.4→Tools→Instruction Counter
To calculate the Dynamic Instruction Count of part A:
• Dynamic Instruction Count is calculated from the first instruction execution until completion of a
proper exit using syscall, as calculated in the “Instructions so far:” dialog box.
• Plot a graph of Dynamic Instructions for different sentences with different lengths. (5 points for
graph including at least 5 different sentences with different lengths, include screenshots)
• Calculate the CPI of your program for the above input, assuming all R-type instructions require 7
clocks, all I-type instructions require 5 clocks and all J-type instructions require 3 clock. (10 points
for detailed solution and calculations of at least 5 different sentences with different lengths)
• Plot a graph of CPI for different sentences with different lengths (5 points for graph including at
least 5 different sentences with different lengths)
Energy Consumption: [60 points]
Using the dynamic instruction count MARS4.4→Tools→Instruction Statistics you should be
able to calculate the energy consumed by your code using below assumptions:
To calculate the Energy Consumption of part A:
• Consider the following are the energy consumption per instruction:
1) ALU: 6 nj
2) Jump: 4 nj
3) Branch: 8 nj
4) Memory: 100 nj
5) Other: 9 nj
• Plot a graph of Energy consumption for different sentences with different lengths before optimization
of the code. (10 points for detailed calculation+5 points for graph including at least 5 different
sentences with different lengths, include screenshots)
• Optimize your code to consume appreciably less energy (minimum of 5% energy savings over the
unoptimized version on an average for the input sentences chosen) based on the assumptions above.
(15 points for code implementations achieving target energy reduction, 5 points for correct
outputs and code output formatting, 5 points for code comments, 5 points for energy
calculations and energy change percentages achieved over un-optimized code for the 5 different
sentences )
• Explain in detail what was your strategy in terms of changes made in the MIPS code , instructions,
algorithm etc. that you applied to reduce the energy consumption? And mention what was the
reasoning behind choosing that strategy. (10 points for details and clarity of the explanation.)
(Continued on next page…)

Plot a graph of Energy consumption for different sentences with different lengths after optimization
of the code. (5 points for graph including at least 5 different sentences with different lengths)
MIPS/mW: [10 points]
Use the information of the two previous sections to determine MIPS/mW for the optimized
code as illustrated in Module 8 (Device Technology)-Slide 30 (assume Clock Cycle is 400ps).
(10 points for detailed solution and calculations of at least 5 different sentences with
different lengths)
Code Check-off: [10 points]

Purchase answer to see full
attachment