Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Questions For the following code sequence ADD R1, R2, R3 SHL R3, R4, R5 SUB R1, R6, R3 SUB R5, R3, R1 (a)How many potential data hazards are there? (b)

Similar presentations


Presentation on theme: "1 Questions For the following code sequence ADD R1, R2, R3 SHL R3, R4, R5 SUB R1, R6, R3 SUB R5, R3, R1 (a)How many potential data hazards are there? (b)"— Presentation transcript:

1 1 Questions For the following code sequence ADD R1, R2, R3 SHL R3, R4, R5 SUB R1, R6, R3 SUB R5, R3, R1 (a)How many potential data hazards are there? (b) Draw a space time diagram showing the progression of the instructions through a 5-stage pipeline (the pipeline as described in notes). (c) How many cycles are saved if internal forwarding is applied? ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides10Quiz.ppt Modification date: Nov 22, 2014

2 2 IF EX MEM OS OF 1 1 1 1 1 2 Set R1 invalid Read R4 and R5 Write to R1, set valid 2 Set R3 invalid Read R2 and R3 2 2 2 3 Write to R3, set valid 3 3 3 Set R1 invalid Read R6 4 3 Read R3 3 3 3 Write to R1, set valid 4 4 4 4 4 4 4 4 4 Read R1 Read R3 4 Write to R5, set valid Set R5 invalid Space time diagram (without forwarding) 1. ADD R1, R2, R3 2. SHL R3, R4, R5 3. SUB R1, R6, R3 4. SUB R5, R3, R1 Waiting on (read after write) Waiting on (write after write)

3 3 IF EX MEM OS OF 1 1 1 1 1 2 Set R1 invalid Read R4 and R5 Write to R1, set valid 2 Set R3 invalid Read R2 and R3 2 2 2 3 Write to R3, set valid 3 3 3 Set R1 invalid Read R6 4 3 3 3 Write to R1, set valid 4 4 4 4 4 4 4 4 Read R3 4 Write to R5, set valid Set R5 invalid Space time diagram (with forwarding) Forward R3 Forward R1 2 cycles saved 1. ADD R1, R2, R3 2. SHL R3, R4, R5 3. SUB R1, R6, R3 4. SUB R5, R3, R1


Download ppt "1 Questions For the following code sequence ADD R1, R2, R3 SHL R3, R4, R5 SUB R1, R6, R3 SUB R5, R3, R1 (a)How many potential data hazards are there? (b)"

Similar presentations


Ads by Google