This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS61c, Midterm #1, Summer 1999 cs61c, Summer 1999 Midterm #1 Professor Clancy Problem #1 (4 points) [10 minutes] Let us define a new MIPS instruction similar to the SBN (Subtract and Branch if Negative) instruction from your first homework as follows: SBN reg1,reg2,reg3,label Where 'reg1', 'reg2', and 'reg3' are registers and 'label' is an address. Its function is identical to that of the following pseudocode: reg1 = reg2 - reg3 if (reg1 < 0) branch to label You have learned of three different instruction formats used by the MIPS processor: R-, I- and J- format. Since this new instruction doesn't fit well into any of these three, let us define a new format, the Y-Format, as follows to use with this instruction: List three completely distinct reasons why the Y-Format instruction, as defined, would not work correctly on the MIPS processor we've been studying. 1. 2. 3. Problem #2 (8 points) [20 minutes] Each part below specifies an instruction that could be defined to be a pseudoinstruction for a particular MIPS simulator. The effect of each instruction is described so there will be no confusion. For each, specify whether it can be translated into a single TAL instruction by circling YES (it can be translated into a single TAL instruction) or NO (it can not be translated into a single TAL instruction). Also for each write out the shortest sequence of TAL instructions that could be used to simulate the given instruction. (Note: This sequence should be only one instruction for all 'YES' answers and more than one instruction for all 'NO' answers.) a. move reg1, reg2 effect: The value in 'reg2' is copied into 'reg1'. Yes No file:///C|/Documents%20and%20Settings/Jason%20Raft...20Summer%201999%20-%20Clancy%20-%20Midterm%201.htm (1 of 6)1/27/2007 5:39:04 PM CS61c, Midterm #1, Summer 1999 b. sbn reg1,reg2,label Effect: 'reg1' gets the value (reg1-reg2). If this value is negative, branch to the given 'label'....
View Full Document
This note was uploaded on 09/26/2009 for the course CS 61CL taught by Professor Clancy during the Fall '08 term at Berkeley.
- Fall '08
- Computer Science