0% found this document useful (0 votes)
297 views

Homework 1

This document provides instructions for Homework 1 assigned in the Introduction to Computer Organization course for Fall 2019. It includes 5 problems to complete individually and submit by September 21st, as well as a group problem to complete with up to 3 other students. The individual problems involve binary and hexadecimal conversions, assembly language programming, and explanations of computer architecture concepts. The group problem involves analyzing assembly code for a function that searches an array.

Uploaded by

bob pupitre
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
297 views

Homework 1

This document provides instructions for Homework 1 assigned in the Introduction to Computer Organization course for Fall 2019. It includes 5 problems to complete individually and submit by September 21st, as well as a group problem to complete with up to 3 other students. The individual problems involve binary and hexadecimal conversions, assembly language programming, and explanations of computer architecture concepts. The group problem involves analyzing assembly code for a function that searches an array.

Uploaded by

bob pupitre
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Introduction to Computer Organization – Fall 2019

Homework 1
Assigned: Thursday September 5th
Due: @11:55PM Saturday, September 21st

Name: ____Robert Sorkin______ Uniqname: _____rsorkin_________

1. Submit a pdf of your typed or handwritten homework on Gradescope. You should have
received an email inviting you to the Gradescope course. If you have not, please go to
www.gradescope.com, register for an account using your university email address (if
necessary), then add yourself to this course using the entry code M4D4D4.

2. Your answers should be neat, clearly marked, and concise. Typed work is
recommended, but not required unless otherwise stated.. Show all your work, and state any
special or non-obvious assumptions you make.

3. You may discuss your solution methods with other students, but the solutions you
submit must be your own.

4. Note that the last question is turned in separately and can be done in a group of up to 3
students. The group should only provide one submission for that problem. Read the directions
carefully for how to turn in that problem.

5. Late Homework Policy If your homework is less than 24 hours late, the grade is
reduced by 50%. Homeworks later than 24 hours will not be accepted.

Problem 1 (16 points): Numbers and stuff

a. (4 points, 1 each) Convert the following numbers to binary two’s complement.

i. 35(decimal)

ii. -66 (decimal)


iii. -13 (decimal)

iv. 13 (base 8)

b. (6 points, 3 each) Convert the following 16-bit binary 2’s complement numbers to
decimal.

i. 0100 1111 0010 0011

ii. 1010 1111 0000 1001

c. (6 points, 2 each) Convert the following 16-bit binary numbers to hex: (Make sure you
have a solid understanding of these conversions, it will make future homeworks and
exams much easier )

i. 1110 1010 0110 1011


0 x

ii. 0110 0110 1111 1010


0 x

iii. 1011 1110 0111 0010


0 x

Problem 2 (12 points): Pulling my LEG

Variable to register mappings


int64_t a - X5 int64_t b - X6 int64_t c - X7
int64_t d - X8 int64_t e - X9 int64_t f - X10
The integers have already been declared. Follow the C/C++ order of operations. You may not
use other registers. Hint: get familiar with the quick reference guide on website under resources
tab

Note: int64_t is a signed integer type with a width of 64 bits


a) (9 points) Convert the following LEGv8 assembly to 3 lines of equivalent C code:

MOVZ X5, #53 C Code Line 1:

ANDI X6, X5, #30 C Code Line 2:

LSL X7, X6, #4 C Code Line 3:

b) (3 points) From part a, what is the resulting binary value in register X7? Please only
write the last 8 bits of the number.

Problem 3 (12 points, 2 points/line): LC2K

Translate the following LC2K instructions from assembly to machine code. (Express your
answers in hexadecimal.)

lw 0 5 5 comment
lw 0 3 4 loop beq 3 4
End
add 6 2 2 beq 0 0
loop noop 65 (Think about how that 65 is
treated...)
End halt
Problem 4 (10 points)
For problem 4 follow the C/C++ order of operations. All variables and arrays are initialized. You
may not modify other registers.

Variable to register mappings Starting addresses


int a - r1 int b - r2 Go - r3 Blue - r4

Convert the following C code to 4 lines of LC2K assembly, use register 5 for computing the
displacement needed for Blue[a], register 6 for storing Blue[a], and register 7 for storing Blue
[a]+b.

Go[12] = Blue[a] + b;

Problem 5 (15 points)

a. (2 points) Define “Moore’s law”.

b. (3 points) Define “Dennard scaling”.

c. (10 points) Explain how “Moore’s law” and “Dennard scaling” have historically impacted
the advancement of computers. Explain how these things are now changing. Your
answer should be between 150-250 words. You must type your explanation.
Group Problem

This problem is to be completed in groups of up to 3 students. You will submit this


problem separately from the rest. Be sure to list all students in the group by both writing
their uniquenames below AND being sure to include them in gradescope as part of the
group. Work together on solving the questions and speak to an instructor if you get
stuck.

Student 1 Uniqname ________________ Student 2 Uniqname________________

Student 3 Uniqname_________________

A now ex-coworker of yours wrote a function Find() and left a few comments, but very limited
documentation. You know that the function takes two arguments. The first is a pointer to an
array (passed in r1) and the second is the number of elements in the array (passed in r2). The
return value is found in r5. Answer the questions on the following page.

lw 0 1 ArrayS
lw 0 2 Num lw
0 3 Fcall jalr
3 7
halt
Find lw 0 6 NegOne // r6=-1 add 0
2 5 // r5=Num Top add 2 6 2
// Decrement Num add 1 2 4 // 4 is
address lw 4 3 0 // ld array element
beq 3 0 skip // is element 0? add
5 6 5 // if not sub 1 skip beq 0 2
Done // if Num=0 we are done beq 0 0 Top
// next iteration
Done jalr 7 3 // return
Zero .fill 0
NegOne .fill -1
Fcall .fill Find
ArrayS .fill Array
Num .fill 8
Array .fill 0
.fill 1
.fill 1
.fill 2222
.fill 0
.fill 777
.fill 0
.fill 1
.fill -5
Group Assignment Questions (35 points)

a) How many times will the line with the label “Find” get executed during this program? [3
Points]

_____________

b) What is the value of r7 when the program halts? [4 Points]

_____________

c) What is the value in r5 when the program halts? [5 points]

_____________

d) In 10 words or less, describe what the return value of the function is in terms of the
array. Your answer should be something like “returns the maximum value in the array”.
[5 Points]

e) Watch https://www.youtube.com/watch?v=ctwj53r07yI from 4:30 to 43:30 (though you


might find it very useful to watch the whole thing). Type an essay 250-400 words) which
addresses the following points (there is a specific graph that will help you a lot with this):
● How quickly have general purpose computers improved in the past and what
does the speaker think this rate of improvement is headed toward? Provide
examples of things that have been designed.
● Why there has been such a radical change in the annual rate of general purpose
performance? (What “laws” apply here?)
● What does the speaker believes is the future of computer architecture in the next
decade or so.
As a note, the faculty of this course don’t necessarily agree with the speaker on all
points. This isn’t “truth”, not even when discussing the past. It is one (very experienced)
person’s take on the history of the field and their sense of the future. [15 points]

f) What did each member of your group find to be the most interesting part of the above
video? (You’ll get full points on this question as long as there is a couple of
sentences from each student that mentions something actually in the video).
[3 points]

You might also like