Analog Blocks in Test Mode: The Safe State

During a scan shift, a flip-flop that controls an analog block holds bits that nobody chose. A clamp at the analog block, driven from outside the chain, keeps the block in a safe state.

You Will Be Able To

  • Explain why a control wire from a scan flip-flop is unsafe during a shift.
  • Place a clamp, and say which signal may drive it.
  • Say who chooses the safe state, and what a digital test cannot tell about an analog block.
Lesson
S8.13
Time
22 min
Runs on
Your browser
Check
5 questions

One flip-flop in the chip holds a single decision of software: the receiver is on, or off. On the tester the same flip-flop is link 4,117 of a scan chain. Thousands of pattern bits pass through it, and the receiver obeys every one.

Before You Start

You need Test Hooks at Chip Level: a scan chain, and how a pattern is shifted through it.

You need Power at Chip Level: a clamp holds a wire at a fixed value, whatever drives it.

Five questions this page answers
Question
1What does a scan flip-flop hold during a shift?
2Why is that a danger for an analog block?
3Where does the clamp sit, and which signal may drive it?
4Who chooses the safe state?
5A pattern is shifted past a request flip-flop: on how many pulses is the enable high, with and without the clamp?

The Idea: What a Scan Flip-Flop Holds During a Shift

A digital block does not mind a scan shift. Its flip-flops hold meaningless bits for a while, and then the test goes on. An analog block is different. It works with voltages and currents, and it needs time to settle. Many of them take a steady bias before they can work at all.

The controls of such a block are ordinary register bits. Software sets a bit, and a wire carries it to the block: bias on, power down, gain. Those register bits are scan flip-flops like any other. During a shift they hold bits of a test pattern, and the wire carries every one of them to the analog block.

So the block is switched on and off at the speed of the test clock, by values that nobody chose. It may draw a large current. It may drive a pin. It may lose the very clock that the test needs.

The cure is a clamp at the input of the analog block. While it is on, the wire is held at one fixed value, the safe state. One condition matters most: the signal that switches the clamp on must not come from a scan flip-flop.

New Words

New words on this page
WordMeaning
Analog blockA circuit that works with voltages and currents in between 0 and 1, such as a receiver, an oscillator or a regulator.
BiasA small steady current or voltage that an analog circuit needs before it can work.
Bias requestOn this page: the register bit with which software asks for the bias.
Bias enableOn this page: the wire that the analog block gets. With no clamp it equals the bias request.
Safe stateThe values of its controls with which an analog block does no harm and takes no harm.
Analog test hookA route added for test at an analog block: a clamp on its controls, or a path to measure it.

One Picture: The Clamp at the Analog Block

A Scan Flip-Flop, an Analog Block and a Clamp Between ThemStep through the picture. The wire at work comes first, then the same wire during a shift, then the clamp.
  • Processor
  • Memory
  • Debug
  • Control / FSM
  • Power
A Scan Flip-Flop, an Analog Block and a Clamp Between ThemStep through the picture. The wire at work comes first, then the same wire during a shift, then the clamp. component Software writes a register bitto switch the bias on component Scan flip-flop holds the biasrequest; one link of ascan chain component Scan chain test patterns passthrough everyflip-flop component Clamp holds the wire at thesafe value while it ison component Test pin drives the clamp; it isnot on any scan chain component Analog block a receiver that needsa bias to work a decisionbias requestbias enablebits of a patternclamp on
  1. component Softwarewrites a register bit to switch the bias on
    • a decision → Scan flip-flop
  2. component Scan flip-flopholds the bias request; one link of a scan chain
    • bias request → Clamp
  3. component Clampholds the wire at the safe value while it is on
    • bias enable → Analog block
  4. component Analog blocka receiver that needs a bias to work
  5. component Scan chaintest patterns pass through every flip-flop
    • bits of a pattern → Scan flip-flop
  6. component Test pindrives the clamp; it is not on any scan chain
    • clamp on → Clamp
  1. At work

    Software decides when the analog block gets its bias. The flip-flop holds that decision, and the wire carries it.

  2. During a shift

    The same flip-flop is a link of a scan chain. On every pulse it holds another bit of a pattern. The wire follows.

  3. The clamp

    A clamp next to the analog block holds the wire at the safe value. The flip-flop may hold anything.

  4. Who drives the clamp

    The clamp is switched on by a test pin. That signal comes from no scan flip-flop, so no pattern can open it.

