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: 1 University of California, Berkeley College of Engineering Computer Science Division EECS Spring 2003 John Kubiatowicz Homework Quiz (HW #2) SOLUTIONS February 12, 2003 CS152 Computer Architecture and Engineering This quiz covers one of the problems from homework #2. Good Luck! Your Name: SID Number: Discussion Section: Total: 2 General Base Conversions In homework problem 3.22, you were asked to write a MIPS assembly language program to convert an ASCII decimal string to an integer. For this quiz, construct a similar program which can convert a string of any base (from 2 to 16) to an integer. The specifications are as follows: The first argument (a0) contains a pointer to a null-terminated string The Second argument (a1) contains the base and will be such that: 2 a1 16 (you can assume that this is true) On exit, v0 will contain the result. This procedure (call it convert) must adhere to all MIPS conventions If any character in the string (before the final null character) is not a legal character for the specified...
View Full Document
- Spring '04
- Computer Architecture