Computer Architecture Sample Final
Computer Architecture Sample Final
1 of 10
(14 points) Mark each of the following statements as either (T)rue or (F)alse.
a)
_____________
b)
_____________
To store a given amount of data, direct mapped caches are typically smaller than
either set associative or fully associative caches, assuming that the block size for
each cache is the same
c)
___________
d)
____________
DRAMs usually save pins by sharing the row and column address inputs on the
same pins
e)
____________
A RISC computer will typically require more instructions than a CISC computer
to implement a given program.
f)
____________
Adding two signed numbers of the same sign will never cause an overflow.
g)
___________
h)
____________
i)
____________
Direct mapping technique maps each block of main memory into more than one
possible cache line.
j)
____________
k)
____________
l)
____________
m)
____________
n)
____________
Computer Architecture
Final Exam
Register addressing
Immediate addressing
Indirect Address
Floating point
Direct mapping
Instruction fetch
Direct access
Overflow
Amdahls Law
Addressing
Underflow
Address space
Mantissa
On the left side, write the letter corresponding to the word that best fits the definition to the right. Not all
words will be used.
Maps each block of main memory into only one possible cache line.
When a result is too large to be represented in a given format.
The address field refers to a register that contains the operand.
The mode or modes by which the address of an operand is specified
The value of the operand is in the instruction.
Individual blocks or records have a unique address based on
physical location
Read instruction from its memory location into the processor
An address of a storage location that contains an address
The range of addresses (memory, I/O) that can be referenced
Speedup is limited by the fraction which is not optimized
2 of 10
Computer Architecture
Final Exam
d. (3 points) Show the IEEE 754 binary representation of the number 3.75 in single precision.
4. (10 points) Below are two sets of 6-bit twos complement numbers.
(a)
Total
Carry Out _________
Overflow __________
(b)
101101
+110001
Total
Carry Out _________
Overflow ________
3 of 10
Computer Architecture
Final Exam
SRAM
Fast access
Slow reading
High costs
Slow access
Large area
Low power
Fast switching
High power
Small area
Low costs
b. (6 points) Fill in the cells of the following table.
Memory Chip
Total # of bytes
# of address lines
to decode address
# data lines
64M x 16
2G x 8
c. (4 points) Given 64K x 8 is the only memory chip available, how many chips are needed for
designing a 16M x 32 memory
4 of 10
Computer Architecture
Final Exam
6. (6 points) Match the address mode to its corresponding addressing mode diagram
Address Mode
Diagram
Address Mode
Immediate
Direct
Indirect
Register
Register Indirect
Displacement (Indexed)
Instruction
Opcode
Instruction
Address A
Opcode
Memory
Address A
Memory
Pointer to operand
Operand
Operand
(b)
(a)
Instruction
Opcode Register R Address A
Memory
Instruction
Registers
Opcode
Pointer to Operand
Operand
Operand
(d)
(c)
Instruction
Opcode
Instruction
Register Address R
Registers
Opcode
Register Address R
Memory
Registers
Operand
Pointer to Operand
(f)
(e)
5 of 10
Operand
Computer Architecture
Final Exam
7. (6 points) Consider a three stage pipeline (fetch, decode, execute) instruction. Draw the timing diagram
to show how many time units are needed for executing a program with 5 instructions. Assume no
branches in the program and that all stages execute in equal time.
a. (2 points) What is the execution time of the program in the absence of pipelining
b. (2 points) What is the execution time (in time units) of the program with pipelining
8. (6 points) Given the following assembly program, how many cycles does it take to execute on:
i) a multi-cycle machine (no pipelining)
ii) an 8-stage pipelined machine
label
add
sub
lw
slt
sw
$1,$2,$3
$2,$3,$4
$1,0x00($10)
$20,$21,$22
$22,0x00($30)
Instruction Type
Arithmetic
Load
Store
Branch
Logical
Number of
Cycles to Execute
5
7
6
9
11
6 of 10
Computer Architecture
Final Exam
9. (6 points) Consider the following MIPS code and the initial content of the registers and the memory.
Show the contents of registers and memory after the code is executed.
exit:
lw
lw
srl
bne
add
add
sw
$1, 0($1)
$1, 0($1)
$3, $1, 4
$2, $3, exit
$1, $2, $0
$2, $3, $0
$1, 0($4)
BEFORE
REGISTERS
$0
0
$1
116
$2
32
$3
0
$4
104
MEMORY
100
0
104
0
108
514
112
0
116
108
AFTER
REGISTERS
$0
$1
$2
$3
$4
MEMORY
100
104
108
112
116
10. (5 points) Show the binary equivalent of the following MIPS instructions by filling in the space
provided below (all registers are specified using their register number $0-$31). Also mark the
boundaries between the fields (e.g., opcode, etc.) and show the names of the fields.
sub
$5, $6, $7
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
7 of 10
Computer Architecture
Final Exam
11. (6 points) Consider a machine with a byte accessible main memory of 256K bytes and block size of 4
bytes. Assume a direct mapped cache consisting of 128 lines in used with this machine
a. How is the memory address divided into tag, line number, and byte number? Illustrate with a
diagram
b. Into what line would bytes with each of the following addresses be stored? The addresses are in hex.
Give your answers in hex.
2C96
61FB c. Suppose the byte with address A043 (in hex) is stored in the cache. What are the addresses of the
other bytes stored along with it? Give your answer in hex.
12. (6 points) Consider a machine with a byte accessible main memory of 64K bytes and block size of 4
bytes. Assume that a 4-way set associative cache with 8K bytes is used with this machine.
d. How is a 16-bit memory address divided into tag, line/set number, and byte/word number?
e. Into what line/set will bytes with each of the following addresses (in hex) be stored? The addresses
are in hex. Give your answers in hex.
5AE3
81CD
f. Suppose the byte with address 1234 (in hex) is stored in the cache. What are the addresses of the
other bytes stored along with it? Give your answer in hex.
8 of 10
Computer Architecture
Final Exam
9 of 10
Computer Architecture
Final Exam
10 of 10
Computer Architecture
Final Exam