Read the diagram as text
  • Software: writes a register bit to switch the bias on
  • Scan flip-flop: holds the bias request; one link of a scan chain
  • Scan chain: test patterns pass through every flip-flop
  • Clamp: holds the wire at the safe value while it is on
  • Test pin: drives the clamp; it is not on any scan chain
  • Analog block: a receiver that needs a bias to work
  • Software → Scan flip-flop: a decision
  • Scan flip-flop → Clamp: bias request
  • Clamp → Analog block: bias enable
  • Scan chain → Scan flip-flop: bits of a pattern
  • Test pin → Clamp: clamp on

The analog hook of the lab. Bias request is what the flip-flop holds. Bias enable is what the analog block gets.

The Smallest Example, Worked by Hand

Take a scan chain of three flip-flops. Flop 0 is next to the scan input. Flop 1 holds the bias request. The tester shifts a pattern of six bits: 1, 0, 1, 1, 0, 0. No simulator yet. The table writes the flops as flop 2, flop 1, flop 0.

Six pulses of a shift, with the clamp off and on
PulseBit shifted inFlops after the pulseBias requestBias enable, clamp offBias enable, clamp on
11001000
20010110
31101000
41011110
50110110
60100000

Read the column of the bias request. It is the pattern itself, one pulse late: flop 1 takes what flop 0 held. Nobody asked for a bias, and the request is 1 after three of the six pulses.

Read the last two columns. With the clamp off, the analog block gets all three. With the clamp on, it gets none. The flip-flop still holds the same bits. The clamp does not change the chain: it changes what the block sees.

The Rules

  1. Rule 1: During a shift, a scan flip-flop holds a bit of a pattern.

    It is not a decision of the function. Any wire from it carries the pattern.

  2. Rule 2: Every control of an analog block is clamped in test mode.

    The clamp sits at the analog block, after everything that a scan chain can change.

  3. Rule 3: The signal that drives the clamp is not on a scan chain.

    It comes from a pin or from test mode itself. A clamp that a pattern can open is no clamp.

  4. Rule 4: The designer of the analog block chooses the safe state.

    It is not always 0. A control that means "power down" is safe at 1.

  5. Rule 5: Clamp first, shift after. Release last.

    The clamp is on before the first pulse of a shift and stays on until the last one is over.

  6. Rule 6: A digital test cannot see a voltage.

    A flip-flop reads back a 0 or a 1. Whether the block settled needs a measurement of its own.

Sources for These Rules

Circuits that draw a steady current, analog circuits among them, must be switched off for a test of the supply current: Weste and Harris, CMOS VLSI Design, fourth edition, section 15.6.4.

Test of analog and mixed blocks by a loop from a converter back to a converter, and by test ports on the pins: the same book, section 15.6.3.

Rules 2 to 5 are common practice. Our reference library has no source that states them.

Which flip-flop holds the request, and a safe value of 0, are choices of our lab.

Further reading: IEEE Std 1500 and IEEE Std 1687 describe test logic inside a chip. Neither is in our reference library.

Now Run It

The lab at the end of this page has the three scan flip-flops and the clamp. Flop 1 is the bias request. Test code shifts the same pattern twice: first with the clamp off, then with it on.

Printed by the lab on Icarus. The flops are written as flop 2, flop 1, flop 0.
clamp=0
shift in 1: flops=001 bias request=0 bias enable=0
shift in 0: flops=010 bias request=1 bias enable=1
shift in 1: flops=101 bias request=0 bias enable=0
shift in 1: flops=011 bias request=1 bias enable=1
shift in 0: flops=110 bias request=1 bias enable=1
shift in 0: flops=100 bias request=0 bias enable=0
bias enable was 1 after 3 of 6 pulses
clamp=1
shift in 1: flops=001 bias request=0 bias enable=0
shift in 0: flops=010 bias request=1 bias enable=0
shift in 1: flops=101 bias request=0 bias enable=0
shift in 1: flops=011 bias request=1 bias enable=0
shift in 0: flops=110 bias request=1 bias enable=0
shift in 0: flops=100 bias request=0 bias enable=0
bias enable was 1 after 0 of 6 pulses
pulses with bias enable at 1: clamp off 3, clamp on 0

Rule 1 at work, in the first six rows. The bias request follows flop 1 through 0, 1, 0, 1, 1, 0. With the clamp at 0 the bias enable is the same list.

