Showing Page:
1/4
Homework One
Computer Organization and Design
Please deliver this homework on time posted on the blackboard. Overdue homework will be
penalized by 10% per day.
Name: Hassan Yahya
No.441013113
Part1: Understanding Binary
A. Convert the following binary numbers to decimal
1100 =1 × 2³ + 1 × 2² =12
101010 =1 × 2⁵ + 1 × 2³ + 1 × 2¹ =42
0010 =1 x 2
1
=2
1011011 =1 × 2⁶ + 1 × 2⁴ + 1 × 2³ + 1 × 2¹ + 1 × 2⁰ =91
10000000 =1 × 2⁷ =128
1000000000000000 =1 × 2¹⁵ =32768
1000 0000 0000 0000 0000 0000 0000 0000 =1 × 2³¹ =2147483648
0000 0000 0000 0000 0000 0000 0000 0010 =1 × 2¹ =2
B. Convert the following hexadecimal numbers to binary
0x7ffd3d518618 =011111111111110100111101010100011000011000011000
0x7ffd3d51861c =011111111111110100111101010100011000011000011100
0x7ffd3d518617 =011111111111110100111101010100011000011000010111
C. Write C program that converts hexadecimal numbers to binary. (Extra credit)
D. Answer the following questions: Elaborate
a. What is the maximum value that we can store in one byte?
Maximum value 255 in decimal
b. How many different values that can be represented in a single byte?
256 in decimal
Part2: Understanding how data is represented in the memory
A. Big-endian vs little-endian: Show how the following 4-byte integer is stored in
Bigendian and Little-endian machines.
Showing Page:
2/4
B. Why we need to load variables from memory to registers before processing them?
To make the data flow faster
Part3: Assembly Codes
A. Determine the output of the following MIPS assembly Codes
Output: Welcome to MIPS
Output: 6
B. What is wrong with the following MIPS Codes
There is no error There is error in line 3 change A to 4
-
Endian
L
ittle
-
Endian
aa
0A
0B
0C
0D
0C
0A
0B
0D
Showing Page:
3/4
C. Write MIPS code to solve the following equations: Use any numbers for the variables
a. F = a + b + a , all integers
b. F= a * b (a^2) , all integers
c. F= A [3] + h. A is an array containing numbers of the type of byte. h is a variable
of type integer. A base address is stored in the register \$s0. You can use any \$t
register to hold the value of h.
Showing Page:
4/4