Docsity

Final Examination - Computer Architecture - Spring 2013 | CS 5513, Exams of Computer Architecture and Organization

Toggle sidebar
bg1
CS5513: Computer Architecture
Final Examination
Spring 2013
Total Marks: 96
Time: 2 hour 30 min
Name:
Banner Id:
Alias:
1. [15 pt] Indicate True or False for the following statements:
• Snoopy cache coherence protocol can be implemented without any broadcast medium.
• A message passing system does not require shared address space.
• If a memory block is marked as Dirty in one cache, it cannot be present in a valid state in any other
caches.
• MESI protocol allows cache to cache data transfer.
• Multilevel caches do not affect miss penalty.
• Fully associative cache does not require index calculation.
• An infinite cache can have only compulsory misses.
• A cache miss is handled by the hardware but a page fault is handled by the operating system.
• Maximum speed up that can be achieved by enhancing 50% of a program execution is 5.
• Software pipelining is a technique to exploit instruction level parallelism.
• Structural hazard cannot be eliminated by duplicating resources.
• The ideal CPI for a single issue pipeline is 1.
• A branch delay slot instruction is executed no matter what the outcome of the branch is.
• Performance is proportional to execution time.
• A superscalar processor issues more than one instruction in every clock cycle.
1
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Final Examination - Computer Architecture - Spring 2013 | CS 5513 and more Exams Computer Architecture and Organization in PDF only on Docsity!

CS5513: Computer Architecture

Final Examination

Spring 2013

Total Marks: 96

Time: 2 hour 30 min

Name:

Banner Id:

Alias:

  1. [15 pt] Indicate True or False for the following statements:
    • Snoopy cache coherence protocol can be implemented without any broadcast medium.
    • A message passing system does not require shared address space.
    • If a memory block is marked as Dirty in one cache, it cannot be present in a valid state in any other caches.
    • MESI protocol allows cache to cache data transfer.
    • Multilevel caches do not affect miss penalty.
    • Fully associative cache does not require index calculation.
    • An infinite cache can have only compulsory misses.
    • A cache miss is handled by the hardware but a page fault is handled by the operating system.
    • Maximum speed up that can be achieved by enhancing 50% of a program execution is 5.
    • Software pipelining is a technique to exploit instruction level parallelism.
    • Structural hazard cannot be eliminated by duplicating resources.
    • The ideal CPI for a single issue pipeline is 1.
    • A branch delay slot instruction is executed no matter what the outcome of the branch is.
    • Performance is proportional to execution time.
    • A superscalar processor issues more than one instruction in every clock cycle.
  1. [13 pt] Short Questions:

(a) [3 pt] What is a precise exception?

(b) [4 pt] Implement a lock using LL (load linked) and SC (store conditional) instructions.

  1. [10 pt] Suppose you can apply three enhancements - enh 1 , enh 2 , and enh 3. They can be applied to 40%, 25%, and 30% of a program respectively. When applied individually, the overall speed ups of the program are 1.50, 1.10, and 1.20 respectively. What are the speed ups of each enhancement alone? How much will be the overall speed up of the program if you apply them together?
  1. [20 pt] Pipeline: Let us consider the pipeline shown in Figure 1 with stages: Instruction Fetch (IF), Instruction Decode (ID), Execution (EX), Memory Read (MEMR), Memory Write (MEMW), and Write Back (WB).

REG DM DM REG

ALU

IM

IF ID EX MEMR MEMW WB

CC1 CC2 CC3 CC4 CC5 CC

Figure 1: Pipeline stages.

Here, CC, IM, and DM stand for clock cycle, instruction memory, and data memory respectively. We have the following assumptions about this pipeline:

  • Register file is written during the first half of a clock cycle and read during the second half.
  • Data memory can be accessed by MEMR and MEMW stages in the same clock cycle. That means, it has multiple ports to avoid structural hazard.
  • A branch instruction is fully resolved in the execution stage.
  • A branch is handled by stalling the pipeline (flush or freeze policy).

(a) [7 pt] Assume that there is no forwarding in the pipeline. Fill up the following pipeline diagram. The code fragment is as follows: LD R1, 0(R2) ADD R3, R1, R SUB R4, R3, R SD R2, 0(R4) LD R3, 8(R2) BEZ R3, L ADD R5, R1, R

