{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

sp99 homequiz 2 solution

Computer Organization and Design: The Hardware/Software Interface

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

View Full Document Right Arrow Icon
1 University of California, Berkeley College of Engineering Computer Science Division EECS Spring 1999 John Kubiatowicz Homework Quiz (HW #2) Solutions February 16, 1999 CS152 Computer Architecture and Engineering This quiz covers one of the problems from homework #2. Good Luck! Your Name: SID Number: Discussion Section: Total:
Background image of page 1

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

View Full Document Right Arrow Icon
2 A better multiply for the Single Instruction Computer In the homework, you were introduced to the “Subtract and branch if negative” instruction: sbn a, b, c # Mem[a] = Mem[a] – Mem[b]; If Mem[a] < 0 goto c; Problem 3.30 asked you to develop a multiply routine that was not particularly efficient. Consider the following alternative for a 16-bit computer. This performs c = a * b, modifying b in the process: c = 0; for (index = 32768; index >= 1; index = index / 2) { If (b >= index) { b = b – index; c = c - index * a; } } c = -c; To implement this, we will assume a macro facility that lets us generate groups of instructions many times. 1.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 3

sp99 homequiz 2 solution - University of California...

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

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