09.01.2015 Views

Solution - Ugrad.cs.ubc.ca

Solution - Ugrad.cs.ubc.ca

Solution - Ugrad.cs.ubc.ca

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2 (10 marks) The Y86-Pipe-Minus CPU implementation is a pipelined version of the Y86 that does not detect or<br />

eliminate hazards automati<strong>ca</strong>lly.<br />

Consider the following Y86 assembly code:<br />

0x000: irmovl $10, %edx<br />

0x006: irmovl $13, %eax<br />

0x00c: subl %edx, %eax<br />

0x00e: halt<br />

2a What unexpected thing will happen if this code is run and why it will happen<br />

Data harzard @ line 3.<br />

values in register %eax and %edx haven’t been written back when ”subl” instuction is executed.<br />

2b How <strong>ca</strong>n the developer fix it Write a modified version of the code that will behave as expected<br />

irmovl $10, %edx<br />

irmovl $13, %eax<br />

nop<br />

nop<br />

nop<br />

subl %edx, %eax<br />

halt<br />

2c Describe the two ways that the CPU designer could change the architecture to fix the problem that we discussed<br />

in class, and explain why one is better than the other.<br />

Stalling and Data forwarding (You need to simply explain what they are). Data forwarding is a better way<br />

when taking throughput, consistency into consideration.<br />

2d In the full, final, pipelined Y86 implementation (Y86-PIPE), there is a single type of data dependency that is<br />

not completely eliminated using data forwarding. What is it, and why <strong>ca</strong>n’t it be fixed<br />

use/load dependency <strong>ca</strong>nnot be fixed by using data forwarding since data is available only after memory stage<br />

and it is needed at decode stage of the load instruction. One bubble is needed.<br />

2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!