sp03 homequiz 2 solutions

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

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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

This homework help was uploaded on 01/29/2008 for the course CS 152 taught by Professor Kubiatowicz during the Spring '04 term at Berkeley.

Page1 / 3

sp03 homequiz 2 solutions - 1 University of California...

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

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