Design Reviews: "Design This SoC"

An open design question has many right answers, but every right answer has numbers. Eight columns, filled from left to right, turn a vague product into a design you can defend.

You Will Be Able To

  • Fill the eight columns of a design review in order, and say what each column takes from the columns before it.
  • Turn every requirement into a number before drawing a block, and size from the peak, not the average.
  • Tell a flaw, which fails a number, from a risk, which passes with a thin margin.
Lesson
S11.4
Time
28 min
Runs on
Your browser
Check
5 questions

The interviewer says: "Design a small logger chip." You draw a processor, a bus and a UART. Ten minutes later she asks how big the SRAM is.

You have no number. Where should your answer have started?

Before You Start

You need Reading an SoC Specification: the tables a chip document holds.

You need The Memory Map, Power Modes and the Energy of a Sleep and Drivers: Polling, Interrupts or DMA.

It helps to have done The Integration Bug Hunt. Its ten faults are the kind a review should catch early.

Five questions this page answers
Question
1What are the eight columns of a design review, in order?
2Why does every requirement become a number before any block is drawn?
3Why do you size from the peak and not from the average?
4What is the difference between a flaw and a risk?
5The logger must keep two minutes of data. What does the board print last?

The Idea: Eight Questions, Always in the Same Order

A design question in a review or an interview is open. Many answers are right. An answer with no numbers is not one of them.

So use the same eight questions every time, in the same order. Write the answers on a board of eight columns. Each column uses what the columns to its left decided.

The first idea is numbers before boxes. Requirements become rates, sizes, times and limits. Only then do blocks appear, and only then do they get addresses.

The second idea is that time and events are sized from rates. Clocks, interrupts and sleep modes follow from how often things happen. The rate that counts is the one in the busiest second, which this page calls the peak.

The third idea is planning for failure. The last two columns ask how you will see the chip fail, and what could still sink it.

The design under review is called the proposal. It can fail a column. That is a design flaw, and it is fixed now. It can also pass with almost nothing to spare. That is a design risk, and it goes on a list.

New Words

New words on this page
WordMeaning
Design reviewA meeting where other engineers check a proposed design against its requirements before work goes on.
ProposalThe design under review: its blocks, its map, its clocks, its interrupt numbers, its modes and its debug access.
Review boardThis page's name for eight columns, one for each question of a review, filled from left to right.
Sizing sheetA worked set of sums that turns requirements into clock rates, buffer depths, interrupt counts and memory sizes.
Design flawA place where the proposal fails a requirement or a rule. It is fixed before work goes on.
Design riskA part that passes with a thin margin, or rests on a number nobody has measured. It is listed with a test that retires it.
Resource marginThe share of a resource left over after the need. Spare SRAM is a resource margin.
ppmParts per million. An error of 64 ppm is 64 millionths, or 0.0064 percent.
UART dividerThe number the clock is divided by to give the baud rate.
Walk-throughAn interview question answered in stages: requirements, blocks, interfaces, the hard corner, trade-offs and follow-ups.

One Picture: The Review Board

The Review Board: Eight Columns, Filled in OrderStep through the board. Each step fills one more column, and each column uses what the columns to its left decided.
  • File
  • Processor
  • Memory
  • Clock / reset
  • Control / FSM
  • Power
  • Debug
  • Report
