Computer Science 61CL - Spring 1998 - Clancy - Midterm 1

Computer Science 61CL - Spring 1998 - Clancy - Midterm 1 -...

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

View Full Document Right Arrow Icon
CS61c, Midterm #1, Spring 1998 cs61c, Spring 1998 Midterm #1 Professor Clancy Problem #1 (7 points, 14 minutes) In lab assignment 4, you wrote a function that returned the contents of the various fields of a MIPS I-format instruction. In this problem we consider a similar task for the Prune 100 computer. The Prune, like the MIPS, has 32-bit instructions. The Prune has only 16 registers. In an I-format Prune instruction, the meaning of the bits is as follows. The first 8 bits are the op code. The next 4 bits are the register to be modified by the instruction. The last 20 bits are the immediate operand, in 1's complement. Thus the equivalent to the MAL instruction, addi $10,-2 might appear in hexadecimal as 94 af ff fd if the op code for the addi instruction were 94 base 16. On the next page, write a MAL function SplitIFormat that returns the contents of the register and immediate fields of a Prune 100 I-format instruction. If written in C, its prototype would be void SplitIFormat (int instr, int *register, int *immediate); If written in C++, its prototype would be void SplitIFormat (int instr, int ®ister, int &immediate); Follow the conventions described in class and in lab and homework assignment 6 for passing arguments and managing registers and the system stadck. Provide comments sufficient for the graders to understand your work.
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 09/26/2009 for the course CS 61CL taught by Professor Clancy during the Fall '08 term at University of California, Berkeley.

Page1 / 4

Computer Science 61CL - Spring 1998 - Clancy - Midterm 1 -...

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