Docsity

Quiz Solutions for Introduction to Computer Engineering (Cmpe 2030 A) - Part III, Exams of Computer Science

Partial preview of the text

Download Quiz Solutions for Introduction to Computer Engineering (Cmpe 2030 A) - Part III and more Exams Computer Science in PDF only on Docsity!

Cmpe 2030 A

Introduction to Computer Engineering

Quiz -III Solutions

May 28th, 1999

1 (a) How many transistors are there in each of a DRAM cell and a SRAM cell (designs we

examined)?

1 (b) Consider the following values of successive bytes in memory. Assume that a word is

accessed from the location shown and placed in a register. Show the 32-bit hexadecimal

value that is placed in a register assuming the data was stored in i) big endian format, and

ii) little endian format.

DRAM ____1____

SRAM ____6____

0x

0x

0x

0x

0x

Address Big Endian Little Endian 0x10010008 0xa0c1b534 0x34b5c1a

2. Consider the following SPIM program. The data segment starts at 0x10010000 and the text

segment starts at 0x00400000.

2 (a) Show the contents of memory at the following data segment addresses. Assume that the

data segment starts at 0x10010000. Present your answer in hexadecimal notation.

2 (b) What is the final value of the contents of $t3?

2 (c) What are the values of the labels begin and str?

.data

label: .word 0xff, 0x

str: .asciiz “CmpE”

.align 2

.word 6

.text

add $t0, $0, $

begin: lw $t1, label($t0)

addi $t0, $t0, 4

lw $t2, label($t0)

and $t3, $t1, $t

li $v0, 10

syscall

Address Contents 0x10010000 0x000000ff 0x10010004 0x 0x10010008 0x45706d 0x1001000c 0x 0x10010010 0x

$t3 __0x00000034____

str 0x

begin 0x

2 (d) Write a short SPIM program that swaps the upper and lower sixteen bits of register $t0.

For example if the initial contents of $t0 were 0x46721128 then the final contents would be

0x11284672. You may use other registers to store intermediate values. A short set of SPIM

instructions is attached to this quiz.

srl $t1, $t0, 16 # store the upper 16 bit sin the lower half of $t

sll $t2, $t0, 16 # store the lower 16 bits in the upper half of $t

or $t0, $t1, $t2 # Perform the logical OR to produce the desired result