Rule 2, in the second six rows. The flops and the request are the same as before. The bias enable is 0 in every row.

The last row counts it: three pulses with the bias on when the clamp is off, and none when it is on.

This lab leaves things out. There is no analog block here. Bias enable is a digital wire, and nothing shows what a receiver does when its bias flickers. The clamp is one gate. The order of rule 5 is in the test code, and nothing checks it.

Why It Is Built This Way

Design choiceThe alternativeWhat the choice buys, and costs
A clamp at the analog blockLeave the control flip-flops out of the scan chainThe flip-flops and the logic before them are still tested. One gate on each control wire.
The clamp driven from a pinA register bit that switches the clampNo pattern can open it. One more pin, or one more code of test mode.
A safe value for each controlClamp everything to 0A control that is active at 0 is held off too. Someone must ask the analog designer, wire by wire.

The Trap: A Pattern That Switched the Clock Off

A chip passed scan on some days and failed on others. The failing bits moved from run to run. Weeks later someone saw that the PLL lost its lock in the middle of a shift.

One scan flip-flop held the bit that powers the PLL down. Whenever a pattern put the wrong value there, the source of the test clock itself went away for a while. The patterns were right. The chip was right. The control had no clamp.

A second trap is a clamp that sits on the chain. Its control was a register bit, and that bit was a scan flip-flop. The first pattern that shifted a 0 through it opened the clamp. That is rule 3.

The third is the value. A team clamped every analog control to 0. One of them was a power-down that is active at 0. On the tester that block stayed off, and its test never ran.

At Scale

This page1 control wire
A phone chiphundreds of analog controls

This section looks ahead. One bias wire becomes hundreds of controls, and the question moves from safety to measurement.

  1. A list of safe states

    Every analog block comes with a table. It lists each control, its safe value, and the order in which to apply and release it.

  2. A way to measure

    Some chips route chosen analog nodes to a pin in test mode. Others loop a signal from one converter back into another.

  3. Trim values

    Many analog blocks are tuned at the factory. The tuning bits must reach the block during its own test, and stay still during scan.

  4. Supply current

    One factory test measures the current of a chip at rest. Any analog block that draws a steady current must be off for it.

Try It

Run the lab. In the first six rows, compare bias request with flop 1 of the three flops.

Change the first scan pattern so that bias enable is never 1 with the clamp off. Why is that not a fix?

Wire the bias request to flop 2 in place of flop 1. After how many pulses is bias enable 1 now?

Names Printed by the Lab
NameMeaning
flopsThree scan flip-flops, written as flop 2, flop 1, flop 0. Flop 0 is next to the scan input.
bias requestThe content of flop 1. At work it is the decision of software.
bias enableThe wire that reaches the analog block, after the clamp.
clampThe level of the test pin. At 1 the clamp holds bias enable at 0.
RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: clamp=0 shift in 1: flops=001 bias request=0 bias enable=0 shift in 0: flops=010 bias request=1 bias enable=1 shift in 1: flops=101 bias request=0 bias enable=0 shift in 1: flops=011 bias request=1 bias enable=1 shift in 0: flops=110 bias request=1 bias enable=1 shift in 0: flops=100 bias request=0 bias enable=0 bias enable was 1 after 3 of 6 pulses clamp=1 shift in 1: flops=001 bias request=0 bias enable=0 shift in 0: flops=010 bias request=1 bias enable=0 shift in 1: flops=101 bias request=0 bias enable=0 shift in 1: flops=011 bias request=1 bias enable=0 shift in 0: flops=110 bias request=1 bias enable=0 shift in 0: flops=100 bias request=0 bias enable=0 bias enable was 1 after 0 of 6 pulses pulses with bias enable at 1: clamp off 3, clamp on 0
Read included file: soc-s85-crg.sv
// Teaching slice. Change mode and gate controls only while both clocks are low.
// Physical clock switching needs characterized cells and a switch protocol.
module ap_crg_scan_slice (
  input logic functional_clk, test_clk, scan_mode, gate_open,
  input logic functional_reset, test_reset, shift, serial_in,
  input logic [2:0] events,
  output logic [2:0] pending
);
  wire leaf_clk = scan_mode ? test_clk : (functional_clk & gate_open);
  wire leaf_reset = scan_mode ? test_reset : functional_reset;
  always_ff @(posedge leaf_clk or posedge leaf_reset) begin
    if (leaf_reset)
      pending <= 3'b000;
    else if (scan_mode && shift)
      pending <= {pending[1:0], serial_in};
    else
      pending <= events;
  end
