Download presentation
Presentation is loading. Please wait.
1
1 Quiz 3, Answers 1,3 The CPI is: 0.22*7 + 0.55*4 + 0.12*3 + 0.11*12 = 1.54 + 2.2 + 0.36 + 1.32 = 5.42 In the 2nd case the CPI is 1.0. Every instruction is executed in 1 cycle. Answer 3: A. ET = 1,200,000*3.68*2.0ns = 8.832ms B. ET = 1,100,000*4.12*1.8ns = 8.158ms C. ET = 1,000,000*1.00*8.8ns = 8.800ms Computer B executes program X the fastest.
2
2 Answer 2A The RegWrite control line controls if an instruction will write into the Register File (RF). –1: write to RF. –0: Don't write to RF. The instructions add and lw write a value into the RF, thus RegWrite will be set to 1. The instructions beq and sw just read data from the RF, thus RegWrite will be set to 0.
3
3 Answer 2B The MemRead control line controls if an instruction will read from data memory. –1: Read from data memory. –0: Don't read from data memory. The instruction lw reads a value from data memory, thus MemRead will be set to 1. The instructions beq, sw and sub don't read from data memory, thus MemRead will be set to 0.
4
4 Answer 4A Sign-extending a number means converting it from a n bit number to a m bit number (m>n) without it losing its sign. The added m-n bits are set to be the value of bit n- 1. Thus the sign-bit is extended and a negative number doesn't turn positive when it is extended. The instruction beq sign-extends the 16-bit address in order to add it to the PC. The instruction sw sign-extends the 16-bit offset in order to add it to the base register.
5
5 Answer 4B Shifting left a number by 2 means multiplying it by 4. The instruction beq shifts left by 2 the word value in order to convert it to a byte value. The instruction j shifts left by 2 the word value in order to convert it to a byte value. The instruction lw doesn't shift left by 2 the offset, it is already a byte offset.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.