The Review Board: Eight Columns, Filled in OrderStep through the board. Each step fills one more column, and each column uses what the columns to its left decided. component Requirements What must it do, innumbers? component Block diagram Which block does eachjob? component Memory map Where does eachblock live? component Clocks and resets How fast, and howdoes it start? component Interrupts Who asks for service,and how often? component Power modes When does it sleep,and what survives? component Debug How will you see itfail? component Risks What could still sinkit? what to buildwhat to placewhat to timewhat to countwhen to wakewhat to seewhat is thinchange and run again
  1. component RequirementsWhat must it do, in numbers?
    • what to build → Block diagram
  2. component Block diagramWhich block does each job?
    • what to place → Memory map
  3. component Memory mapWhere does each block live?
    • what to time → Clocks and resets
  4. component Clocks and resetsHow fast, and how does it start?
    • what to count → Interrupts
  5. component InterruptsWho asks for service, and how often?
    • when to wake → Power modes
  6. component Power modesWhen does it sleep, and what survives?
    • what to see → Debug
  7. component DebugHow will you see it fail?
    • what is thin → Risks
  8. component RisksWhat could still sink it?
    • change and run again → Requirements
  1. 1. Requirements

    Write every requirement as a rate, a size, a time or a limit. Bytes each second, seconds kept, a deadline.

  2. 2. Block diagram

    One block for each job the numbers name. A block with no number behind it has no reason to be there.

  3. 3. Memory map

    Give every block an aligned window. The SRAM must hold the buffers that column 1 sized, plus the stack.

  4. 4. Clocks and resets

    Pick the clocks that meet the rates, and check every divider. Say which resets reach which blocks, and in what order.

  5. 5. Interrupts

    One source number for each requester, all different. Count the requests in a second, on average and at the peak.

  6. 6. Power modes

    List the modes and what each one keeps powered. Data that must survive a sleep must stay in a powered block.

  7. 7. Debug

    A debugger that can stop the core from reset, a console, and counters for every buffer that can overflow.

  8. 8. Risks

    Every thin margin and every unmeasured number goes on a list, each with a test that retires it. Then change a requirement and run the board again.

Read the diagram as text
  • Requirements: What must it do, in numbers?
  • Block diagram: Which block does each job?
  • Memory map: Where does each block live?
  • Clocks and resets: How fast, and how does it start?
  • Interrupts: Who asks for service, and how often?
  • Power modes: When does it sleep, and what survives?
  • Debug: How will you see it fail?
  • Risks: What could still sink it?
  • Requirements → Block diagram: what to build
  • Block diagram → Memory map: what to place
  • Memory map → Clocks and resets: what to time
  • Clocks and resets → Interrupts: what to count
  • Interrupts → Power modes: when to wake
  • Power modes → Debug: what to see
  • Debug → Risks: what is thin
  • Risks → Requirements: change and run again

Four pairs: what to build, where and how fast, when it acts, and how it fails. Every worked system on the next pages fills this same board.

The Smallest Example, Worked by Hand

No simulator yet. A logger reads one temperature sensor over SPI, 10 times a second, 2 bytes each time. It keeps the last minute and reports it on UART0 at 115,200 baud.

The board of the logger, by hand
ColumnSumEntry
1 Requirements2 bytes × 10 a second; × 60 seconds20 bytes a second; a buffer of 1200 bytes
2 Block diagramone block for each jobtimer, SPI, UART0, SRAM and boot ROM
3 Memory map1200 + 512 of stack + 64 of variables1776 bytes: an SRAM of 2 KiB at 8000_0000
4 Clocks and resets50 MHz ÷ 115,200 = 434.03, so a divider of 434115,207 baud, 64 ppm fast; one reset for everything
5 Interrupts10 timer + 10 SPI + 1200 UART bytes a minute40 a second on average
5, at the peakwhile a report goes out: 115,200 ÷ 10 bits a byte11,540 in that second
6 Power modesasleep between samplesthe SRAM must stay powered
7 Debugstop the core from reset; see the outputJTAG from reset; console on UART0
8 Risks272 bytes spare of 204813 percent spare: on the list

Read row 5 twice. On average the logger asks for service 40 times a second. While a report is sent, UART0 asks once for every byte, over 11,000 times. The core and the handler must keep up with that second.

A report of 1200 bytes, at 10 bits a byte, takes 104.2 ms on the wire. The lab rounds that up to 105 ms.

The Rules

  1. Rule 1: Numbers before boxes.

    Write every requirement as a rate, a size, a time or a limit. A block exists because a number needs it.

  2. Rule 2: Fill the columns in order.

    Each column uses what the columns to its left decided. A change on the left reruns every column to its right.

  3. Rule 3: Size from the peak.

    Buffers, clocks and handlers must survive the busiest second, not the average one.

  4. Rule 4: A flaw fails a number; a risk passes thinly.

    Fix a flaw now. Put a risk on a list with the test that will retire it.

  5. Rule 5: Plan for the day it fails.

    Debug access works from the first instruction. Every buffer that can overflow has a counter that says so.

  6. Rule 6: Say what you assumed.

    Every number on the board names its source, or says "exercise value" or "not checked".

Sources for These Rules

