Computation II: MIPS, Pipelining, Memory, Parallelism, Exercises of Computational Methods

Computer Architecture Questions

Typology: Exercises

2018/2019

Uploaded on 06/24/2019

kristikapllani
kristikapllani 🇳🇱

2 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Exercises Computation II 5EIB0
Questions
Question 1
We compare 3 different implementations of the MIPS architecture, the single cycle, the multi-
cycle and the (5-stage) pipelined implementation, all implemented in the same technology. All
run the same MIPS program. This program contains 20% load, 10% store, 20% control, and 50%
other
instructions. On the multi-cycle implementation loads take 5 cycles, control instructions 3 cycles,
and all others 4 cycles. To make the exercise easier you may ignore all hazards and pipeline
register overhead.
Can you fill in the open fields in the next table.
N_instructions CPI T_cycle T_execution
------------------------------------------------------------------
Single cycle 10000 - 2.0 ns -
Multi cycle - - - -
Pipelined - - - -
Question 2
A Pentium-4 processor is a so-called 3-issue machine. It has 20 pipeline stages. It uses branch
prediction, with a correct branch prediction rate of 95%. A correctly predicted branch has no
penalty, however a wrongly predicted branch has a penalty of 19 cycles. 15% of the instructions
are branches.
a. What is its ideal CPI of a Pentium-4?
b. What is the CPI if we take branches into account, but ignore all other hazards.
pf3
pf4
pf5

Partial preview of the text

Download Computation II: MIPS, Pipelining, Memory, Parallelism and more Exercises Computational Methods in PDF only on Docsity!

Exercises Computation II 5EIB

Questions

Question 1

We compare 3 different implementations of the MIPS architecture, the single cycle, the multi-

cycle and the (5-stage) pipelined implementation, all implemented in the same technology. All

run the same MIPS program. This program contains 20% load, 10% store, 20% control, and 50%

other

instructions. On the multi-cycle implementation loads take 5 cycles, control instructions 3 cycles,

and all others 4 cycles. To make the exercise easier you may ignore all hazards and pipeline

register overhead.

Can you fill in the open fields in the next table.

N_instructions CPI T_cycle T_execution

Single cycle 10000 - 2.0 ns - Multi cycle - - - - Pipelined - - - -

Question 2

A Pentium-4 processor is a so-called 3-issue machine. It has 20 pipeline stages. It uses branch

prediction, with a correct branch prediction rate of 95%. A correctly predicted branch has no

penalty, however a wrongly predicted branch has a penalty of 19 cycles. 15% of the instructions

are branches.

a. What is its ideal CPI of a Pentium-4?

b. What is the CPI if we take branches into account, but ignore all other hazards.

Question 3

Given the 5-stage pipelined MIPS processor from the book (requiring 1/2 cycle for register file

read and register file write), with all hazard detection included, but no forwarding!

We run the following program:

lw $t0, 0($t2) lw $t1, 4($t0) sub $s5, $t1, $t sw $s5, 4($t0)

How many stall cycles are generated during the execution of above program.

Question 4

We add the following 'multiply-accumulate' instruction to the 5-stage pipelined MIPS processor:

mulacc r1, r2, r3 // r1 = r1 + r2*r

Which changes are needed to the register file of the pipelined data path?

Question 5

What is the data cache hit-rate for this program, assuming that this cache has 1-word (32-bit)

blocks, 2-word or 4-word blocks?

Question 8

Consider a virtual memory system with the following properties: 40-bit virtual byte address, 16

kbyte page size, 36-bit physical byte address. What is the total size (in bits) of the page table for

each process on this machine, assuming that each entry contains a valid, protection, dirty and use

bit, and that all virtual pages are in use. Tricks to reduce the page table are not used.

Question 9

Given following two processes, P1 and P2, running in parallel. They have access to the shared

variable 'a'. Variables b and c are locals.

/* Process P1 / / Process P2 */

lw $t0,a lw $t2,a lw $t1,b lw $t3,c add $t0,$t0,t1 sub $t2,$t2,$t sw $t0,a sw $t2,a

Given that variables a, b and c contain initially the values 100, 20, and 30 respectively, what are

all possible outcomes of the value of 'a' after executing both processes once?

Question 10

Give the MIPS assembly code for the following string copy function

void strcpy (char x[], char y[]) { int i; i = 0; while ((x[i] = y[i]) != 0) // copy and test byte i++; }

Assume : i located in register $s1, arguments x[] and y[] are in registers $a0 and $a1.

Question 11 Performance scaling (weak and strong; Amdahl vs Gustafson)

Assume you have a program with a serial part (S), which does not show any speedup when executed on a parallel processor, and a parallel part (P), which shows ideal speedup on a parallel processor. a. Assume the S = 10 % of the program, when running on a single core, with a certain data input with fixed size (D). Give the speedup when running this program on a 10-core system. b. Give the general formula for Speedup when running this program on an N-core parallel system? c. Now we assume so-called weak scaling, i.e. the amount of input data (D) for the parallel part is proportional to the number of cores (N); give again the general formula for speedup.

Question 12. Parallel execution of Matrix-Matrix multiply We are building a highly parallel system (like a GPU processor) to support matrix- multiplication. The system contains:

  • 8 cores, running at 1.5 GHz.
  • each core supports 8 single precision floating point multiply-add operations per cycle.
  • main memory: 8 memory banks, each 8 bytes wide, with each 256 MB DRAM capacity; the memory system runs at 1 GHz
  • the system does not contain data caches.