Skip to content
Tactiverge

School/□ Systems Engineer/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

1.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.

  • ◇ Propose an ISA or datapath change and specify it precisely.
  • ◇ Estimate the speed-up in cycles from your measured baseline.
  • ◇ Weigh the speed-up against its cost in gates, cycle time or complexity.

2.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?

Guess first. Being wrong here is how the surprise works.

3.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

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

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

  • Cutting cycles always gives the same speed-up in time.
    ✓ If the change lengthens the clock period, time improves by less.
  • Optimising any part of a program helps a lot.
    ✓ Amdahl's law: the gain is capped by how much of the time that part takes.

4.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.

Can't use the interactive? Read a description instead

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.

5.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1

Setup 1 instruction, loop of 7 instructions run 10 times. A change cuts the loop to 4. Speed-up (2 decimal places)?

×

Practice 2

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

6.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 3 · a fresh version every time

A program spends 2 cycles on setup, then runs a loop 8 times with 8 cycles per pass. A new instruction cuts the loop body to 5 cycles. What is the speed-up (old cycles ÷ new cycles), to 2 decimal places?

Practice 4

A change makes 60 % of a program's run time 3 times faster. Using Amdahl's law, what is the overall speed-up (2 decimal places)?

×

Practice 5

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

7.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.

Open BUILD 008: Create a Virtual Computer →

8.Reflect

Concepts: Instruction set architecture · Register-transfer-level design · Algorithms, searching and complexity