TactivergeLite

Lite / Engineering Complex Systems / Week 27

Project: then speed it up

One new instruction or one new gate path could make your multiply several times faster. Which change gives the most speed for the least hardware?

About 60 min · 3 goals · Checked by automated tests · Full interactive version

Why should I care?

Every real processor feature, from multiply instructions to branch predictors, began as an argument like the one you will make: here is the bottleneck, here is the change, here is what it buys and what it costs. This is architecture as engineers practise it.

Predict

A loop has 8 instructions per pass and 1 of setup. A new instruction removes 3 instructions from the body. For y = 10, roughly what speed-up?

  1. About 1.1×
  2. About 1.6×
  3. About 3×
  4. About 8×
Guess first, then reveal

Before: 8 × 10 + 1 = 81. After: 5 × 10 + 1 = 51. 81/51 ≈ 1.59×. Useful, but not as dramatic as changing the algorithm, which can turn y passes into about log₂ y.

Discover

Do Level 5: investigate how the adder's longest gate path grows with bit width (ripple versus carry lookahead) using at least four sizes. Then use your findings to estimate the hardware cost of the speed-up you propose for the multiply.

What the interactive shows (text version)

Level 5 builds adders of several widths from gates and reports gate counts and longest-path depth: the ripple adder's depth grows by about 2 gate delays per bit, while carry lookahead stays shallower but uses more gates. These numbers give the hardware cost of speed.

You can also open the interactive on the full site when you have a faster connection.

Understand

Three kinds of speed-up

Fewer instructions: a new instruction does the work of several (a combined 'decrement and jump if not zero', or a SHIFT for shift-and-add multiply). Fewer cycles per instruction: overlap fetch with execute. Shorter cycle: a faster adder (lookahead) shortens the critical path. The iron law, T = IC × CPI × T_clk, tells you which term each idea attacks.

Quantify it

Speed-up = old time ÷ new time, from your measured baseline. Changes that only touch the loop body help most when y is large; setup costs dominate when y is small. Always state the input you assumed. If a change also lengthens the clock period, include that: a 2× reduction in cycles with a 1.5× longer period is only a 1.33× speed-up.

Price it

New instructions need opcodes (Nibble has spare ones), control-table rows and possibly datapath blocks: a shifter, an extra register, a second adder. Carry lookahead uses more gates to shorten the path. A good design note gives the speed-up, the extra hardware and one risk, and recommends honestly, including 'not worth it'.

Explain it another way

Intuitive

You can make a delivery round faster by carrying more parcels per trip, walking faster, or finding a shorter route. Each costs something different.

Technical

Amdahl's law: if a fraction p of the time is sped up by s, overall speed-up = 1/((1 − p) + p/s). Optimising the part that takes 5 % of the time can never give more than 5 % back.

Mathematical

Speed-up = (s + b·n)/(s + b'·n). As n → ∞ it tends to b/b'. Shift-and-add reduces passes from y to the number of bits of y (4 on Nibble), so for y = 15 it can beat any constant-factor tweak.

Applied

Processor teams decide on new instructions by profiling real workloads and estimating exactly these numbers; adding hardware multiply-accumulate to microcontrollers came from signal-processing code like the filters earlier this term.

Worked example 1

Setup 2 cycles, 10 passes of 24 cycles. A change cuts a pass to 15 cycles but lengthens the clock period by 10 %. Speed-up?

Cycles: 242 → 152, ratio 1.59. Period ×1.1, so time ratio = 1.59/1.1 ≈ 1.45×.

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

×

Practice 2. As the loop count grows very large, the speed-up from shrinking the body from b to b' approaches…

×

Practice 5. A design halves cycle count but makes the clock period 1.5 times longer. Net effect?

Apply it

Deliverables 2 and 3 of the term project: propose one hardware or ISA change, specify it precisely (opcode, RTL for each cycle, new datapath blocks), estimate the new cycle count for your four y values, and write a one-page design note on the speed-up and its gate cost, using your Level 5 data.

Reflect

Would your proposed change still be worth it if most real inputs had y ≤ 2? Why?

Write your answer on paper or in your own notes. Lite never stores what you write.

← Project: program the processorSignals meet hardware: the cycle budget →