endmodule
Read included file: soc-s85-test-boundaries.sv
// Digital test fixtures. The two-word SRAM sweep demonstrates MBIST ownership
// and completion. It is deliberately smaller than a production March test.
module ap_memory_test_slice (
  input logic clk, reset, test_owner, start, functional_write, functional_addr,
  input logic [7:0] functional_data,
  output logic done, fail
);
  typedef enum logic [1:0] {IDLE, FILL, VERIFY} phase_t;
  phase_t phase;
  logic address;
  logic [7:0] ram[2];
  wire [7:0] pattern = address ? 8'h5a : 8'ha5;
  always_ff @(posedge clk) begin
    if (reset) begin
      phase <= IDLE;
      address <= 0;
      done <= 0;
      fail <= 0;
    end else if (!test_owner) begin
      phase <= IDLE;
      if (functional_write) ram[functional_addr] <= functional_data;
    end else case (phase)
      IDLE: if (start) begin
        address <= 0;
        done <= 0;
        fail <= 0;
        phase <= FILL;
      end
      FILL: begin
        ram[address] <= pattern;
        address <= !address;
        if (address) phase <= VERIFY;
      end
      VERIFY: begin
        if (ram[address] !== pattern) fail <= 1;
        address <= !address;
        if (address) begin
          done <= 1;
          phase <= IDLE;
        end
      end
    endcase
  end
endmodule

// One boundary bit: capture/shift and update are distinct operations.
module ap_pad_test_slice (
  input logic test_clk, capture_pin, shift_pin, update_pin, serial_in, pad_input,
  input logic isolate_bias, functional_bias,
  output logic shift_bit, driver_enable, bias_enable
);
  always_ff @(posedge test_clk) begin
    if (capture_pin) shift_bit <= pad_input;
    else if (shift_pin) shift_bit <= serial_in;
    if (update_pin) driver_enable <= shift_bit;
  end
  assign bias_enable = isolate_bias ? 1'b0 : functional_bias;
endmodule

Check Yourself

