Sie sind auf Seite 1von 2

CS2214 COMPUTER ARCHITECTURE & ORGANIZATION SPRING 2012

110 MINUTES

EXAM I
OPEN BOOK
# R11 initially has 10000000 # R9 initially has F # R12 is initially 2

WORK ALL PROBLEMS

(55 pts) 1) Consider the following piece of EMY mnemonic machine language program :
400A00 400A04 400A08 400A0C 400A10 400A14 ---10000000 10000004 LW SUB SW ADDI ADDI BNE ---A E R8, 0(R11) R10, R9, R8 R10, 0(R11) R11, R11, 4 R12, R12, (-1)10 R12, R0, (-6)10

a) Obtain a table that shows the values of registers and memory locations used by the above piece of EMY code as shown in class. Also show the number of memory accesses made for each instruction. Determine what this piece of code does. That is, what is its purpose ? Indicate it in one sentence. b) Invent a new EMY instruction that implements the instructions in locations 400A00, 400A04 and 400A08 above (the LW, SUB and SW). Indicate only the following : Its syntax, semantics, format and the memory accesses made. Then, rewrite the above code starting at 400A00 so that the new EMY instruction is used. Add comments to your code.

(35 pts) 2) Consider the following pseudoinstruction in the mnemonic machine language notation :
Polytechnic Institute of NYU Page 1 of 2 Handout No : 10 February 29, 2012

INVB Rt, Rs

# Rt

Rs [8:31], Rs [0:7]

The Invert Byte pseudoinstruction inverts (complements) the rightmost 8 bits (the rightmost byte) of a register. The leftmost 24 bits (the leftmost 3 bytes) are kept the same. a) Assume that this instruction is added to the EMY instruction set. Indicate only its format, arguments and memory accesses made.

b) Consider the following piece of EMY mnemonic machine language program : 400000 400004 400008 40000C 400010 400014 ---10000000 LW R8, 0(R10) INVB R9, R8 SW R9, 2000(R10) ADDI R10, R10, 4 ADDI R11, R11, (-1)10 BNE R11, R0, (-6)10 ---1234ABCE # R10 initially has 10000000

# R11 is initially 1

Obtain a table that shows the values of registers and memory locations used by the above piece of EMY code as shown in class. Also show the number of memory accesses made for each instruction. c) Assume that you are asked to invert (complement) all the bits (all 32 bits) of a register : INV R9, R8 # Rt Rs

Implement this instruction by using a few actual EMY instructions in the mnemonic notation. Your code starts at 410000. Add comments to your code. Do not use more than 3 (three) instructions. Otherwise, it will not be graded.

(10 pts) 3) Convert the following decimal number to a single-precision IEEE-754-format FP number as
shown in class such that all calculations are manual :

(73)10 = ( ? )IEEE-754
Again, make sure to show all the intermediate steps and as shown in class.
Polytechnic Institute of NYU Page 2 of 2 CS2214 Handout No : 10 February 29, 2012

Das könnte Ihnen auch gefallen