Review as a team activity, with design and verification reviewing each other's work: Mehta, ASIC/SoC Functional Design Verification, section 6.4.4.

A written verification plan as the first step of a chip project: the same book, sections 2.2 and 16.2.

The eight columns, the split between flaw and risk, and the 20 percent line are common practice. They are choices of this page; no book in our library gives them.

The 2 percent budget for both baud-rate errors together is a common habit, not checked. The 30,000 ppm of the RC oscillator and the 50 ppm of the crystal are exercise values. The 50 MHz crystal is that of ap_soc (docs/soc/ap_soc-facts.md, section 10).

Now Run It: A Proposal with Three Flaws

The lab at the end of this page is the board as a sizing sheet. A colleague has proposed a logger, and the lab reviews it column by column.

Each column ends in ok or in FLAW. FLAW stands for a design flaw in that column.

Printed by the lab on Icarus: the board of the proposal under review.
1 requirements  data=20 B/s  buffer=1200 B  report=105 ms
2 blocks        sensors=1 on one SPI  jobs=5  blocks=5  missing=0  ok
3 map           sram=1024 B  need=1776 B  aligned=5/5  overlaps=0  FLAW
4 clocks        core=25000000 Hz  div=217  baud=115207  error=64 ppm  source=30000 ppm  FLAW
5 interrupts    average=40/s  peak=11540/s  numbers_ok=0  FLAW
6 power         sleep_keeps_sram=1  wake=timer  ok
7 debug         jtag_from_reset=1  console=UART0  ok
8 risks         sram_spare=0%  clock_budget_used=150%  open_risks=2
flaws=3

Rule 1, in the first row. The requirements become 20 bytes a second and 1200 bytes kept.

Rule 2, in row 3. The proposal has an SRAM of 1 KiB. Column 1 asked for 1776 bytes, so the map fails.

Row 4. The divider is right for a 25 MHz clock, and only 64 ppm off. But the clock comes from the RC oscillator, at 30,000 ppm. Together they break the 20,000 ppm budget.

Row 5. SPI and UART0 share source number 1. One handler would answer for two blocks, as in trial 3 of the bug hunt.

Rule 4, in row 8. The risk line counts thin margins. It is not a flaw count; the last row is.

Now fix the three flaws, as the first steps under the lab say. The board passes, and one risk stays open.

Four rows of the same lab with the three flaws fixed.
3 map           sram=2048 B  need=1776 B  aligned=5/5  overlaps=0  ok
4 clocks        core=50000000 Hz  div=434  baud=115207  error=64 ppm  source=50 ppm  ok
8 risks         sram_spare=13%  clock_budget_used=0%  open_risks=1
flaws=0

Spare SRAM is 13 percent. That passes, so it is not a flaw. It is below 20 percent, so it is a risk. One way to retire it: measure the stack on the real program, or take 4 KiB.

This lab leaves things out. It is a sheet of sums, not a chip. It checks only the rules it was given, and a passing board is not a working chip.

Why It Is Built This Way

ChoiceThe alternativeWhat it buys, and what it costs
Eight fixed columnsA free discussion of the designNothing is forgotten, and two reviews can be compared. A column can feel empty on a small chip; write "none" and say why.
Left to rightStart with the block you know bestEvery entry has a reason to its left. The interesting block waits until the numbers ask for it.
Flaws and risks kept apartOne list of concernsFlaws stop the work; risks only schedule tests. A single list lets a flaw hide among fifty worries.
Each worked system on its own pageThree systems as rows of one tableA table row has no room for a timeline or a trade-off. Each system gets the whole board.

The Trap: Starting with the Processor

The commonest wrong start draws the processor first. It is the block everyone knows. The SRAM, the clock and the interrupt count then get guessed to fit it.

The second trap is the average. The logger asks for service 40 times a second on average. Its handler was timed for that, and the report lost bytes at 11,540 a second.

The third trap calls a risk a flaw, or a flaw a risk. Spare SRAM of 13 percent is not a reason to stop the project. An SRAM that is too small is.

Revision: Every Walk-Through on One Board

The track asks you to design sixteen blocks and systems, each as an interview walk-through. Every one of them fits the board.

For a block, the requirements are its users and their rates; the risks are its hardest cases. Answer each one in the eight columns, then compare with its lesson.

