Download Problem 1 [3 pts] Convert the following MIPS program into machine

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Problem 1 [3 pts]
Convert the following MIPS program into machine code.
0xBC000010
start: …………..
0xBC000014
loop: addi $t0,$t0,-5
0xBC000018
lw $t0,-4($t2)
0xBC00001C
beq $t0,$t3,loop
0xBC000020
sw $t3, 4($t2)
0xBC000024
lui $t0,15
0xBC000028
j start
Register name:
$t0
$t1
$t2
$t3
$t4
$t5
$t6
$t7
Register number:
8
9
10
11
12
13
14
15
1
Problem 2 [10 pts]
a.
b.
[2 pts] Assume $t1 contains the value -5 (in 2’s complement). Find the binary value of $v0 after
each of the following two instructions:
add $v0, $t1, $zero
$v0 ………………………………………….
addu $v0, $t1, $zero
$v0 …………………………………………..
[3 pts] Produce the minimal sequence of actual MIPS instructions that accomplish each one of the
following:
1.
bge $t5, $t3, L
if ($t5 >= $t3) go to L
2.
addi $t5, $t3, 0x12345678
c.
[2 pts] Represent 120.125 (decimal) in IEEE 754 single precision format
d.
[3 pts] Assume we have the following float number representation:
1
Sign
7
8
Exponent
Significand
1.
What is the bias?
2.
What is the largest number smaller than ∞?
3.
Represent ∞ using the design above
2
Problem 3 [4 pts]
With X = 0100 0110 1101 1000 0000 0000 0000 0000, Y= 1011 1110 1110 0000 0000 0000 0000 0000,
representing IEEE 754 floating point numbers, perform (showing all steps):
a.
X+Y
b.
X*Y
Problem 4 [4 pts]
A compiler designer is trying to decide between two code sequences for a particular machine. Based on the
hardware implementation, there are three different classes of instructions: Class A, Class B, and Class C,
and they require one, two, and three cycles (respectively).
The first code sequence has 5 instructions: 2 of A, 1 of B, and 2 of C
The second sequence has 6 instructions: 4 of A, 1 of B, and 1 of C.
1. Which sequence will be faster? How much?
2. What is the CPI for each sequence?
3
Problem 5 [4 pts]
Design a single-cycle data path that can do the following:
Given: Registers A, B and C
Compute:
if Function = 0
then compute (A + B) * C
else if Function = 1
then compute (A + C) / B
else if Function = 2
then compute (B - C) / A
Your circuit should include the following:
Registers A, B and C, (Assume they already have the right values loaded),
1 adder/ subtractor, 1 multiplier block, 1 divider block,
Any multiplexers you may need.
Problem 6 [5 pts]
Assembly MIPS
“Solve behind this page”
GOOD LUCK
4
Related documents