Predict the outputIn this run the pattern is 1, 1, 0, 0, 0, 0 and flop 1 is still the bias request. What is the last row? Its form is: pulses with bias enable at 1: clamp off ., clamp on .
`timescale 1ns/1ns
module tb;
  logic functional_clk = 0, functional_reset = 0;
  logic test_clk = 0, test_reset = 0, scan_mode = 0, shift = 0, serial_in = 0;
  logic gate_open = 0;
  logic [2:0] events = 3'b000;
  wire [2:0] pending;                  // three scan flip-flops; flop 0 is next to the scan input
  ap_crg_scan_slice island(.*);

  // In the function, flop 1 holds the request for the bias of an analog receiver.
  wire bias_request = pending[1];
  logic clamp = 0;                     // a test pin, not a scan flip-flop: 1 holds the bias off
  wire bias_enable;                    // what the analog block gets
  ap_pad_test_slice hook(.test_clk(1'b0), .capture_pin(1'b0), .shift_pin(1'b0), .update_pin(1'b0), .serial_in(1'b0),
    .pad_input(1'b0), .isolate_bias(clamp), .functional_bias(bias_request),
    .shift_bit(), .driver_enable(), .bias_enable(bias_enable));

  task automatic test_pulse;
    #2 test_clk = 1; #2 test_clk = 0;
  endtask
  int high, first;
  task automatic pattern;              // shift one scan pattern through the chain
    high = 0;
    serial_in = 1; test_pulse(); high += bias_enable;
    $display("shift in 1: flops=%b bias request=%b bias enable=%b", pending, bias_request, bias_enable);
    serial_in = 1; test_pulse(); high += bias_enable;
    $display("shift in 1: flops=%b bias request=%b bias enable=%b", pending, bias_request, bias_enable);
    serial_in = 0; test_pulse(); high += bias_enable;
    $display("shift in 0: flops=%b bias request=%b bias enable=%b", pending, bias_request, bias_enable);
    serial_in = 0; test_pulse(); high += bias_enable;
    $display("shift in 0: flops=%b bias request=%b bias enable=%b", pending, bias_request, bias_enable);
    serial_in = 0; test_pulse(); high += bias_enable;
    $display("shift in 0: flops=%b bias request=%b bias enable=%b", pending, bias_request, bias_enable);
    serial_in = 0; test_pulse(); high += bias_enable;
    $display("shift in 0: flops=%b bias request=%b bias enable=%b", pending, bias_request, bias_enable);
    $display("bias enable was 1 after %0d of 6 pulses", high);
  endtask

  initial begin
    test_reset = 1; scan_mode = 1; #1 test_reset = 0;
    shift = 1;
    $display("clamp=0");
    pattern();
    first = high;
    test_reset = 1; #1 test_reset = 0;
    clamp = 1;
    $display("clamp=1");
    pattern();
    $display("pulses with bias enable at 1: clamp off %0d, clamp on %0d", first, high);
    $finish;
  end
endmodule
Read included file: soc-s85-crg.sv
// Teaching slice. Change mode and gate controls only while both clocks are low.
// Physical clock switching needs characterized cells and a switch protocol.
module ap_crg_scan_slice (
  input logic functional_clk, test_clk, scan_mode, gate_open,
  input logic functional_reset, test_reset, shift, serial_in,
  input logic [2:0] events,
  output logic [2:0] pending
);
  wire leaf_clk = scan_mode ? test_clk : (functional_clk & gate_open);
  wire leaf_reset = scan_mode ? test_reset : functional_reset;
  always_ff @(posedge leaf_clk or posedge leaf_reset) begin
    if (leaf_reset)
      pending <= 3'b000;
    else if (scan_mode && shift)
      pending <= {pending[1:0], serial_in};
    else
      pending <= events;
  end
endmodule
Read included file: soc-s85-test-boundaries.sv
// Digital test fixtures. The two-word SRAM sweep demonstrates MBIST ownership
// and completion. It is deliberately smaller than a production March test.
module ap_memory_test_slice (
  input logic clk, reset, test_owner, start, functional_write, functional_addr,
  input logic [7:0] functional_data,
  output logic done, fail
);
  typedef enum logic [1:0] {IDLE, FILL, VERIFY} phase_t;
  phase_t phase;
  logic address;
  logic [7:0] ram[2];
  wire [7:0] pattern = address ? 8'h5a : 8'ha5;
  always_ff @(posedge clk) begin
    if (reset) begin
      phase <= IDLE;
      address <= 0;
      done <= 0;
      fail <= 0;
    end else if (!test_owner) begin
      phase <= IDLE;
      if (functional_write) ram[functional_addr] <= functional_data;
    end else case (phase)
      IDLE: if (start) begin
        address <= 0;
        done <= 0;
        fail <= 0;
        phase <= FILL;
      end
      FILL: begin
        ram[address] <= pattern;
        address <= !address;
        if (address) phase <= VERIFY;
      end
      VERIFY: begin
        if (ram[address] !== pattern) fail <= 1;
        address <= !address;
        if (address) begin
          done <= 1;
          phase <= IDLE;
        end
      end
    endcase
  end
endmodule

// One boundary bit: capture/shift and update are distinct operations.
module ap_pad_test_slice (
  input logic test_clk, capture_pin, shift_pin, update_pin, serial_in, pad_input,
  input logic isolate_bias, functional_bias,
  output logic shift_bit, driver_enable, bias_enable
);
  always_ff @(posedge test_clk) begin
    if (capture_pin) shift_bit <= pad_input;
    else if (shift_pin) shift_bit <= serial_in;
    if (update_pin) driver_enable <= shift_bit;
  end
  assign bias_enable = isolate_bias ? 1'b0 : functional_bias;
endmodule
ConceptWhat does a scan flip-flop hold during a shift?
ConceptWhy is that a danger for an analog block?
ConceptWhich signal may drive the clamp?
ConceptWho chooses the safe state of an analog block?

Common Mistakes

Wrong Let an analog control follow its register bit during scan.

The register bit holds pattern bits, and the block is switched by them.

Fix Clamp the control at the analog block in test mode.

Wrong Drive the clamp from a register bit.

That bit is on a scan chain, so a pattern can open the clamp.

Fix Drive it from a pin or from test mode.

Wrong Clamp every analog control to 0.

Some controls are active at 0.

Fix Take the safe value of each control from the analog designer.

Remember

  • During a shift, a scan flip-flop holds a bit of a pattern, not a request.
  • Clamp every analog control at the analog block in test mode.
  • Drive the clamp from a signal that is on no scan chain.
  • The analog designer chooses the safe state. A digital test cannot see a voltage.

Practice

Report a problem with this page