chapter 4 exercises solutions

Upload: kristina-norton

Post on 18-Oct-2015

84 views

Category:

Documents


0 download

DESCRIPTION

CDA3100 Intro into Computer Architecture. Computer Organization and Design, Revised Fourth Edition . ISBN 9780123747501. Chapter 4: The Processor.

TRANSCRIPT

  • Chapter 4 Exercises Solutions

    Exercise 4.1.1 pg. 409 (5 points)

    The values of the signals are as follows:

    RegWrite MemRead ALUMux MemWrite ALUop RegMux Brancha. 1 0 0 (Reg) 0 AND 1 (ALU) 0b. 0 0 1 (Imm) 1 ADD X 0

    ALUMux is the control signal that controls the Mux at the ALU input, 0 (Reg)selects the output of the register file and 1 (Imm) selects the immediate from theinstruction word as the second input to the ALU.

    RegMux is the control signal that controls the Mux at the data input to the registerfi le, 0 (ALU) selects the output of the ALU, and 1 (Mem) selects the output ofmemory.A value of X is a dont care (does not matter if signal is 0 or 1).

    Exercise 4.4.1 pg. 412 (5 points)

    Implementation Latency in Gates

  • Exercise 4.9.1 pg. 417 (10 points)

    Exercise 4.13.1 pg. 420 (10 points)

    Exercise 4.19.2 pg. 427 (5 points)

    With full forwarding, the only RAW data dependences that cause stalls are those from the MEM stage of oneinstruction to the 1st next instruction. Even these dependences cause only one stall cycle, so we have:

    Exercise 4.23.1 pg. 431 (10 points)

    Each branch that is not correctly predicted by the always-taken predictor will cause 3 stall cycles, so we have:Extra CPIa. 3 (1 0.45) 0.25 = 0.41 b. 3 (1 0.65) 0.08 = 0.08

    Exercise 4.32.1 pg. 440 (5 points)

    The expected number of mispredictions per instruction is the probability that a given instruction is a branchthat is mispredicted. The number of instructions between mispredictions is one divided by the number ofmispredictions per instruction. We get: