The Verification Plan

Read a specification into plan rows: feature, stimulus, check, coverage, priority. Use the plan as the definition of done, and see what happens to a feature the plan never names.

You Will Be Able To

  • Read a short specification into plan rows, one feature per row.
  • Give each row its stimulus, its check and its coverage.
  • Rank rows by risk, so the riskiest features are verified first.
  • Explain why the plan is the definition of done, and what a missing row costs.
Lesson
B4.1
Time
22 min
Runs on
Your browser
Check
5 questions

The transmitter's tests all pass, and the manager asks one question: are we done? Nobody can answer, because nobody wrote down what done means. Ten minutes with the specification and a table would have answered it.

A Table That GrowsStep through. A plan row starts as one feature read from the specification. Then it gains a stimulus, a check and a coverage item. Last come a priority and a name.
  • Design
  • Step
  • Control / FSM
  • Test
  • Result
  • Data
A Table That GrowsStep through. A plan row starts as one feature read from the specification. Then it gains a stimulus, a check and a coverage item. Last come a priority and a name. design Specification the UARTtransmitter, one page step Feature R3: two frames backto back control Stimulus start again in theclock busy falls test Check both bytes arrive, noframe error result Coverage count back-to-backstarts control Priority and name high; who writes it read intohow to reach ithow to decide ithow to know it ranrisk and person
  1. design Specificationthe UART transmitter, one page
    • read into → Feature
  2. step FeatureR3: two frames back to back
    • how to reach it → Stimulus
    • risk and person → Priority and name
  3. control Stimulusstart again in the clock busy falls
    • how to decide it → Check
  4. test Checkboth bytes arrive, no frame error
    • how to know it ran → Coverage
  5. result Coveragecount back-to-back starts
  6. control Priority and namehigh; who writes it
  1. A feature

    Read one thing the design must do from the specification. That is the start of a row.

  2. How to reach it

    Write the stimulus that makes the feature happen: a directed case, a constraint, a corner.

  3. How to decide it

    Write the check that decides pass or fail: a model comparison, an assertion.

  4. How to know it ran

    Name the coverage that shows the stimulus really reached the feature.

  5. Who and how urgent

    Give the row a priority from its risk, and a person who owns it.

Read the diagram as text
  • Specification: the UART transmitter, one page
  • Feature: R3: two frames back to back
  • Stimulus: start again in the clock busy falls
  • Check: both bytes arrive, no frame error
  • Coverage: count back-to-back starts
  • Priority and name: high; who writes it
  • Specification → Feature: read into
  • Feature → Stimulus: how to reach it
  • Stimulus → Check: how to decide it
  • Check → Coverage: how to know it ran
  • Feature → Priority and name: risk and person

An idea drawing of one plan row. The lab below runs five rows of the transmitter's plan.

Before You Start

What "Done" Means showed that a plan defines done. This lesson writes one. A plan row uses three earlier lessons: Directed Tests, Assertions: Checks That Travel With the Design and Functional Coverage: What Was Tested.

Five questions this page answers
Question
1What is a verification plan, and what is in one row?
2How do you read a specification into rows?
3Why does a plan rank its rows?
4Why is the plan the definition of done?
5What happens to a feature the plan never names?

The Idea: Write Down What Done Means

Every lesson so far gave you a tool: directed cases, random stimulus, corners, assertions, coverage. A real design needs all of them, in the right places. The verification plan is where you decide which tool goes where, before you write a line of the bench.

A plan is a table. Each row is one feature, read from the specification. The row then says how to reach the feature, how to check it, and how to know it was reached. It also says how much it matters and who will do it. When every row has passed its check and filled its coverage, you are done. Not before, and not because the tests ran out of ideas.

The plan is written early and it keeps growing. New rows appear when the specification changes or a bug shows a feature nobody listed.

New Words

New words on this page
WordMeaning
Verification planA table of what must be verified: one feature per row, with its stimulus, check, coverage, priority and owner.
Plan rowOne feature of the design and everything needed to verify it.
PriorityHow soon a row must be done, set by its risk: how likely a bug is, and how bad it would be.
OwnerThe person who writes and closes a row.
UART transmitterA block that sends a byte one bit at a time on one wire. A start bit comes first and a stop bit last.
FrameThe ten bits of one UART byte on the wire.

The Smallest Example: The Transmitter's Plan

Here is the whole specification of the small UART transmitter used in this module. It sends a byte as a start bit (0), eight data bits low bit first, and a stop bit (1). Each bit lasts four clocks. A start pulse is taken only while busy is 0, and data is read in that same clock. Reset makes the line idle.

Read it sentence by sentence and turn each promise into a row.

Five plan rows for the UART transmitter
RowFeatureStimulusCheckCoveragePriority
R1One byte makes one correct framesend 41receiver model gets 41, no frame errorframes senthigh
R2Every data bit reaches the wiresend 55, then AAboth bytes arrive exactlyeach bit seen at 0 and 1high
R3Two frames back to backstart again in the clock busy fallsboth bytes, no frame errorback-to-back startshigh
R4start while busy is ignoredpulse start in the middle of a frameonly the first byte arrivesstarts while busymedium
R5Reset during a framereset in the middle of a frameline idle at 1, busy 0resets while busymedium

