C854 of 55
0 XP
  1. Hook
  2. Problems

C8 · Problem set 12

Problem set 12: computer organization across the course

Multi-step problems that draw on the whole course: timing and pipelines, addresses and the stack, device registers and interrupts, caches and virtual memory, machine code, fixed-point arithmetic, and one program to write. Each one has your own numbers.

Check

A program runs 5 million instructions. A single-cycle processor runs it at 50 MHz. A 5-stage pipelined version of the same processor runs at 200 MHz with an average CPI of 1.5.

(a)

How long does the single-cycle processor take?

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

(b)

How long does the pipelined processor take?

(c)

How many times faster is the pipelined processor?

Check

An array of 21 ints (4 bytes each) starts at 0x1578, and lesson 17's sum adds it up on a processor with CPI 1 at 100 MHz.

(a)

At what address does the last element start?

(b)

How many instructions does sum run (7 per pass, plus 5)?

(c)

How long does it take?

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

Check

sp holds 0xADF0 when f is called. f makes a 16-byte frame and saves ra at 12(sp), then calls g, which does the same and calls h, a leaf that makes no frame.

(a)

What does sp hold while h runs?

(b)

At what address did f save its ra?

Check

An 8-bit LED register holds 0x29. Firmware sets bit 1, then flips all eight bits with an XOR.

(a)

What does it hold after setting bit 1?

(b)

What does it hold after the XOR with 0xFF?

Check

A timer counting at 16 MHz interrupts a processor every 1 ms. The handler runs 64 instructions on a 150 MHz core with CPI 1.

(a)

How much does the handler add to TIMECMP each time?

(b)

How long does the handler take?

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

(c)

What percentage of the processor's time does it use?

Check

A direct-mapped cache holds 8 KiB in 32-byte lines. It hits in 2 ns, misses cost 60 ns more, and 4% of accesses miss.

(a)

How many lines does it have?

(b)

How many index bits?

(c)

What's the average access time?

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

Check

Count how many of the five words in vals are negative, and leave the count in a0.

RISC-V RV32IM (base integer plus multiply and divide). End your program with ebreak. Tab indents; press Esc and then Tab to move on.

Check

A five-stage pipeline at 500 MHz: 0.2 of instructions are loads, 0.3 of them used at once; 0.2 are branches, 0.1 of them mispredicted at 2 cycles; 0.3 of instructions access data, missing 0.02 of the time at 40 cycles.

(a)

What is the CPI?

(b)

How long do a billion instructions take?

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

Check

Encode sw x10, 8(sp) (S-type: opcode 0x23, funct3 2, rs1 = x2).

(a)

What goes in bits 11:7?

(b)

What is the whole word?

Check

Virtual address 004C4B40 is on a page that maps to physical page 0012C (4 KiB pages). The TLB hits 0.995 of the time in 1 cycle; memory takes 100 cycles and the page table has 2 levels.

(a)

What physical address does it become?

(b)

What is the average time per access?

Check

A UART receives continuously at 115200 baud (10 bit times a byte) into a FIFO that interrupts the 72 MHz processor once every 4 bytes, each interrupt costing 100 cycles plus 5 cycles per byte moved.

(a)

How many interrupts a second?

(b)

What percentage of the processor does receiving use?

Check

A smoothing filter runs y = y + ((a * (x - y)) >> 15) in Q15, with a = 8192, y starting at 0 and every input x = 10000.

(a)

What is y after the first sample?

(b)

What is y after the second?

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

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