HW2 answers

HW2 answers - Solutions for Homework 2 5.2(12 points 2 each...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Solutions for Homework 2 5.2 (12 points – 2 each) a. RegWrite = 0: All R-format instructions, in addition to lw , will not work because these instructions will not be able to write their results to the register file. b. ALUop1 = 0: All R-format instructions except subtract will not work correctly because the ALU will perform subtract instead of the required ALU operation. c. ALUop0 = 0: beq  instruction will not work because the ALU will perform addition instead of subtraction (see Figure 5.12), so the branch outcome may be wrong. d. Branch (or PCSrc) = 0: beq  will not execute correctly. The branch instruction will always be not taken even when it should be taken. e. MemRead = 0: lw  will not execute correctly because it will not be able to read data from memory. f. MemWrite = 0: sw  will not work correctly because it will not be able to write to the data memory. 5.3 (12 points – 2 each) a. RegWrite = 1: sw  and beq  should not write results to the register file. sw ( beq ) will overwrite a random register with either the store address (branch target) or random data from the memory data read port. b. ALUop0 = 1: lw  and sw  will not work correctly because they will perform subtraction instead of the addition necessary for address calculation. c. ALUop1 = 1: lw  and sw  will not work correctly. Lw  and sw  will perform a random operation depending on the least significant bits of the address field instead of addition operation necessary for address calculation. d. Branch = 1: Instructions other than branches ( beq ) will not work correctly if the ALU Zero signal is raised. An R-format instruction that produces zero output will branch to a random address determined by its least significant 16 bits. e. MemRead = 1: All instructions will work correctly. (Data memory is always read, but
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/03/2008 for the course CSE 230 taught by Professor Calliss during the Spring '08 term at ASU.

Page1 / 3

HW2 answers - Solutions for Homework 2 5.2(12 points 2 each...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online