Notice what is not here. The specification says data is read in the same clock as start. No row tests what happens when data changes straight after that clock. Keep that gap in mind: Debugging: From a Failure to a Cause finds a bug living in it.

The Rules

  1. Rule 1: One promise, one row.

    Read the specification sentence by sentence. Each promise it makes becomes a row.

  2. Rule 2: Every row has a stimulus, a check and a coverage item.

    Stimulus reaches the feature, the check decides pass or fail, coverage proves it was reached.

  3. Rule 3: Rank by risk.

    New logic, complex logic and corners come first. A plan has more rows than time.

  4. Rule 4: Done means every row closed.

    Each row's check passed and its coverage filled, or its gap is written down and accepted at sign-off. A pile of passing tests does not define done.

  5. Rule 5: The plan grows.

    A changed specification, or a bug in a feature no row named, adds a row.

Sources for These Rules

A comprehensive verification plan: subsystems, stimulus and response, traffic, checking, assertions, coverage, regressions: Mehta, ASIC/SoC Functional Design Verification, section 2.2.

The test plan formed from the design specification as the starter of the verification flow: Mehta, section 15.5.1.

Writing a plan from the specification as the first step of verification: Spear and Tumbush, section 1.1.

The Lab: The Plan, Run Row by Row

The lab runs the five rows against uart_tx. A model of the far end of the wire samples every bit in its middle and collects the bytes. Each row prints its own verdict, and the last line counts the closed rows:

Printed by the lab (Icarus Verilog version 12.0).
R1 one byte, one correct frame        PASS
R2 patterns 55 and AA                 PASS
R3 two frames back to back            PASS
R4 start while busy is ignored        PASS
R5 reset mid-frame, line idle         PASS
plan rows passed: 5 of 5

Rule 4 at work: five of five, so by this plan the transmitter is done. Now plant a bug that ends busy one bit early, cutting the stop bit short:

The same plan on a transmitter that cuts the stop bit short.
R1 one byte, one correct frame        PASS
R2 patterns 55 and AA                 FAIL
R3 two frames back to back            FAIL
R4 start while busy is ignored        PASS
R5 reset mid-frame, line idle         PASS
plan rows passed: 3 of 5

R2 and R3 fail. Both send a byte straight after the last one finished, and the short stop bit is only visible then. A single byte with idle time after it looks perfect, which is why R1 still passes.

One more experiment. Plant the bug from the gap above, where the transmitter reads data one clock late. The plan prints plan rows passed: 5 of 5. Rule 5 at work, the hard way: no row asked the question, so no test failed.

Why a Plan Before the Tests

Why write a plan instead of just writing tests? Because tests answer "does this case work?" and nobody can ask "are we done?" of a pile of tests. The plan turns that question into a list people can read and agree with. That includes the designer, who knows where the risks are.

Why give every row a coverage item? Because a random test may never reach the feature it was meant for. A passing check on a feature that was never reached is not evidence of anything. Coverage is how a row proves its stimulus arrived.

Traps

The first trap is a plan written from the tests. Someone lists the tests that exist and calls it a plan. It then says done the moment it is written, and every feature without a test stays invisible. Write rows from the specification.

The second trap is the row with no check. "Send back-to-back frames" is stimulus, not verification. If nothing compares the bytes, a broken stop bit passes. Every row needs a sentence that starts with "check that".

The third trap is the frozen plan. The specification changes in week six, the plan does not, and the new feature ships with no test. Treat the plan as a living document, and review it with the designer whenever either one changes.

Where This Goes Next

Plans exist at every level of a project. These pages show the same idea for bigger designs.

Where each idea is taught in depth
The idea from this pageWhere it is taught
A test plan for a FIFO, in SystemVerilogStart From the FIFO Rules
An assertion planAn Assertion Plan
A coverage model from a planCapstone: A Coverage Model That Finds Holes
A formal verification planThe Formal Verification Plan
The chip-level verification planThe Chip-Level Verification Plan

Try It

Run it: five plan rows, each a short test with its own verdict.

In uart_tx, change bits == 1 to bits == 2, which cuts the stop bit short. Predict the last line.

Write a sixth row: change data straight after the start clock, and check that the byte sent is still the old one.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: R1 one byte, one correct frame PASS R2 patterns 55 and AA PASS R3 two frames back to back PASS R4 start while busy is ignored PASS R5 reset mid-frame, line idle PASS plan rows passed: 5 of 5

Check Yourself

Predict the outputThe transmitter now ends busy one bit early, so the stop bit is cut short. What is the last line the plan prints?
// uart_tx: sends one byte as a frame: a start bit (0), eight data bits low bit first, a stop bit (1).
// Each bit lasts CPB clocks. start is taken only while busy is 0; data is read in the same clock.
module uart_tx #(parameter int CPB = 4) (input logic clk, rst, start, input logic [7:0] data,
                                          output logic tx, busy);
  logic [9:0] frame;                // the bits still to send, low bit first
  logic [3:0] bits;                 // how many bits are left
  logic [7:0] ticks;                // clocks spent in this bit
  assign tx = busy ? frame[0] : 1'b1;
  always_ff @(posedge clk)
    if (rst) begin busy <= 0; bits <= 0; ticks <= 0; frame <= '1; end
    else if (!busy) begin
      if (start) begin frame <= {1'b1, data, 1'b0}; bits <= 10; ticks <= 0; busy <= 1; end
    end else begin
      if (ticks == CPB - 1) begin
        ticks <= 0;
        frame <= {1'b1, frame[9:1]};
        bits <= bits - 1;
        if (bits == 2) busy <= 0;
      end else ticks <= ticks + 1;
    end
endmodule

module tb;
  logic clk = 0, rst = 1, start = 0, tx, busy;
  logic [7:0] data = 0;
  uart_tx #(.CPB(4)) dut (.clk(clk), .rst(rst), .start(start), .data(data), .tx(tx), .busy(busy));
  always #5 clk = ~clk;
  // The far end of the wire: wait for a falling edge, then sample each bit in its middle.
  logic [7:0] got [$];              // bytes received, in order
  int frame_errors = 0;
  initial forever begin
    logic [7:0] byte_in;
    @(negedge tx);
    repeat (2) @(posedge clk);      // the middle of the start bit
    if (tx === 1'b0) begin
      for (int i = 0; i < 8; i++) begin repeat (4) @(posedge clk); byte_in[i] = tx; end
      repeat (4) @(posedge clk);    // the middle of the stop bit
      if (tx !== 1'b1) frame_errors++;
      got.push_back(byte_in);
    end
  end
  // Send one byte: wait until the transmitter is free, then pulse start for one clock.
  task automatic send(input logic [7:0] d);
    @(negedge clk); while (busy) @(negedge clk);
    data = d; start = 1;
    @(negedge clk) start = 0;
  endtask
  int passed = 0;
  task automatic row(input string id, input string what, input bit ok);
    if (ok) passed++;
    if (ok) $display("%s %-34s PASS", id, what);
    else $display("%s %-34s FAIL", id, what);
  endtask
  initial begin
    int n0;
    @(negedge clk) rst = 0;
    // R1: one byte makes one frame with the right bits.
    send(8'h41); wait (!busy); repeat (8) @(negedge clk);
    row("R1", "one byte, one correct frame", got.size() == 1 && got[0] == 8'h41 && frame_errors == 0);
    // R2: every bit of the data reaches the wire (two opposite patterns).
    send(8'h55); send(8'hAA); wait (!busy); repeat (8) @(negedge clk);
    row("R2", "patterns 55 and AA", got.size() == 3 && got[1] == 8'h55 && got[2] == 8'hAA && frame_errors == 0);
    // R3: a new byte the clock after busy falls (back to back).
    n0 = got.size();
    send(8'h0F); @(negedge clk); while (busy) @(negedge clk); data = 8'hF0; start = 1; @(negedge clk) start = 0;
    wait (!busy); repeat (8) @(negedge clk);
    row("R3", "two frames back to back", got.size() == n0 + 2 && got[n0] == 8'h0F && got[n0 + 1] == 8'hF0 && frame_errors == 0);
    // R4: start while busy is ignored.
    n0 = got.size();
    send(8'h3C); repeat (5) @(negedge clk); data = 8'hFF; start = 1; @(negedge clk) start = 0;
    wait (!busy); repeat (12) @(negedge clk);
    row("R4", "start while busy is ignored", got.size() == n0 + 1 && got[n0] == 8'h3C);
    // R5: reset in the middle of a frame leaves the line idle (1).
    send(8'h00); repeat (10) @(negedge clk); rst = 1; @(negedge clk) rst = 0;
    row("R5", "reset mid-frame, line idle", tx === 1'b1 && busy === 1'b0);
    $display("plan rows passed: %0d of 5", passed);
    $finish;
  end
endmodule
ConceptWhat does one plan row hold?
ConceptEvery test passes, but no row covers a feature in the specification. Is verification done?
ConceptIn the lab, the late-data bug passes all five rows. Why?
ConceptWhy does a plan rank its rows?

Common Mistakes

Wrong List the tests that exist and call it a plan.

Features without a test never appear, and the plan says done at once.

Fix Write one row per promise of the specification.

Wrong Write rows that only describe stimulus.

Stimulus with no check cannot fail.

Fix Give every row a check and a coverage item.

Wrong Freeze the plan after the first review.

New and changed features ship with no test.

Fix Add rows when the specification changes or a bug shows a gap.

Remember

  • A verification plan is a table: one row per promise of the specification.
  • Each row has a stimulus to reach it, a check to decide it and coverage to prove it was reached.
  • Rows are ranked by risk; done means every row closed.
  • A feature with no row has no test; the plan grows when the specification or a bug shows a gap.

Practice

Report a problem with this page