Ins 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 LD R1, 0(R2) ADD R3, R1, R SUB R4, R3, R SD R2, 0(R4) LD R3, 8(R2) BEZ R3, L ADD R5, R1, R

  1. [8 pt] Tomasulo’s Algorithm: We have the following assumptions. - Assume you have 1 Integer, 1 Address Generation, 1 FP Add/Sub, 1 Branch and 1 FP Divider/Multiplier Functional Unit. Integer, Address Generation and Branch FU takes 1 cycle in EX stage, FP Add/Sub takes 6 cycles and FP Divider/Multiplier takes 12 cycles. - Assume no hardware speculation and single issue. - There is just one CDB. - Whenever there is a conflict for a functional unit or CDB, assume that the oldest (by program order) of the conflicting instruction gets access, while others are stalled. - A branch instruction occupies the branch functional unit for its one cycle EX. - A branch instruction does not have any WR stage. - Assume that the first branch is not taken. - Memory accesses use the Address Generation functional unit to perform effective address calculation during the EX stage. For loads, after the effective address is calculated, data memory is accessed in 1 cycle. Thus for loads, EX stage does both address calculation and memory access. - For stores, data memory is written during WR stage. A store instruction enters into WR stage when both the effective address is calculated and the data value is available. A store instruction that finishes address calculation but waits for the data value still occupies the reservation station. It the data value is broadcast in CDB at cycle x, the store will enter into WR stage at cycle x+1. - Loads and stores enter into EX stage in program order. That is, even if a load/store is ready to execute, it will not enter into EX stage until all prior (according to the program order) loads/stores finish EX stage. - None of FP Add/Sub or FP Divider/Multiplier is pipelined. - If an instruction moves to its WR stage in cycle x, then an instruction that is waiting on the same functional unit (due to a structural hazard) can start executing in cycle x unless the waiting instruction is dependent on the first one. In that case, the waiting instruction will start at cycle x+1. - Assume that the number of reservation stations are 5 for loads, 2 for stores, 4 for integers, 3 for FP Add/Sub, 2 for branch, and 4 for FP Divider/Multiplier.

Complete Table 1 using Tomasulo’s algorithm with the above specifications.

Instruction Reservation Station IS EX WR

LD F0, 0(R1) Load buffer 1 1 2-3 4

ADD.D F2, F0, F

SD F0, 8(R1)

BEQZ F2, L

ADD.D F4, F6, F

DIV.D F6, F4, F

SD F4, 16(R1)

DADD.I R1, R1, #-

BE R1, R4, L

Table 1: Instruction sequence

  1. [10 pt] Software Pipelining: Assume the latencies of a 5 stage MIPS pipeline with full forwarding support. The following code fragment shows a loop:

Loop: LD R1, 0(R2) ADD R2, R1, R SUB R4, R1, R SD R2, 8(R7) SD R4, 0(R8) SUB R2, R2, # BNEQ R2, Loop

(a) [6 pt] Show the steady state code of the software pipelined loop.

  1. [22 pt] Multiprocessor & Memory Hierarchy:

(a) [4 pt] Suppose a student wrote the following code fragment for lock operation. lock: LD R1, 0(R2) // 0(R2) is the lock variable BNEQZ R1, lock ADD R3, R0, #1 // Initialize R3 with 1 SD R3, 0(R2) Is the implementation correct? If not, explain how the code can fail to guarantee mutual exclusion for a critical section.

(b) [4 pt] Implement Fetch-and-Decrement with Load Linked (LL) and Store Conditional (SC) instruc- tions.

(c) [10 pt] Let us assume a multiprocessor system with 3 processors. Each of them has a 64 Kbyte phys- ically tagged and physically indexed direct mapped L1 cache with 256 Byte block, a write back write policy, and a write allocate write miss policy. The caches are connected with a shared bus. The system has an invalidation based snoopy MESI protocol. We have three variables x, y, and z with physical ad- dress 0x10000, 0x20000, and 0x30000 respectively. The following table shows the memory reference stream. Show the state associated with the block at index 0x00 of each cache.

Reference P1’s Cache^ P2’s Cache^ P3’s Cache^ Any Tag State Tag State Tag State Writeback? P1: Rd x 0x 1 E – I – I No P2: Rd x P3: Rd x P1: Wr x P1: Rd y P2: Rd x P1: Rd z P3: Rd x P1: Wr y P1: Wr x P2: Rd x

Table 2: Memory reference stream

(d) [4 pt] Assume that a system has 16 bit virtual address and 14 bit physical address and page size is 4 KByte. How many entries are there in the page table? A partial page table is given in Table 3. Translate the virtual addresses in Table 4 into physical addresses.

Virtual Page Physical Page 0 0 6 2 A 1 C 3

Table 3: Partial page table

Virtual Address Physical Address A C D20E D

Table 4: Address to be translated