Computer Science 61CL - Summer 1999 - Clancy - Midterm 1

# Computer Science 61CL - Summer 1999 - Clancy - Midterm 1 -...

This preview shows pages 1–3. Sign up to view the full content.

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

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

View Full Document
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'.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern