ECE314sp06_HW2_solutions - 1 ECE/CS 314 Spring 2006...

Info iconThis preview shows pages 1–4. 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

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 ECE/CS 314 Spring 2006 Homework 2 Solutions Problem 1. Show the effects on memory and registers of the following instructions. (8 points) Suppose a portion of memory contains the following data Address Data 0x1000000C 0xBEEFFEED 0x10000008 0xFEEDBABE 0x10000004 0x89ABCDEF 0x10000000 0x01234567 And that register $8 contains 0x10000000, $9 contains 0x10000004, and $10 contains 0x10000006. Assume each of the following instructions is executed independently of the others, starting with the values given above. Hint: Dont forget that the MIPS architecture is Big-Endian. (a) What will be contained in register $16 after executing the following instruction? lw $16,0($8) $16 will contain 0x01234567 (b) What will be contained in register $16 after executing the following instruction? lh $16,0($10) $16 will contain 0xFFFFCDEF (Sign extension!) (c) What will be contained in register $16 after executing the following instruction? lb $16,3($8) $16 will contain 0x00000067 (d) What will be contained in register $16 after executing the following instruction? lhu $16,2($9) $16 will contain 0x0000CDEF (No sign extension!) (e) What will be contained in register $16 after executing the following instruction? lbu $16,12($8) 2 $16 will contain 0x000000BE Now suppose that register $16 contains 0xABCDEF12. Assume each of the following instructions is executed independently of the others, starting with the values given above. (f) What will the word at address 0x10000000 contain after executing the following instruction? sw $16,0($8) The word at 0x10000000 will contain 0xABCDEF12 (g) What will the word at address 0x10000000 contain after executing the following instruction? sh $16,0($8) The word at 0x10000000 will contain 0xEF124567 (h) What will the word at address 0x10000000 contain after executing the following instruction? sb $16,3($8) The word at 0x10000000 will contain 0x01234512 3 Problem 2. Repeat Problem 1, assuming the processor architecture is Little-Endian. (8 points) (a) What will be contained in register $16 after executing the following instruction? lw $16,0($8) $16 will contain 0x01234567 (b) What will be contained in register $16 after executing the following instruction? lh $16,0($10) $16 will contain 0xFFFF89AB (Sign extension!) (c) What will be contained in register $16 after executing the following instruction? lb $16,3($8) $16 will contain 0x00000001 (d) What will be contained in register $16 after executing the following instruction? lhu $16,2($9) $16 will contain 0x000089AB (No sign extension!) (e) What will be contained in register $16 after executing the following instruction? lbu $16,12($8) $16 will contain 0x000000ED Now suppose that register $16 contains 0xABCDEF12. Assume each of the following instructions is executed independently of the others, starting with the values given above....
View Full Document

Page1 / 12

ECE314sp06_HW2_solutions - 1 ECE/CS 314 Spring 2006...

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

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