0706.205.01 Computer Organization

Homework 2

Supporting Procedures / Strings


Due Date

Monday, March 11 (11:59pm)

Form of Submission

Homework can submitted via email or printout by deadline.

Preparation

Patterson & Hennessy. Chapter 3 (through Section 3.7)
(Questions 2-4 below require knowledge of Section 3.7)

Correction

On Slide 12 of last week's lecture I claimed that there was an instruction SUBI, which subtracted immediate values. That isn't strictly true. In order to subtract an immediate value in MIPS, one uses ADDI with a negative immediate value. Thus
	subi	$sp, $sp, 8	# reserve two words on the stack
is more accurately written:
	addi	$sp, $sp, -8	# reserve two words on the stack

Questions

  1. P&H: Exercise 3.26
    (Assume n is in $a0, and place result in $v0)

  2. P&H: Exercise 3.21

  3. Compute the hexadecimal form of the string from Exercise 3.21.

  4. P&H: Exercise 3.22
    (You might find it useful to create a multiply-by-ten procedure as part of your answer.)