Walk-through D14 is a whole system. A sensor hub is a small chip that collects sensor readings while a larger processor sleeps.

The sixteen walk-throughs of the track
#Design thisWhere the block is taughtColumn that decides it
D1A memory map for a microcontrollerS4.1 The Memory MapMemory map
D2A bus matrix for two managers and four subordinatesS4.4 Many ManagersBlock diagram
D3An AXI crossbarS4.4 Arbitration at Each TargetBlock diagram
D4A clock and reset controllerSoC Design (not yet built). The chip view: S5.5 Reset ArchitectureClocks and resets
D5An interrupt controller for 32 sourcesS6.3 The Interrupt ControllerInterrupts
D6A watchdogS6.11 The WatchdogRisks
D7A DMA controllerS6.12 DMAInterrupts
D8A GPIO block with interruptsS7.2 GPIOInterrupts
D9A pin mux for 32 padsS7.4 Pads and Pin MultiplexingBlock diagram
D10A cache for a given workloadS3.6 Cache Performance, S3.20 Choosing a CacheMemory map
D11A branch predictor under a bit budgetS2.12 Better Predictors, S2.28 The Bit BudgetRequirements
D12The boot flow of a secure microcontrollerS9.6 Secure BootDebug
D13A performance monitor that finds a bottleneckS8.8 Finding the BottleneckDebug
D14A sensor-hub SoC, end to endThis page and S11.10 Worked System: A Sensor HubAll eight
D15A register-block generatorSoC Design (not yet built). The contract: S6.8 RegistersMemory map
D16A TLB with a page-table walkerS3.8 The TLB, S3.23 The Page-Table WalkerMemory map

Each walk-through is an interview question with a staged answer, kept with the lesson that teaches its block. Answer each one on the board of this page.

The next three pages fill the whole board for three systems. The first is the sensor hub of D14.

A motor controller is a chip that switches the coils of an electric motor. A network node is a small chip that sends and receives on a network.

At Scale

This page1 board, 8 columns
A phone chipa document for each column

This section looks ahead, from a logger to a chip with a hundred blocks.

  1. A column becomes a document

    The map, the clock plan, the power intent and the debug plan each become a document. Each has an owner, as in The SoC Design Flow.

  2. Reviews repeat

    The same board is reviewed at each milestone. A requirement that changes reruns every column to its right.

  3. Risks get a date

    Each risk has an owner and a test that retires it. The list should shrink as the chip nears tape-out.

Try It

Run the lab. Three columns print FLAW. Read each one before you change anything.

Fix the map: set SRAM_SIZE to 2048. Fix the clocks: CLOCK_HZ 50000000, SOURCE_PPM 50, UART_DIV 434. Fix the interrupts: IRQ_SPI 4. Run again.

Now set KEEP_S to 90. Which column fails first, and why does the next column not care?

Names Printed by the Lab
NameMeaning
data, buffer, reportBytes stored each second, bytes kept, and the time to send them all at the baud rate, rounded up.
sram, needThe SRAM of the proposal, and the buffer plus 512 bytes of stack and 64 of variables.
aligned, overlapsWindows whose base is a multiple of their size, out of five; pairs of windows that share an address.
div, baud, errorThe UART divider, the baud rate it gives, and how far that is from the one required, in ppm.
sourceThe accuracy of the clock source, in ppm. Error and source together must stay under 20,000 ppm.
average, peakInterrupts in a second: on average, and in a second when a report is being sent.
numbers_ok1 when the three source numbers are different and all lie from 1 to 16.
sram_spare, clock_budget_usedThe share of the SRAM left over, and the share of the 20,000 ppm used. Spare below 20 percent is a risk.
flawsThe columns that print FLAW.
RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: 1 requirements data=20 B/s buffer=1200 B report=105 ms 2 blocks sensors=1 on one SPI jobs=5 blocks=5 missing=0 ok 3 map sram=1024 B need=1776 B aligned=5/5 overlaps=0 FLAW 4 clocks core=25000000 Hz div=217 baud=115207 error=64 ppm source=30000 ppm FLAW 5 interrupts average=40/s peak=11540/s numbers_ok=0 FLAW 6 power sleep_keeps_sram=1 wake=timer ok 7 debug jtag_from_reset=1 console=UART0 ok 8 risks sram_spare=0% clock_budget_used=150% open_risks=2 flaws=3

