Docsity

COSC 201 Fall 2002 Final Exam Questions and Solutions - Prof. Jaime W. Spacco, Exams of Computer Architecture and Organization

Partial preview of the text

Download COSC 201 Fall 2002 Final Exam Questions and Solutions - Prof. Jaime W. Spacco and more Exams Computer Architecture and Organization in PDF only on Docsity!

COSC 201 Final Exam Fall 2002 Name: ____________________________________

  1. What is an Instruction Set Architecture?

  2. What are a cache hit and a cache miss? Explain how each is detected.

  1. Convert the following number in binary two's complement format to decimal. 1111 1111 1111 1111 1111 1111 1111 0100

  2. Convert the following number in IEEE floating point format to decimal. 1100 0001 0100 0000 0000 0000 0000 0000

  1. How many clock cycles are required for each of the following instructions for the multicycle CPU? Briefly explain what actions are performed in each clock cycle (except for the first two clock cycles, which are the same for all instructions). a) lw $s0, 4($sp)

b) sw $s1, 8($sp)

c) slt $t0, $t1, $t

d) beq $t0, $t1, loop

e) jr $ra (be careful)

f) nop (be careful)

  1. How many clock cycles does it take to execute this function on the multicycle CPU? Write a formula in terms of the parameter "length".
  1. Assume that we have a pipelined CPU with the following branch and data hazards:
  • One instruction following a branch is always fetched.
  • A branch may not depend on a result from the previous instruction.
  • The result of a load may not be used by the next instruction.

Rewrite the MIPS assembly language by inserting the minimum number of nop instructions to correctly deal with these hazards. To save time and space, you may refer to the instructions by number rather that writing them out completely. For example, to insert a nop after every instruction (which obviously is not the best answer) you could write:

1 nop 2 nop 3 nop 4 nop 5 nop 6 nop 7 nop 8 nop 9 nop

  1. One advantage of a multicycle CPU is that it reduces duplicated hardware. In particular, it has only one memory that is used to store both instructions and data. Thus a cache for a multicycle CPU would contain a combination of instructions and data.

Assume that you have a combined instruction/data cache, direct mapped, with 32 words organized into blocks of 4 words each. A hit takes 1 clock cycle and a miss takes 6 clock cycles.

The first instruction of the sum function is stored in memory at the following address: 0x

The array contains 10 numbers and first number in the array is stored in memory at the following address: 0x6789ABC

How many hits and misses occur when the sum function is executed?