- CS Course Webpages

Transcription

- CS Course Webpages
CSCE 312 Computer Organization
Final Exam (Total: 100, 4 pages)
Name : UIN: 1. (20 pts) Fill the empty slots of the following table to describe the processing of irmovl V, rB and popl intstructions.
Stage
Fetch
irmovl V, rB
Icode:ifun Å M1[PC]
1)
2)
3) valP Å Decode
Execute
Memory
Write Back
5) valE Å
PC update
PC Å valP
8)
Popl rA
Icode:ifun Å M1[PC]
1)
valP Å PC +2
valA Å R[%esp]
4)
6) valE Å
7) valM 9)
10)
PC Å valP
2. (10 pts) Convert the following decimal numbers to 8‐bit two’s complement binary from: 1) ‐26
2) 8
3) 30
4) –6
5) ‐12
1
3. Pipeline Architecture
1) (4pts) Name two dependencies that may cause hazards in pipeline architecture.
2) (15 pts) In the following codes, identify any dependency. For each dependency, determine whether it cause hazard or not. If so, describe any suggestion to solve the hazards or to reduce the effect of hazards. Be brief!
Sum:
pushl %ebp
rrmovl %esp, %ebp
mrmovl 8(%ebp),%ecx
mrmovl 12(%ebp), %edx
xorl %eax,%eax
andl %edx, %edx
je End
Loop:
mrmovl (%ecx), %esi
addl %esi, %eax
irmovl $4,%ebx
addl %ebx,%ecx
irmovl $‐1,%ebx
addl %ebx,%edx
jne Loop
End:
rrmovl %ebp,%esp
popl %ebp
ret
2
4. CPI calculation
1) (5 pts) What is ideal CPI (clock per an instruction) of perfect pipeline architecture?
2) (15 pts) Calculate the effective CPI with the following assumptions.
‐ Load instructions account for 25% of all instructions executed. Of these, 20% cause load hazards whose penalty is one bubble.
‐ Conditional branches account for 20% of all instructions executed. Of these 60% are take and 40% are not taken. The predictor always predicts to non‐taken for all branches. The penalty for misprediction is two bubbles.
‐ Return instructions account for 2% of all instructions executed. The system will add bubbles until the return address be known. (You need to figure out how many bubbles should be added.)
5. Suppose that a 1MB file consisting of 512 byte logical blocks is stored on a disk drive with the following characteristics:
Parameter
Value
Rotational rate
10,000 RPM
Average Seek Time
5 ms
Average # sectors/track
1000
Surfaces
4
Sector size
512 bytes
For each case below, supposed that a program reads the logical bocks of the file sequentially, one after the other, and that the time to position the head over the first block is the Average Seek Time + the Average Rotation Time.
1) (5 pts) Best case: Estimate the optimal time required to read the file given the best possible mapping of logical blocks to disk sectors.
2) (5 pts) Random case: Estimate the optimal time required to read the file if blocks are mapped randomly to disk sectors.
3
6. Suppose we have a system with the following properties:
x
x
x
x
The memory is byte addressable.
Memory accesses are to 1-byte words (not to 4‐byte words).
Addresses are 12 bits wide.
The cache is two‐way set associative (E = 2), with a 4‐byte block size (B = 4) and four sets (S = 4).
The contents of the cache are as follows, with all addresses, tags, and values given in hexadecimal notation:
Set index 0
1
2
3
Tag
00
83
00
83
00
40
FF
00
Valid
1
1
1
0
1
0
1
0
Byte 0
40
FE
44
‐‐
48
‐‐ 9A
‐‐
Byte 1
41 97
45
‐‐
49 ‐‐ C0
‐‐ Byte 2
42 CC
46 ‐‐ 4A ‐‐
03
‐‐ Byte 3
43
D0
47
‐‐
4B
‐‐ FF ‐‐ 1) (6 pts) The following diagram shows the format of an address (one bit per box). Indicate (by labeling the diagram) the fields that would be used to determine the following:
CO The Cache block Offset CI The Cache set Index CT The Cache Tag
11 10 9 8 7 6 5 4 3 2 1 0
2) (15 pts) For each of the following memory accesses indicate if it will be a cache hit or miss when carried out in sequence as listed, from top to bottom. Also give the value of a read if it can be inferred from the information in the cache. (Copy the two right‐most columns of the table, and fill in the missing values.)
Operation
Read
Write
Read
Address
0x834
0x836
0xFFD
Hit?
Read value (or "unknown")
4