C855 of 55
0 XP
  1. Hook
  2. Problems

C8 · Final exam

Final exam: computer organization

Twelve problems from the whole course: instructions and machine code, memory and the stack, bits and fixed point, interrupts and I/O, linking, performance, the single-cycle and pipelined processor, branch prediction, caches, virtual memory and multicore power, and one program to write. Give yourself three hours, work without the lessons open, and write out your reasoning before checking each answer. "Another set" deals a different exam.

Check

Encode the R-type instructions below (opcode 0x33).

(a)

sub x12, x5, x11 (funct3 0, funct7 0x20)

(b)

mul x12, x5, x11 (funct3 0, funct7 1)

Check

The word FF010113 is an addi.

(a)

Which register does it write?

(b)

What is its immediate?

Check

The word 9ABCDEF0 is stored at 0x3000, little-endian.

(a)

What byte is at 0x3001?

(b)

What does lh from 0x3002 load?

Check

A recursive function saves ra and 2 s registers in a frame rounded up to 16 bytes and recurses 8 levels deep.

(a)

How much stack does it use at the deepest point?

(b)

How much would a loop version, with one such frame, use?

Check

Fixed point: 0.45 in Q15, and a 12-bit ADC reading of 1327 with a 5000 mV reference.

(a)

What integer stores 0.45?

(b)

What does multiply-then-shift give for the reading, in millivolts?

Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.

Check

A peripheral produces 200000 values a second. Interrupts cost 40 cycles on a 120 MHz core.

(a)

What load would one interrupt per value cause? (Over 100% is impossible.)

(b)

With double-buffered DMA blocks of 1024, how long may processing a block take?

Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.

Check

A firmware build has 40 kB of .text, 5 kB of .rodata, 6 kB of .data, 30 kB of .bss and a 4 kB stack.

(a)

How much flash?

(b)

How much RAM?

Check

A fraction 0.8 of a program's time is in code made 3 times faster.

(a)

What is the overall speedup?

(b)

What is the limit as s grows?

Check

A single-cycle processor has clock-to-Q 35, memories 180, register read 140, ALU 200, mux 30 and register setup 50 (ps). A pipelined version's slowest stage is one memory access, plus 40 ps of register overhead.

(a)

What is the single-cycle clock period?

Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.

(b)

How many times faster is the pipelined clock?

Check

0.2 of instructions are loads, 0.3 of them used at once; 0.2 are branches, predicted with accuracy 0.97, at a 2-cycle penalty.

(a)

What is the CPI?

(b)

What is the IPC?

Check

A loop of 8 iterations runs 20 times; count all runs, the predictors starting at not taken (1-bit) and weakly not taken (2-bit).

(a)

How many mispredictions does the 1-bit predictor make?

(b)

How many does the 2-bit counter make?

Check

A 32 KiB, 4-way L1 with 64-byte lines hits in 2 cycles and misses 0.05 of the time; L2 takes 12 cycles with a local miss rate of 0.25; memory takes 150 cycles.

(a)

How many tag bits does the L1 use (32-bit addresses)?

(b)

What is the AMAT?

Have paper and a calculator ready. Work each problem out by hand, then enter the answer. Your first try on each one counts toward your score.

Practice

Keep practicing

16 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.