Check Yourself

Predict the outputThe healthy logger must now keep 120 seconds of data. What is the last line? Its form is: flaws=..
// The review board of a small logger, filled column by column. Test code: a sizing sheet, no circuit.
// Every number is an exercise value. Change a line of the proposal and run the board again.
module tb;
  // ---- Requirements: what the product must do -------------------------------------------------------------
  parameter int S1_BYTES = 2, S1_HZ = 10, S2_BYTES = 0, S2_HZ = 0;   // two sensors: bytes per sample, samples per second
  parameter int KEEP_S = 120, BAUD = 115200;            // seconds of data kept; the report link
  // ---- The proposal under review ---------------------------------------------------------------------------
  parameter int CLOCK_HZ = 50000000, SOURCE_PPM = 50, UART_DIV = 434;   // core clock, its source's accuracy, UART divider
  parameter logic [31:0] ROM_BASE = 32'h0000_0000, SRAM_BASE = 32'h8000_0000;
  parameter int ROM_SIZE = 4096, SRAM_SIZE = 2048;
  parameter logic [31:0] UART_BASE = 32'h1000_0000, TIMER_BASE = 32'h1000_2000, SPI_BASE = 32'h1000_5000;   // 4 KiB windows each
  parameter int IRQ_UART = 1, IRQ_TIMER = 3, IRQ_SPI = 4;   // interrupt source numbers (1 to 16)
  parameter bit SLEEP_KEEPS_SRAM = 1, JTAG_FROM_RESET = 1;
  // ---- Rules of thumb of this sheet (exercise values) ------------------------------------------------------
  localparam int STACK = 512, VARS = 64;          // bytes of stack and of variables
  localparam int CLOCK_BUDGET_PPM = 20000;        // both errors together must stay under 2 percent
  localparam int MARGIN_PCT = 20;                 // a spare share below this is a risk to retire

  int flaws = 0, risks = 0;
  task automatic verdict(input bit ok); if (!ok) flaws++; endtask
  function automatic string mark(input bit ok); if (ok) return "ok"; else return "FLAW"; endfunction

  logic [31:0] base [5]; int size [5];
  initial begin
    real error;
    int data, buffer, report_ms, need, overlaps, aligned, baud, error_ppm, total_ppm, numbers_ok, average, peak, margin, sensors, missing;
    // 1. Requirements become numbers.
    data = S1_BYTES * S1_HZ + S2_BYTES * S2_HZ;
    buffer = data * KEEP_S;
    report_ms = (longint'(buffer) * 10 * 1000 + BAUD - 1) / BAUD;   // ten bits on the wire for each byte
    $display("1 requirements  data=%0d B/s  buffer=%0d B  report=%0d ms", data, buffer, report_ms);
    // 2. Every job needs a block: sampling (timer), sensors (SPI), report (UART), buffer (SRAM), code (ROM).
    sensors = (S1_HZ > 0) + (S2_HZ > 0);
    missing = (ROM_SIZE == 0) + (SRAM_SIZE == 0);
    $display("2 blocks        sensors=%0d on one SPI  jobs=5  blocks=%0d  missing=%0d  %s", sensors, 5 - missing, missing, mark(missing == 0));
    verdict(missing == 0);
    // 3. The map: the SRAM must hold the buffer, and no two windows may overlap or sit off their size.
    need = buffer + STACK + VARS;
    base[0] = ROM_BASE;   size[0] = ROM_SIZE;
    base[1] = SRAM_BASE;  size[1] = SRAM_SIZE;
    base[2] = UART_BASE;  size[2] = 4096;
    base[3] = TIMER_BASE; size[3] = 4096;
    base[4] = SPI_BASE;   size[4] = 4096;
    overlaps = 0; aligned = 0;
    foreach (base[i]) begin
      if (base[i] % size[i] == 0) aligned++;
      for (int j = i + 1; j < 5; j++)
        if (base[i] < base[j] + size[j] && base[j] < base[i] + size[i]) overlaps++;
    end
    $display("3 map           sram=%0d B  need=%0d B  aligned=%0d/5  overlaps=%0d  %s", SRAM_SIZE, need, aligned, overlaps,
      mark(SRAM_SIZE >= need && aligned == 5 && overlaps == 0));
    verdict(SRAM_SIZE >= need && aligned == 5 && overlaps == 0);
    // 4. Clocks: the UART divider sets the baud rate; its error adds to the error of the clock source.
    baud = CLOCK_HZ / UART_DIV;
    error = (CLOCK_HZ * 1.0 / UART_DIV - BAUD) / BAUD;
    if (error < 0) error = -error;
    error_ppm = $rtoi(error * 1000000.0 + 0.5);                     // rounded to the nearest ppm
    total_ppm = error_ppm + SOURCE_PPM;
    $display("4 clocks        core=%0d Hz  div=%0d  baud=%0d  error=%0d ppm  source=%0d ppm  %s", CLOCK_HZ, UART_DIV, baud, error_ppm, SOURCE_PPM,
      mark(total_ppm <= CLOCK_BUDGET_PPM));
    verdict(total_ppm <= CLOCK_BUDGET_PPM);
    // 5. Interrupts: one number each, in range; the rate on average and at the peak of a report.
    numbers_ok = (IRQ_UART != IRQ_TIMER && IRQ_UART != IRQ_SPI && IRQ_TIMER != IRQ_SPI);
    numbers_ok = numbers_ok && IRQ_UART >= 1 && IRQ_UART <= 16 && IRQ_TIMER >= 1 && IRQ_TIMER <= 16 && IRQ_SPI >= 1 && IRQ_SPI <= 16;
    average = (S1_HZ > S2_HZ ? S1_HZ : S2_HZ) + S1_HZ + S2_HZ + buffer / KEEP_S;   // timer, SPI done, UART room
    peak = (S1_HZ > S2_HZ ? S1_HZ : S2_HZ) + S1_HZ + S2_HZ + BAUD / 10;           // while a report is sent
    $display("5 interrupts    average=%0d/s  peak=%0d/s  numbers_ok=%0d  %s", average, peak, numbers_ok, mark(numbers_ok));
    verdict(numbers_ok);
    // 6. Power: between samples the chip sleeps, and the buffer must survive the sleep.
    $display("6 power         sleep_keeps_sram=%0d  wake=timer  %s", SLEEP_KEEPS_SRAM, mark(SLEEP_KEEPS_SRAM));
    verdict(SLEEP_KEEPS_SRAM);
    // 7. Debug: a debugger must be able to stop the core from the first instruction.
    $display("7 debug         jtag_from_reset=%0d  console=UART0  %s", JTAG_FROM_RESET, mark(JTAG_FROM_RESET));
    verdict(JTAG_FROM_RESET);
    // 8. Risks: every thin margin goes on the list, with a way to retire it.
    margin = SRAM_SIZE > need ? (SRAM_SIZE - need) * 100 / SRAM_SIZE : 0;
    if (margin < MARGIN_PCT) risks++;
    if (total_ppm > CLOCK_BUDGET_PPM / 2) risks++;
    $display("8 risks         sram_spare=%0d%%  clock_budget_used=%0d%%  open_risks=%0d", margin, total_ppm * 100 / CLOCK_BUDGET_PPM, risks);
    $display("flaws=%0d", flaws);
  end
endmodule
ConceptWhich order of columns does this page use?
ConceptWhy does every requirement become a number before a block is drawn?
ConceptThe logger averages 40 interrupts a second. Why size the handler for more?
ConceptThe SRAM has 13 percent to spare. What is that on the board?

Common Mistakes

Wrong Draw the processor first and size the rest to fit it.

The numbers that should choose the processor come later and get guessed.

Fix Write the requirements as numbers, then let them name the blocks.

Wrong Size the handler and buffers from the average rate.

The busiest second decides whether data is lost.

Fix Find the peak and size for it.

Wrong Put every concern in one list.

A flaw that must stop the work hides among worries.

Fix Fix flaws now. List risks with the test that retires each one.

Remember

  • Eight columns, left to right: requirements, block diagram, memory map, clocks and resets, interrupts, power modes, debug, risks.
  • Numbers before boxes: every block exists because a number needs it.
  • Size from the peak, not the average.
  • A flaw fails a number and is fixed now. A risk passes thinly and is listed with its test.

Practice

Report a problem with this page