School/✦ Research Engineer/Week 27
Designing an architecture comparison
Ripple-carry or carry-lookahead: which adder is 'better'? The honest answer starts with 'better at what, and how will we know?'
About 50 min · 3 goals · Checked by automated tests
1.Why should I care?
This week you run the term's comparison project. Whether it compares adders, precisions, cache settings or algorithms, the method is the same: a question, a baseline, a prediction from theory, measurements across conditions, and an honest report.
- ◇ Turn 'which is better?' into a measurable research question with a fair baseline and pre-stated metrics.
- ◇ Predict the outcome from first principles (complexity, gate depth, Iron Law) before measuring.
- ◇ Plan measurements across sizes so a trend, not a single point, answers the question.
2.Predict
A ripple-carry adder's delay grows linearly with the number of bits n. How does a carry-lookahead adder's delay grow, roughly?
Guess first. Being wrong here is how the surprise works.
3.Understand
A measurable question
Replace 'which is better?' with something like: 'How does worst-case delay and gate count grow with width n for ripple-carry and carry-lookahead adders, for n = 4 to 32?' The question names the systems, the metrics, the conditions and the range.
Theory first
Write what you expect, with reasons: ripple delay ≈ 2n gate delays (Θ(n)); lookahead ≈ c·log₂ n (Θ(log n)) with more gates. A prediction made before measuring turns the experiment into a test. If the data disagree, that is a finding to explain, not a failure.
Fair comparison
Same gate library and delay model, same widths, same test inputs (including worst-case carry chains), equal effort on each design. Measure a range of sizes so the growth rate is visible; a single size can hide a crossover where the 'worse' design wins for small n.
Explain it another way
Racing two cars on one short track tells you who wins that track. Racing them on tracks of many lengths tells you who wins in general and where the lead changes.
Report metrics as functions of size, fit the expected model (linear, logarithmic) and compare residuals. State the model of delay you used (unit gate delay, no wire delay) and its limits.
If T_ripple(n) = a·n and T_cla(n) = b·log₂ n + c, the crossover where lookahead becomes faster solves a·n = b·log₂ n + c; for a = 2, b = 4, c = 2: n = 8 gives 16 vs 14, so lookahead wins from about n = 8.
Real processors use parallel-prefix adders, a lookahead family, in their ALUs because a 64-bit ripple adder would set an unacceptably long critical path for the clock.
Worked example 1
Write a decision rule for the term project before measuring.
Example: 'Choose the smallest precision whose mean absolute error over the 200 held-out test signals is below 0.5% of full scale, with the upper end of its 95% interval also below 0.5%. If none qualifies, report float.'
Common mix-ups
- Theory isn't needed if you can measure.
✓ Without a prediction you cannot tell a surprising result from an expected one, or spot a measurement error. - The faster design is better.
✓ Better depends on all the metrics that matter (area, energy, accuracy) and the requirement you stated.
4.Discover
Open Level 5 'Investigate speed'. Before measuring, write your hypothesis about how the longest gate path grows with adder width. Then record at least four sizes, keeping everything else fixed, and compare the measured trend with your prediction.
Can't use the interactive? Read a description instead
The Level 5 investigation builds adders of several widths from gates and reports their longest gate path. Ripple-carry paths grow by about 2 gate delays per bit; lookahead designs grow roughly with log₂ of the width but use more gates.
5.Checkpoint: guided practice
Check what you just discovered before going on. Hints appear after a wrong answer.
Practice 1
Which is the best research question for an adder comparison?
6.Practice on your own
Practice, not a test. Wrong answers get a hint and another try.
Practice 2
With a model of 2 gate delays per bit for the carry, what is the worst-case carry delay of a 24-bit ripple-carry adder, in gate delays?
Practice 3 · a fresh version every time
How many times is work() called when n = 210? Code: for i in 0 … n−1: for j in i+1 … n−1: work()
Practice 4
Why measure several sizes rather than one?
Practice 5 · a fresh version every time
90% of a program's run time is moved onto a hardware accelerator that makes that part 5× faster. What is the overall speed-up?
7.Apply it
Finish and submit the project's pre-registration: question, systems, baseline, metrics, sizes or conditions, prediction from first principles, decision rule and analysis plan. Then run the Level 5 adder investigation as a practice run of the method.
8.Reflect
Concepts: Experimental design and test protocols · Baselines and ablation studies · Research questions and hypotheses · Algorithms, searching and complexity