Scan Bench
One page per interview topic, each with a 60-second answer, drawn schematics and timing diagrams, the traps interviewers like, and questions with model answers. Round 1 covers the first two focus areas; round 2 is scan PD, DFT timing and SDC. The deep dives go further on EDT, test-mode timing and SSN.
Focus areas
Scan architecture & clocking
Mux-D, shift/capture protocol, lockup latches, OCC, LOC vs LOS.
Scan insertion & compression
Scannability DRC, stitching and balancing, EDT, X masking.
Core wrapping
Wrapper cells, internal/external modes, graybox, retargeting, IEEE 1500.
Test point insertion
Random-pattern resistance, control/observe points, SCOAP, costs.
Low-power scan
Shift vs capture power, fill, Q-gating, ICG TE, UPF domains.
JTAG 1149.1
TAP state machine, registers, instructions, timing, BSR cell.
IJTAG 1687
TDRs, SIBs, ICL/PDL, retargeting.
IEEE 1500 wrapper
WSP/WSC, WIR/WBY/WBR, instructions, TAP/IJTAG control, CTL.
Fault models & ATPG
Models, D-alg/PODEM, fault classes, coverage formulas, AU debug.
GLS & SDF
Annotation, timing checks and X, serial vs parallel, debug method.
Post-silicon debug
Bring-up ladder, chain signatures, chain & logic diagnosis, shmoo.
EDT signals & behavior
Interface, edt_update and edt_clock cycle by cycle, masking, bypass, what breaks.
Test-mode timing
Scan-in from a GPIO pin, scan-out strobe, SE settling before capture, checks per mode.
Streaming Scan Network
Bus and hosts, packets, IJTAG setup, on-chip compare, and the switching-noise SSN.
Scripting drills
Flists, RTL vs netlist parsing, chain tracing, fail logs, with hints and partial solutions.
Scan PD, DFT timing & SDC
Reordering, SE, congestion, test modes, SDC per mode, convergence.
Tessent foundations: everything before ATPG
For anyone whose work starts at a scan-stitched netlist. What has to happen to a design before ATPG, what a flop goes through on the way, what a Tessent spec is and what you can set in it, and what instruments look like as RTL when you insert them yourself. Read these before the flow chapters.
Before ATPG: the jobs
Basic vocabulary, the five jobs, who does what in tool-driven and scripted flows.
Life of a flop
RTL to library cell, scan replacement, stitching, chains on EDT, RTL rules.
What a spec is
DftSpecification syntax, lifecycle, an annotated example, parameter reference.
Instruments & hand insertion
EDT, OCC, SSN host and TDR ports; generating IP and wiring it yourself.
Tessent flow: one partition, end to end
A second track for the step before "here's a netlist": how a wrapped partition gets its MBIST, IJTAG network, OCCs, EDT, wrapper and scan chains in Tessent Shell, how it's synthesized and constrained, how its patterns are generated and retargeted, and how to size compression and debug DRC. Each chapter has annotated dofiles written for this site.
The flow, end to end
TSDB and design IDs, the eight steps, two passes, top-down planning.
Tessent Shell & Tcl
Contexts and modes, dofile skeleton, introspection, editing specs.
Pass 1: MemoryBIST
Memory libraries, controllers and interfaces, bypass in logic test, repair.
Pass 2: signals, OCC, EDT
Static and dynamic DFT signals, pre-DFT DRC, OCC types, the EDT spec.
IJTAG plumbing
SRI and STI sides, ICL and PDL you write, test setup in ATPG, extraction.
Synthesis & SDC
Tessent SDC procs, preserving DFT, OCC CTS stop points, STA modes.
Scan & wrapper insertion
Shared and dedicated wrapper cells, int and ext modes, stitching rules.
Patterns & retargeting
Graybox, extest, intest SA and TDF, coverage merge, the TAM.
Compression math
Ratio, init cycles, pattern inflation, analysis, OCC bits, a calculator.
DRC failures & fixes
Rule families by step, T3, C1, D1, clock gaters, K19 to K22.
Run triage: grep & Python
Regex essentials, tested one-liners, five scripts for DRC, ATPG and sim logs.
Verilog for DFT
For when you mostly read netlists: the RTL rules that decide what hardware you get, how RTL names turn into netlist names, and fourteen "what's wrong with this module for scan?" puzzles. Code examples are simulated and the outputs are real.
Verilog refresher
Blocking vs non-blocking, latches, resets, sensitivity lists, RTL to netlist names.
What's wrong for scan?
A review checklist, a simulated reset bug, fourteen module and netlist puzzles.
Boundaries: wrappers and boundary scan
The cells at a block's edge, from first principles: a wrapper cell built from a flop and two muxes, simulated in both test modes, and chip-level boundary scan from the cell to the board test and its BSDL.
Wrapper cells
Why a boundary, the cell, int and ext modes simulated, dedicated vs shared, chains, a planning outline.
Extest & boundary scan
Board and core extest, cells per pin type, instructions, an EXTEST step by step, shorts and opens, BSDL, 1149.6.
How to use this
- Rate every page first. Use the "My level" buttons at the top of each page (Daily, Solid, Rusty, Weak). The dots in the sidebar and on the cards above follow your rating. Ratings stay in this browser only.
- Study Weak and Rusty first. For each: read the 60-second answer aloud, study the figures until you can redraw them, then answer the questions before opening the model answers.
- Redraw from memory. The whiteboard figures that come up most: mux-D cell, lockup latch + its timing, OCC + capture waveform, LOC vs LOS, EDT architecture, wrapper cell, TAP state machine, SIB, chain-test signatures.
- Daily topics get a quick pass. For topics you use every day, read the traps and the "how to say it" boxes. The risk there isn't knowing the material; it's explaining your tool flow in general terms.
- Drill in chat. Mock interviews and scripting practice happen in the conversation with Claude (formats below).
Mock interview formats
Start any of these in the chat by typing the line in the box, or say it aloud in voice mode. Claude plays the interviewer, asks one question at a time, pushes with follow-ups, and scores at the end.
Rapid fire · 15 min
10–12 short questions across a topic set. One or two sentences each. Tests recall and precision.
mock rapid: scan + JTAGDeep dive · 30 min
One topic, whiteboard style: you describe the drawing, Claude drills into why, edge cases, and "what if".
mock deep: OCC and at-speedDebug scenario · 20 min
A GLS or silicon failure. You ask for data, Claude reveals it as the tester or simulator would. Scored on method, not just the answer.
mock debug: silicon chain failScripting · 30–45 min
A Python problem from the scripting drills page. You write pseudo-code or Python; Claude reviews for correctness, edge cases, complexity and clarity, then gives a follow-up twist.
mock script: flistScoring rubric (1–4 each)
| Dimension | 4 looks like |
|---|---|
| Correctness | No technical errors; terms used precisely |
| Depth | Explains why, names trade-offs, knows where it breaks |
| Structure | Answer first, then support; a method for open problems |
| Communication | Draws or describes a figure clearly; tool-agnostic terms with tool examples |
Scripting problem bank
The full set, with format reminders, hints and partial solutions, is on the Scripting drills page. Use it to prepare, then drill in chat without looking.
About the existing site content
This review was written independently of vlsi.tylerpeller.com so it can serve as a cross-check. To fact-check the site itself, connect its GitHub repository in the chat; each DFT page can then be compared against this material and corrections proposed file by file.
Scan architecture and clocking
How a scan cell works, how shift and capture are sequenced, and how clocks are controlled for stuck-at and at-speed test: lockup latches, OCCs, LOC and LOS.
60-second answer
Scan turns a sequential test problem into a combinational one. Every flop gets a mux (SE selects between functional D and scan-in), and the flops are stitched into shift registers. In shift mode the tester loads state and unloads responses serially at a slow, safe frequency. In capture mode SE is low and one or more functional clock pulses capture the logic's response. For stuck-at, one slow capture pulse is enough. For transition faults we need a launch and a capture exactly one functional period apart, which in practice comes from an on-chip clock controller that gates PLL pulses. Clock-domain crossings inside a chain get lockup latches, and all of it has to be timed in separate shift and capture modes.
The scan cell
Mux-D is the industry default: one standard cell (e.g. SDFF) with pins D, SI, SE, CK, Q, sometimes a separate SO. It costs a mux delay on the functional D path (the scan mux sits in the setup path) and a little area. Two other styles you should be able to name:
- LSSD (level-sensitive scan design, IBM): two latches with non-overlapping clocks. Master latch takes either system data (clock C) or scan data (clock A); slave latch clocked by B. Race-free by construction and robust to hold problems, but needs extra clock routing. Rare in modern SoCs.
- Clocked scan: separate scan clock selects the scan input instead of a mux. Avoids the mux delay in the functional path.
Chains and the shift/capture protocol
scan_in pin to scan_out. SE (orange) and the clock (blue) are shared by every cell in the chain. With SE=1 the tester controls every flop state; with SE=0 one capture pulse turns the circuit into a pure combinational test problem.Everything a chain touches is shared: SE and the shift clock go to every cell, so a single defect in the SE tree or the clock tree can break every chain at once. That is the first thing you rule out in silicon bring-up.
Stuck-at pattern sequence
- Load (SE=1): shift L cycles; the chain now holds the pattern. The previous response comes out on scan_out at the same time.
- Force PIs, then measure POs (SE=0). PO strobe is before the capture pulse, because capture changes flop state.
- Capture: one clock pulse; every flop samples its functional D.
- Unload overlapped with the next load.
test time ≈ test cycles / fshift
Example: 10,000 patterns, longest chain 2,000 cells, 50 MHz shift → ~20.0 M cycles ≈ 0.4 s. Halve the longest chain and test time roughly halves. That's the case for balanced chains and compression. Only the longest chain matters, because all chains shift in parallel.
Mixed clocks in a chain: lockup latches and edge ordering
Chains often cross clock domains or clock-tree branches with large skew between them. In shift mode all of these are driven from one shift clock, but the insertion delays differ. If the capture flop's clock is later than the launch flop's clock by more than the Q→SI delay, the capture flop takes the new bit: a hold violation in shift. The chain loses a bit.
- Rule: for positive-edge flops, the lockup latch is a negative-level (active-low) latch clocked by the launching domain's clock. Tools insert them automatically at domain boundaries in a chain (
set_scan_configuration -add_lockupstyle options, or Tessent's lockup cell insertion when stitching across clocks). - A lockup latch does not add a cell to the chain; it retimes the transfer by half a cycle. A lockup flop would add a bit, which also works but changes the chain length.
- Mixed edges: put negative-edge flops before positive-edge flops in a chain (or keep them on separate chains). A pos→neg hop inside one cycle lets a bit move through two cells in one shift cycle; neg→pos is a clean half-cycle transfer.
- If the launch clock is the late one, you have a setup issue instead, and it's harmless at slow shift frequency.
Clock control: why an OCC
For at-speed test the capture pulses have to be at functional frequency (hundreds of MHz to GHz). Testers can't drive that cleanly through package pins, and the real functional clock comes from an on-chip PLL anyway. An on-chip clock controller sits between the PLL output and each clock domain's root. It chooses between the slow shift clock and a precise burst of PLL pulses.
- Clock-chain bits
- A short shift register inside the OCC, stitched into a scan chain. ATPG loads it per pattern, so each pattern chooses how many pulses (e.g. 1 for stuck-at, 2 for LOC) and which domains pulse. This is what lets the ATPG tool model the OCC as a programmable clock source (Tessent handles this through clock control definitions for the OCC).
- SE synchronizer
- SE comes from the tester, asynchronous to the PLL. It's synchronized into the fast domain so the pulse burst starts cleanly and at a fixed cycle count.
- Glitch-free gating
- Gating uses a latch-based ICG, and the slow/fast switch is a glitch-free clock mux. Any glitch on a clock root corrupts the whole domain.
- Slow capture
- Stuck-at patterns can capture with a single shift-clock pulse routed through the OCC (the "slow" path), useful for debug and for domains with no PLL.
- Inter-domain at-speed
- Launch in domain A, capture in domain B, at speed, is only meaningful if the two OCCs are synchronous and aligned. Otherwise ATPG pulses one domain per pattern (or compatible groups) and masks cross-domain paths.
At-speed launch: LOC vs LOS
| LOC (broadside) | LOS (skewed-load) | |
|---|---|---|
| Launch | First functional capture pulse | Last shift pulse |
| V2 | Circuit response to V1 (functionally reachable) | V1 shifted by one cell (any value ATPG wants) |
| SE timing | Slow; SE settles before launch | At-speed: must fall between launch and capture |
| Coverage / patterns | Lower coverage per pattern, more patterns, slower ATPG | Higher coverage, fewer patterns |
| Overtest risk | Low: tests reachable transitions | Higher: can launch non-functional transitions and fail good parts |
| Hardware | Just OCC/clock control | Pipelined SE or at-speed SE tree, per-domain |
| Industry use | LOC is the default in most flows. LOS is used selectively, sometimes as a top-off. Hybrid schemes exist. | |
Interview questions
Why does scan make ATPG tractable? basic
Without scan, detecting a fault means finding an input sequence that drives the state machine into the right state and then propagates the effect to a pin. That's sequential ATPG and it's very expensive. With full scan every flop is directly controllable (load) and observable (unload), so each flop output becomes a pseudo-PI and each flop input a pseudo-PO. ATPG only has to solve the combinational logic between them.
Where exactly do you put a lockup latch and what clocks it? core
Between the last cell of domain A and the first cell of domain B in the chain, clocked by domain A's clock (the launch side). For posedge flops it's a latch that's transparent when that clock is low. It holds the old value through the high phase, which gives half a period of hold margin to absorb skew between the domains. It does not add a scan bit.
A chain has a hold violation in shift only at one clock-domain crossing. What are your fixes? core
Add a lockup latch if it's missing (or check it's clocked by the right domain). Otherwise add hold buffering on the Q→SI path, reorder the chain so the crossing sits between closer clock-tree leaves, or use the flop's dedicated SO pin if there is one. Also check the shift-mode timing constraints: hold on shift paths must be analyzed with shift-mode case analysis and real clock latencies.
Why can't the ATE just supply the at-speed clock? core
GHz clocks through package pins and probe cards suffer from signal-integrity problems, tester channel limits and cost. More importantly, the functional clock tree is designed around the PLL output. Testing with an external clock doesn't exercise the real clock path and has different jitter/duty cycle. The OCC reuses the PLL and only needs slow control signals from the tester.
How does ATPG know how many pulses the OCC will deliver? core
The OCC's control bits (clock chain) are scan cells. The tool is given a model of the OCC: which bits enable which pulse in the capture window. It then treats the bits as part of the pattern. It chooses 1 pulse for a stuck-at pattern, 2 for a LOC transition pattern, sometimes more for sequential depth, and sets them in the load data.
What's the risk of LOS for yield? deep
LOS can create V1→V2 transitions that are functionally impossible, e.g. exercising a path that's a false path or a multicycle path in functional mode. A good chip fails at speed on a path that never matters. You mitigate with timing exceptions fed to ATPG (false/multicycle paths masked), or by using LOC as the main method.
Why must PO be strobed before the capture pulse in a stuck-at pattern? basic
The expected PO values are computed from the loaded state + forced PIs. After the capture pulse the flops take new values, and any PO that depends combinationally on flop outputs changes. Standard order: force PI → measure PO → pulse capture clock.
What is a "dead cycle" around SE, and why add one? core
An extra tester cycle with no clock pulse after SE toggles, so the high-fanout SE net settles everywhere before the next active edge. It lets SE be timed as a multicycle path, which relaxes its buffering. The OCC's synchronizer delay provides a similar settling window on the capture side.
Your chain includes both posedge and negedge flops. What goes where? core
Negedge flops first (closer to scan-in), posedge flops after. Within one shift cycle, the posedge flops shift at the rising edge and then the negedge flops at the falling edge. If a negedge flop follows a posedge one, it grabs the bit the posedge flop just took, so two cells shift in one cycle. Alternatives: separate chains per edge, or a lockup element at the boundary.
Further reading: EDN, launch-off-shift at-speed test · Siemens, navigating Tessent OCCs · VLSI Tutorials, on-chip clock controller
Scan insertion and compression
What has to be true of a netlist before it can be scanned, how chains are built and balanced, and how compression cuts test data and time by one to two orders of magnitude.
60-second answer
Insertion replaces flops with scan flops and stitches them into chains, but most of the engineering is making the design scannable. Every scan flop's clock and async set/reset must be controllable from the tester, there must be no X sources the tool can't handle, and memories and black boxes need to be isolated or bypassed. Then chains are built per clock domain, edge and power domain, and balanced. Compression puts a decompressor/compactor pair between a few tester channels and hundreds of short internal chains. That works because ATPG patterns are mostly don't-cares, so a small stream of channel data can encode the few care bits.
Where insertion sits
Scannability rules (the stuff that breaks ATPG)
| Problem | Why it breaks scan | Typical fix |
|---|---|---|
| Generated / gated / muxed clocks | Flop clock not controllable from a test clock source, so shift fails | Test-mode clock mux to OCC/test clock; ICG TE pin tied to SE |
| Async set/reset from logic | Reset can fire during shift and wipe the chain | Gate or mux the reset in test mode; hold it off during shift; ATPG can pulse it in capture |
| Latches | Not scannable in a mux-D flow | Make transparent in test mode, or treat as sequential elements ATPG can model |
| Combinational loops | Oscillation, unknown values | Break with a test-mode gate or scan flop |
| Tristate buses | Contention (two drivers on) or float (none) | One-hot enable decode in test, bus keepers; ATPG contention checks |
| Memories, analog, hard macros | X sources; logic around them untestable (shadow logic) | Bypass/observe logic around the macro, or macro test mode; model as black box and mask |
| Non-scan flops | Uncontrollable state, X at capture | Scan them, reset them in test, or accept as X source and mask |
| Pad/IO control | Bidirectional pins toggle direction during test | Force direction in test mode; boundary scan controls pads |
Stitching and balancing
Chain construction rules, roughly in order of priority:
- Clock domain and edge: keep one domain per chain where possible. Where not, order and add lockup latches (see scan clocking). Negedge before posedge.
- Power domain: a chain should not cross a switchable domain, or the chain breaks when that domain is off (and needs isolation/level shifters when it's on).
- Hierarchy / partition: wrapper chains and internal chains per core; keep physical partitions together.
- Balance: equal length within each compression unit or channel group.
- Physical: reorder after placement using the scan DEF, within those constraints (see round 2).
Compression
A pattern typically has only 1–5% care bits. Compression exploits that: the tester supplies a small compressed stream, and on-chip hardware expands it. Test data volume and test time drop by roughly the chain-to-channel ratio, until either encoding capacity or X density limits it.
- Decompressor
- Continuous-flow linear decompressor: ring generator (a compact LFSR) + phase shifter. Each internal chain bit is a linear (XOR) function of the channel bits injected so far. ATPG solves a system of linear equations over GF(2) per pattern to find channel data that produces the care bits. If the care bits don't fit, that fault moves to a different pattern.
- Compactor
- Spatial XOR trees combine many chain outputs per channel each shift cycle. Aliasing (two errors canceling) is possible but rare and accounted for by fault simulation.
- Masking
- Per-pattern (or per-shift) mask bits, delivered with the compressed data, block chains carrying X. Masking also reduces observability, so heavy X sources cost coverage and patterns.
- Ratio
- Compression ratio ≈ internal chains / scan channels, adjusted by pattern inflation. Past a point, more chains means more patterns (encoding limits) and more routing congestion around the decompressor and compactor, so the effective gain flattens.
- Bypass
- A bypass mode concatenates internal chains into long uncompressed chains. It's the first thing you use in silicon debug because failures map directly to cells.
- Low-pin-count
- Channel counts can be tiny (a few pins) for package test or for hierarchical cores sharing top-level pins through broadcast or channel sharing.
e.g. 2 M cells, 8 channels: no compression, 8 chains of 250 k cells. With 800 internal chains: 2.5 k cells/chain, ~100× shorter shift, typically 1.5–3× more patterns → ~30–60× net.
X handling
Where X comes from, and what to do:
- Uninitialized state (non-scan flops, memories, register files): initialize in test setup, use memory bypass, or constrain.
- Black boxes / analog: model outputs as X, add observe/control logic around them.
- Timing exceptions in at-speed capture: false and multicycle paths can't be trusted at speed, so ATPG masks their endpoints (captures X). That's why SDC exceptions get imported into ATPG.
- Cross-domain captures with asynchronous clocks: mask or don't pulse both domains in one pattern.
- Bus contention / floating: ATPG resolves to X.
Interview questions
Why does compression work at all? basic
Deterministic ATPG patterns specify only a small fraction of bits (care bits); the rest are don't-cares. A linear decompressor can produce any small set of specified bits from much less input data, as long as the linear equations are solvable. The don't-care bits come out as whatever the decompressor happens to generate.
What limits the compression ratio? core
(1) Encoding capacity: care bits per shift cycle can't exceed roughly what the channels inject, so dense patterns fail to encode and faults move to extra patterns. (2) X density and masking reduce observability. (3) Physical: hundreds of chains fanning out of a decompressor and into a compactor cause routing congestion. (4) Aliasing is minor. In practice pattern count rises as the ratio rises, so the net benefit saturates.
ATPG shows low coverage on logic around an SRAM. What's happening and what do you do? core
That's shadow logic: the memory's outputs are X to ATPG and its inputs aren't observed, so logic feeding and fed by the RAM is uncontrollable or unobservable. Options: memory bypass mode (a mux from data-in to data-out in test mode), observation flops on the RAM inputs, ATPG with a RAM model (RAM sequential patterns), or accept and cover the memory with MBIST.
How do you decide how many scan chains / channels? core
Start from test time and pin budget. Channels are limited by available test pins (and the tester's channel memory). Chain length is set by the target: total cells / internal chains. Then check routing congestion around the EDT logic, shift power (more parallel chains are fine, total toggling is the same), and whether hierarchical cores share channels. Iterate with pattern count estimates.
Why a compression bypass mode? basic
For debug and diagnosis. In bypass, a tester fail maps directly to (chain, cell) without having to invert the compactor. Also for chain integrity tests before trusting the EDT logic, and as a fallback if the compression logic has a defect.
Where do you place chain-to-domain crossings and why? core
As few as possible, grouped, with lockup latches at each crossing. Many tools order chains by clock domain and edge so there's at most one crossing per group, and put the lockup latch right at it. Crossings are the most common source of shift hold issues after CTS.
Reset is asynchronous and generated by a reset synchronizer. What DRC do you expect and how do you fix it? core
An "uncontrollable set/reset" violation: the reset output of the synchronizer isn't directly controllable from a PI during shift. Fix: in test mode, mux the flops' reset to a top-level pin (or gate it with a test signal so it's inactive during shift). Also scan the synchronizer flops themselves or constrain them. ATPG can then test reset logic by pulsing the test reset in capture.
Further reading: Siemens Tessent blog, hierarchical coverage reports
Core wrapping and hierarchical DFT
Isolating a core with wrapper cells so it can be tested on its own, generating patterns once at core level, and reusing them at the top. This is how every large SoC gets through ATPG.
60-second answer
A wrapper puts a controllable/observable cell on every core I/O. In internal mode the input cells drive the core and the output cells capture its response, so the core's patterns don't depend on the rest of the chip. That lets us run ATPG per core (fast, small memory), sign off coverage at core level, and retarget those patterns to the top through whatever channels the top gives the core. In external mode the wrapper cells test the top-level glue and wiring between cores. At the top, each wrapped core is replaced by a graybox model that only keeps the wrapper cells and the logic between them and the ports. Control is via IJTAG or an IEEE 1500 WIR.
Why wrap
- ATPG capacity: flat ATPG on a 108-gate SoC is slow and memory-hungry. Per-core runs parallelize and finish early in the schedule.
- Reuse: the same core instantiated 16 times gets one pattern set, broadcast to all instances.
- Schedule: core DFT signs off before the top is ready. Late top changes don't force re-ATPG of cores.
- Test scheduling and power: cores can be tested in groups to fit channel and power budgets.
- Diagnosis: failures localize to a core.
Wrapper cells
| Dedicated cell | Shared cell | |
|---|---|---|
| What | New flop + muxes on the port | Existing functional boundary flop doubles as wrapper cell |
| Area | Higher | Low |
| Timing | Adds mux on functional I/O path | No extra mux on the port path, but the flop's capture behavior is constrained in each mode |
| When | Unregistered ports, timing-relaxed I/O | Registered I/O (most well-designed cores); tools analyze fan-in/fan-out cones to find candidates |
Ports that don't need a wrapper cell: clocks, resets handled separately, test control pins, and ports whose logic is covered another way. Wrapper cells for a port feeding many flops through logic save a lot versus making every flop a shared cell. Tools apply a threshold on fan-in/fan-out cone size to choose.
Internal and external modes
| Mode | Input wrapper cells | Output wrapper cells | Tests |
|---|---|---|---|
| Internal (INTEST) | Drive core inputs (launch). Isolate from outside. | Capture core outputs (observe); drive safe values outward | Core logic |
| External (EXTEST) | Capture from outside (observe) | Drive outward (launch) | Glue logic, inter-core wiring |
| Functional | Transparent | — | |
The hierarchical flow
- Core level: insert wrapper cells, core EDT, OCC if needed, IJTAG-controlled mode signals. Run internal-mode ATPG, sign off coverage. Write a graybox (interface) model.
- Top level, internal: retarget core patterns to top-level pins. The tool maps core scan ports through top-level connections (channel sharing, broadcast, pipelines) and merges patterns of cores tested together.
- Top level, external: load grayboxes of all cores plus top logic; run ATPG with every core in external mode. Tests top glue and wiring.
- Coverage roll-up: sum core internal + top external fault lists to report the chip number (Tessent can merge flat fault lists across the hierarchy).
analyze_graybox/write_design -graybox-style commands; pattern retargeting maps core-level patterns to chip pins. Synopsys calls wrapped core models CTL models and does the same with DFT Compiler / TestMAX.IEEE 1500 in one picture
Summary only; the full treatment (serial control timing, every instruction, TAP/IJTAG control, CTL) is on the IEEE 1500 page.
- WSP
- Wrapper Serial Port: WSI, WSO plus the WSC control signals WRCK, WRSTN, SelectWIR, ShiftWR, CaptureWR, UpdateWR (TransferDR is optional in the standard).
- WIR
- Wrapper instruction register: selects mode and which register sits between WSI and WSO.
- WBY
- 1-bit bypass register, so you can shift through many wrapped cores quickly.
- WBR
- Wrapper boundary register: the chain of wrapper cells.
- Instructions
- WS_BYPASS and WS_EXTEST are mandatory, plus at least one internal-test instruction. Others include WS_INTEST_SCAN, WS_INTEST_RING, WS_PRELOAD, WS_CLAMP, WS_SAFE, and parallel-port (WP_) variants.
- vs 1149.1
- 1500 has no TAP state machine: the control signals are the decoded states (shift/capture/update). It's usually driven from a TAP or IJTAG network. Many teams now skip a full 1500 WIR and control wrappers directly with IJTAG TDR bits. Describing it as "1500-style wrapper, IJTAG-controlled" is accurate for most modern flows.
Interview questions
What's a graybox model and why is it enough for top-level ATPG? core
A reduced netlist of a wrapped core: wrapper chains, the logic between ports and wrapper cells, and the control/clock logic needed to operate them. The internal logic is removed. External-mode ATPG only launches from and captures into wrapper cells, so that's all it needs. It shrinks the top-level design by orders of magnitude.
How do identical core instances share test resources? core
Channel broadcast: the same compressed input stream goes to all instances, and each instance's outputs are compared (or compacted) separately, so any instance can fail independently. Pattern count is that of one core. Care: instances must be in the same mode and clocked identically, and output pins must be enough to observe each (or use on-chip compare).
A top-level port of a core is unregistered and feeds 2,000 flops through logic. Shared or dedicated cell? core
Dedicated. With no single boundary flop, a shared-cell approach would need to make every flop in the fan-out cone a wrapper cell (2,000 cells worth of constraints). One dedicated cell on the port isolates the whole cone.
Why can core-level coverage and chip-level coverage differ? deep
Retargeting constraints: at the top, the core may get fewer channels, pins tied, or clocks controlled differently (different OCC setup), so some patterns can't be applied as generated. Also faults on the core boundary are only covered in external mode, and top glue coverage depends on graybox accuracy. Report both and reconcile the difference.
How are wrapper modes controlled in your flow? basic
Either a 1500 WIR (instruction decode drives int/ext enables) or, more commonly now, IJTAG TDR bits in the core's ICL network. The test setup (PDL) sets those bits before scan; ATPG treats them as constant during the pattern set.
Further reading: Tsiatouhas, IEEE 1500 SECT lecture notes · Let's talk about wrappers (IEEE 1500)
Test point insertion
Adding a small amount of logic to make hard-to-control or hard-to-observe nets easy. It's essential for LBIST and increasingly used to cut deterministic pattern counts.
60-second answer
Some logic is random-pattern resistant: a wide AND needs all inputs at 1, which random patterns almost never produce, and a net deep in reconvergent logic may rarely propagate to a flop. Test points fix that. A control point adds an AND/OR gate driven by a test-point scan cell to force a net to 0 or 1 in test mode. An observe point taps a net into a scan cell. Tools pick locations with testability analysis (SCOAP-style or probabilistic) and avoid timing-critical paths. For LBIST, test points are what get you from ~80% to 90%+ coverage. For deterministic ATPG with compression, test points aimed at pattern-count reduction can cut patterns by 2–4×.
Random-pattern resistance
Test point types
- Control-0 / control-1: force a net low/high. The TP scan cell supplies the value (random in LBIST, chosen by ATPG in deterministic mode). Gated by a global test-point enable so functional mode is unaffected.
- Inversion (XOR) control point: flips a net instead of forcing it. Less biasing of the signal distribution.
- Observe point: net → dedicated scan cell or XOR tree into a scan cell. No gate in the functional path, only a load on the net. Cheapest in timing.
- Sharing: one TP scan cell can drive several control points, and XOR trees compress many observe points into one cell.
Testability metrics (SCOAP)
SCOAP gives each net a combinational 0-controllability (CC0), 1-controllability (CC1) and observability (CO), counting roughly how many assignments are needed. Higher is harder. PIs and scan cell outputs start at 1; POs and scan cell inputs have CO = 0.
OR: CC0(z) = Σ CC0(inputs) + 1 CC1(z) = min CC1(inputs) + 1
NOT: CC0(z) = CC1(a) + 1, CC1(z) = CC0(a) + 1
CO(input a of AND) = CO(z) + Σ CC1(other inputs) + 1 (side inputs at non-controlling value 1)
For the 16-input AND built from 4-input ANDs, CC1 at Z = 4×(4×1+1)+1 = 21, while CC0 = 1+1+1 = 3. That asymmetry is what flags it for a control-1 point. Commercial tools use probabilistic (COP-like) estimates plus fault simulation to rank candidate locations by expected coverage gain.
Where test points are used, and what they cost
| Use | Goal | Notes |
|---|---|---|
| Logic BIST | Raise random-pattern coverage | Essential. LBIST relies on PRPG + MISR, no deterministic top-off at runtime, so RP-resistant faults need TPs. Used for in-system/automotive test (ISO 26262). |
| EDT / deterministic | Cut pattern count | TPs that make faults easier to detect together reduce patterns (Tessent offers pattern-count-targeted TPI). Also helps when compression encoding is tight. |
| Hybrid LBIST+EDT | Share logic | Same TPs serve both; common in automotive chips. |
| X-bounding | Block X sources | Control points on X sources (memories, black boxes) so they don't corrupt MISR/compactor. |
- Timing: control points add a gate on a functional path. Tools exclude critical paths (read SDC/timing slack) and prefer observe points.
- Area: each TP costs a gate + share of a scan cell. Typically 1–2% of flops.
- Power: control points change toggle activity in test; enable only in test mode.
- Verification: equivalence check with TP enable = 0 must pass against the pre-TP netlist.
Interview questions
Why do control points hurt timing but observe points don't? basic
A control point inserts a gate in series on the net, adding delay to every functional path through it. An observe point only adds a fanout branch (capacitive load) to a scan cell; the functional path is unchanged apart from the extra load.
Why does LBIST need test points and ATPG mostly doesn't? core
ATPG targets each fault deterministically: it will set all 16 inputs of an AND to 1 if needed. LBIST applies pseudo-random patterns, so the probability of hitting such a combination is tiny. Test points change the circuit so random patterns detect those faults with reasonable probability.
How can TPI reduce deterministic pattern count? deep
Patterns are often limited by conflicts: two faults need incompatible values on some net, or a fault needs so many care bits that few other faults fit in the same pattern. Control points break those conflicts and observe points shorten propagation paths (fewer care bits per fault). More faults fit per pattern, so fewer patterns are needed. Useful when tester memory or test time is the constraint.
Where would you not put a test point? core
On timing-critical paths, clock and reset nets, asynchronous crossings, analog interfaces, and anything in a safety mechanism's functional path where an added gate would need extra safety analysis. Also not in paths where a forced value in test could cause contention or damage.
Low-power scan
Scan toggles far more logic than functional operation. Shift power heats the die and drops the supply; capture power causes IR-drop that slows paths and fails good parts at speed. How to control both.
60-second answer
There are two problems. Shift power is average power over long shift sequences: every flop toggles with random data, so switching activity can be several times functional. The fixes are slower shift, low-transition fill, Q-gating, and shifting only some chains or cores at a time. Capture power is the instantaneous peak at launch/capture in at-speed tests. IR-drop there slows paths, so good dies fail (yield loss) or bad dies escape if you relax the clock. The fixes are clock-gating-aware and power-aware ATPG that caps toggles per pattern, staggering domain clocks, and limiting how many cores capture together. With UPF domains you also keep chains inside one domain, test the isolation and retention cells, and test with domains in their valid power states.
Why test power is different
| Shift | Capture (at-speed) | |
|---|---|---|
| Nature | Average, sustained (thousands of cycles) | Peak, 1–2 fast cycles |
| Cause | Random data rippling through every flop + the logic behind them | Launch transitions across many domains simultaneously |
| Effect | Thermal, package/probe current limits, supply droop → shift failures | Dynamic IR-drop → slower paths → false at-speed fails, or reduced test frequency |
| Typical knobs | fshift, fill, Q-gating, chain/core partitioning | Power-aware ATPG, clock gating usage, staggered/sequential capture, fewer active domains |
Shift power
- Lower shift frequency: power ∝ f. Simplest, but test time goes up proportionally.
- Clock gating in shift: shift only part of the design at a time (per core or per chain group), holding the other groups' clocks off. Costs test time.
- Q-gating: blocks the combinational logic from seeing shift toggles. Very effective on logic power, costs area and functional timing.
- Low-power EDT: the decompressor can hold values for chains that have no care bits in a given shift window, which mimics adjacent fill.
- Scan chain ordering: grouping flops so adjacent cells tend to hold equal values reduces toggles a bit. Minor compared to fill.
Capture power
scan_en and ATPG controls the functional enable during capture (tests the enable logic, lower capture power); tie it to test_mode and the clock is always on in test (the enable logic becomes untestable and capture power goes up).- Power-aware ATPG: set a budget (e.g. maximum % of flops that change state at capture, or weighted switching activity). ATPG respects it using fill choices and by turning off clock gates it doesn't need (enables = 0) for that pattern. More patterns result.
- Clock-gating aware: requires TE tied to SE, not test_mode, so ATPG controls the functional enables during capture (see figure).
- Staggered capture: domains pulse at different times in the capture window rather than together. The OCC per domain supports this.
- Core scheduling: in hierarchical test, choose which cores capture together to meet the peak budget.
- Validation: run vector-based IR-drop (e.g. RedHawk/Voltus with the actual patterns' switching) on worst patterns before tapeout; correlate with silicon.
Power domains and scan
- Chains don't cross switchable domains. If a domain is off, any chain passing through it breaks. Build chains per domain (tools read UPF during insertion).
- Isolation cells clamp outputs of an off domain. Test their clamp behavior with the domain in the off state, and that they're transparent when on.
- Level shifters between voltage domains may sit on scan paths; they add delay and need timing in shift mode across voltages.
- Retention flops: need save/restore testing, often a dedicated retention test sequence (save, power down, power up, restore, unload).
- Power states in test: patterns run with a defined power-state table (which domains on, which voltages). Test all valid states that matter, not just all-on.
- Power switch control must be controllable in test mode and not toggle during shift.
Interview questions
Why can test power exceed functional power? basic
Functional workloads have correlated data and most logic idle; typical toggle rates are low. Scan data is essentially random and every flop shifts every cycle, and at capture ATPG deliberately activates many paths at once. Also functional designs rely on clock gating to keep idle blocks off, which test may bypass.
Good dies fail transition patterns at nominal voltage but pass at +5% V. What do you suspect? core
Capture IR-drop. Too many transitions at launch drops local supply, slowing paths. Extra voltage restores speed. Confirm: check the failing patterns' switching activity; rerun with a power-aware pattern set (toggle cap) and see if fails go away; compare fails vs path slack. Fix with power-aware ATPG, staggered capture, or fewer simultaneous domains.
How does adjacent fill interact with compression? core
With a linear decompressor you don't choose non-care bits freely; they're whatever the decompressor produces, which looks random. Low-power compression modes add hold logic so that chains (or groups) with no care bits in a window receive a constant, which recreates the adjacent-fill effect at a cost of some encoding capacity.
What's wrong with tying ICG TE to test_mode? core
The clock is always on in test, so (1) the functional enable logic can't be tested (its effect is masked); (2) every gated flop captures every pattern, raising capture power; (3) you lose the ability to use clock gating for power-aware ATPG. With TE = SE the gate is forced on only during shift, and ATPG controls the enable in capture.
JTAG (IEEE 1149.1)
The Test Access Port: five pins, a 16-state controller, an instruction register and a set of data registers. It's the front door for boundary scan, IJTAG networks, MBIST, test-mode entry and silicon debug.
60-second answer
1149.1 defines a serial port (TCK, TMS, TDI, TDO, optional TRST*) and a 16-state TAP controller driven by TMS on rising TCK edges. There are two symmetric paths: load an instruction through the IR, then that instruction selects which data register sits between TDI and TDO. Each scan goes Capture → Shift → Update, so the register's parallel outputs only change at Update and don't ripple while shifting. Mandatory pieces are the IR, BYPASS, the boundary-scan register and the instructions BYPASS, SAMPLE, PRELOAD and EXTEST. On an SoC it's mostly used as the access mechanism for internal test infrastructure through user-defined data registers and IJTAG.
The TAP controller
- Reset
- TMS=1 for 5 TCKs reaches Test-Logic-Reset from any state (or assert TRST*). In TLR the IR holds IDCODE if the device has an ID register, else BYPASS, and test logic is inactive.
- Capture-xR
- Parallel load into the shift stage on the rising edge leaving the state. IR capture loads
…01into the two LSBs (the other bits are design-specific), which lets software check the chain. - Shift-xR
- One bit per rising edge, LSB first out of TDO. The edge that moves from Shift to Exit1 also shifts, so an n-bit register needs TMS=0 for n−1 edges in Shift and TMS=1 on the last one.
- Pause-xR
- Hold shifting without losing state, e.g. while the tester reloads buffers.
- Update-xR
- Shift stage copied to the parallel hold stage on the falling edge of TCK.
- Run-Test/Idle
- Idle state, and where self-tests run (RUNBIST, MBIST started via a TDR and left running for N TCKs).
Architecture and instructions
| Instruction | Status | Register between TDI/TDO | Effect |
|---|---|---|---|
| BYPASS | Mandatory, all-1s opcode | BYPASS (1 bit, captures 0) | Shortest path through a chip on a board chain |
| SAMPLE | Mandatory | BSR | Capture pin values without disturbing function |
| PRELOAD | Mandatory (may share opcode with SAMPLE) | BSR | Load BSR update stage before EXTEST so pins start in a known state |
| EXTEST | Mandatory | BSR | Pins driven from BSR; board interconnect test. Historically all-0s opcode, no longer required since 2001 |
| IDCODE | Optional (required if ID register exists) | 32-bit ID | LSB=1, 11-bit JEDEC manufacturer, 16-bit part, 4-bit version |
| INTEST, RUNBIST, CLAMP, HIGHZ | Optional | BSR / BYPASS | Core test via BSR; self-test; hold pins while bypassed; tri-state all outputs |
| USER / private | Design-defined | Any TDR | IJTAG host, MBIST, fuse, PLL, test-mode control |
Timing
Boundary-scan cell
The two-stage structure (capture/shift + update) is the idea to remember. 1500 wrapper cells and 1687 TDRs reuse it: shifting never disturbs parallel outputs, and everything updates at once.
Interview questions
From Run-Test/Idle, what TMS sequence shifts 8 bits into a DR and returns to Idle? core
RTI → Select-DR (1) → Capture-DR (0) → Shift-DR (0). Then 7 more rising edges with TMS=0 in Shift (7 bits), and the 8th bit shifts on the edge with TMS=1 into Exit1-DR. Then Update-DR (1), then RTI (0). TMS: 1 0 0 | 0000000 1 | 1 0 = 13 TCKs.
Why does IR capture load 01 in the LSBs? core
Chain integrity. When scanning a board's IR chain, each device shifts out its fixed 01 pattern first, so software can check the chain is connected and count devices and IR lengths. The 1 guarantees a 0→1 transition, which detects stuck-at-0 and stuck-at-1 on TDO.
Why does TDO change on the falling edge? basic
So the next device in a daisy chain (or the tester) samples on the rising edge with half a TCK period of setup and hold margin. It makes chaining devices across a board robust to skew.
How do you find the number of devices on an unknown JTAG chain? core
Reset (all IRs → IDCODE or BYPASS). Put everything in BYPASS by shifting a long string of 1s into the IR chain. Then flush the DR chain with 0s and shift a 1: the number of TCKs until the 1 appears at TDO equals the number of 1-bit BYPASS registers, i.e. the device count. Alternatively after reset, read the DR chain: IDCODE registers start with 1, bypass captures 0.
SAMPLE vs PRELOAD vs EXTEST? basic
SAMPLE captures live pin values into the BSR while the chip runs normally. PRELOAD shifts a known pattern into the BSR update stage, still in normal mode. EXTEST then hands pin control to the BSR, driving those preloaded values out and capturing what arrives, which tests board interconnect. PRELOAD first avoids driving garbage when EXTEST activates.
What does 1149.1 give an SoC DFT engineer beyond boundary scan? core
A standard, always-available, low-pin-count access port. Through private instructions and TDRs you enter test modes, program OCC/PLL settings, start and read MBIST, blow/read fuses, configure scan and compression modes, and in silicon debug read status registers. Today mostly as the host for an IJTAG network.
Further reading: Corelis JTAG technical primer · Electronic Design, JTAG vs IJTAG
IJTAG (IEEE 1687)
A standard way to describe and access hundreds of on-chip instruments through a reconfigurable scan network, and to write their test procedures once at the instrument level and have a tool retarget them to the chip's pins.
60-second answer
1149.1 gives you a port and a few data registers, but an SoC has hundreds of instruments: MBIST controllers, PLL and OCC configuration, sensors, wrapper enables, fuse controllers. 1687 defines a scan network behind the TAP built from TDRs, SIBs and scan muxes, so the active path contains only what you're accessing. It has two languages. ICL describes the network's structure. PDL describes operations on an instrument, like "write this field, run 1,000 clocks, read that status bit". A tool combines the two to compute the TAP-level vectors (retargeting). Instruments and their PDL are reusable across designs and hierarchy levels, and the tool handles path lengths and SIB sequencing.
Why 1687 exists
- Scale: one flat user DR per instrument doesn't scale; one long chain containing everything is slow and fragile.
- Reuse: an instrument's access procedure (PDL) is written against its own ports and registers, not against a specific chip.
- Hierarchy: a core's network plugs into the parent's network; procedures stay valid.
- Automation: the tool, not a person, figures out SIB states, path lengths and the order of scans.
The network
- TDR
- Test data register: a shift stage and (usually) an update stage, like a 1149.1 DR. Its parallel outputs drive instrument inputs; its capture inputs read instrument status.
- SIB
- Segment insertion bit: 1-bit register that inserts or bypasses a hosted segment. Builds hierarchical, variable-length networks.
- ScanMux
- Selects between scan segments, controlled by bits elsewhere in the network (e.g. a TDR field). More general than a SIB.
- AccessLink
- ICL construct connecting the network to the 1149.1 TAP (which instruction opens it). The network can in principle be reached through other ports too.
- Instrument
- The thing being controlled (MBIST, sensor, PLL). It sees only parallel data ports, never TCK/TMS.
The SIB in detail
ICL and PDL
ICL describes structure: modules, scan in/out ports, scan registers, muxes, data ports and how they connect. PDL describes operation at the instrument's level.
// ICL (simplified): a TDR driving a PLL's controls and capturing its lock status
Module pll_ctrl_tdr {
ScanInPort si; ScanOutPort so { Source ST[0]; }
ShiftEnPort se; CaptureEnPort ce; UpdateEnPort ue;
SelectPort sel; TCKPort tck;
DataOutPort div_o[3:0] { Source R[7:4]; }
DataOutPort byp_o { Source R[1]; }
DataInPort lock;
ScanRegister R[7:0] { ScanInSource si; ResetValue 8'h00; }
ScanRegister ST[0:0] { ScanInSource R[0]; CaptureSource lock; }
Alias div[3:0] = R[7:4];
Alias bypass = R[1];
}
# PDL (Tcl-based, Level-1): configure the PLL and check lock
iProcsForModule pll_ctrl_tdr
iProc set_div {ratio} {
iWrite div $ratio ;# queue writes
iWrite bypass 0
iApply ;# one retargeted scan (or more)
iRunLoop 2000 -tck ;# wait for lock
iRead ST 1 ;# expect captured lock = 1
iApply
}
- iWrite / iRead
- Queue a write, or an expected read (compare value), on a register field or data port.
- iApply
- Execute everything queued. The tool may merge operations on different instruments into one scan.
- iScan
- Raw scan of a register with given data (less common).
- iRunLoop
- Wait N clock cycles (TCK or a named system clock), e.g. for MBIST to run.
- iProc / iCall
- Define and invoke reusable procedures, scoped to a module. Calls are hierarchical:
iCall coreA.pll.set_div 4. - iClock
- Declare that a system clock must be running for the following operations.
- iMerge
- Allow operations from parallel threads to share scans.
Retargeting
Given ICL for the whole chip and PDL at instrument level, the tool:
- Finds the path from the TAP to each target register in the ICL graph.
- Computes the SIB/ScanMux settings needed and the sequence of scans to reach them (opening outer SIBs first).
- Assembles each scan's bit vector with the right length, placing writes and expected reads at the right offsets. Other bits keep their values.
- Emits TAP-level patterns (TMS/TDI/expected TDO) for the tester or a testbench, or drives them through a DFT test-setup procedure before scan ATPG.
iCall in a test-setup procedure), so the scan patterns inherit a known DFT configuration. When silicon doesn't enter a mode, simulate the retargeted setup vectors first.Interview questions
What's the difference between ICL and BSDL? basic
BSDL describes a chip's 1149.1 boundary-scan implementation for board test (pins, BSR cells, instructions). ICL describes the internal instrument network behind the TAP: registers, SIBs, muxes, and how instruments connect. They complement each other.
Why do SIBs make access faster? core
With everything closed the active path is a handful of bits. You open only the branch you need, so each scan is short. A flat daisy chain of every TDR would make every access as long as the sum of all registers, often tens of thousands of bits.
A retargeted PDL sequence works in simulation but silicon reads back all zeros. Where do you look? deep
First TAP basics: IDCODE reads correctly? Does the IJTAG host instruction load? Then network integrity: shift a known pattern through the closed network (just SIB bits) and check the length. Then open SIBs one level at a time and check each length. All zeros suggests a broken path (so TDO stuck), a wrong instruction opcode, or TCK/reset issues. Check TRST/reset values of SIBs and that the tester's TDO strobe timing is correct (falling-edge launch).
How does IJTAG relate to 1500? core
1500 standardizes the core wrapper and its serial control. 1687 standardizes the access network and procedure description. In practice wrapper controls are often just TDR bits in the core's 1687 network, and 1500-style wrappers are described in ICL. They coexist: 1687 can host a 1500 WIR as a register.
What does iApply guarantee about ordering? core
All operations queued since the last iApply complete before the next one starts. Within one iApply, the tool may combine writes to different registers into one scan and may need several scans if SIB reconfiguration is required. Reads compare what's captured in that scan. If you need a write, then time, then a read, you need separate iApply calls with an iRunLoop between them.
Further reading: ASSET InterTech, ICL and PDL explained · Electronic Design, scan ATPG vs IJTAG retargeting · Nordic Test Forum, IEEE 1687 slides
IEEE 1500 core wrapper
The standard for isolating an embedded core so it can be tested on its own: a boundary register around the core, an instruction register that sets the wrapper's mode, and a serial port that looks like a TAP without the state machine.
60-second answer
IEEE 1500 (Standard Testability Method for Embedded Core-based ICs) standardizes the wrapper around a reusable core. It has four register pieces: the WBR (a cell on every functional I/O), the WIR (instruction register), the WBY (1-bit bypass), and the core's own data registers such as scan chains. They're reached through the Wrapper Serial Port: WSI and WSO plus six control signals (WRCK, WRSTN, SelectWIR, ShiftWR, CaptureWR, UpdateWR). An optional parallel port (WPI/WPO) carries high-bandwidth scan. Unlike 1149.1 there's no state machine on the core. The control signals are already decoded, so one chip-level TAP (or IJTAG network) can drive many wrappers. Mandatory instructions are WS_BYPASS and WS_EXTEST plus at least one internal-test instruction. The core's test interface is described in CTL (IEEE 1450.6), so the integrator can reuse the core's patterns.
What problem 1500 solves
- Isolation: the core can be tested without knowing what surrounds it, and the surroundings (glue logic, other cores) can be tested without the core.
- Reuse: the core provider ships the wrapper plus patterns and a CTL description; the SoC integrator retargets the patterns to chip pins.
- Plug-and-play access: a standard serial control interface, so a chip-level controller can manage dozens of wrappers the same way.
- Scalability: serial access for control and low-bandwidth test, parallel ports for real scan bandwidth.
1500 standardizes the wrapper and its interface. It deliberately does not standardize the chip-level access mechanism (TAM): how WPI/WPO and the WSP reach the pins is the integrator's choice.
Architecture
- WSP
- Wrapper Serial Port: WSI, WSO, and the WSC control signals WRCK, WRSTN, SelectWIR, ShiftWR, CaptureWR, UpdateWR. TransferDR is an optional extra control, and the standard also allows auxiliary clocks (AUXCK).
- WPP
- Wrapper Parallel Port (optional): WPI, WPO and WPC (parallel control). This is how real scan data reaches the core: many channels into core chains or EDT.
- WIR
- Instruction register, with a shift stage and an update stage. Its decoded value sets every WBR cell's mode and picks the register between WSI and WSO. WRSTN resets it asynchronously so the wrapper is transparent (functional mode).
- WBY
- 1-bit bypass, so a chain of many wrapped cores stays short when you only want one.
- WBR
- Boundary register made of wrapper boundary cells, one per functional port bit (clocks, resets and test pins are typically excluded).
- Core data registers
- Scan chains, MBIST or other core registers that instructions can put on the serial or parallel path.
Serial control timing
Instructions
Naming: WS_ instructions use the serial port for test data, WP_ the parallel port. The standard mandates WS_BYPASS and WS_EXTEST plus at least one core-test (INTEST-type) instruction. The rest are optional or user-defined.
| Instruction | Status | WSI→WSO register | Wrapper behavior | Used for |
|---|---|---|---|---|
| WS_BYPASS | Mandatory | WBY | Cells transparent; core runs functionally. Default after WRSTN. | Normal mode, short path through untested cores |
| WS_EXTEST | Mandatory | WBR | Output cells drive outward from the WBR; input cells capture from outside. Core isolated. | Glue logic and interconnect between cores |
| Wx_INTEST (one required) | Mandatory (at least one) | depends | Input cells drive the core; output cells capture from it | Testing the core itself |
| WS_INTEST_SCAN | Optional form | WBR + core chains, concatenated | All serial through WSI/WSO | Low-pin-count or debug scan of the core |
| WS_INTEST_RING | Optional form | WBR only | Core stimulated and observed through its boundary only | Cores without internal scan (or functional/BIST-style tests) |
| WP_INTEST | Optional form | Parallel: WPI/WPO | Core chains and WBR segments on the parallel port | Production scan: the one that carries real bandwidth |
| WP_EXTEST | Optional | Parallel | EXTEST via the parallel port | Faster external test |
| WS_PRELOAD / WP_PRELOAD | Optional | WBR | Load cell update stages while the wrapper stays functional | Preset outputs before switching to EXTEST |
| WS_CLAMP | Optional | WBY | Outputs held at WBR values while the short WBY path is selected | Keep a core's outputs fixed while testing neighbors |
| WS_SAFE | Optional | WBY | Cells force predefined safe values on outputs | Isolation: stop an untested or powered-down core from disturbing others |
Wrapper boundary cells
- Events a cell supports: shift (along the WBR), capture (from its functional input), update (copy the shift stage to a hold stage, if the cell has one), and apply (drive its functional output from the stored value).
- Dedicated vs shared: a dedicated cell is a new flop added on the port. A shared cell reuses an existing functional boundary flop. Shared saves area and a mux on the path, but its capture behavior is constrained in each mode. See core wrapping.
- With or without update stage: an update stage keeps outputs steady while the WBR shifts (needed if downstream logic must not see rippling values, e.g. when driving other cores' inputs). Without it, the cell is smaller but outputs ripple during shift.
- Safe values: cells used by WS_SAFE need a way to force a fixed output value independent of the shift data.
- Naming: the standard defines a naming scheme for cell types (names like
WC_SD1_CII) that encodes the storage elements and where capture and update happen. It's worth recognizing; you won't be asked to decode it.
Driving wrappers from a TAP or an IJTAG network
- From a TAP: the TAP state machine produces ShiftWR/CaptureWR/UpdateWR, TCK becomes WRCK, and a TAP instruction asserts SelectWIR. Wrappers are daisy-chained; untested cores sit in WS_BYPASS.
- From IJTAG: each wrapper's WIR (or just its mode bits) is a TDR behind a SIB. Only the wrappers you open are in the path. This is how most modern flows do it. Tessent's hierarchical flow, for example, uses 1500-style wrapper cells whose internal/external mode enables are TDR bits in the core's IJTAG network.
- Parallel port at chip level: WPI/WPO connect to chip scan pins or to a shared test bus, often through muxes or channel broadcast, so several cores can be scanned at once.
- CTL (IEEE 1450.6)
- Core Test Language, an extension of STIL. It describes the core's test modes, wrapper structure, scan chains and pattern references, so the integrator's tools can connect and retarget without reading the core's netlist.
- Compliance
- The standard distinguishes a wrapped compliant core (wrapper included, described in CTL) from an unwrapped compliant core (no wrapper yet, but with CTL so a compliant wrapper can be added later). You'll also hear "1500-ready" used informally for the second.
1149.1 vs 1500 vs 1687
| 1149.1 (JTAG) | 1500 (core wrapper) | 1687 (IJTAG) | |
|---|---|---|---|
| Scope | Chip pins, board test, chip access port | Boundary of an embedded core | Network of on-chip instruments |
| Control | TMS + 16-state FSM | Decoded signals (WSC), no FSM | Uses a host port (usually the TAP); SIB/ScanMux configure the path |
| Instruction register | IR | WIR | None of its own; configuration bits live in the network |
| Boundary register | BSR on pins | WBR on core ports | — |
| Bypass | BYPASS (1 bit) | WBY (1 bit) | Closed SIB (1 bit) |
| Description language | BSDL | CTL (1450.6) | ICL + PDL |
| High-bandwidth path | No | Yes: parallel port (WPI/WPO) | No (access network; scan data goes elsewhere) |
| Typical use today | Chip access, boundary scan, IDCODE | Wrapper architecture concepts, core isolation, hierarchical ATPG | Accessing MBIST, PLLs, sensors, wrapper/EDT/OCC setup |
Interview questions
Why doesn't a 1500 wrapper have a state machine like the TAP? core
Because cores are embedded, the chip already has a controller (TAP or IJTAG) that decodes the protocol. Giving the wrapper decoded control signals (ShiftWR, CaptureWR, UpdateWR, SelectWIR) means one controller can drive many wrappers in parallel over a broadcast bus, with less area per core and no risk of per-core FSMs getting out of sync.
Which instructions are mandatory? basic
WS_BYPASS, WS_EXTEST and at least one internal-test instruction (a Wx_INTEST form, such as WS_INTEST_SCAN, WS_INTEST_RING or WP_INTEST). Everything else (WS_SAFE, WS_CLAMP, PRELOAD, parallel variants, user instructions) is optional.
WS_SAFE vs WS_CLAMP? core
Both select the 1-bit WBY so the serial path stays short. WS_CLAMP holds the outputs at whatever was loaded into the WBR (you choose the values, like 1149.1 CLAMP). WS_SAFE drives predefined safe values built into the cells, for example to isolate a core that's powered down or untested so it can't disturb its neighbors.
What's WS_INTEST_RING for, if WP_INTEST exists? deep
It tests the core only through its boundary: input cells apply values, output cells capture. It's useful for cores without internal scan (small or legacy cores, or hard macros tested functionally), or for applying a BIST-style or functional pattern. WP_INTEST is the high-bandwidth scan path for cores with internal chains.
How would you connect 20 wrapped cores to one TAP? core
Broadcast the WSC from the TAP (WRCK = TCK, Shift/Capture/UpdateWR from the TAP states, SelectWIR from a TAP instruction, WRSTN from reset) and daisy-chain WSI/WSO between TDI and TDO. First load all WIRs in one long instruction scan: the core under test gets its INTEST/EXTEST instruction and the rest get WS_BYPASS (or WS_SAFE). Then the data scan passes through one WBR plus 19 bypass bits. For better scaling, put each wrapper behind a SIB in an IJTAG network. For scan data, route WPI/WPO to chip scan pins, with muxing or broadcast.
What does WRSTN do, and why does it matter at power-up? basic
It's the asynchronous active-low wrapper reset. It forces the WIR to its functional state (bypass, cells transparent). If the WIR powered up in a random test mode, a core's outputs could be driven from garbage WBR values in functional operation. So WRSTN must be asserted at reset and tied off correctly in the chip.
Why do 1500 and IJTAG coexist in the same chip? core
They solve different problems. 1500 defines the wrapper around a core (boundary cells, modes, isolation). 1687 defines how you reach and configure on-chip instruments. In practice the wrapper's mode control is often just TDR bits in the core's IJTAG network, and the scan data still moves through parallel scan/EDT channels. You can describe a 1500 wrapper in ICL and drive its WIR as an IJTAG register.
What's in the CTL for a core, and who uses it? deep
Test modes and how to enter them, wrapper and scan structure (which ports are scan in/out, chain lengths, clocks), signal constraints per mode, and references to the core's test patterns. The SoC integrator's DFT tools use it to connect the core's test ports, check compatibility and retarget the core-level patterns to chip pins without the core's full netlist.
Further reading: Tsiatouhas, IEEE 1500 SECT lecture notes · Arm, IEEE 1500 compliant wrapper boundary register cell · Marinissen et al., Overview of the IEEE P1500 standard · Da Silva, McLaurin, Waayers, The Core Test Wrapper Handbook
Fault models and ATPG
What defects we model, how ATPG finds a pattern for each fault, how faults are classified, and how coverage is computed and debugged.
60-second answer
A fault model is an abstraction of physical defects that ATPG can target. Stuck-at covers static shorts and opens; transition faults cover gross delay defects with a launch-capture pair at speed; path delay and timing-aware ATPG go after small delays on long paths; bridging and cell-aware models target specific layout or intra-cell defects. For each fault, ATPG excites it (sets the site opposite the stuck value), propagates the difference to an observable scan cell or PO through non-controlling side inputs, and justifies all required values back to scan cells and PIs. Fault simulation then drops every other fault the pattern detects, and dynamic compaction packs more faults into each pattern. Test coverage is detected over testable faults, with untestable faults excluded. The ATPG-untestable faults are the ones you debug: they point to constraints, black boxes, clocking and X.
Fault models
| Model | Targets | Test | Notes |
|---|---|---|---|
| Stuck-at (SA0/SA1) | Static shorts to rail, opens | One pattern, slow capture | 2 faults per pin; baseline, ≥99% TC typical target |
| Transition (STR/STF) | Gross delay at a node | Two patterns: V1 init, V2 launch; capture one period later | LOC/LOS; ~90–95%+ TC typical; lower than SA because of clocking/exception limits |
| Path delay | Cumulative delay on a specific path | Two patterns sensitizing the whole path | Robust vs non-robust sensitization; used on critical paths from STA |
| Small delay defect (timing-aware) | Small extra delays | Transition patterns through longest paths (low slack) | Uses SDF/slack; more patterns |
| Bridging | Shorts between neighboring nets | Drive nets to opposite values, observe victim | Net pairs extracted from layout |
| Cell-aware | Defects inside standard cells | Cell-specific input combinations (static and delay) | From transistor-level defect simulation of each library cell; catches what SA misses |
| IDDQ | Leakage-causing defects (bridges) | Measure quiescent current | Less effective at advanced nodes (high background leakage) |
Fault collapsing
An n-input AND has 2n+2 stuck-at faults on its pins. Any input SA0 is equivalent to output SA0 (same tests detect them), so they collapse to n+2 classes. Dominance: output SA1 of an AND is detected by any test for an input SA1, so it can be dropped when targeting. Checkpoint theorem: tests for stuck-at faults on PIs and fanout branches detect all single stuck-at faults in a fanout-free structure. Tools report both collapsed and uncollapsed counts; know which one a coverage number uses.
ATPG algorithms
- D-algorithm (Roth)
- 5-valued algebra (0, 1, X, D, D̄). Propagates the D-frontier forward, justifies the J-frontier backward; decisions on internal nodes.
- PODEM (Goel)
- Decides only on primary inputs (and scan cells), backtraces objectives to an input, then simulates. Smaller search space and far fewer backtracks than D-alg.
- FAN
- PODEM plus decisions at headlines and fanout stems, multiple backtrace. Modern tools add learning (static and dynamic implications) and SAT solvers for hard faults.
- Backtrack limit
- Give up on a fault after N backtracks: it's aborted. Raise the limit or add effort in a second pass to resolve aborts.
- Fault simulation
- After each pattern, simulate all remaining faults (bit-parallel or concurrent) and drop the ones detected fortuitously. Most faults are detected this way, not by being targeted.
- Compaction
- Dynamic: after generating a test for one fault, fill remaining don't-cares to detect more targeted faults in the same pattern. Static: afterward, merge compatible patterns and drop redundant ones (reverse-order fault sim).
- N-detect
- Detect each fault N times through different patterns; improves unmodeled defect coverage at the cost of more patterns.
Transition faults
Why transition coverage is lower than stuck-at: a pattern needs a legal launch (LOC can only launch transitions the logic produces from V1), both launch and capture domains must be pulsed with a known relationship, paths through false/multicycle exceptions must be masked, and non-scan or X sources hit twice. Two-cycle sequential depth also makes ATPG harder. Typical numbers: SA ~99%, TDF ~90–97% depending on design and clocking.
Fault classes and coverage
fault coverage = (DT + c·PT) / total
c = possible-detect credit (commonly 50%)
ATPG effectiveness = (DT + UT + AU + PU + c·PT) / total (how many faults ATPG resolved)
Test coverage is what you sign off. It's the fraction of faults that can be tested that are tested. Fault coverage penalizes redundant/tied logic you can't do anything about. Always state which one, collapsed or not, and at which level of hierarchy.
Coverage debug: from AU to action
| Cause | Symptom | Fix |
|---|---|---|
| Pin constraints / test-mode ties | Logic controlled by a constrained pin is blocked | Relax constraints; test the logic in another mode |
| Black boxes / RAMs | Shadow logic AU (inputs unobserved, outputs X) | Bypass, observe points, RAM sequential ATPG, or model |
| Non-scan cells | X at capture, uncontrollable state | Scan them, initialize them, or add test points |
| Clock restrictions | Faults between domains not pulsed together | Allow multi-domain capture where synchronous; add capture procedures |
| Timing exceptions (at-speed) | Endpoints of false/MCP masked | Expected; verify exceptions are correct and not too broad |
| X sources + compression | Faults observable only through heavily masked chains | Remove X at source; more masking granularity; X-bounding TPs |
| Aborted (UD) | Hard faults | Higher backtrack limit, second pass with more effort |
report_statistics for the class breakdown, report_faults -class AU (and sub-classes) to list, analyze_fault on a sample to see why it's untestable, and grouping AU by instance to find the one block costing you 0.5%.Interview questions
Test coverage is 98.2%. How would you find the missing 1.8%? core
Break down the non-detected faults by class (AU, UD, PT/PU) and then by hierarchy/instance. Usually a few blocks dominate. For each: check pin constraints and test-mode ties, black boxes and memories, non-scan flops, clock-domain capture restrictions, and X masking. Run fault analysis on samples to get the actual blocking reason. Separate "fixable in ATPG setup" from "needs design change" (test points, bypass logic) from "expected" (redundant).
Why is PODEM more efficient than the D-algorithm? core
PODEM only makes decisions on primary inputs/scan cells, so every decision is followed by simulation that gives consistent values; there are no internal-node inconsistencies to discover late. The search space is 2#inputs rather than over all internal nodes, and backtracking is simpler.
What's a redundant fault? Give an example. core
A fault that no input combination can detect because the faulty and good circuits are logically equivalent. Example: z = a·b + ā·c + b·c. The b·c term is the consensus term: whenever b·c = 1, either a·b or ā·c is already 1. So the output of the b·c AND stuck-at-0 never changes z and can't be detected. Consensus terms like this are often added on purpose to avoid hazards. RE faults are excluded from test coverage; the logic could be removed.
Why do you need both stuck-at and transition patterns if transition patterns also detect stuck-at faults? core
Transition patterns do detect many stuck-at faults, and many flows fault-simulate transition patterns against stuck-at to top off. But stuck-at patterns are cheaper (single capture, fewer constraints), can use slow capture on logic that has no at-speed clocking, and reach faults blocked in at-speed mode (masked exception endpoints, domains not pulsed together). So: run transition first, fault-sim for SA credit, then top off with SA ATPG.
What is posdet (possibly detected)? basic
The good machine produces a known value at an observation point but the faulty machine produces X, so detection depends on what the X resolves to in silicon. Tools give partial credit (often 50%). Commonly caused by faults on clock or enable lines, or feeding X sources.
What is cell-aware test and why is it worth the extra patterns? deep
Each library cell is characterized at transistor level: inject opens/shorts in the layout, simulate, and record which input combinations (static and two-cycle) detect each defect. ATPG then targets those specific combinations. Stuck-at at cell pins doesn't guarantee these combinations are applied, so cell-aware catches intra-cell defects that escape; industry data shows measurable DPPM reduction. Cost: more patterns and library characterization effort.
Further reading: Fault classes, Mentor terminology · VLSI Space, test vs fault coverage · Wikipedia, fault coverage
Gate-level simulation and SDF
Simulating ATPG patterns on the real netlist, with and without back-annotated timing, to prove they'll pass on good silicon. Also the systematic way to debug a mismatch back to its root cause.
60-second answer
ATPG computes expected values with its own zero-delay model and its own understanding of the test setup. GLS checks that against a real simulator on the final netlist. Zero-delay GLS catches functional issues: wrong test-mode setup, IJTAG/OCC programming, clock muxing, X from uninitialized state, library model mismatches. SDF-annotated GLS adds the real delays and timing checks at each corner (max/setup at slow, min/hold at fast) and catches shift hold races, SE timing, capture timing and glitches that STA constraints may have missed or mis-modeled. Parallel-load sim runs all patterns fast; serial sim runs a subset to prove the chains. To debug a mismatch I go from the first failing pattern and cycle, map it to the scan cell, trace back in the waveform to the first X or wrong value, and then decide whether it's timing, setup or a model issue.
What GLS catches that ATPG and STA don't
- Test setup: IJTAG/TDR programming, test-mode entry sequence, PLL lock time, OCC configuration. ATPG often assumes these (via test procedures); simulation proves them.
- Constraint gaps: a path STA didn't time in the right mode (missing case analysis, over-broad false path), or a clock mux STA assumed static.
- X and initialization: non-reset flops, memories, analog models that go X in simulation.
- Library issues: Verilog model vs Liberty vs ATPG library disagreeing (e.g. scan cell pin function, ICG behavior).
- Glitches on clocks or async resets from muxing or gating in test mode.
SDF annotation
// SDF excerpt
(CELL (CELLTYPE "SDFFRQX1") (INSTANCE u_core/r_state_reg_3_)
(DELAY (ABSOLUTE
(IOPATH (posedge CK) Q (0.061:0.078:0.102) (0.058:0.074:0.097))))
(TIMINGCHECK
(SETUPHOLD (posedge D) (posedge CK) (0.031:0.040:0.055) (-0.012:-0.008:-0.004))
(SETUPHOLD (posedge SE) (posedge CK) (0.045:0.058:0.079) (-0.010:-0.006:-0.002))
(RECREM (posedge RN) (posedge CK) (0.020::0.035) (0.015::0.028))))
(CELL (CELLTYPE "top") (INSTANCE)
(DELAY (ABSOLUTE (INTERCONNECT u_a/Q u_b/SI (0.004:0.006:0.009)))))
// testbench
initial $sdf_annotate("top_ffg.sdf", dut, , "sdf.log", "MINIMUM");
- Triples
(min:typ:max). Pick one with the annotate call or simulator switch. Use the SDF written for the corner you care about: max delays from a slow corner for setup-type checks, min delays from a fast corner for hold.- IOPATH / INTERCONNECT
- Cell arc delays and net delays. They fill the
specifypath delays in the cell models. - TIMINGCHECK
- SETUP, HOLD, SETUPHOLD, RECOVERY, REMOVAL, RECREM, WIDTH, PERIOD. They fill
$setuphold,$recrem,$widthetc. - Negative checks
- Negative setup or hold values (common in modern libraries, as above) need the simulator to create delayed internal copies of the signals. Enable negative timing check support (e.g. VCS
+neg_tchk; check your simulator's equivalent) or the checks get clamped to 0 and you see false violations. - Annotation log
- Read it every time. Instance-name mismatches (escaped names, hierarchy separators, a netlist that doesn't match the SDF) leave cells unannotated and silently fast.
Timing checks, notifiers and X
- Legitimate violations: synchronizer first stages and async CDC flops violate by design. Disable checks on those instances with the simulator's timing-check control file, not globally.
- +notimingcheck disables all checks: fine for zero-delay functional runs, wrong for timing sign-off runs.
- X-pessimism: gate-level X propagation can be pessimistic (reconvergent X), or optimistic in RTL-style models. If a mismatch is X in simulation but ATPG expected a value, check whether the X is real (uninitialized) or a model artifact.
Serial vs parallel-load simulation
write_patterns tb_par.v -verilog -parallel and ... -serial (typically with -begin/-end to limit the serial set). The parallel testbench forces scan cell states through hierarchical references, so it's sensitive to netlist naming; rebuild it for each netlist version.Parallel load bypasses the shift path. Chain problems (broken stitching, lockup latches missing, shift hold races) are invisible until you run serial patterns. Always run the chain test pattern set serially with SDF at the fast corner.
A repeatable mismatch debug method
- Classify: how many patterns fail, which chains/cells, is it every pattern from pattern 0, from pattern N, or scattered? Pattern 0 (or chain test) failing = setup or chain problem. All cells on one chain = shift path. Scattered cells in capture = timing or logic.
- Zero-delay first: does it fail without SDF? If yes, it's functional (setup sequence, model, X), not timing.
- Map the mismatch: pattern + cycle + scan-out pin → chain + cell → instance. (Parallel testbenches usually print the instance directly.)
- Go to the capture of that pattern: dump waves around the capture window, look at the failing cell's D at the capture edge, and compare to ATPG's expected (Tessent can report simulated values per pattern for comparison).
- Trace back the cone to the first node that differs from ATPG's value or goes X. Check its clock: right number of pulses? Glitch? Check timing check messages at that time.
- Decide: real timing violation (STA gap → fix constraints/design), setup/procedure mismatch (fix test procedure or ATPG setup), model mismatch (fix library), or known issue (mask).
| Symptom | Likely cause |
|---|---|
| Chain test fails serially, one bit short | Shift hold race at a domain crossing; missing/wrong lockup latch |
| Chain test output all X | Test mode not entered (IJTAG setup), SE/clock not reaching, reset X |
| Zero-delay passes, SDF min fails in capture | Hold violation in capture path, often across clock domains or on test-mode muxed clocks |
| At-speed patterns fail, stuck-at pass | OCC not programmed as ATPG assumed, false/MCP not masked, setup at max corner |
| First pattern after setup fails only | Initialization sequence, PLL lock wait too short, state left from test setup |
| Many random cells mismatch with X | X source spreading: memory, non-scan flop, black box, uninitialized TDR |
Interview questions
If STA is clean, why run SDF GLS on scan patterns at all? core
STA is only as good as its constraints and modes. GLS checks the actual pattern sequence: test-mode setup, clock muxing and OCC pulses, SE transitions, async resets in test, and paths STA was told to ignore. It also validates the testbench and pattern formatting before tester time. It's a cross-check on the constraints, not a replacement for STA.
Parallel sim passes, serial sim fails at the first pattern. Where do you look? core
The shift path, since parallel skips it. Run the chain test serially, find the first cell where the 0011 pattern breaks, and check that transition in waves: clock arrival at both cells (skew), a lockup latch at domain crossings, Q→SI hold timing, SE value during shift, and any reset activity during shift.
Which SDF corner for which check? basic
Hold-type problems show at fast process/high voltage/low or high temperature (min delays): run min SDF from the fast corner. Setup-type at slow corner (max delays). For scan, shift is slow so hold dominates: the fast-corner run with chain patterns is the most valuable. At-speed capture needs the slow corner for setup at functional frequency.
What is a notifier and why does it matter? basic
A reg passed to a timing check system task. When the check fails, the simulator toggles the notifier; the cell's UDP treats a notifier change as "output becomes X". That's how timing violations become visible functionally in GLS.
A handful of patterns mismatch at one flop only at the slow corner at-speed. Walk me through it. deep
Likely a real setup path at functional frequency. Get the launch and capture flops and the path from the waveform, compare against STA at the same corner in at-speed capture mode. If STA shows it failing, it's a design/timing closure issue. If STA says it passes, check whether it's a mode issue (STA ran functional mode but the test-mode clock path differs), whether it's a declared multicycle/false path that ATPG should have masked (exceptions not imported to ATPG), or an SDF/annotation mismatch.
Post-silicon scan debug
Bringing scan up on first silicon, reading chain-test signatures, localizing chain and logic failures, and reading voltage/frequency behavior. This is the part where your day-to-day bring-up experience is the answer.
60-second answer
Climb in order: power/clocks/reset, TAP IDCODE, IJTAG read-back, chain integrity in bypass, then through compression, then stuck-at, then at-speed, then corners. A chain test tells you the fault type from its signature: constant means stuck, shortened runs mean slow-to-rise or slow-to-fall, a one-cycle-early stream means a hold race. Chain diagnosis finds the location using capture patterns, because cells downstream of the defect unload correctly and cells upstream don't. For logic fails, the tester fail log maps to pattern/chain/cell, and diagnosis produces ranked suspects for physical failure analysis. Shmoo shapes separate speed problems (a diagonal wall) from frequency-independent problems (a flat floor), and that tells you whether to look at setup paths or at hold/min-V issues.
Bring-up order
- Before silicon: have the chain test, a small stuck-at set and IJTAG setup vectors simulated with SDF at fast and slow corners, in the exact tester format (STIL/WGL), including test-mode entry. Prepare bypass-mode patterns and per-chain patterns.
- Tester setup is a real failure source: timing sets (strobe too early), levels, pin mapping, pattern conversion. Loopback/golden-unit checks rule it out.
- Keep a "known-good" reference die once one passes: compare failing parts against it on the same tester and program.
Chain integrity test
Chain test = load a pattern with SE held at 1 the whole time (no capture), and compare what comes out. It tests the shift path, SE and the scan clocks. Run per chain (bypass mode) to isolate. Also run at different shift frequencies and voltages: a failure that disappears at slow shift is setup/IR-drop; one that persists at any frequency is hold/race or a hard defect.
Chain diagnosis: where is the break?
Consider a chain with a stuck-at-0 at cell k (counting from scan-in). Anything that must shift through cell k reads 0. Now use a capture pattern:
- Load (the values upstream of k are destroyed by the defect, so ATPG uses patterns whose care values don't depend on those cells, or accepts X for them).
- Pulse capture: every cell captures from logic, including cells downstream of k (between k and scan-out).
- Unload: cells downstream of k reach scan-out without passing through k, so their captured values come out correctly. Cells upstream of k all pass through k and come out 0.
The boundary between "matches expected" and "all 0" in the unload stream locates k. Diagnosis tools automate this with dedicated chain diagnosis patterns, handle intermittent and timing (hold/setup) chain faults, and report a ranked list of suspect cells. Hardware assists: chain test at different frequencies and voltages, reading cell values through alternate paths (e.g. other modes), and on the bench laser voltage probing / LVI to see the toggling stop.
Logic failures and diagnosis
- Fail log
- The tester records failing cycles (vector number + pin), usually limited by fail memory depth. Convert cycle → pattern → shift position → chain → cell using the pattern file and chain map. With compression, a fail is on a compactor output: use compression-aware diagnosis or rerun in bypass.
- Diagnosis
- Tool (e.g. Tessent Diagnosis) fault-simulates candidate faults and scores how well each explains the failing and passing patterns. Output: suspects (net/cell/pin, fault type like stuck, bridge, open, cell-internal) with scores.
- Layout-aware
- Adds physical info: bridges only between neighbors, opens on specific via/segments. Narrows the area for PFA.
- Volume diagnosis
- Diagnose many failing dies and look for systematic patterns (same cell type, same layer, same layout pattern). Feeds yield learning.
- PFA
- Physical failure analysis at the suspect: delayering, SEM/TEM. Expensive, so diagnosis resolution matters.
Shmoo and voltage corners
- Vmin / LVCC: the lowest voltage that passes at a given frequency. Read it on the wall of the speed-limited plot.
- HVCC: high-voltage stress and screening; also where hold races can get worse (fast data vs clock skew) and where leakage-sensitive defects appear.
- Frequency independence is the key diagnostic: slowing the clock fixes setup problems but not hold problems.
- Temperature: with temperature inversion at advanced nodes, low temperature can be the slow corner at low voltage. Check both hot and cold.
- Guardband: production test limits sit inside the characterized pass region (voltage and frequency margin) to cover tester accuracy, aging and variation.
Triage table
| Observation | Suspect first |
|---|---|
| All chains fail, all dies | Test-mode entry, IJTAG setup, SE or scan clock at top, pad direction, tester timing/pin map |
| All chains fail, some dies | Global defect (power, clock), or marginal setup (PLL lock, reset) |
| A group of chains fails | Shared resource: clock branch, power domain, SE buffer tree, one EDT block |
| One chain, one die | Local defect → chain diagnosis |
| One chain, many dies, same cell | Systematic: hold race at a crossing, missing lockup latch, marginal cell |
| Bypass passes, EDT fails | Decompressor/compactor, channel mapping, mask logic, EDT clock, setup bits |
| Chain passes slow, fails fast shift | Shift setup or shift IR-drop; lower fshift or stagger |
| Stuck-at passes, at-speed fails | OCC setup, capture IR-drop, real slow paths, exceptions not masked |
| Fails only at low V, any frequency | Hold/race, min-V cell weakness, level shifters, retention |
| Intermittent | Noise, marginal timing, tester contact; repeat and correlate with conditions |
Interview questions
First silicon: every chain returns all 1s. What do you do? core
All chains, same signature → something global. Check the tester first (TDO/scan-out strobe, pin map, levels) on a loopback or known pattern. Then JTAG: does IDCODE read? Then the test-mode setup: read back the IJTAG/TDR bits that set scan mode, EDT bypass and OCC. Constant 1 on every output also fits scan-out pads not enabled as outputs (floating/pulled up), SE stuck, or scan clock not reaching. Work down the bring-up ladder, don't jump to chain diagnosis.
The chain output is the expected stream shifted one bit early. Diagnosis? core
A hold/race failure: somewhere a bit passes through two cells in one shift cycle, so the chain acts one cell short. Classic causes: clock skew between domains without a lockup latch, a missing/ineffective lockup latch, a negedge→posedge ordering error, or a very short Q→SI path with late capture clock. It won't go away at lower shift frequency. Try higher/lower voltage to see sensitivity, and locate it with chain diagnosis.
How does the tester fail log get mapped to a flop? basic
The tester reports failing vector (cycle) numbers per pin. The pattern file tells you which pattern and which shift cycle that vector belongs to. The pin tells you the scan-out (chain or compactor channel). Shift position + chain length gives the cell index: in unload the cell nearest scan-out comes out first. The chain map (from ATPG) gives the instance. With compression, the channel output combines several internal chains, so you need the compactor model or a bypass rerun.
At-speed yield is low but failures don't correlate to any single path. What could it be? deep
Capture IR-drop (too much switching at launch; check failing patterns' toggle activity), overtesting (non-functional paths or exceptions not masked, especially with LOS), OCC pulse width/duty problems at high frequency, or timing model/corner mismatch. Experiments: raise voltage (IR-drop and speed fails improve), use power-aware patterns, lower frequency by steps and see where fails disappear, compare against functional Fmax.
Why run chain test at more than one shift frequency? basic
To separate setup-type from hold-type chain failures. If it passes when slowed down, it's setup or shift IR-drop. If it fails at every frequency, it's a hold race or a hard defect (stuck/open).
Further reading: Advantest, An Introduction to Scan Test for Test Engineers, part 2 · Adolfsson, On Scan Chain Diagnosis for Intermittent Faults
Scan physical design, DFT timing and SDC
What DFT does to placement, routing, clock trees and timing closure, and how test modes are constrained. Round-2 material, but the basics (shift hold, modes, case analysis) come up in round 1 too.
60-second answer
Physically, DFT adds wiring that doesn't follow the functional dataflow. Scan chains get reordered after placement using the scan DEF. SE is a high-fanout net that needs its own tree, or pipelining for at-speed. Compression logic concentrates hundreds of chain ends, which causes local congestion. Test clock muxes and OCCs sit at the clock roots and affect CTS. For timing, test adds modes: shift (slow clock, SE=1, hold-critical), stuck-at capture (slow), at-speed capture (functional frequency, SE=0, exceptions matter) and JTAG/IJTAG on TCK. Each gets case analysis on test-mode and SE signals, its own clocks, and IO constraints on scan ports. The usual convergence problems are thousands of shift hold violations, SE timing, clock-mux-related paths, and missing or over-broad test-mode constraints.
Physical aspects
| Item | PD concern | Typical handling |
|---|---|---|
| Scan chains | Wirelength, congestion, hold | Scan DEF (SCANDEF) with stitching partitions and ordered segments; P&R reorders after placement and again after CTS (clock-aware) |
| Scan enable | Very high fanout; at-speed for LOS | Buffer tree, dead cycles / multicycle for LOC; pipelined SE flops per region for LOS |
| EDT decompressor/compactor | Hundreds of chain ends converge → local congestion | Place near the chains they serve; one EDT per partition; limit chains per EDT; pipeline channels |
| OCC / test clock mux | Sits at clock roots, affects insertion delay and skew between test and functional clocks | Place near PLL / clock root; balance through CTS; define clocks at OCC outputs |
| Wrapper cells | On every core port | Place near ports; shared cells avoid extra muxes on critical I/O |
| IJTAG/TAP network | Long, slow, spread over the die | Low frequency, but hold still matters; retiming stages on long hops |
| MBIST | Controllers and collars near memories | Collars at memory pins; controllers shared per cluster |
| Test points, lockup latches | Small cells on functional/scan paths | Avoid critical paths; keep lockup latch next to its launch cell |
Timing modes
| Mode | Clocks | Case analysis | What matters |
|---|---|---|---|
| Functional | PLL clocks | test_mode = 0 | Everything, as usual |
| Shift | Shift clock(s) at 10–100 MHz, through OCC slow path | test_mode = 1, SE = 1 | Hold on Q→SI (fast corner), SE is static, scan IO delays |
| Capture, stuck-at | Slow clock | test_mode = 1, SE = 0 | Mostly hold; setup trivially met |
| Capture, at-speed | PLL clocks via OCC fast path | test_mode = 1, SE = 0 | Setup at functional frequency, same exceptions as function (and ATPG must mask them), test-only clock mux paths |
| LOS (if used) | PLL via OCC | SE toggling | SE → all scan flops within one functional period |
| JTAG / IJTAG | TCK (e.g. 10–50 MHz) | per setup | TAP/TDR/SIB network setup and hold, TDI/TDO/TMS IO |
| MBIST | Functional clocks | MBIST enable | Memory interface paths at speed through collars |
SDC by mode
# ---- shift mode ------------------------------------------------
set_case_analysis 1 [get_ports test_mode]
set_case_analysis 1 [get_ports scan_en]
create_clock -name shift_clk -period 20 [get_ports shift_clk] ;# 50 MHz
set_input_delay -clock shift_clk 5 [get_ports scan_in*]
set_output_delay -clock shift_clk 5 [get_ports scan_out*]
set_false_path -from [get_ports scan_en] ;# static in this mode (it's a case value)
# ---- at-speed capture mode -------------------------------------
set_case_analysis 1 [get_ports test_mode]
set_case_analysis 0 [get_ports scan_en]
create_clock -name pll_clk -period 1.0 [get_pins u_pll/CLKOUT]
create_generated_clock -name occ_core_clk -source [get_pins u_pll/CLKOUT] \
-divide_by 1 [get_pins u_occ_core/clk_out]
# reuse functional exceptions (false paths, multicycles) for this domain
set_multicycle_path 2 -setup -from [get_clocks occ_core_clk] -to [get_clocks occ_core_clk] -through [get_pins u_div/*]
# SE is quasi-static in LOC: it changes only outside the capture window
set_false_path -from [get_ports scan_en]
# ---- JTAG ------------------------------------------------------
create_clock -name tck -period 50 [get_ports tck]
set_input_delay -clock tck 10 [get_ports {tms tdi}]
set_output_delay -clock tck 10 -clock_fall [get_ports tdo] ;# TDO launched on falling TCK
set_clock_groups -asynchronous -group tck -group [get_clocks pll_clk]
set_false_path -from scan_en is fine in shift and LOC because SE is a case value or quasi-static there. It's wrong for LOS, where SE must be timed at speed to every scan flop. Also check that constraints don't false-path test-only paths that actually toggle in the capture window, such as OCC control flops or clock-chain bits.- Mode merging
- MMMC setups often merge compatible modes to cut run time: at-speed capture is close to functional mode, but shift must stay separate (SE=1 case changes which paths exist, and clocks differ). If you merge, use
set_clock_groups -physically_exclusiveor-logically_exclusivefor clocks sharing a net. - Case analysis correctness
- One wrong
set_case_analysiscan hide a whole class of paths. Review test-mode case values against the actual DFT setup (IJTAG TDR values, OCC settings) that ATPG and GLS use. - Handoff
- Timing exceptions from SDC should feed ATPG (so it masks false/MCP endpoints at speed) and ATPG's clocking assumptions should match STA's test modes. Mismatches here are what cause "passes STA, fails tester at speed".
DFT timing convergence: the usual problems
- Shift hold: thousands of small violations after CTS. Reorder clock-aware, fix with hold buffers at SI pins, and review large-skew crossings for lockup latches.
- Test clock mux / OCC paths: glitch-free mux internal timing, clock-chain flop timing, and paths between slow and fast clocks inside OCC need proper exceptions, not blanket false paths.
- SE: transition/fanout violations on the SE tree; for LOS, real setup/hold at speed.
- Scan IO: scan-in/out through pads at shift frequency, with pad delays at corners.
- Test-mode-only paths: bypass muxes (memory bypass, clock bypass), test points, wrapper cells. These exist only in test and are easy to leave unconstrained.
- Signoff coverage: make sure every test mode is in the signoff MMMC matrix at every corner where it's hold/setup critical.
Interview questions
Why do shift paths have so many hold violations and so few setup violations? basic
Shift runs slowly, so setup has a huge margin. But Q→SI paths are very short (neighboring cells, no logic), so hold slack is roughly clock-to-Q + wire minus skew minus hold time. Any skew toward a late capture clock makes it negative, and there are as many such paths as scan cells.
What is a scan DEF and what goes in it? core
A DEF SCANCHAINS section written by the DFT tool that describes each chain as start/stop points and a set of reorderable cells, grouped into partitions, plus ORDERED segments that must stay fixed (e.g. a cell and its lockup latch, wrapper chains, cells with fixed order requirements). P&R reorders within these constraints and can swap cells between chains in the same partition. The DFT tool then needs the updated chain order back for ATPG.
How would you constrain scan_en for LOC vs LOS? core
LOC: SE changes only outside the capture window with dead cycles, so it can be treated as quasi-static: case analysis per mode, or false/multicycle from the SE port. LOS: SE must reach every scan flop between launch and capture, so it's timed as a real at-speed signal from its launch flop (a pipelined SE flop per region) with the functional clock period.
After P&R, ATPG patterns fail simulation although nothing changed in DFT. What happened? core
Likely scan reordering: chain order and possibly chain membership changed, and ATPG is still using the pre-reorder chain definitions. Re-extract the chains from the final netlist (or read back the updated scan DEF), rerun DRC/ATPG, regenerate patterns. Also hold fixing may have inserted buffers, but that doesn't change order.
Which test modes do you sign off, and at which corners? deep
Shift: hold at all fast corners, setup at slow corner at the chosen shift frequency. Stuck-at capture: hold (fast corners). At-speed capture: setup at slow corners at functional frequency, and hold at fast. JTAG/IJTAG: setup and hold at TCK frequency. MBIST: functional frequency. Plus IO timing for scan ports at the tester's timing. Mention the power/IR-drop aware analysis for at-speed capture if the team does it.
EDT deep dive: signals, interface and behavior
What the EDT block looks like from the outside, what each control signal does cycle by cycle, how a compressed pattern is actually applied, and what breaks when any of it is wrong. Tessent names are used because they're the common vocabulary; the concepts carry over to other compression schemes.
60-second answer: "walk me through the EDT interface"
From outside, EDT is a block between a few scan channels and many short internal chains. Its inputs are the channel inputs, edt_clock, edt_update, edt_bypass and scan enable (plus an optional configuration select). Its outputs are the channel outputs. Inside there's a decompressor (a ring generator plus a phase shifter), the internal chains with lockup cells where clocks can skew, and on the output side mask logic and an XOR compactor. Every pattern starts with one EDT clock pulse while edt_update is high: that resets the ring generator and moves the mask bits that were shifted in with the previous pattern into the mask hold register. Then a few initialization cycles fill the ring generator, and the shift cycles load the new pattern while the previous response unloads through the masked compactor. In capture the EDT clock is held off so the EDT state isn't disturbed. edt_bypass turns the whole thing into plain concatenated chains for debug.
The interface
edt_clock, a separate clock that pulses together with the scan shift clock and stays off in capture. edt_update is sampled on the one EDT clock pulse before each load: it resets the ring generator and copies the mask shift register into the mask hold register. edt_bypass switches the muxes that concatenate internal chains straight onto the channels. Lockup cells sit wherever the EDT clock and the chain clocks can be skewed.| Signal | Driven by | When it's active | What it does | If it's wrong |
|---|---|---|---|---|
edt_channels_in[n] | Scan-in pins (via pads, pipelines, or an SSN host) | Every shift cycle | Compressed stimulus into the ring generator | Swapped or shifted channels: every compressed pattern fails, bypass may pass |
edt_channels_out[n] | Compactor → scan-out pins | Every shift cycle | Compacted responses | Pipeline count mismatch: fails shifted by N cycles |
edt_clock | Its own pin, or a clock derived with the shift clock (OCC / SSH in hierarchical flows) | Pulses with the shift clock; off in capture | Clocks the decompressor, mask registers, pipeline flops | Pulsing in capture corrupts EDT state; not pulsing on update means no reset |
edt_update | Pin or control logic | High for the one EDT clock pulse before each load | Resets the ring generator; mask shift reg → mask hold reg | Stuck low: decompressor never re-seeded, patterns fail from the second one on |
edt_bypass | Pin or IJTAG/TDR bit (static per pattern set) | Whole pattern set | Selects bypass: internal chains concatenated onto channels | Wrong value vs. pattern set: everything fails |
scan_en | Pin, pipeline, or SSH | High in shift, low in capture | Scan cells' SE; often also qualifies mask/compactor behavior | See the test-mode timing page |
| Configuration select (optional) | Pin or TDR bit | Whole pattern set | Chooses between compression configurations (e.g. high and low compression), if the block was built with more than one | Patterns generated for the other configuration |
edt_clock, edt_update and scan enable locally. The behavior is the same; only who drives the signals changes. Say that explicitly: it shows you know the signals are logical roles, not pins.A compressed pattern, cycle by cycle
edt_update=1 resets the ring generator and moves the previous mask into the mask hold register; the chain clocks stay off in that cycle. Next come the initialization cycles: the ring generator fills up (⌈decompressor size / channels⌉ cycles). Then L shift cycles load pattern k while pattern k−1's response unloads through the compactor, masked by the mask hold register. For capture, SE falls, the EDT clock stays off, and the capture clock fires. Gaps elide most of the L shift cycles.- Update cycle. SE is high,
edt_updateis high, oneedt_clockpulse, chain clocks off. The ring generator resets to a known state and the mask bits collected during the previous load move into the mask hold register. - Initialization cycles. ⌈decompressor size ÷ channels⌉ cycles of channel data fill the ring generator before its outputs mean anything (e.g. a 64-bit ring with 8 channels → 8 cycles). The chains shift during these cycles too; the data that enters them falls off the far end by the time the load finishes.
- Shift cycles. L cycles, L = the longest internal chain. The EDT clock and the chain clocks pulse together. Each cycle, the decompressor turns n channel bits into one bit per internal chain; the compactor XORs the masked chain outputs into n channel outputs.
- Capture. SE falls, the EDT clock stays off, one or more capture pulses (OCC). EDT state is preserved.
- Repeat. The next update pulse starts pattern k+1, whose shift cycles also unload pattern k's response.
test cycles ≈ Npat × (1 update + init + L + capture cycles)
How ATPG uses this: each care bit in the chains is a linear (XOR) combination of channel bits injected so far. ATPG builds those equations for the care bits of a pattern and solves them; if they can't all be satisfied, some target faults move to another pattern. That's why dense patterns and high compression ratios cost pattern count.
Masking
- Why mask: an X in any chain feeding a compactor XOR makes that output X for that cycle, hiding every other chain on it. Masking forces the X chain's output to 0 for the pattern.
- How: mask bits are part of the compressed data. They're shifted into the mask shift register during the load, transferred to the mask hold register by the next update pulse, decoded (typically one chain, a group, or none masked), and applied at the compactor inputs during the next unload.
- Cost: a masked chain is unobservable for that whole pattern, so heavy masking means more patterns and coverage loss. Fix X at the source when you can.
- Debug use: "one-hot" masking (observe one chain at a time) turns the compactor into a transparent path for one chain. Useful for diagnosis without going to bypass.
Clocking and timing inside EDT
- Two clock domains that must behave as one in shift: the EDT clock (decompressor, masks, pipelines) and the chain clocks. They're pulsed together, but they reach flops through different trees. Where the EDT logic hands off to a chain, or a chain hands off to the compactor, lockup cells absorb the skew, exactly like domain crossings inside a chain.
- EDT logic is shift-mode logic: timed at shift frequency with SE=1 case analysis. Hold dominates, like chains. The decompressor and compactor have real XOR depth, so at high shift frequency setup can matter too.
- Channel pipelines: long routes between pins and EDT blocks get pipeline flops on both the input and output channels. They add latency; ATPG and the pattern files must know the count. Identical broadcast destinations need equal pipeline depth.
edt_updatetiming: it's quasi-static (it changes only between cycles with no conflicting clock), so it's usually constrained like SE: case analysis per mode, plus a check that it settles before the update pulse.- Capture: the EDT clock must be off. If the EDT clock is derived from a shared clock source, the gating must guarantee no pulse in the capture window.
Bypass and configurations
| Mode | What changes | Used for |
|---|---|---|
| Compressed (normal) | Channels → decompressor → internal chains → compactor → channels | Production patterns |
| Bypass | Muxes concatenate internal chains onto channels (with lockups); decompressor and compactor out of the path | Silicon bring-up, chain integrity, diagnosis, fallback if EDT logic is defective |
| Low-compression config (if built) | Fewer internal chains per channel or a different compactor setup | Better diagnosis resolution, pattern count at lower compression, debug |
| Low-power shift (if built) | Decompressor holds values for chains with no care bits | Shift power reduction |
What actually breaks, and how you'd see it
| Symptom | Likely cause | First check |
|---|---|---|
| Bypass chain test passes, every compressed pattern fails | EDT control: update/clock sequencing, channel mapping, configuration bits, pipeline count | Simulate one compressed pattern with waves on edt_clock/edt_update; compare the test procedure against the EDT spec |
| First compressed pattern passes, later ones fail | Ring generator not re-seeded (update not reaching), or mask transfer broken | edt_update path and its timing |
| Fails shifted by a fixed number of cycles | Pipeline stage count differs from what ATPG assumed | Pipeline count in the EDT/pattern setup vs. netlist |
| Fails only on chains next to EDT logic | Missing or wrong lockup between EDT and chain clocks (hold) | SDF GLS at the fast corner; STA shift-mode hold at the handoff |
| No fails but coverage lower than expected | Excess masking, X sources | ATPG X/mask statistics per chain |
| Diagnosis can't localize | Compactor mixes many chains per channel | Rerun in bypass or low-compression configuration |
Interview questions
What does edt_update do, and when is it asserted? core
It's sampled on one EDT clock pulse at the start of each load (in the load/unload procedure, before shifting). On that pulse the ring generator resets to a known state, and the mask shift register contents (the mask bits that came in with the previous pattern) are copied into the mask hold register, which then masks the unload of that previous pattern's response. It's low during shift and during capture.
Why is the EDT clock separate from the scan clock, and why must it be off in capture? core
The EDT logic has its own state (ring generator, mask registers, pipelines) that must advance exactly once per shift cycle and must not change during capture. A separate clock lets it be pulsed in lockstep with shift but gated off in capture, independent of whatever functional clocks capture uses. If it pulsed in capture, the ring generator and mask state would shift away from what ATPG computed.
What are initialization cycles and how many are there? core
After the reset on update, the ring generator needs channel data before its outputs carry useful, independent values. The tool adds about ⌈decompressor size ÷ number of channels⌉ extra shift cycles per load for this. They're part of every pattern's shift length, so a very wide decompressor with few channels costs noticeable test time.
Why is the mask applied one pattern later? core
Because the response of pattern k is unloaded while pattern k+1 is being loaded. The mask bits for k come in with k's load (into the mask shift register), the update pulse before load k+1 moves them into the hold register, and they gate the compactor inputs during that load, which is exactly when k's response is coming out.
Compressed patterns fail on silicon, bypass passes. Walk me through debug. deep
Bypass passing means chains, SE, shift clocks and scan pins work. So the problem is in what compression adds: the EDT control sequence (update pulse, EDT clock gating), channel pin mapping and pipeline stages, configuration bits, and the EDT logic itself. I'd simulate one compressed pattern at gate level with the exact tester procedure and look at edt_update/edt_clock around the load, check the channel order and pipeline count against what ATPG used, and check the configuration TDR values actually applied. On silicon, try the low-compression configuration or one-hot masking to see whether fails are channel-wide (control) or chain-specific (a real defect).
Where do lockup cells go in an EDT design? core
Wherever a shift path crosses from one clock to another with possible skew: between the decompressor (EDT clock) and the first cell of each internal chain, between the last cell and the compactor/pipeline flops, and in the bypass path where chains are concatenated. The tool inserts them automatically when it can see the clocks differ.
How does compression interact with X sources? basic
An X on any chain feeding an XOR in the compactor corrupts that output for that cycle, so it hides all the other chains on it. EDT uses per-pattern masking to block X chains, which costs observability. Many X sources means more masking, more patterns and lower effective compression, so X sources are fixed at the design level (initialize memories, bound black boxes, avoid non-scan flops).
How would you pick the number of channels and internal chains? core
Channels come from available pins (or SSN bandwidth). Internal chains set chain length: total cells ÷ chains. More chains per channel shortens shift but makes each pattern harder to encode and increases compactor fan-in, so pattern count rises and diagnosis gets harder; routing around the EDT block gets congested. I'd run the tool's compression analysis on a few ratios and pick the knee of test data volume vs. pattern count, then check routing.
Sources: EDT compressor and controller (mask registers, edt_update) · EDT decompressor (ring generator, phase shifter) · EDT user manual excerpts (EDT clock off in capture, initialization cycles, lockups, pipelines) · EDN, test compression
Test-mode timing: pins, scan enable and capture
The timing questions that come up once you've explained scan: how a scan bit gets from a GPIO pin into the first cell safely, why scan-out is a tester strobe problem, how you guarantee capture only happens after scan enable has settled everywhere, and which checks belong to which mode.
60-second answer: "how do you time scan from a GPIO pin?"
The reference isn't an on-chip flop, it's the tester. The tester drives scan-in at a known point in each cycle and pulses the scan clock at another point, usually mid-cycle. Data goes pad → test mux → first cell on a short path; the clock goes pad → OCC or clock mux → the whole clock tree. So at the first cell the clock arrives late relative to the data, and scan-in is mainly a hold check: the cell has to sample the current bit before the tester's next bit gets there. Scan-out is the other direction: the last cell launches on its late clock, the bit goes through a mux and an output pad, and it has to be stable at the tester's strobe, so that's a setup check against the strobe time. In STA you model the tester with a clock at the scan clock port plus input and output delays that match the tester's timing set. If a path doesn't close you add a retiming flop near the pad, add hold delay on the input, move the strobe, or slow shift down.
Scan-in from a pin
Put numbers on it. Tester period T, data driven at the start of the cycle, clock edge at the pin at T/2. The first cell sees data after tin and the clock after tclk:
hold: T/2 + tclk + thold < T + tin → margin = T/2 + tin − tclk − thold
- Insertion delay eats hold margin. Every ns of clock tree between the pin and the first cell comes straight out of the margin. Scan clocks through an OCC and a big tree can have several ns.
- Tester edge placement matters. The T/2 in the formula is the tester's choice. Moving the clock edge earlier relative to data drive (or driving data later) changes the margin. That's why test engineers and DFT agree on a timing set per pattern type.
- Slowing shift helps hold here, unlike on-chip hold, because the margin contains T/2. It's still the wrong first fix; fix the path.
- Fixes: hold buffers on the scan-in route (the setup side has lots of room), a retiming flop right after the pad clocked from a low-insertion point or on the opposite edge, or a pipeline stage between pad and EDT inputs, which ATPG then has to know about.
One way to write the SDC for this
# shift mode, T = 20 ns. Tester drives SI at 0, pulses scan_clk rising at 10. create_clock -name scan_clk -period 20 -waveform {10 15} [get_ports scan_clk] # virtual clock = the tester's drive/strobe reference create_clock -name ate -period 20 -waveform {0 10} set_input_delay -clock ate 1.0 [get_ports {scan_in*}] ;# tester + board skew set_output_delay -clock ate 3.0 [get_ports {scan_out*}] ;# strobe setup + board set_case_analysis 1 [get_ports scan_en] set_case_analysis 1 [get_ports test_mode] set_propagated_clock [all_clocks]
Tools differ and teams have their own templates. The point is that the input and output delays are relative to a clock that represents the tester, and the real scan clock is defined with its true waveform at the pin, so the tool computes the pin-to-cell relationship with the actual insertion delay.
Scan-out to the tester
strobe must land inside that window, with the tester's setup/hold around it
- It's a window, not a single number. Early strobes see the previous bit, late strobes see the next one. At slow shift the window is wide and centered wherever you like. As shift speeds up the window shrinks and moves relative to the tester edge.
- Fixes: strobe later or in the following cycle (the tester program then accounts for the one-cycle offset), a retiming flop or lockup latch near the output pad to hold the data longer, better pad drive, or lower shift frequency.
- Pipelines change the pattern, not just timing. Any retiming flop in the scan-in or scan-out path adds a cycle of latency. The pattern generation setup has to include it, otherwise every compare is shifted by one.
GPIO pad details that come up
| Item | Why it matters in test |
|---|---|
| Direction control | Scan pins are usually shared with functional GPIO. In test mode the pad's output enable is forced by test_mode so scan-in pads are inputs and scan-out pads are outputs regardless of functional logic. That forcing mux is on the path and in STA it's a case-analysis value. |
| Pad delay | IO pads with level shifters are slow compared to core logic (on the order of ns). Pad delay dominates tin and tout, and it varies a lot across corners. |
| Bidirectional turnaround | If a pad switches direction between phases (e.g. used as input in shift and output elsewhere), the switch needs its own time and must not happen while the tester drives it. |
| Output switching | Many scan-out pins toggling at once cause simultaneous switching noise on the IO supply. It's a reason to limit output count or stagger strobes. See the note on the SSN page. |
| Tester and board | Tester edge placement accuracy and board trace delay go into the input/output delay values. Test engineering usually provides them. |
Making sure capture happens after SE has settled
Scan enable is a very high-fanout net that has to change twice per pattern: fall before capture, rise before the next shift. Two conditions per transition:
- Falling edge, early side (hold): SE must not reach any cell before the last shift edge plus hold, or that cell captures functional data instead of its shift neighbor. Because SE is launched from the tester or a flop clocked by the same shift clock, this is an ordinary hold check.
- Falling edge, late side (setup): SE must reach the farthest cell and settle before the capture edge minus setup. In LOC there's plenty of time if the protocol adds dead cycles or if the OCC takes a few cycles to synchronize SE before it releases capture pulses. In LOS the launch happens on the last shift edge, so SE has only one at-speed period to fall everywhere.
- Rising edge: after capture, SE must reach every cell before the first shift edge of the next load. Usually easy at shift speed, but check it.
| Technique | What it buys |
|---|---|
| Dead cycles / extra tester cycles | Time for SE to settle before the OCC or tester releases capture. Costs a few cycles per pattern. |
| OCC synchronization | The OCC sees SE fall, synchronizes it into the fast clock domain, and only then generates the capture pulses. That delay is built-in settling time and guarantees ordering. |
| SE pipelining | Flops (clocked by the shift clock) re-drive SE per region, so each local tree is small. The pipeline adds cycles of latency that the test procedure accounts for. |
| STA treatment | For LOC, SE is not a single-cycle at-speed path: time it at shift frequency, or use a multicycle or case-analysis setup that matches the protocol. For LOS it has to be timed at speed, which is a main reason LOS is used less. |
Which checks belong to which mode
| Mode | Clocks | What dominates | Typical signoff corner |
|---|---|---|---|
| Shift | Slow scan clock, SE=1 by case analysis | Hold: chain neighbors, lockups across domains, scan-in from pins; setup at scan-out pins | Hold at fast corners; also check shift speed limit at slow corners |
| Capture (LOC, at-speed) | Functional clocks via OCC, SE=0 | Functional setup and hold, same as mission mode but only for the clock pairs pulsed together | Setup at slow corner, hold at fast |
| Capture (stuck-at, slow) | Slow clocks, SE=0 | Hold (setup relaxed) | Fast |
| SE transitions | Shift clock | Hold always; setup vs. protocol time | Both |
| JTAG / IJTAG | TCK | Its own domain; TDI/TMS sample on rising TCK, TDO changes on falling | Both, at TCK frequency |
| Static config | none | test_mode, TDR bits, EDT bypass: set by case analysis per mode; paths from them are usually false paths | n/a |
Interview questions
Why is scan-in from a pin usually a hold problem? core
The data path is short (pad, mux, a route) and the clock path is long (pad, OCC or mux, full clock tree). The tester drives the next bit a fixed time after its clock edge, so if the clock at the first cell is late by more than that time minus hold, the cell sees the next bit instead of the current one. Setup has most of a period of slack.
The scan-in hold check fails by 1 ns at the fast corner. What are your options? core
Add hold delay on the scan-in route (cheap, setup has room). Add a retiming flop close to the pad clocked from a low-insertion point, or a negative-edge retiming stage. Ask test engineering whether the timing set can drive data later relative to the clock. Check whether the input delay values are realistic. Slowing shift helps too, but that's a last resort because it costs test time.
How do you make sure capture only happens after SE has reached every flop? core
Protocol plus timing. The protocol gives SE time: dead cycles between the last shift and capture, and in OCC designs the controller synchronizes SE into the fast domain before it fires capture pulses. Timing then proves SE reaches the farthest cell within that time (at shift frequency or with a matching multicycle), and that it doesn't reach the nearest cells before the last shift edge plus hold. If the tree is too slow, pipeline SE per region.
Why is LOS harder on scan enable than LOC? core
In LOS the launch is the last shift edge and the capture follows one at-speed period later, so SE has to switch from 1 to 0 at every cell within that period. It becomes an at-speed signal with huge fanout. In LOC, SE falls during a slow gap before the launch pulse, so it has many ns to settle.
Scan-out at the tester fails only above 50 MHz shift. What's going on? core
The valid window at the pin (starting at clock pin → insertion → clk-to-Q → mux → output pad → board) slides relative to the tester strobe as the period shrinks, and at some point the strobe sees the old or the next bit. Check the output path delay vs. strobe placement. Fixes: strobe later or in the next cycle, a retiming stage near the pad, better pad drive, or keep shift at the lower frequency.
What happens to your patterns if you add a pipeline flop between the scan-in pad and the EDT channel? basic
Every bit arrives one shift cycle later. The pattern generation setup must declare the pipeline so the load data is shifted accordingly, and for outputs the expected data is shifted too. Forgetting it gives a pattern set where everything miscompares by one position.
How are static test signals like test_mode handled in STA? basic
Set by case analysis per mode, which removes the other mux leg from timing. Paths starting at those signals are usually false paths because they're set once before the test and held. SE is the exception people get wrong; it switches every pattern.
Which corner would you sign off shift timing at? core
Hold at the fast corners (fast process, high voltage; and check both temperature extremes because of temperature inversion at advanced nodes). Also check that the chosen shift frequency meets setup at the slow corner, which matters for scan-out and EDT logic with XOR depth.
SSN: Streaming Scan Network
SSN is how Tessent delivers scan data to many cores through a fixed-width, packetized bus instead of wiring each core's EDT channels to chip pins. Below: the problem it solves, how the bus and packets work, how it's configured, what it changes for timing and debug, and how to answer if "SSN" turns out to mean simultaneous switching noise.
60-second answer: "tell me about SSN"
In a hierarchical design each core has its own EDT with a certain number of channels. The classic way to test them at the top is to mux core channels onto chip scan pins, so you test a few cores at a time, you fix the channel allocation at design time, and when cores have different chain lengths the short ones sit padded. SSN replaces that with a bus of fixed width, sized by the pins you have, that runs through a Streaming Scan Host in every core. Data goes across the bus as packets: one packet holds all the bits every active core needs for one shift cycle. Each host knows its bit positions and shift count, which are programmed through IJTAG at pattern time, picks its bits out of the stream, and generates its core's scan enable, EDT controls and clock gating locally. So you can test any group of cores together without changing hardware, cores can shift independently and capture together, identical cores can get the same data with the comparison done on chip, and the bus width is independent of the cores' channel counts.
The problem it solves
- Pins don't scale with cores. A chip with dozens of cores, each with several EDT channels, can't bring every channel to a pin. Pin-muxed schemes test cores in groups, and the grouping is frozen in hardware.
- Padding waste. When cores tested together have different chain lengths or pattern counts, the shorter ones wait. The tester is busy but those cores aren't getting useful data.
- Late changes are expensive. If a core's pattern count grows late in the project, the best grouping changes, but the top-level muxing is already built.
- Scan enable and capture must be coordinated globally when many cores share pins, which makes top-level timing harder.
The bus and the hosts
Packets
- Packet size = sum of the channel bits every active host needs for one internal shift cycle. It's independent of bus width.
- No wasted bus bits. Packets don't need to align with bus cycles, so an odd total doesn't leave idle lanes.
- Independent shift. A core with a shorter chain can finish its load and wait, or be given fewer bits per packet; hosts manage their own shift and capture timing within the pattern.
- Shift rate per core ≈ bus bits per second ÷ packet size. Adding active cores makes packets bigger, so each core shifts slower, but the tester pins are always fully used.
SSN vs. pin-muxed channels
| Pin-muxed EDT channels | SSN | |
|---|---|---|
| Top-level wiring | Per-core channels routed to pin muxes | One bus through all hosts |
| Which cores test together | Fixed by hardware grouping | Chosen at pattern generation |
| Channels per core | Limited by pins at the top | Set by core needs; bus width set by pins |
| Different chain lengths | Padding | Bits sized per core, no padding |
| Scan enable, EDT controls | Top-level signals to every core | Generated in each host |
| Identical cores | Broadcast possible, outputs need pins or compaction | Broadcast plus on-chip compare, sticky status |
| Setup cost | Low: simple muxes | IJTAG configuration per pattern set, host area, more complex debug |
Published results from Siemens and users report large test time reductions (Siemens cites up to several times on some designs, and Intel has reported double-digit percentage cycle reductions). Quote numbers carefully in an interview and frame them as "published results", not guarantees.
Timing and debug implications
- The bus is a timing path like any other. Hop to hop between hosts at the bus frequency; long hops get pipeline stages. Identical cores that share broadcast data should see equal pipeline depth.
- Local scan enable. Because each host generates its own core's SE and EDT controls, the huge chip-wide SE tree goes away. The SE timing problem from the timing page becomes a per-core problem, clocked locally.
- Clock crossing at the host. The host bridges the bus clock and the core's shift clock. Treat it like any other domain crossing in shift mode: lockups or designed handshakes, and constraints from the tool's generated SDC.
- Debug path. Bring up the IJTAG network first, then the SSN bus in a simple configuration (one host active, known data), then each core's EDT in bypass through its host, then compressed patterns. Same ladder as always, one layer more.
- Diagnosis. Fails come back as bus positions and cycles; the tool maps them back to core, channel and pattern. With on-chip compare you get pass/fail per host, and you rerun the failing core in a streaming (not compare) setup for full fail data.
If they meant simultaneous switching noise
SSN is also the old abbreviation for simultaneous switching noise, and it's relevant to test. It's fine to ask "streaming scan network or switching noise?" and then answer. The short version:
- Core side: during shift, many flops toggle every cycle; during capture, a large fraction of the logic switches at once. That draws current spikes and causes IR drop and ground bounce, which slow paths (false at-speed fails) or corrupt shift. Mitigations: low-power fill (fill don't-care bits to reduce toggling), shift at lower frequency, Q-gating, staggered or partitioned capture clocks, capture power limits in ATPG. See the low-power scan page.
- IO side: many output pads switching together (scan-out pins, boundary scan EXTEST) cause bounce on the IO supply. Mitigations: limit simultaneous outputs, stagger, proper power/ground pad ratios.
Interview questions
Why would you use SSN instead of muxing core channels to pins? core
Because the core grouping and channel allocation become pattern-time decisions instead of hardware decisions, the bus width is set by pins independent of how many channels the cores have, cores with different chain lengths don't pad each other, SE and EDT controls are generated locally in each core, and identical cores can be tested in parallel with on-chip compare. It matters most with many cores and limited pins.
What is a packet in SSN? core
All the bits that every active core needs for one internal shift cycle. If core A has 5 channels and core B has 4, a packet is 9 bits. Packets stream across the bus regardless of bus width, so on an 8-bit bus the packet boundaries don't line up with bus cycles. Each host knows its offset in the packet and the packet size.
How is each host told what to do? core
Through IJTAG before the pattern set: the host's registers hold whether it's active, its position in the packet, the packet size and shift count, and related control. The pattern generation tool writes this setup as part of the test procedure.
How does SSN test identical cores efficiently? core
The same stimulus goes to all copies, with the expected response also sent on the bus. Each host compares its core's output locally and records a sticky pass/fail. So adding copies doesn't add bus bits. After the pattern set, the per-host status is read out. If a core fails, you rerun it alone to collect full fail data for diagnosis.
What does SSN change about scan enable timing? deep
The chip-level SE tree is gone. Each host generates SE for its core, timed in the core's shift domain, so the SE setup/hold problem shrinks to core size and is closed at core level. Cores can even be in capture while others are still shifting, as long as the tool schedules it that way.
SSN patterns fail on all cores, but IJTAG reads and writes work. Where do you look? deep
The bus itself: pin mapping of ssn_in/ssn_out, bus pipeline count vs. what the tool assumed, bus clock and any frequency conversion settings, and whether the host configuration actually applied (read back the host registers). Then run the simplest configuration: one host active, low bus rate. If that passes, add hosts until it breaks.
"SSN" in the sense of switching noise: why does it matter for test? basic
Test switches much more logic at once than functional mode: shift toggles many flops per cycle and capture can switch a large part of the design at once. The resulting IR drop and ground bounce slow paths and can cause fails that aren't real defects, or corrupt shift. You control it with low-toggle fill, lower shift frequency, partitioned capture and ATPG power constraints.
Sources: Siemens white paper, Tessent Streaming Scan Network · SemiEngineering, SSN: an efficient packetized data network · 2020 ITC paper (Siemens blog) · On-chip compare and diagnosis with SSN
Scripting drills
The scripts a DFT engineer actually writes: read a file line by line, pull out what you need with a regex, count or group it in a dictionary, print a clean report. No computer-science tricks needed. Each problem opens to plain-language steps, then a hint, pseudo-code and a short tested Python solution.
What the interviewer is actually looking for
- It works on the example. Correct output on the sample beats clever code.
- You understand the file. Say what a line looks like and what you're pulling out of it. This is where your hardware background is the advantage.
- It's readable. Clear names, one small function per job, a comment where the format is odd.
- You think about messy input. Comments, blank lines, a line that doesn't match, a name that appears twice. Mention them even if you only handle some.
- You talk while you write. A slightly wrong script you explained well scores better than a silent perfect one.
Nobody expects algorithm theory in a hardware scripting round. If they ask "how would this scale to a 5 GB netlist?", the answer is practical: read line by line instead of all at once, and don't redo the same work twice.
The Python you actually need
Almost every problem below uses only these pieces.
Read a file line by line
for line in open("run.log"):
line = line.strip() # remove spaces and the newline at the end
if not line or line.startswith("#"):
continue # skip blank lines and commentsLine numbers
for line_no, line in enumerate(open("run.log"), start=1):
...Split a line into words
parts = "chain1 u_core/a_reg_0_".split() # ['chain1', 'u_core/a_reg_0_']
chain, cell = partsRegex: find a pattern and pull out pieces
import re
m = re.search(r"pattern=(\d+)\s+chain=(\S+)", line)
if m:
pattern = int(m.group(1)) # first ( ) group
chain = m.group(2) # second ( ) group
# \d digit \w letter/digit/_ \S non-space \s space + one or more * zero or more . any charCount things with a dictionary
counts = {}
for word in ["C4", "S1", "C4"]:
counts[word] = counts.get(word, 0) + 1 # .get returns 0 the first time
# counts == {"C4": 2, "S1": 1}Group things: dictionary of lists
files_of = {}
files_of.setdefault("core", []).append("rtl/core.v") # creates the list the first timeSort a report
for name in sorted(counts): # by name
...
for name in sorted(counts, key=lambda k: counts[k], reverse=True): # biggest count first
...Compare two lists: sets
before = {"a", "b", "c"}
after = {"b", "c", "d"}
before - after # {'a'} removed
after - before # {'d'} added
before & after # {'b', 'c'} in bothWalk a folder tree
import os
for folder, subfolders, files in os.walk("rtl"):
for name in files:
if name.endswith(".v"):
path = os.path.join(folder, name)Nice printing
print(f"{name:12s} {count:4d} {slack:+.3f}") # padded name, 4-wide int, signed 3 decimalsCommand-line arguments
import sys
log_path = sys.argv[1] # python3 summary.py run.logA function that calls itself (recursion)
def read_flist(path, files):
for line in open(path):
if line.startswith("-f"):
read_flist(line.split()[1], files) # a nested list: handle it exactly the same way
else:
files.append(line.strip())
# Use it when the data nests inside itself: file lists that include file lists,
# modules that contain modules. Each call handles one level.File formats you'll be handed
Simulator file list (flist)
// top.f
+incdir+rtl/include // where `include files live
+define+SYNTH // a macro
rtl/top.v // a source file
rtl/core.v
-f rtl/sub/sub.f // another file list, read it too
-v $LIBDIR/cells.v // library file
rtl/top.v // duplicate: keep the first one
-f means "read this other list too". Lines starting with + or - are options, not files. Comments are // or # depending on the tool.
RTL vs post-synthesis netlist
module core #(parameter W = 8) ( // RTL: directions inside ( )
input clk,
input [W-1:0] a,
output [W-1:0] y
);
alu #(.W(W)) u_alu (.a(a), .y(y)); // instance: TYPE #(params) NAME ( ... );
always @(posedge clk) ... // behavior, no gates yet
endmodulemodule core_W8_0 ( clk, a, y, si, se ); // netlist: names only in ( )
input clk, si, se; // directions declared below
input [7:0] a;
output [7:0] y;
wire n12, n13;
alu_W8_1 u_alu ( .a(a), .y({n12, n13}) ); // child module, renamed by synthesis
SDFFRQX1 \y_reg[0] ( .D(n12), .SI(si), .SE(se), .CK(clk), .Q(y[0]) );
AOI22X1 U137 ( .A0(a[2]), .A1(n12), .B0(n13), .B1(y[0]), .Y(n14) );
endmodule| RTL | Netlist | |
|---|---|---|
| Port directions | Inside the ( ) header | Names in the header, input/output lines below |
| Contents | always, assign, expressions | Almost only instances of library cells |
| Names | Written by people | Tool-made: U137, n12, y_reg_3_, alu_W8_1 |
| One instance | Usually one line | Often several lines: split on ;, not on newlines |
| Escaped names | Rare | \y_reg[0] is one name: starts at \, ends at the next space |
;. Each piece is one statement, however many lines it took. Look at its first word to decide what it is (input, wire, assign, or a cell/module type).Warm-ups
P1Summarize errors and warnings in a tool log basic
Given a DFT tool log, print how many times each error/warning ID appears and the line where each first appears.
Input looks like
// Tessent-style log excerpt (made up)
Info: Reading netlist top.v
Warning: Clock 'clk_div' is gated by non-test logic. (C4)
Warning: Clock 'clk_aux' is gated by non-test logic. (C4)
Error: Scan cell u_core/r_reg_3_ has uncontrollable reset. (S1)
Warning: Clock 'clk_div' is gated by non-test logic. (C4)
Info: 12,480 scan cells found
Error: Scan cell u_core/q_reg_7_ has uncontrollable reset. (S1)
Warning: Non-scan cell u_pll/lock_q is an X source. (D5)Think it through
- Loop over the lines with line numbers.
- Keep only lines that start with
Error:orWarning:and end with an ID in parentheses. - Build a key like
Warning C4; add 1 to its count. - If it's the first time you see that key, remember the line number.
- Print sorted.
Hint
One regex does the matching and pulls out both pieces: (Error|Warning):.*\((\w+)\). Two dictionaries: one for counts, one for first line.
Pseudo-code
for each line (with its number):
if it looks like "Error: ... (ID)" or "Warning: ... (ID)":
key = kind + ID
counts[key] += 1
if key not seen before: first_line[key] = line number
print each key, its count and first linePython solution
import re
def log_summary(path):
"""Count errors and warnings by message ID, remember where each first appeared."""
counts = {} # "Warning C4" -> how many times
first_line = {} # "Warning C4" -> first line number where it appeared
for line_no, line in enumerate(open(path), start=1):
m = re.match(r"(Error|Warning):.*\((\w+)\)\s*$", line)
if not m:
continue
key = m.group(1) + " " + m.group(2) # e.g. "Warning C4"
counts[key] = counts.get(key, 0) + 1
if key not in first_line:
first_line[key] = line_no
for key in sorted(counts):
print(f"{key:12s} x{counts[key]:<3d} first at line {first_line[key]}")
return countsOutput on the sample:
Error S1 x2 first at line 5
Warning C4 x3 first at line 3
Warning D5 x1 first at line 9Follow-ups they might ask
- Also print the text of the first message for each ID (store the line, not just its number).
- Exit with a non-zero code if there's any error, so a regression script can stop (
sys.exit(1)). - Ignore a list of waived IDs read from a file.
P2Find every line that uses a signal basic
Search every .v/.sv file under a folder and print file:line: text for each line containing a given name, like a small grep.
Input looks like
rtl/
top.v
core.v
sub/alu.v
search word: DFFX1Think it through
- Walk the folder tree.
- For each Verilog file, loop over its lines with line numbers.
- If the word is in the line, print file, number and the line.
Hint
os.walk gives you every folder and its files. if word in line is enough; a regex is only needed for whole-word matching.
Pseudo-code
for each folder, files under root:
for each file ending in .v or .sv:
for each line (with number):
if word in line: print path:number: linePython solution
import os
def grep(root, word, exts=(".v", ".sv")):
"""Print file:line: text for every line that contains word, in all Verilog files under root."""
hits = 0
for folder, subfolders, files in os.walk(root):
for name in sorted(files):
if not name.endswith(exts):
continue
path = os.path.join(folder, name)
for line_no, line in enumerate(open(path), start=1):
if word in line:
print(f"{path}:{line_no}: {line.strip()}")
hits += 1
return hitsOutput on the sample:
rtl/core.v:3: DFFX1 r0 (.D(a[0]), .CK(clk), .Q(y[0]));
rtl/sub/alu.v:2: DFFX1 f0 (.D(a[0]));
rtl/sub/alu.v:3: DFFX1 f1 (.D(a[1]));Follow-ups they might ask
- Whole-word only, so
clkdoesn't matchclk_div:re.search(r"\b" + word + r"\b", line). - Skip comment lines.
- Only search files listed in an flist (combine with P3).
File lists and Verilog
P3Expand a file list (flist) core
Return the list of source files in an flist, including the files from any nested -f lists, without duplicates, in order.
Input looks like
// top.f
+incdir+rtl/include // where `include files live
+define+SYNTH // a macro
rtl/top.v // a source file
rtl/core.v
-f rtl/sub/sub.f // another file list, read it too
-v $LIBDIR/cells.v // library file
rtl/top.v // duplicate: keep the first oneThink it through
- Read the flist line by line; drop comments and blank lines.
- If the line is
-f other.f, read that file the same way and add its files to the same list. - If the line starts with
+or-, it's an option: skip it (or collect it separately). - Otherwise it's a file: add it unless it's already in the list.
Hint
The nested -f is the only tricky part. Write one function that reads one flist, and when it sees -f, it calls itself on the nested file. That's all "recursion" means here.
Pseudo-code
function read_flist(path, files):
for each line in path:
remove comments; skip if empty
if line starts with "-f": read_flist(nested path, files)
else if line starts with + or -: skip (option)
else if line not in files: add it
return filesPython solution
import os
def read_flist(path, files=None):
"""Return the list of source files in a file list, following nested -f files.
Paths are taken relative to where the script runs (the -f convention)."""
if files is None:
files = [] # first call: start an empty list
for line in open(path):
line = line.split("//")[0].split("#")[0].strip() # drop comments
if not line:
continue
parts = line.split()
if parts[0] == "-f": # nested file list: read it the same way
read_flist(parts[1], files) # <- the function calls itself
elif line.startswith("+") or line.startswith("-"):
continue # +incdir+, +define+, -v, -y ... skipped here
elif line not in files: # keep first occurrence only
files.append(line)
return filesOutput on the sample:
['rtl/top.v', 'rtl/core.v', 'rtl/sub/alu.v']Follow-ups they might ask
- Also collect
+incdir+directories and+define+macros into their own lists. - Replace
$VARwith the environment variable (os.path.expandvars). -F: paths inside the nested list are relative to that list's own folder (os.path.dirname+os.path.join).- Detect a list that includes itself (keep a list of flists you're currently reading).
P4Which file defines each module? basic
Given a set of Verilog files, list every module with the file(s) it's defined in, and flag modules defined more than once.
Input looks like
rtl/top.v: module top ( ... ); ... endmodule
rtl/core.v: module core ( ... ); ... endmodule
rtl/core_old.v: module core ( ... ); ... endmodule <- duplicateThink it through
- Read each file and remove comments (so a commented-out
module foodoesn't count). - Find every
module NAME. - Add the file to that name's list.
- Print; mark names with more than one file.
Hint
re.findall(r"\bmodule\s+(\w+)", text) returns all module names in the text. The \b keeps it from matching inside endmodule.
Pseudo-code
for each file:
text = file contents without comments
for each "module NAME" in text:
where[NAME].append(file)
for each NAME: print NAME and its files, flag if more than onePython solution
import re
def remove_comments(text):
text = re.sub(r"/\*.*?\*/", "", text, flags=re.S) # /* ... */ blocks, can span lines
return re.sub(r"//.*", "", text) # // to end of line
def module_map(paths):
"""Return {module_name: [files that define it]}."""
where = {}
for path in paths:
text = remove_comments(open(path).read())
for name in re.findall(r"\bmodule\s+(\w+)", text):
where.setdefault(name, []).append(path)
return where
def print_report(where):
for name in sorted(where):
files = where[name]
flag = " <-- defined more than once!" if len(files) > 1 else ""
print(f"{name:12s} {', '.join(files)}{flag}")Output on the sample:
alu rtl/sub/alu.v
core rtl/core.v, rtl/core_copy.v <-- defined more than once!
pll ip/pll/pll.v
top rtl/top.vFollow-ups they might ask
- Which one does the simulator use? The one compiled first/last depending on the tool; say so and suggest failing the flow on duplicates.
- Also find modules that are used but never defined (compare with the instance list from P5).
P5Find all instances of a module or cell core
Given Verilog files and a top module, print the full hierarchical path of every instance of module (or cell) X, e.g. every DFFX1 under top.
Input looks like
module top(...); core u_core (...); core u_core2 (...); pll u_pll (...); endmodule
module core(...); alu u_alu (...); DFFX1 r0 (...); endmodule
module alu(...); DFFX1 f0 (...); DFFX1 f1 (...); endmoduleThink it through
- First build a table: for each module, the list of (child type, instance name) inside it.
- An instance statement looks like
TYPE NAME ( ... );orTYPE #( ... ) NAME ( ... );. Skip keywords likeinput,wire,assign. - Then start at the top. For each child: if its type is X, record the path. If the child is itself one of your modules, go inside it and repeat, with the path extended.
Hint
Two separate steps make this easy: (1) parse every module into a table once, (2) walk the table from the top. The walk is the same "function calls itself" pattern as P3.
Pseudo-code
table = {module: [(child_type, inst_name), ...]} # step 1
function find(module, path): # step 2
for each (child_type, inst_name) in table[module]:
child_path = path + "/" + inst_name
if child_type == X: record child_path
if child_type is in table: find(child_type, child_path)
find("top", "top")Python solution
import re
KEYWORDS = {"module", "input", "output", "inout", "wire", "reg", "assign", "always",
"if", "else", "begin", "end", "for", "case", "parameter", "localparam"}
def remove_comments(text):
text = re.sub(r"/\*.*?\*/", "", text, flags=re.S)
return re.sub(r"//.*", "", text)
def read_modules(paths):
"""Return {module_name: [(child_type, instance_name), ...]} from Verilog files.
Handles 'type name (' and 'type #(params) name (' on one statement."""
modules = {}
for path in paths:
text = remove_comments(open(path).read())
for m in re.finditer(r"\bmodule\s+(\w+)(.*?)\bendmodule", text, flags=re.S):
name, body = m.group(1), m.group(2)
children = []
for statement in body.split(";"):
inst = re.match(r"\s*(\w+)\s*(?:#\s*\(.*\))?\s*(\\\S+|\w+)\s*(\[[^\]]*\])?\s*\(",
statement, flags=re.S)
if inst and inst.group(1) not in KEYWORDS:
children.append((inst.group(1), inst.group(2).lstrip("\\")))
modules[name] = children
return modules
def find_instances(modules, top, target, path=None, found=None):
"""Every hierarchical path under top whose instance type is target."""
if path is None:
path, found = top, []
for child_type, inst_name in modules.get(top, []):
child_path = path + "/" + inst_name
if child_type == target:
found.append(child_path)
if child_type in modules: # it's one of our modules: look inside it too
find_instances(modules, child_type, target, child_path, found)
return foundOutput on the sample:
top/u_core/u_alu/f0
top/u_core/u_alu/f1
top/u_core/r0
top/u_core2/u_alu/f0
top/u_core2/u_alu/f1
top/u_core2/r0Follow-ups they might ask
- Only count them: return a number instead of paths. For a huge design, count per module once and multiply, instead of walking every copy.
- Match by pattern, e.g. every cell starting with
SDFF:child_type.startswith("SDFF"). - Instance arrays
u_alu[3:0]: say there are 4 copies and multiply.
P6Print a module's ports with direction and width basic
Given one module's text, print each port with its direction and width. It must work for RTL-style and netlist-style headers.
Input looks like
// RTL style
module m (input wire [3:0] a, b, output reg y);
// netlist style
module alu_W8_0 ( clk, a, y );
input clk;
input [7:0] a;
output [7:0] y;Think it through
- Grab the module name, the text inside the header
( ), and the body. - If the header contains
input/output, it's RTL style: go item by item; an item without a direction keeps the previous one (bis alsoinput [3:0]). - Otherwise it's netlist style: the header only has names; read the
input ...;/output ...;statements in the body.
Hint
Notice the two styles out loud before coding. That alone shows you've looked at real netlists.
Pseudo-code
name, header, body = regex on the module
if header has "input"/"output":
for each comma-separated item: take direction/range if present, else reuse previous
else:
for each statement in body: if it starts with input/output, record direction/range for each name
print ports in header orderPython solution
import re
def port_list(text):
"""Return (module_name, [(port, direction, range)]) for the first module in text.
Works for ANSI headers (RTL) and non-ANSI headers (netlists)."""
text = re.sub(r"/\*.*?\*/", "", text, flags=re.S)
text = re.sub(r"//.*", "", text)
m = re.search(r"\bmodule\s+(\w+)\s*(?:#\s*\(.*?\)\s*)?\((.*?)\)\s*;(.*?)\bendmodule", text, flags=re.S)
name, header, body = m.group(1), m.group(2), m.group(3)
decl = r"(input|output|inout)\s+(?:wire\s+|reg\s+|logic\s+)?(\[[^\]]*\])?\s*(.*)"
ports = []
if re.search(r"\b(input|output|inout)\b", header): # ANSI: directions are in the header
direction, rng = None, ""
for item in header.split(","):
d = re.match(decl, item.strip(), flags=re.S)
if d: # new direction on this item
direction, rng, pname = d.group(1), d.group(2) or "", d.group(3)
else: # same direction as the item before
pname = item
ports.append((pname.strip(), direction, rng))
else: # non-ANSI: names only in the header
info = {}
for statement in body.split(";"):
d = re.match(decl, statement.strip(), flags=re.S)
if d:
for pname in d.group(3).split(","):
info[pname.strip()] = (d.group(1), d.group(2) or "")
for pname in header.split(","):
pname = pname.strip()
if pname:
ports.append((pname,) + info.get(pname, ("?", "")))
return name, portsOutput on the sample:
('core', [('clk', 'input', ''), ('a', 'input', '[W-1:0]'), ('y', 'output', '[W-1:0]')])
('alu_W8_0', [('clk', 'input', ''), ('rst_n', 'input', ''), ('a', 'input', '[7:0]'), ...])Follow-ups they might ask
- Compare RTL and netlist port lists of the same block: which ports did scan insertion add?
- Convert a range like
[7:0]into a width of 8.
Netlists
P7Count cells and find flops that aren't scan flops core
From a gate-level netlist, count instances of each cell type and list the flops that have no scan-in pin (a quick check after scan insertion).
Input looks like
SDFFRQX1 \y_reg[0] ( .D(n1), .SI(si), .SE(scan_en), .CK(clk), .RN(rst_n), .Q(y[0]) );
DFFRQX1 cnt_reg ( .D(n3), .CK(clk), .RN(rst_n), .Q(n4) );
AND2X1 U12 ( .A(a[0]), .B(b[0]), .Y(n1) );Think it through
- Split the netlist on
;so each instance is one piece, even across lines. - Skip pieces that start with
module,input,wire,assign... - For the rest: first word = cell type, second = instance name (strip a leading
\), then pull every.PIN(net)into a small dictionary. - Counting: add 1 per cell type.
- Non-scan flops: it has
CKandDpins but noSIpin.
Hint
Store each instance's pins as a dictionary ({"D": "n1", "SI": "si", ...}). Then questions become simple checks like "SI" in pins, and P8 reuses the same parsing.
Pseudo-code
for each statement in netlist split on ";":
skip declarations
type, name, pins = parse it
counts[type] += 1
if pins has CK and D but no SI: non_scan.append(name)Python solution
import re
def read_cells(path):
"""Return a list of (cell_type, instance_name, {pin: net}) for every instance in a netlist."""
text = open(path).read()
text = re.sub(r"//.*", "", text)
cells = []
for statement in text.split(";"): # one statement can span many lines
words = statement.split()
if not words or words[0] in ("module", "endmodule", "input", "output", "inout",
"wire", "assign", "reg"):
continue
m = re.match(r"\s*(\w+)\s+(\\\S+|\w+)\s*\((.*)\)\s*$", statement, flags=re.S)
if not m:
continue
cell_type, inst = m.group(1), m.group(2).lstrip("\\")
pins = dict(re.findall(r"\.(\w+)\s*\(\s*([^()]*?)\s*\)", m.group(3)))
cells.append((cell_type, inst, pins))
return cells
def cell_counts(cells):
counts = {}
for cell_type, inst, pins in cells:
counts[cell_type] = counts.get(cell_type, 0) + 1
return counts
def non_scan_flops(cells):
"""Flops without a scan-in pin. Checking the SI pin is more reliable than the cell name."""
result = []
for cell_type, inst, pins in cells:
is_flop = "CK" in pins and "D" in pins
if is_flop and "SI" not in pins:
result.append(inst)
return resultOutput on the sample:
{'SDFFRQX1': 2, 'DFFRQX1': 1, 'AND2X1': 1, 'XOR2X1': 1, 'INVX1': 1, 'BUFX2': 1, 'alu_W8_0': 1, 'LATNQX1': 1}
['cnt_reg']Follow-ups they might ask
- Why checking the
SIpin beats checking the nameSDFF*: libraries name cells differently. - Some non-scan flops are on purpose (synchronizers). Read an allowed list from a file and skip those.
- Counts per module rather than for the whole file: track the current
modulename while you loop.
P8Trace a scan chain through the netlist core
Starting from the scan-in net, follow the chain: find the flop whose SI is on that net, go to its Q, and repeat. Pass through buffers. Print the chain in order and the net where it ends.
Input looks like
SDFFRQX1 \y_reg[0] ( ..., .SI(si), ..., .Q(y[0]) );
SDFFRQX1 \y_reg[1] ( ..., .SI(y[0]), ..., .Q(y[1]) );
BUFX2 U15 ( .A(y[1]), .Y(so) );Think it through
- Using P7's parsing, build a lookup: net → the scan flop whose SI is on it. Also net → buffer whose input is on it.
- Start with
net = scan_in. - Loop: if a flop's SI is on this net, record it and move to its Q net. If a buffer's input is on it, move to its output. Otherwise stop: this is the end of the chain.
- Add a safety limit so a wiring loop can't make it run forever.
Hint
The lookup dictionary is the key: "which flop listens on this net?" is then one line instead of searching the whole netlist every step.
Pseudo-code
si_of = {net: flop whose SI is on net}
net = scan_in
while True:
if net in si_of: record the flop; net = its Q
elif a buffer reads net: net = buffer output
else: stop
print the order and the final net (should be a scan-out port)Python solution
def trace_chain(cells, scan_in_net):
"""Follow a scan chain: find the cell whose SI is on the current net, move to its Q, repeat.
cells: list of (cell_type, instance, {pin: net}) as returned by read_cells()."""
si_of = {} # net -> scan cell whose SI pin is on that net
buf_in = {} # net -> buffer whose input is on that net (chains often pass through buffers)
for cell_type, inst, pins in cells:
if "SI" in pins:
si_of[pins["SI"]] = (inst, pins)
elif cell_type.startswith("BUF"):
buf_in[pins.get("A")] = (inst, pins)
order = []
net = scan_in_net
while True:
if net in si_of:
inst, pins = si_of[net]
order.append(inst)
net = pins["Q"]
elif net in buf_in:
inst, pins = buf_in[net]
net = pins["Y"] # step through the buffer, don't count it
else:
break # nothing continues: this net is the chain's end
if len(order) > 1_000_000:
raise RuntimeError("chain loops back on itself?")
return order, netOutput on the sample:
(['y_reg[0]', 'y_reg[1]'], 'so')Follow-ups they might ask
- Compare the traced order with the chain report from the DFT tool (P11 does the comparison).
- Two flops listening on the same net = a branch: report it instead of picking one.
- The chain ends on something that isn't a scan-out port: that's a broken chain, print where.
Tester logs and reports
P9Fail log to instance names core
Count tester fails per scan cell and print the worst cells first, with their instance names from the chain map.
Input looks like
# tester: pattern=... lines
pattern=12 chain=c3 cell=40 expected=1 actual=0
pattern=13 chain=c3 cell=40 expected=1 actual=0
pattern=13 chain=c1 cell=7 expected=0 actual=1
pattern=20 chain=c3 cell=40 expected=1 actual=0
# chain map: <chain> <cell> <instance>
c3 40 top/u_core/u_alu_2/f1
c1 7 top/u_pll/lock_qThink it through
- Read the chain map into a dictionary: (chain, cell) → instance.
- Read the fail log; for each fail line add 1 to that (chain, cell).
- Sort by count, largest first, and print with the instance name (or say it's missing from the map).
Hint
Use a pair (chain, cell_number) as the dictionary key. Convert the cell number with int() in both files so they match.
Pseudo-code
cmap = {(chain, cell): instance} from the chain map
for each fail line: fails[(chain, cell)] += 1
for key in fails, biggest first: print count, key, cmap.get(key, "missing")Python solution
import re
def read_chain_map(path):
"""chain map lines: '<chain> <cell_index> <instance>' -> {(chain, index): instance}"""
cmap = {}
for line in open(path):
parts = line.split()
if len(parts) == 3 and not line.startswith("#"):
cmap[(parts[0], int(parts[1]))] = parts[2]
return cmap
def fail_summary(log_path, cmap):
"""Count fails per (chain, cell); print worst first with the instance name."""
fails = {}
for line in open(log_path):
m = re.search(r"pattern=(\d+)\s+chain=(\S+)\s+cell=(\d+)\s+expected=(\d)\s+actual=(\d)", line)
if not m:
continue
key = (m.group(2), int(m.group(3)))
fails[key] = fails.get(key, 0) + 1
for key in sorted(fails, key=lambda k: fails[k], reverse=True):
inst = cmap.get(key, "<not in chain map>")
print(f"{fails[key]:4d} fails {key[0]}[{key[1]}] {inst}")
return failsOutput on the sample:
3 fails c3[40] top/u_core/u_alu_2/f1
1 fails c1[7] top/u_pll/lock_qFollow-ups they might ask
- Also show whether it's always 1→0 or 0→1 (a stuck-at hint).
- How many different patterns failed on each cell?
- Given only tester cycle numbers, convert them to pattern and cell first (P12).
P10Timing report summary basic
From a timing report with many paths, print the worst slack (WNS), the sum of negative slacks (TNS) and the number of failing paths for each path group.
Input looks like
Startpoint: u_core/reg_a (rising edge-triggered flip-flop clocked by clk_core)
Endpoint: u_core/reg_b (rising edge-triggered flip-flop clocked by clk_core)
Path Group: clk_core
Path Type: max
slack (VIOLATED) -0.042
Startpoint: u_core/reg_c (rising edge-triggered flip-flop clocked by clk_core)
Endpoint: u_core/reg_d (rising edge-triggered flip-flop clocked by clk_core)
Path Group: clk_core
Path Type: min
slack (MET) 0.013
Startpoint: tck_in (input port clocked by tck)
Endpoint: u_tap/ir_reg_0 (rising edge-triggered flip-flop clocked by tck)
Path Group: tck
Path Type: max
slack (VIOLATED) -0.200Think it through
- Each path is a block of lines. Remember the current
Path Groupwhen you see it. - When you reach the
slackline, the block is complete: take the number. - If it's negative, update that group's worst, total and count.
Hint
You don't need to understand the whole report: just two kinds of lines, the group name and the slack. Keep "current group" in a variable between lines.
Pseudo-code
group = None
for each line:
if "Path Group:" in line: group = the name
if it's a slack line:
slack = number
if slack < 0: wns[group] = min(...); tns[group] += slack; count[group] += 1
print per groupPython solution
import re
def timing_summary(path):
"""Worst slack (WNS), total negative slack (TNS) and number of failing paths per path group."""
results = {} # group -> [wns, tns, count]
group = None
for line in open(path):
m = re.search(r"Path Group:\s*(\S+)", line)
if m:
group = m.group(1) # remember which group this path belongs to
m = re.search(r"slack\s*\(\w+\)\s*(-?[\d.]+)", line)
if m and group:
slack = float(m.group(1))
if group not in results:
results[group] = [0.0, 0.0, 0]
if slack < 0:
results[group][0] = min(results[group][0], slack)
results[group][1] += slack
results[group][2] += 1
for group, (wns, tns, n) in results.items():
print(f"{group:10s} WNS {wns:+.3f} TNS {tns:+.3f} failing {n}")
return resultsOutput on the sample:
clk_core WNS -0.042 TNS -0.042 failing 1
tck WNS -0.200 TNS -0.200 failing 1Follow-ups they might ask
- Split setup (
Path Type: max) and hold (min) results. - List the 5 worst endpoints.
- Group by launch/capture clock pair to spot a bad clock crossing.
P11What changed between two chain reports? basic
Compare the scan chain report before and after place-and-route: which cells moved to a different chain, which disappeared, which are new.
Input looks like
before: after:
chain1 u_core/a_reg_0_ chain1 u_core/a_reg_0_
chain1 u_core/a_reg_1_ chain1 u_core/b_reg_0_
chain1 u_core/a_reg_2_ chain1 u_core/a_reg_2_
chain2 u_core/b_reg_0_ chain2 u_core/a_reg_1_
chain2 u_core/b_reg_1_ chain2 u_core/b_reg_1_
chain2 u_core/spare_reg chain2 u_core/new_regThink it through
- Read each report into a dictionary: cell → (chain, position).
- For every cell in before: missing in after → removed; different chain → moved.
- For every cell in after that wasn't in before → added.
Hint
Think of it as two dictionaries keyed by cell name. Once both are built, the comparison is a few ifs.
Pseudo-code
before = {cell: chain}, after = {cell: chain}
for cell in before:
if cell not in after: removed
elif chains differ: moved
for cell in after not in before: addedPython solution
def read_chains(path):
"""'<chain> <cell>' per line, in scan order -> {cell: (chain, position)}"""
where = {}
position = {}
for line in open(path):
parts = line.split()
if len(parts) != 2:
continue
chain, cell = parts
position[chain] = position.get(chain, -1) + 1
where[cell] = (chain, position[chain])
return where
def chain_diff(before_path, after_path):
before, after = read_chains(before_path), read_chains(after_path)
for cell in sorted(before):
if cell not in after:
print(f"removed : {cell} (was {before[cell][0]})")
elif before[cell][0] != after[cell][0]:
print(f"moved : {cell} {before[cell][0]} -> {after[cell][0]}")
for cell in sorted(after):
if cell not in before:
print(f"added : {cell} ({after[cell][0]})")Output on the sample:
moved : u_core/a_reg_1_ chain1 -> chain2
moved : u_core/b_reg_0_ chain2 -> chain1
removed : u_core/spare_reg (was chain2)
added : u_core/new_reg (chain2)Follow-ups they might ask
- Also report chain lengths before/after (count per chain).
- Report cells that stayed in the same chain but changed position (reorder).
- Why this matters: ATPG must use the chain order from the final netlist, or patterns fail.
Bits and numbers
P12Bit tricks and cycle-to-cell math basic
Small functions that come up in hardware scripting: count 1s, parity, get/set/clear a bit, reverse bits, hex to a binary string, and convert a tester fail cycle into (pattern, scan cell).
Input looks like
count_ones(0b1011) -> 3
reverse_bits(0b0011, 4) -> 0b1100 (12)
hex_to_bits('0x3A', 8) -> '00111010'
cycle_to_cell(1202, setup=1000, chain_length=100) -> (2, 99)Think it through
- Bits: shifting (
>>,<<) and masking (& 1,|,& ~) cover almost everything. - Cycle to cell: subtract the setup cycles; each pattern takes chain_length + capture cycles; the remainder is the shift position; the first bit out is the cell nearest scan-out, so cell = chain_length − 1 − position.
Hint
Python helpers: bin(x) gives '0b1011', int('3A', 16) parses hex, format(x, '08b') gives 8 binary digits.
Pseudo-code
count_ones(x): count "1" characters in bin(x)
get_bit(x, n): (x >> n) & 1
set_bit(x, n): x | (1 << n)
clear_bit(x, n): x & ~(1 << n)
cycle_to_cell: offset = cycle - setup
pattern = offset // (L + capture)
position = offset % (L + capture)
cell = L - 1 - positionPython solution
def count_ones(value):
"""Number of 1 bits, e.g. to count toggles or check parity."""
return bin(value).count("1")
def parity(value):
return count_ones(value) % 2 # 1 = odd number of ones
def get_bit(value, n):
return (value >> n) & 1
def set_bit(value, n):
return value | (1 << n)
def clear_bit(value, n):
return value & ~(1 << n)
def reverse_bits(value, width):
result = 0
for i in range(width):
if get_bit(value, i):
result = set_bit(result, width - 1 - i)
return result
def hex_to_bits(hex_string, width):
"""'0x3A', 8 -> '00111010' (MSB first)"""
return format(int(hex_string, 16), f"0{width}b")
def cycle_to_cell(cycle, setup_cycles, chain_length, capture_cycles=1):
"""Tester fail cycle -> (pattern, cell index). Assumes each pattern = shift of chain_length + capture.
The first bit out of the chain comes from the cell nearest scan-out."""
offset = cycle - setup_cycles
per_pattern = chain_length + capture_cycles
pattern = offset // per_pattern
shift_pos = offset % per_pattern
cell = chain_length - 1 - shift_pos
return pattern, cellOutput on the sample:
3 1 12 00111010
(2, 99)
(2, 0)Follow-ups they might ask
- Parity of a 32-bit word without
bin(): loop over bits and XOR them. - Which bits differ between expected and actual?
expected ^ actual, then list the set bits. - Chains of different lengths: the shift length is the longest chain, shorter chains are padded at the start.
Stretch: only if you have time
These come up less often. Knowing the idea in plain words is enough; you'd write them the same way as the problems above.
- Fan-in cone
- "Which flops and inputs feed this flop's D pin?" Build a dictionary net → the cell that drives it (P7 parsing, using output pin names like
Q,Y). Start at the D pin's net, look up its driver, then look at that driver's input nets, and keep going backwards. Stop at flops and module inputs. Keep a list of nets already visited so you don't repeat. - Balancing scan chains
- "Split these blocks into N chains so the longest is as short as possible." Simple approach: sort blocks biggest first, and give each one to whichever chain is currently shortest. It's not always perfect, but it's close and it's what you'd do by hand.
- Combinational loop check
- "Is there a loop of gates with no flop in it?" Follow gate outputs to gate inputs, skipping flops; if you ever get back to a gate you're currently in the middle of exploring, there's a loop. Mention it; it's rarely asked to be coded in full.
Before ATPG: what happens to a design, and who does it
If your work starts when someone hands you a scan-stitched netlist, everything before that point can look like a black box. This page opens it. It names each job between "RTL exists" and "ATPG can run", what each job produces, and how the same jobs look in a fully tool-driven flow and in a flow where most of it is hand-written RTL and in-house scripts. Read this first; the rest of the section builds on these words.
60-second answer: "what has to happen before you can run ATPG?"
Five jobs. First someone decides the test architecture: how many scan channels, which compression, which clocks get on-chip clock control, how static test controls are reached. Then the test instruments (EDT, OCCs, SSN host, TDRs, MBIST) are built as RTL and wired into the design. Then the whole thing is synthesized into a gate netlist of library cells. Then the flops are replaced with scan flops and stitched into chains that connect to the EDT. Finally the result is described for ATPG: chains, clocks, test procedures, and a description file for every instrument, and that description is checked by simulation. ATPG reads only the last two things: the scan netlist and those description files. A tool like Tessent can do jobs two, four and five automatically. Many teams do them with hand-written RTL, in-house connectivity scripts and a separate synthesis team instead. The jobs and their outputs are the same either way.
The basic words
- RTL
- Register-transfer level code: Verilog or SystemVerilog that describes behavior with
alwaysblocks andassignstatements. Written by people (or generated by tools). Not yet made of real cells. - Module, instance
- A module is a definition (a "part number"). An instance is one placed copy of it inside another module, with a name like
u_edt. A design is a tree of instances: the hierarchy. - Port, pin, net
- A port is a module's own input or output. A pin is a port of an instance, seen from outside. A net is a wire connecting pins and ports. "Connectivity" means deciding which pins share a net.
- Elaboration
- Reading the RTL and building the hierarchy: resolving every instance to its module and every parameter. Missing modules show up here. In Tessent this happens at
set_current_design. - Synthesis
- Turning RTL into a gate netlist: a list of instances of library cells (flip-flops, gates, muxes) and the nets between them. Done by a synthesis tool (Design Compiler, Genus), with timing constraints in SDC.
- Cell library
- The set of cells the foundry and library team provide, each with timing, area and a functional model. A scan flop is one of these cells. ATPG needs a model of every cell (in Tessent, a
.tcelllibor ATPG library). - Gate netlist
- The output of synthesis, also Verilog, but only instances of library cells. This is what you've been reading in ATPG.
- Instrument
- A piece of test hardware added to the design: EDT controller, OCC, SSN ScanHost, TDR, SIB, TAP, MBIST controller, boundary scan cell.
- Insertion
- Adding an instrument to the design: create its RTL, instantiate it somewhere, and rewire existing nets to go through it (for example, cut a clock net and route it through an OCC).
- Scan replacement
- Swapping each ordinary flop for its scan version (a flop with a mux in front). Done in synthesis ("test-ready" compile) or by a scan insertion tool.
- Stitching
- Wiring scan flops into chains: each flop's output to the next one's scan input, from a scan-in to a scan-out. Includes ordering, balancing chain lengths and lockup cells between clock domains.
- Specification (spec)
- In Tessent, a structured text that says which instruments to create and how to connect them. The tool reads it and does the insertion. The spec page covers it in detail.
- TSDB
- Tessent's working directory for a design: every generated instrument, edited design file and description lands there, organized by insertion pass.
Terms you'll meet in the next pages
Skim this now and come back to it. Each term gets a full explanation on the page linked.
Instruments and access
- EDT
- Embedded deterministic test: Tessent's scan compression. A decompressor feeds many short internal chains from a few channels; a compactor squeezes their outputs back down. EDT deep dive.
- Channel
- One EDT input or output that the tester (or SSN bus) drives or observes each shift cycle.
- OCC
- On-chip clock controller: sits at a clock's root and decides, per pattern, how many capture pulses pass and whether they're slow or at speed. Pass 2.
- Condition bits
- The few scan cells inside an OCC that hold the per-pattern pulse count. Loaded by scan like any other cells.
- Chopping
- An OCC letting only some pulses of a running clock through.
- Shift-only mode, clock injection
- OCC features that let shift run from a test clock (or one injected from IJTAG or an SSN host) even when the OCC itself isn't active.
- Kill-clock mode
- An OCC option to block the functional clock completely.
- SSN, ScanHost
- Streaming Scan Network: a packetized scan bus through the chip; a ScanHost in each block unpacks its bits for the local EDT and generates scan enable and clocks. SSN.
- IJTAG
- IEEE 1687: a scan network, usually behind the JTAG TAP, for reaching test registers inside the chip. IJTAG.
- TDR
- Test data register: a shift register on the IJTAG network whose outputs drive static test controls.
- SIB
- Segment insertion bit: a one-bit register that opens or closes a branch of the IJTAG network.
- SRI, STI
- Scan resource instruments (must stay configured during scan test: TDRs, EDT and OCC controls) and scan-tested instruments (covered by scan like normal logic: MBIST controllers).
- BAP
- BIST access port: the IJTAG-facing control block of MemoryBIST.
- ICL, PDL
- IEEE 1687 languages: ICL describes the network's registers and connections; PDL describes operations on them (
iWrite,iRead,iApply), grouped into procedures (iProc) that are called withiCall. - TCD
- Tessent core description: a file telling ATPG how an instrument or core behaves in scan (chains, clocks, EDT configuration, modes).
- TAP
- The IEEE 1149.1 JTAG controller at the chip pins. JTAG.
- TAM
- Test access mechanism: the chip-level muxing that connects pins (or an SSN bus) to each core's channels for a given test.
- MBIST, BISR, LBIST
- Memory built-in self-test; built-in self-repair (spare rows or columns fused in); logic BIST (pseudo-random patterns generated on chip).
- Auxiliary pins
- Functional pins given extra muxing at the pad so they can double as EDT channels in test.
Hierarchy and flow
- Physical block, core, partition
- A piece of the chip synthesized and laid out on its own. "Wrapped" if it has wrapper cells.
- Wrapper cells, intest, extest
- Scan cells at a core's boundary that isolate it. Intest tests the inside; extest tests the logic between cores. Core wrapping.
- Graybox
- A reduced copy of a core keeping only its boundary logic, wrapper chains and IJTAG network, used by the parent level.
- Retargeting, retargeting mode
- Reusing a core's patterns at the chip level by mapping them through the TAM; a retargeting mode is one TAM setting for one group of cores.
- Design ID
- The label of one insertion pass in the TSDB (
rtl1,rtl2,gate). - DFT signal
- A named test control with a known role (
ltest_en,scan_en,int_mode,edt_mode,output_pad_disable). Static ones live in TDRs; dynamic ones need pins or a ScanHost. - Persistent cells
- Buffers and gaters Tessent places as fixed anchor points for SDC constraints; they must survive synthesis.
- Boundary optimization
- A synthesis optimization across module ports (propagating constants, removing unused ports). Must be off for DFT instances.
- Case analysis
- An STA setting that fixes a signal to 0 or 1 so only the paths active in one mode are timed.
- Scan DEF
- A file listing chain contents and order, passed from stitching to layout and back.
ATPG and debug
- Test procedure file
- Waveforms for test: timeplates (when inputs are forced, outputs measured, clocks pulsed in a cycle) and procedures (test_setup, shift, load_unload, capture).
- Named capture procedure
- A user-defined capture sequence (which clocks pulse in which cycles), used for at-speed tests through OCCs or PLLs.
- Flat model, PatDB
- The flattened design ATPG works on, and Tessent's pattern database; both saved in the TSDB for reuse.
- Fault classes
- DT detected, PD possibly detected, UT untestable, AU ATPG-untestable, UD undetected.
posdet_creditis how much a PD counts (50% by default). Fault models. - Fault sampling
- Running ATPG on a random fraction of faults for a quick estimate.
- Care bits
- The few scan-cell values a pattern actually needs; the rest are free. Compression works because there are few.
- Masking, X
- X is an unknown value. Masking blocks a chain's output at the compactor so its X doesn't hide other chains.
- Aliasing
- Two different errors cancelling in the compactor so the output looks correct.
- Xpress compactor
- Tessent's default compactor, which masks only the chains that carry X.
- Multi-load patterns
- Patterns with more than one scan load, used for example to write and read a memory.
- Shadow logic
- The logic just around a memory (address, data, control paths).
- DRC rule families
- Letters name what a rule checks: T trace, D data, C clock, S scannability, E extra, K EDT, I ICL extraction, P procedures, DFT_C pre-DFT clocks. DRC page.
The five jobs
| Job | What it decides or does | What it produces | If it's wrong, ATPG sees |
|---|---|---|---|
| 1. Architect | Channel count per block, compression ratio, chain count and length, OCC per clock, how static controls are set (TDRs, IJTAG), SSN or pin-based access, wrapper or not | A plan: numbers and a block diagram | Coverage loss, too many patterns, test time over budget, blocks that can't run in parallel |
| 2. Build + connect | Create each instrument's RTL (generate it or write it), instantiate it, rewire clocks, scan enable, channels, IJTAG | RTL with instruments in it | Trace failures, K19/K22 on EDT, I-rule failures in ICL extraction, test setup that does nothing |
| 3. Synthesize | Map RTL to library cells under timing constraints, keep DFT hierarchy intact | Gate netlist | Missing or merged test registers, renamed ports that break descriptions, constants propagated through test logic |
| 4. Scan + stitch | Replace flops with scan flops, order and stitch chains, add lockups, connect chain ends to EDT | Scan netlist + a record of the chains | Unbalanced chains, broken chains (T3), wrong clock-domain crossings, chains on the wrong EDT ports |
| 5. Describe + verify | Write down how to drive the result: library, chains, clocks, procedures, one description per instrument; simulate setup and a few patterns | Description files, passing sims | DRC errors that are really description errors (wrong pin, wrong off-state, wrong chain length) |
Who does each job, in two kinds of flow
A fully tool-driven Tessent flow and a flow built on hand-written RTL and in-house scripts split the same jobs differently. Neither is "the right one". Big companies often mix them: hand-written or legacy RTL, a home-grown connectivity tool, a synthesis team that owns stitching, and Tessent used for EDT and SSN generation, DRC and patterns.
| Job | Tessent automates it with | In a hand-built / scripted flow |
|---|---|---|
| Architect | Nothing; always an engineer's decision. analyze_compression helps size EDT. | Same: an engineer and a spreadsheet |
| Build instruments | create_dft_specification + process_dft_specification generate the RTL | Instruments written by hand, reused from older projects, or generated by Tessent and then taken as IP |
| Connect instruments | process_dft_specification instantiates and rewires | A connectivity tool or scripts edit the RTL; parameters changed per project by script |
| Static control network | IJTAG network (SIBs, TDRs) generated in the same step | Hand-written registers, often memory-mapped or behind a TAP |
| Synthesis | Not Tessent; it writes the load script and SDC procs | Synthesis team with their own scripts |
| Scan + stitch | Tessent Scan: insert_test_logic | Synthesis tool's scan insertion (often the synthesis team) |
| Describe for ATPG | Mostly automatic: scan modes recorded as TCD, ICL extracted, test setup generated | Dofiles, test procedure files and TCD/ICL written or generated by in-house flow scripts |
| ATPG | Tessent | Tessent |
What actually reaches ATPG
Whoever did the upstream work, ATPG starts from the same inputs. In Tessent terms:
| Input | Command that reads it | Where it comes from |
|---|---|---|
| Scan-stitched netlist | read_verilog or read_design | Synthesis / scan insertion |
| Cell library | read_cell_library | Library team; must include scan and non-scan models |
| Chains and groups | add_scan_groups, add_scan_chains (or import_scan_mode from a recorded mode) | Whoever stitched; often generated from the stitching report |
| Clocks and constraints | add_clocks, add_input_constraints | The architecture plan |
| Test procedures | set_procfile_name (test_setup, load_unload, shift, capture) | Written by hand or generated from the TCD |
| Instrument descriptions | read_core_descriptions (TCD), read_icl, PDL via dofile | Generated with the instrument, or written for hand-made ones |
The next three pages go one level deeper: what happens to one flop on the way, what a spec is and what you can set in it, and what an instrument looks like as RTL and how to insert one by hand.
Interview questions
What's the difference between RTL and a gate netlist? basic
RTL describes behavior with language constructs (always blocks, assignments) and has no cells in it. A gate netlist is the result of synthesis: instances of specific library cells and the nets between them. ATPG works on the gate netlist because it needs the actual structure to model faults.
Where can a T3 trace failure come from upstream of ATPG? core
From any job that touches the shift path: connectivity (SE or clock not reaching a cell, a gater not enabled in shift), synthesis (a test register optimized away, an inverter added on a clock), or stitching (a missing lockup, a chain crossing domains in the wrong order, the chain ends on the wrong EDT ports). It can also be a description error: the chain declared with the wrong scan-in or scan-out pin.
Why does ATPG need description files at all if it has the netlist? core
The netlist shows structure, not intent. ATPG has to know which pins are clocks and their off states, where each chain starts and ends, how to put the design into test mode, what the EDT's configuration is and which static values each mode needs. Some of that can be traced (chains, EDT connectivity once the EDT is described), but the starting point has to be declared.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
Life of a flop: from an always block to a scan cell
The fastest way to understand the stages before ATPG is to follow one flip-flop through them. This page does that, then lists the RTL habits that decide whether a flop can make the trip at all. Those habits are what pre-DFT DRC checks, and they're why some flops end up non-scan.
60-second answer: "how does a register in RTL become a scan cell?"
Synthesis infers a flip-flop from the always @(posedge clk) block and maps it to a library cell, say a flop with an asynchronous reset. Scan replacement swaps that cell for the library's scan equivalent: the same flop with a two-input mux in front, where scan enable picks between the functional data and a scan input. Stitching then wires the scan output of each cell to the scan input of the next, from a scan-in point to a scan-out point, inserting lockup latches where neighboring cells use different clocks. With compression, those scan-in and scan-out points are the EDT decompressor and compactor rather than pins. For the flop to make it, its clock has to be controllable in test, its async reset has to be holdable inactive during shift, and nothing in its path can be a combinational loop or an uncontrolled latch. Those are the scannability rules.
The four stages
always block into a library flip-flop, here one with an async reset. (2) Scan replacement swaps it for the library's scan version: the same flop with a mux in front, selected by scan enable (SE). Functionally nothing changes while SE is 0. (3) Stitching wires each cell's Q to the next cell's SI, from a scan-in port to a scan-out port. Where two neighbors run on different clocks, a lockup latch keeps the shift safe. (4) With compression, the chain ends connect to the EDT decompressor and compactor instead of to pins. ATPG never sees the RTL. It sees panel 4 plus a description of how to drive it.Stage 1: synthesis infers and maps the flop
- Inference. An assignment inside
always @(posedge clk)becomes a flip-flop; theif (!rst_n)branch, if the reset is in the sensitivity list (always @(posedge clk or negedge rst_n)), becomes an asynchronous reset pin. Without it in the list, the reset is synchronous and becomes logic in front of D. - Mapping. The synthesis tool picks a library cell that matches: DFF, DFF with async reset (DFFR), with set, with enable, multi-bit flops. The name in the netlist is usually derived from the RTL register (
q_reg,q_reg_3_), which is how you trace a failing cell back to RTL. - Constraints matter. The SDC tells synthesis the clock periods. If test-only paths aren't constrained, synthesis may make them too slow or remove logic it thinks is unused, which is why DFT registers have to be protected.
Stage 2: scan replacement
- The library has a scan version of most flops: same function, plus SI (scan in) and SE (scan enable) pins, and sometimes a separate SO. ATPG libraries describe the pairing, which is how a tool knows a DFFR becomes an SDFFR.
- With SE = 0 the flop behaves exactly as before. With SE = 1 it loads SI on every clock edge, which is shift.
- When it happens: in many flows the synthesis tool maps straight to scan flops ("test-ready" synthesis) and a later step stitches them. In a Tessent Scan flow, the tool replaces and stitches in one step on the synthesized netlist.
- Flops that are deliberately left non-scan (for example some synchronizer stages or flops the architecture excludes) stay as plain flops. ATPG has to model them through capture, and they're often X sources.
Stage 3: stitching
- Order. Cells are ordered to keep chains in one clock domain and edge where possible, then reordered after placement to shorten the wires. Reordering in layout is common, which is why chain descriptions are regenerated after layout.
- Balance. Chains are kept close in length, because shift time is set by the longest one.
- Lockups. Where a chain goes from one clock domain to another, a lockup latch (or flop) clocked by the launching domain delays the bit by half a cycle so clock skew between the domains can't cause a hold race. See the scan architecture page for the timing.
- Records. The stitching step writes what it did: chain names, scan-in and scan-out points, length, cell order. In Tessent Scan this becomes the recorded scan mode; with other tools it's a report or a scan DEF that in-house scripts turn into
add_scan_chainscommands.
Stage 4: chains on the EDT
Without compression, each chain's scan-in and scan-out are chip pins. With EDT, they're internal: each chain's first cell is fed by one output of the decompressor and its last cell feeds one input of the compactor. Because those ends aren't pins, ATPG declares them as internal chains (add_scan_chains -internal) or learns them from the EDT's description. The EDT's channel pins are what the tester or the SSN bus actually drives. The EDT deep dive covers what happens inside.
The RTL habits that decide whether a flop gets scanned
These are what scannability DRC (pre-DFT DFT_C rules in Tessent, S rules on the netlist) checks. Writing RTL with them in mind avoids most fixes later.
| RTL pattern | Why it's a problem in test | Usual fix |
|---|---|---|
| Clock generated internally (divider, gated with logic, derived from data) | ATPG can't control when the flop is clocked, so it can't shift | Clock mux to a test clock in test mode, or an OCC at the generated clock's root; library clock gating cells with a test enable |
| Asynchronous reset driven by logic or a flop | The reset can fire during shift and wipe the chain | Gate the reset with a test signal so it's held inactive during shift (Tessent can add this automatically) |
| Clock gating written as an AND gate in RTL | Not recognized as a clock gater; enable not controllable | Use the library ICG cell with its test enable, or tell the tool the enables |
| Latches | Transparent at the wrong time, hard to control | Avoid, or make them transparent in test |
| Combinational loops | No stable value; ATPG has to cut them and loses coverage | Break with a flop or a test-mode mux |
| Uninitialized memories, black boxes, analog | Drive X into flops that observe them | Bypass or model them; bound their outputs in test |
| Bidirectional / tri-state buses | Contention or floating values | Control the enables in test |
Interview questions
What's the difference between a synchronous and an asynchronous reset for scan? basic
A synchronous reset is logic in front of D, so it only takes effect on a clock edge through the functional path; in shift (SE=1) the mux selects SI and the reset doesn't matter. An asynchronous reset acts on the flop directly, any time, so it must be held inactive during shift by a test control or it can clear the chain.
Why do lockup latches exist, and what clocks them? core
When a chain crosses from one clock domain to another, the two clocks can arrive with different delays. If the receiving cell's clock is late, it can capture the new value instead of the old one: a hold race. A latch clocked by the launching domain's clock, transparent in the low phase for positive-edge flops, holds the bit for half a cycle so the receiving cell always sees the previous value.
How does ATPG know where an internal chain starts and ends when it's connected to EDT? core
From the EDT description and the chain declarations. With the EDT described (TCD), the tool can trace from the decompressor outputs to the first cells and from the last cells to the compactor. Without that, you declare the chains with internal scan-in and scan-out nodes, for example with add_scan_chains -internal.
A flop has a clock divided down from the PLL in RTL. What happens in DFT? deep
The divider output isn't directly controllable, so the flop can't shift reliably. Options: a test-mode mux that selects a controllable clock at the divider output, an OCC at that generated clock's root, or defining the divider's behavior so ATPG can use it (rarely practical). Usually it's caught by pre-DFT clock DRC and fixed with a mux or OCC in RTL.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
What a spec is, and the parameters you can set
"Spec" in Tessent means a DftSpecification: a structured text that describes which test instruments to build and how to connect them. You don't write the RTL; you write (or adjust) the spec, and the tool writes the RTL. This page explains the format from zero, walks through one complete spec line by line, and lists the parameters you'll actually touch for each instrument.
60-second answer: "what is a DftSpecification?"
It's Tessent's description of the DFT hardware to insert, written in a nested Wrapper(id) { property : value; } syntax. The root names the design and the insertion pass, for example DftSpecification(my_core,rtl2). Under it there's one wrapper per instrument type: IjtagNetwork for SIBs and TDRs, OCC, EDT, SSN, MemoryBist, BoundaryScan. Each holds one element per instance, like Controller(c1), with properties such as scan_chain_count : 400;. create_dft_specification writes a default from what the tool knows about the design; you change what you need with read_config_data or set_config_value; process_dft_specification generates each instrument's RTL, ICL, PDL and TCD and wires them into the design. It's the order form; processing is the factory.
What it is, in plain terms
- It's data, not a script. A spec says what you want ("an EDT controller with 400 chains and 8 channels, hosted on SIB edt"). It doesn't say how to build it. The tool knows how.
- It lives in memory and on disk. In a Tessent session it's a tree you can query and edit. When processed, a copy is written into the TSDB, so you can see exactly what built a given design.
- It's tied to one design and one pass.
DftSpecification(my_core,rtl2)is the spec for designmy_core, insertion passrtl2. The next pass gets a new spec. - Most of it is defaults. The default spec already reflects your declared DFT signals, design level and requirements. A typical edit touches ten lines.
The syntax in five rules
DftSpecification(my_core,rtl2)/EDT/Controller(c1)/scan_chain_count points at exactly one leaf, which is how scripts read and change it. Only a few of the possible properties are shown.- Wrappers are named blocks with braces:
EDT { ... }. Some take an ID in parentheses:Controller(c1) { ... }. The ID is yours to choose and must be unique among siblings. - Properties are
name : value;with the semicolon. Values can be numbers,on/off, names, lists (250, 300), or references to other elements (Sib(edt),DftSignal(int_edt_mode)). - Paths address any node:
$spec/EDT/Controller(c1)/scan_chain_count. Scripts use paths to read and set values. - Comments start with
//. - Legal names come from the tool. Every wrapper has a fixed set of child wrappers and properties.
report_config_syntax DftSpecification/EDTprints them with defaults and allowed values. When in doubt, ask the tool, not memory.
What happens to a spec in one run
create_dft_specification writes a starting spec from what it knows: the design, the DFT signals and requirements you declared, the instruments it found. You edit it. -validate_only checks it without touching the design. Processing generates each instrument (Verilog, ICL, PDL, TCD), inserts them, rewires the design, and writes everything into the TSDB, including a copy of the spec that was processed. With -no_insertion it stops after generation and you instantiate the RTL yourself.set spec [create_dft_specification -sri_sib_list {edt occ}] ;# 1. start from defaults
report_config_data $spec ;# read what you got
read_config_data -in $spec -from_string { ... } ;# 2. paste a block
set_config_value $spec/EDT/Controller(c1)/scan_chain_count 420 ;# or set one value
process_dft_specification -validate_only ;# 3. check, change nothing
process_dft_specification ;# 4. generate + insert
# process_dft_specification -no_insertion ;# generate only
-sri_sib_list {edt occ} asks the default spec to include empty SIBs named edt and occ on the scan-resource side of the IJTAG network. The EDT and OCC wrappers then point their ijtag_host_interface at those SIBs. That's how their static controls end up reachable through IJTAG.
One complete spec, annotated
DftSpecification(my_core,rtl2) { // design my_core, insertion pass rtl2
IjtagNetwork { // static-control network (nesting simplified)
HostScanInterface(ijtag) { // this block is reached through its IJTAG port
Sib(sri) { // a SIB for scan-resource instruments
Tdr(sri_ctrl) { } // TDR holding static DFT signals (made from add_dft_signals)
Sib(edt) { } // empty SIB: the EDT's static inputs hang here
Sib(occ) { } // empty SIB: the OCCs' static inputs hang here
}
}
}
OCC {
ijtag_host_interface : Sib(occ); // static controls via that SIB
type : standard; // standard | parent | child
Controller(core) { // one OCC per functional clock
clock_intercept_node : core_clk; // where to cut the clock and insert the OCC
}
}
EDT {
ijtag_host_interface : Sib(edt);
Controller(c1) {
longest_chain_range : 250, 300; // expected longest chain, min and max
scan_chain_count : 400; // internal chains
input_channel_count : 8; // channels from pins or SSN
output_channel_count : 8;
Connections {
EdtChannelsIn(1) { port_pin_name : edt_ch_in[0]; } // where channel 1 connects
EdtChannelsOut(1) { port_pin_name : edt_ch_out[0]; }
// ... one per channel; omitted ones get default ports
}
}
}
}
Indexing: spec channel IDs count from 1 (EdtChannelsIn(1)), while bus bits count from 0 (edt_ch_in[0]). Chain i on the EDT side counts from 0 like the buses.
Processing this produces a SIB, a TDR, an OCC module, an EDT module (with ICL, PDL and TCD for each), a core_clk net that now goes through the OCC, and EDT channel ports on my_core.
Parameter reference: what you'll actually set
Not complete; these are the ones that come up in nearly every block. report_config_syntax gives the full list for your tool version.
IjtagNetwork
| Element / property | Meaning |
|---|---|
HostScanInterface(id) | Where the network is entered from: the block's IJTAG port, or a TAP at the chip. Its Interface wrapper maps signal roles to ports (tck : tck;). |
Tap(id) | A JTAG TAP controller (chip level). |
Sib(id) | Segment insertion bit: a 1-bit gate that splices the segment under it into the scan path when opened. Can nest. |
Tdr(id) | Test data register. DataOutPorts / DataInPorts (with count and connections) define its parallel outputs and inputs. |
ScanMux(id) | Selects between scan segments, with the select driven by a TDR bit. |
OCC
| Property | Meaning | Typical |
|---|---|---|
ijtag_host_interface | Which SIB the OCC's static controls attach to | Sib(occ) |
type | standard (selection + chopping + gating), parent (selection only), child (chopping + gating only) | standard in cores |
Controller(id)/clock_intercept_node | The net or pin where the clock is cut and the OCC inserted: the root of the domain, before the tree | clock port or PLL output |
capture_window_size | Condition bits in the OCC's shift register: the most capture pulses per pattern | default; smaller means fewer care bits |
shift_only_mode | Whether an inactive OCC still uses the slow clock for shift | on (needed for SSN) |
kill_clock_mode | Adds an input to block the fast clock when the OCC isn't active | off unless needed |
capture_trigger | capture_en for a free-running slow clock | LBIST flows |
include_clocks_in_icl_model | Puts the clocks in the OCC's ICL so IJTAG can inject TCK | on with SSN |
EDT
| Property | Meaning | How to choose |
|---|---|---|
ijtag_host_interface | SIB for the EDT's static controls (bypass, configuration, low power) | Sib(edt) |
Controller(id)/scan_chain_count | Number of internal chains | cells ÷ target chain length; see compression math |
input_channel_count, output_channel_count | Channels in and out; can differ | From pins or SSN bandwidth |
longest_chain_range | Min and max of the longest chain the EDT must support | Your target longest chain with room either side, for example ±10 to 20% (target 275 → 250, 300) |
Connections/EdtChannelsIn(n), EdtChannelsOut(n) | Where channel n connects (port_pin_name), plus optional PipelineStage wrappers | Pads' auxiliary pins at the chip; ports in a core |
Connections/mode_enables | DFT signal that selects this controller when a block has several (internal vs external) | DftSignal(int_edt_mode) |
ShiftPowerOptions | present : on; plus min_switching_threshold_percentage to build the low-power shift controller | When shift power is a limit |
SSN
| Element / property | Meaning |
|---|---|
ijtag_host_interface | SIB for the SSN nodes' configuration (Sib(ssn)) |
DataPath(id) | One bus through the block. Children are the nodes, in order along the bus. |
DataPath/output_bus_width | Bus width in bits (for example 32) |
ScanHost(id) | Node that unpacks this block's data for its EDT and generates its scan controls |
Pipeline(id) | Retiming stage on the bus, for timing between blocks |
Multiplexer(id) | Lets the bus bypass or select branches |
MemoryBist and BoundaryScan (pass 1)
| Path | Meaning |
|---|---|
MemoryBist/Controller(id)/Step/MemoryInterface(id) | One controller, its test steps, and one interface per memory. Grouping is decided here. |
.../MemoryInterface(id)/scan_bypass_logic | How the memory is bypassed in logic test (for example sync_mux) |
BoundaryScan/max_segment_length_for_logictest | Splits the boundary scan chain into segments that logic test can use as chains |
BoundaryScan/AuxiliaryInputOutputPorts | auxiliary_input_ports and auxiliary_output_ports: functional pins that can be shared as EDT channels |
The other two kinds of spec
- PatternsSpecification describes which ICL and instrument patterns to generate and simulate after insertion (ICL network verify, MBIST, SSN continuity).
create_patterns_specificationmakes the default;process_patterns_specificationwrites the testbenches. Same syntax:Patterns(name) { TestStep(name) { MemoryBist { ... } } }. - DefaultsSpecification changes defaults for every spec created afterwards, with
set_defaults_value, for exampleset_defaults_value DftSpecification/BoundaryScan/max_segment_length_for_logictest 100. Good for company-wide settings.
Interview questions
What's the difference between create_dft_specification and process_dft_specification? basic
Create builds a spec (data) in memory, filled with defaults from the design and your declarations. Process acts on it: validates, generates each instrument's RTL and description files, inserts them and rewires the design, and writes it all to the TSDB. You edit between the two.
How do you find out which properties an OCC controller supports? basic
report_config_syntax DftSpecification/OCC/Controller. It prints the legal child wrappers and properties with their defaults and allowed values for the tool version you're running.
What does ijtag_host_interface : Sib(edt) actually do? core
It says the EDT's static control inputs (bypass, configuration, low-power enable) should be driven from the IJTAG network under the SIB named edt. Processing creates the registers and connections, and the EDT's ICL and PDL describe them, so test setup can set them with an iCall instead of you wiring pins.
Why might you run process_dft_specification -no_insertion? core
To get the instrument (RTL, ICL, PDL, TCD) without letting Tessent edit your design, for example when RTL is owned by a team that instantiates IP through its own connectivity scripts. You then instantiate and wire it yourself and make sure the description files go with it to ATPG.
Notes: command, signal and file names follow Tessent Shell conventions. Property names shown are common ones; check report_config_syntax for your version. Scripts use generic names and need adapting to your design.
Instruments as RTL: ports, connections, and inserting by hand
An instrument is just a Verilog module with a known job. This page shows what EDT, OCC, SSN ScanHost and TDR modules look like from the outside, where each port has to connect, and what you need to hand Tessent so ATPG works when the instrument was instantiated by your own scripts instead of by the tool.
60-second answer: "how do you insert EDT by hand and still run Tessent ATPG?"
Generate the EDT IP with Tessent, from a spec with process_dft_specification -no_insertion or with write_edt_files. That gives the RTL plus its ICL, PDL and TCD. Instantiate the module in your RTL and connect it: channels to pins or the SSN ScanHost, edt_clock to a gated copy of the test clock, edt_update and scan enable to their sources, static controls to a TDR or pins, and the chain-side buses to the first and last cell of each chain after stitching. Synthesis must keep the EDT hierarchy and port names. For ATPG, read the netlist and library, read the EDT's TCD with read_core_descriptions, bind it with add_core_instances and give its parameters (for example edt_bypass off), declare clocks, give the test procedures, and if static controls go through IJTAG, read the ICL and PDL and extract the network. Then K19 and K22 in DRC tell you whether your hand wiring matches what the TCD says.
EDT controller
- Two sides. The channel side (few wide signals: channels, clock, update) faces pins or an SSN host. The chain side (many signals: one input and one output per internal chain) faces the scan cells.
edt_clockis its own clock, pulsed with the shift clock and off in capture. Don't tie it to a functional clock that also clocks scan cells.edt_updateis high for one EDT clock pulse before each load. It's dynamic, so it needs a real source (pin or SSN host), not a TDR bit.- Chain-side order matters. Chain i of the decompressor must reach the chain the TCD calls chain i, and that same chain's last cell must return to compactor input i. Swaps show up as K19 or K22 failures.
- Inversions. If a pad or buffer inverts a channel or control between the pin and the EDT, the IP has to know (it's an option when the IP is created).
OCC
| Port | Connects to | Note |
|---|---|---|
fast_clock | Functional clock source (PLL output, clock port) | The OCC sits at the root of the clock tree |
slow_clock | Shift/capture clock (gated test clock, or from SSN host) | Must not clock any functional flop directly |
clock_out | The clock tree that used to hang off the functional clock | Replaces the original net |
scan_en | Same scan enable as the chains | Resynchronized inside to the fast clock |
scan_in, scan_out | Stitched into a scan chain like any segment | The condition bits; a few cells long |
test_mode, fast_capture_mode (and others) | TDR bits via IJTAG, or pins | Static for a pattern set |
| Operation | test_mode | fast_capture_mode | clock_out carries |
|---|---|---|---|
| Functional (mission mode) | 0 | don't care | the fast clock, straight through |
Shift (any pattern type, scan_en=1) | 1 | don't care | the slow clock |
| Slow capture (stuck-at) | 1 | 0 | slow-clock pulses, as many as the condition bits say |
| Fast capture (transition) | 1 | 1 | fast-clock pulses, as many as the condition bits say |
For ATPG you declare the clocks at their sources, not at clock_out: the test clock at its pin with add_clocks, and the functional or PLL clock as a free-running (pulse-always) reference with its period. The OCC's description (TCD) tells the tool that clock_out is a controlled internal clock whose pulses come from the condition bits.
The full behavior is on the pass 2 page. For hand insertion the key point: the OCC has an embedded scan segment, so whoever stitches must include it, and ATPG must know it's an OCC (from its TCD) to load the condition bits.
SSN ScanHost
- Bus side:
ssn_bus_data_in,ssn_bus_data_out(passing through to the next block), andssn_bus_clock. - Core side: EDT channels in and out, plus locally generated scan enable, EDT update and the EDT and shift/capture clocks. In an SSN block those signals don't come from pins at all.
- Configuration (which bits of each packet belong to this block, on or off this test) comes through IJTAG, so the host also has an IJTAG port and an ICL description.
- OCC requirement: each block's OCCs need clock injection and shift-only mode, so shift can run from the host's clock.
- In a spec, put the SSN and EDT wrappers in the same DftSpecification; the tool connects the EDT channels to the ScanHost itself and doesn't create the block-level scan-signal ports:
SSN { ijtag_host_interface : Sib(ssn); DataPath(main) { output_bus_width : 32; // bus bits; a pin budget, also limits how many blocks run at once Pipeline(in) { } // retiming before the host ScanHost(1) { } // this block's host Pipeline(out) { } } } EDT { ijtag_host_interface : Sib(edt); Controller(c1) { ... } } - For ATPG, almost nothing changes: you don't bind the ScanHost (DRC finds it by tracing from the EDT), you give the bus clock and shift clock periods (
set_load_unload_timing_options) and the IJTAG TCK period, and the tool builds the load/unload procedures itself and maps the EDT channel data into bus packets when patterns are written. A validated ICL model of the block is required. - More on packets and bandwidth is on the SSN page.
TDRs and SIBs
A TDR is a shift register on the IJTAG network with a parallel output register that only changes on update. Its outputs drive static controls: ltest_en, wrapper mode bits, EDT bypass, OCC test mode. A SIB is a one-bit TDR whose value decides whether a segment below it is in the scan path. Both have the same IJTAG port set: ijtag_si, ijtag_so, ijtag_tck, ijtag_reset, and select, shift-enable, capture-enable and update-enable. If your flow uses hand-written control registers (memory-mapped or behind a TAP), the job is the same; you just describe them in ICL so test setup can reach them. The IJTAG plumbing page has an ICL example.
Clocks and dynamic controls in a hand flow
When Tessent inserts EDT and OCC, it also builds the test clocks with add_dft_signals edt_clock shift_capture_clock -create_from_other_signals. By hand you build them yourself, usually from library clock-gating (ICG) cells on a dedicated test clock. One common arrangement:
| Signal | Built from | Must do |
|---|---|---|
test_clock | Dedicated pin (or TCK) | Not shared with a functional clock that drives scan cells |
shift_capture_clock (OCC slow_clock) | test_clock through an ICG enabled by the logic-test mode (ltest_en) | Pulse in shift and slow capture; off in mission mode |
edt_clock | test_clock through an ICG whose enable is high in shift and in the update cycle and low in capture; scan_en (which is high in both) is a common choice, qualified by test mode | Never pulse in capture; don't clock scan cells |
edt_update | Pin (tester drives it) | High only in the one update cycle before each load |
scan_en | Pin, optionally pipelined | Reach every cell, EDT and OCC; settle before capture |
Use ICG cells embedded the Type-A way (the clock's off state reaches the gater uninverted), or ATPG will report C1 and T3 problems; see the DRC page.
Static controls without Tessent insertion
ATPG doesn't need to know that "TDR bit 3 is int_mode". It needs test_setup to put the right values on the right nets, and then it simply simulates test_setup and sees the resulting constants. With IJTAG that works like this:
- Describe each control register in ICL, naming its outputs (for example
DataOutPort int_mode { Source R[3]; }). Tessent-generated EDT and OCC IP already come with ICL. - Write a PDL setup iProc per register, writing those outputs by name (
iWrite int_mode 1). - Build the block's top-level ICL by extraction: in
patterns -ijtag, read the netlist and all instrument ICL,set_current_design, go to analysis,write_icl. The tool traces how your registers connect to the block's IJTAG port. - Call the iProcs from test_setup in ATPG with
set_test_setup_icall(oriCalllines inside the test_setup procedure). The tool retargets them to shifts at the block's IJTAG port and simulates them before DRC.
# step 3: top-level ICL by extraction (once per netlist)
set_context patterns -ijtag
read_cell_library ../lib/tessent/stdcells.tcelllib
read_verilog ../netlist/my_core_scan.vg
read_icl ../ip/ctl_tdr.icl ../ip/my_core_edt_c1.icl ../ip/my_occ.icl
set_current_design my_core
set_system_mode analysis ;# extraction + I-rule checks happen here
write_icl -output_file my_core.icl -replace
# step 4: in the ATPG run (setup mode)
read_icl my_core.icl ../ip/ctl_tdr.icl ../ip/my_core_edt_c1.icl ../ip/my_occ.icl
dofile ../ip/ctl_tdr.pdl
dofile ../ip/my_core_edt_c1.pdl
set_test_setup_icall {u_ctl.setup ltest_en 1 int_mode 1} -append
set_test_setup_icall {u_edt.setup edt_bypass off} -append
If your static controls are plain pins or memory-mapped registers without IJTAG, the old way still works: force the pins in the test_setup procedure's cycles (or constrain them with add_input_constraints), and for registers, write the register-access sequence as cycles in test_setup.
Inserting by hand: the steps
extract_icl, DRC and simulation.- Get the IP. From a spec (
process_dft_specification -no_insertion) or, for EDT on an existing netlist, thedft -edtcontext andwrite_edt_files. You get the RTL, ICL, PDL and TCD (and, forwrite_edt_files, a synthesis script and legacy dofiles). - Instantiate and connect. Your connectivity tool or scripts. Keep the generated module and port names; descriptions refer to them.
- Synthesize with the hierarchy kept. Don't flatten or ungroup the instrument, don't let boundary optimization rename ports. A flattened EDT can still be used but needs extra mapping, and diagnostics get worse.
- Stitch to the EDT. The stitching step connects chain i to the decompressor output i and compactor input i, and includes the OCC segments.
- Describe for ATPG. Read the TCDs, bind them to instances, give procedures and clocks, read ICL/PDL and extract the network if IJTAG is used.
- Prove it. DRC (K19, K22, trace and clock rules), the ICL verify patterns if there's a network, then a few serial patterns in simulation.
# ---- generating EDT IP without inserting it (from a spec)
set_context dft -rtl -design_id rtl2 ;# the ID only labels where the IP lands in the TSDB
read_verilog -f rtl.f
set_current_design my_core
set_design_level physical_block
add_dft_signals scan_en edt_update test_clock -source_nodes {scan_en edt_update test_clock}
check_design_rules
set spec [create_dft_specification -sri_sib_list {edt}]
read_config_data -in $spec -from_string {
EDT { ijtag_host_interface : Sib(edt);
Controller(c1) { scan_chain_count : 400; input_channel_count : 8;
output_channel_count : 8; longest_chain_range : 250, 300; } }
}
process_dft_specification -no_insertion ;# IP lands in tsdb .../instruments/
# -no_insertion: every element in the spec is generated, including the
# SIB(edt) and any TDR from -sri_sib_list, but nothing is instantiated.
# Instantiate them too, or drop -sri_sib_list and drive the EDT static
# inputs from your own registers (then describe those in ICL).
# Generating only EDT needs no add_clocks; add OCCs and you declare their
# clocks and set_dft_specification_requirements -logic_test on.
# ---- see "ATPG setup" below for the full ATPG run
ATPG setup for a hand-inserted EDT and OCC
What each description supplies, so you know what's left to write:
| Item | Comes from |
|---|---|
| EDT structure, channels, configurations, its control values, the update pulse and initialization cycles in load_unload | The EDT's TCD (bound with add_core_instances) |
| Internal chains (EDT to first cell, last cell to EDT) | Traced by DRC from the EDT ports; no add_scan_chains needed in this flow |
| OCC condition-bit segment and controlled clock | The OCC's TCD (generated with Tessent IP, or written for a third-party OCC as shown below) |
| Clocks at pins, timeplates, shift and basic load_unload, any pin forces in test_setup | You: dofile and test procedure file |
| Static control values | You: iCalls (or pin forces) as above |
set_context patterns -scan
read_cell_library ../lib/tessent/stdcells.tcelllib
read_verilog ../netlist/my_core_scan.vg
set_current_design my_core
set_current_mode int_sa
# instrument descriptions
read_core_descriptions ../ip/my_core_edt_c1.tcd ../ip/my_occ.tcd
add_core_instances -core my_core_edt_c1 -modules my_core_edt_c1 \
-parameter_values {edt_bypass off}
add_core_instances -core my_occ -modules my_occ
read_icl my_core.icl ../ip/ctl_tdr.icl ../ip/my_core_edt_c1.icl ../ip/my_occ.icl
dofile ../ip/ctl_tdr.pdl
set_test_setup_icall {u_ctl.setup ltest_en 1 int_mode 1} -append
# clocks and procedures
add_clocks 0 test_clock
add_clocks core_clk -pulse_always -period 1.25ns ;# OCC fast clock reference
set_procfile_name ../atpg/my_core.testproc
check_design_rules ;# K19/K22 check your EDT wiring
report_edt_configurations
report_procedures ;# the procedures as the tool completed them
create_patterns
write_patterns pat/int_sa_par.v -verilog -parallel -replace
A minimal test procedure file to start from (timing values illustrative; with explicit scan groups, add a scan_group line to shift and load_unload; the EDT's update and initialization cycles are added from its TCD, so check report_procedures to see the final version):
set time scale 1.000000 ns ;
timeplate tp =
force_pi 0 ;
measure_po 10 ;
pulse test_clock 40 20 ;
period 100 ;
end;
procedure test_setup =
timeplate tp ;
iReset ; // reset the IJTAG network first
cycle =
force scan_en 0 ;
force edt_update 0 ;
end;
end; // iCalls from set_test_setup_icall go after this
procedure shift =
timeplate tp ;
cycle =
force_sci ;
measure_sco ;
pulse test_clock ;
end;
end;
procedure load_unload =
timeplate tp ;
cycle =
force scan_en 1 ;
end;
apply shift 300 ; // longest chain; EDT extra cycles added by the tool
end;
write_edt_files -rtl_prefix for the EDT-context flow) rather than editing generated files. TCD files shouldn't be edited by hand.The description files, compared
| File | Describes | ATPG uses it for | For hand-written instruments |
|---|---|---|---|
| ICL | The instrument's IJTAG ports and registers | Finding the path to each static control; test setup | Write one (IEEE 1687 syntax) |
| PDL | How to operate it: iProcs like setup | The iCalls in test_setup | Write one |
| TCD | Scan behavior: embedded chain segments, clocks, EDT configuration | Mapping chains, EDT, OCC condition bits; generating procedures | For a simple segment, a small Core(...) { Scan { ... } } block |
| Test procedure file | Timeplates and procedures: test_setup, load_unload, shift, capture | Every pattern's waveforms | Usually in-house generated |
For a hand-written instrument with an embedded scan segment, such as a third-party OCC, a minimal TCD scan description looks like this (names illustrative):
Core(my_occ) {
Scan {
module_type : occ;
is_hard_module : 1; // don't look inside, trust this description
Clock(slow_clock) { off_state : 1'b0; }
ClockOut(u_out_mux/y) { // where the controlled clock leaves
slow_clock_input : slow_clock;
fast_clock_input : fast_clock;
}
ScanEn(scan_en) { active_polarity : 1'b1; }
ScanChain { // the condition-bit segment
length : 4;
scan_in_port : scan_in;
scan_out_port : scan_out;
scan_in_clock : slow_clock;
scan_out_clock : ~slow_clock;
}
}
}
Keep the ICL, PDL and Verilog of such a module side by side with the same base name; Tessent can pick them up automatically when it reads the Verilog.
Connection checklist for a hand-inserted EDT
| Check | Caught by |
|---|---|
| Each channel reaches its pin or host bit, in order, with any inversion declared | K19 / K22, simulation |
edt_clock pulses in shift and update, off in capture, doesn't clock scan cells | K19, D1, simulation |
edt_update high only in the update cycle | K19 (later patterns fail) |
| Chain i: decompressor out i → first cell, last cell → compactor in i | K19 (input side), K22 (output side) |
| Static controls reachable and set by test setup | I rules in ICL extraction, ICL verify sim, K19 |
| Lockups between EDT clock and chain clocks where needed | Shift-mode STA (hold), serial sim |
| Hierarchy and port names kept through synthesis | K19-K22 can't find the EDT; TCD binding fails |
| Internal chain pins not shared with functional pins | Low coverage warnings |
Interview questions
What does the EDT's TCD contain, and why does ATPG need it? core
The configuration of that EDT IP: channel and chain counts, decompressor and compactor structure, control signals and their active values, and its configurations (bypass, low power and so on). With it, the tool can trace how the IP connects to the chip, adjust the test procedures (update pulse, initialization cycles) and generate compressed patterns without you writing EDT-specific setup by hand.
Why can't edt_update be a TDR bit? basic
It changes inside every pattern: high for the update cycle before each load, low for shift and capture. A TDR bit only changes through an IJTAG scan and update, which can't happen cycle by cycle during scan test. Static controls like bypass can be TDR bits; update can't.
You hand-instantiated an EDT and DRC fails K19 on every chain. First three checks? deep
The control signals in the load_unload simulation (set_gate_report drc_pattern load_unload): is edt_clock pulsing, is edt_update high only in the update cycle, is bypass at its off value. Then the channel connections and any inversion between pin and EDT. Then whether the EDT instance found in the netlist is the one the TCD describes (module name, ports kept through synthesis). Chain-specific failures would point at the chain-side wiring instead.
What changes in the block's ports when you go from pin-based EDT to SSN? core
The per-block channel pins and the dynamic scan signals disappear from the block boundary. The block gets the SSN bus in and out and the bus clock; the ScanHost inside drives the EDT channels and generates scan enable, EDT update and the shift clocks. Configuration goes through IJTAG. The EDT itself is unchanged.
Notes: command, signal and file names follow Tessent Shell conventions. Port names are generic defaults; generated IP carries a design prefix. Scripts use generic names and need adapting to your design.
The partition flow, end to end
How a block goes from RTL to retargetable patterns in Tessent Shell: what runs in which order, what each run reads and writes, and why the flow is split the way it is. The rest of this section takes one wrapped partition through every step, so read this page first and come back to it as a map.
60-second answer: "walk me through DFT on a block in Tessent"
For a wrapped partition it's a bottom-up flow with two DFT insertion passes on RTL, one synthesis, then scan insertion and ATPG on the netlist. Pass one inserts MemoryBIST and builds the IJTAG network around it. Pass two adds the DFT signals, an OCC per functional clock and the EDT controller, runs pre-DFT DRC, extracts ICL and simulates the ICL patterns. Then you synthesize everything once, using the SDC that Tessent generated. Scan insertion on the netlist does wrapper analysis and stitches two scan modes: an internal mode where every cell goes through EDT, and an external mode with only the wrapper chains. Finally I build the graybox, run extest ATPG on it, run intest stuck-at and transition ATPG on the full block, and store everything in the block's TSDB. The parent opens that TSDB, uses the graybox for its own logic, and retargets the intest patterns.
Vocabulary you need first
- Physical block
- A synthesis and layout region that survives to tapeout.
set_design_level physical_block. Gets its own TSDB, its own EDT and OCCs, and usually a wrapper. - Sub-block
- A module that gets DFT instruments (MBIST, pre-DFT fixes) but is synthesized and scan-inserted with its parent.
set_design_level sub_block. - Chip
- The top physical block: pads, TAP, boundary scan, PLLs, the TAM.
set_design_level chip. - Wrapped core
- A physical block with wrapper cells, so its internal patterns don't depend on what surrounds it. Required for pattern retargeting.
- TSDB
- Tessent Shell Data Base: a directory where every step writes its outputs and the next step reads them. One per physical block.
- Design ID
- The label for one insertion pass inside the TSDB. The usual names are
rtl1,rtl2,gate(orgate1,gate2,gate3when you start from a netlist). - DftSpecification
- A configuration-data tree describing what to insert.
create_dft_specificationbuilds a default one, you edit it,process_dft_specificationgenerates and inserts the RTL. - ICL / PDL
- IEEE 1687 descriptions of the IJTAG network (ICL) and of how to operate each instrument (PDL). Tessent writes both for everything it inserts.
- TCD
- Tessent Core Description: what a later step needs to know about an instrument or a core (EDT configuration, scan modes, clocks).
import_scan_modereads it so you don't re-describe chains by hand. - Graybox
- A reduced view of a wrapped core: wrapper chains, the logic between them and the ports, and the IJTAG network. What the parent loads instead of the full netlist.
The steps
| Step | Context | Reads | Writes | Sign-off check before moving on |
|---|---|---|---|---|
| 1-2. Pass 1 | dft -rtl, ID rtl1 | RTL, memory library (TCD memory files), cell library | MBIST RTL, IJTAG network, ICL/PDL, edited RTL | MBIST and ICL testbenches pass in RTL simulation |
| 3. Pass 2 | dft -rtl, ID rtl2 | read_design -design_id rtl1 | DFT signals and TDRs, OCC and EDT RTL, ICL, SDC, synthesis load script | Pre-DFT DRC clean (DFT_C rules), ICL extraction clean (I rules), ICL patterns pass |
| 4. Synthesis | DC or Genus | Script from write_design_import_script, Tessent SDC | Gate netlist | DFT instances preserved, no SDC errors from the Tessent procs |
| 5. Scan insertion | dft -scan, ID gate | Netlist + read_design -design_id rtl2 -no_hdl | Scan-stitched netlist, scan modes, TCD | Scan DRC clean, chain lengths as planned, ICL verify patterns pass on the netlist |
| 6. Graybox | patterns -scan | ID gate, import_scan_mode ext_mode | Graybox view under ID gate | DRC clean in external mode |
| 7. ATPG | patterns -scan | Full view (intest) and graybox (extest) | PatDB, fault lists, flat models, testbenches | Coverage targets met, parallel and a few serial patterns simulate clean |
| 8. Parent | Parent's own dft/patterns runs | open_tsdb on the core's TSDB, graybox view | Parent DFT, retargeted patterns | Retargeted patterns simulate at the parent level |
rtl2 contains everything from rtl1 plus what pass 2 added. Each later step loads the previous ID with read_design, which also loads that step's ICL, PDL and TCD. In the scan step, -no_hdl loads that collateral but not the RTL, because the synthesized netlist replaces it.What ends up inside the partition
test_clock, scan_en, edt_update, channels), the functional clock that the OCC intercepts, and the IJTAG port that reaches every static control. Static DFT signals such as int_ltest_en or memory_bypass_en are TDR bits, not pins. The IJTAG network topology here is simplified; the exact SIB arrangement depends on your DftSpecification.Three groups of test ports reach the partition boundary:
- Dynamic scan signals, which change during a pattern:
test_clock,scan_en,edt_update, and the EDT channels. In a wrapped core the tool creates ports for them if they don't exist. In an SSN flow a ScanHost drives them locally instead. - Functional clocks, each intercepted by an OCC. The core's patterns then carry their own clock control, which is what makes them retargetable.
- The IJTAG port, which reaches every static control: the TDR holding the static DFT signals, the EDT and OCC configuration, and the MBIST BAP.
Why two passes, and why in that order
- Pass 2 needs to see what pass 1 added. MBIST controllers and interfaces are logic too. They get scan-tested by the EDT inserted in pass 2, so the flop count that sizes the EDT (and the DRC that checks their clocks and resets) has to include them.
- Pass 2 checks pass 1 for rule compliance. The second pass runs pre-DFT DRC on everything, including the MBIST logic, against the DFT signals you just defined. Problems found here would otherwise surface as coverage loss in ATPG.
- One synthesis. On RTL you insert both passes and synthesize once. If you only have a netlist, you synthesize the inserted RTL after each pass (design IDs
gate1,gate2), then scan-insert asgate3. - Boundary scan only at the chip. For a core, pass 1 is just MBIST, unless the core contains pad cells (the embedded boundary scan case).
set_tsdb_output_directory in a later run. The tool then writes a fresh tsdb_outdir in the current directory, and the next step can't find the previous design ID. Either set the same directory in every run of the block, or open_tsdb the one you used before.A run layout that scales
my_core/
1.mbist/ run_pass1.tcl # dft -rtl, design_id rtl1
2.edt_occ/ run_pass2.tcl # dft -rtl, design_id rtl2
3.synth/ run_dc.tcl # sources the script written by pass 2
4.scan/ run_scan.tcl # dft -scan, design_id gate
5.atpg/ run_graybox.tcl run_ext_sa.tcl run_int_sa.tcl run_int_tdf.tcl
6.signoff/ run_icl_verify.tcl run_mbist_gate.tcl
tsdb_core/ # every run points here
One directory per step, each with one dofile, all pointing at the same TSDB. That way a failed step is rerun alone, sibling blocks run in parallel without touching each other's data, and the parent only needs one path per child: its tsdb_core.
Plan top-down, implement bottom-up
Insertion order is forced: a parent can't be done until its children are. But the choices inside each child depend on the chip, so they're made top-down first.
- Count pins. How many chip pins can carry scan channels, and how many tester channels you have. Use the smaller number.
- Pick the test clock. A dedicated test clock (or TCK) that doesn't share a functional clock port. Tessent derives
edt_clockandshift_capture_clockfrom it. - Plan the OCCs. Which functional clocks each core has, and which OCC type: standard in the core is the default recommendation; parent and child OCCs are for clock meshes or when a clock mux isn't allowed in the core.
- Size each core's EDT. Channels per core from its size and pattern count, ideally with
analyze_compressionon a scan-stitched netlist. - Schedule the cores. Group identical cores (they can share broadcast inputs), group cores with similar channel needs, test the hungriest alone. Fix internal chain length to the same value across cores you'll run together so their shift lengths match.
- Decide external mode and the TAM. How each core's wrapper chains connect at the parent, and which pins go to which core in each retargeting mode.
Interview questions
Why is DFT inserted in two passes instead of one? core
Because the logic-test hardware in the second pass has to cover the instruments from the first. MBIST controllers and interfaces add flops that EDT must test, and their clocks and resets must pass the pre-DFT DRC that runs in pass 2 against the new DFT signals. Inserting MBIST first gives an accurate flop count for sizing EDT and lets the tool check MBIST's rule compliance before synthesis.
What's a design ID and why does the scan step read rtl2 with -no_hdl? basic
A design ID labels one insertion pass in the TSDB and holds that pass's design and collateral (ICL, PDL, TCD, DFT signals). They're cumulative, so rtl2 includes rtl1. In the scan step the design comes from the synthesized netlist, so read_design ... -design_id rtl2 -no_hdl loads the collateral from pass 2 without the RTL.
What has to exist in a core before its patterns can be retargeted to the chip? core
Wrapper cells so the internal test doesn't depend on the core's surroundings, OCCs inside the core so the patterns carry their own capture clocking, and a test setup that the parent can reproduce through IJTAG. Then the core's intest patterns, stored in its TSDB, can be mapped to chip pins through the TAM without regenerating them.
Your core has 2 million flops and the chip gives it 4 scan pins. What do you look at? deep
Whether 4 pins means 2 in and 2 out or 4 shared, the compression that implies, and the resulting shift length and test time. At 2M flops, even with a high chain:channel ratio the internal chains are long, so I'd check test time against the budget, whether SSN or a TAM schedule can give the core more bandwidth when it runs, whether channel pipelines are needed for routing, and run analyze_compression to see where coverage starts to drop. If the numbers don't work, the answer is at the chip level: more pins in that core's retargeting mode, or running it alone.
Why should every core you test in parallel have the same internal chain length? core
Retargeted patterns from cores run together are merged cycle by cycle at the chip pins. If one core needs 300 shift cycles and another 200, the shorter one is padded to 300, which wastes test time. Fixing the chain length when the cores are built avoids the padding.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
Tessent Shell and the Tcl you actually write
Every step in the flow is a dofile: plain Tcl plus Tessent commands. Most of what looks hard in a Tessent script is three things: the context and system mode you're in, how to find design objects (introspection), and how to read and edit configuration data like the DftSpecification. This page covers those, with the idioms that show up in every real flow.
60-second answer: "how is a Tessent Shell run structured?"
You start the shell, pick a context with set_context (for example dft -rtl to insert hardware, dft -scan for scan insertion, patterns -scan for ATPG), and you're in setup mode. There you read libraries and the design, set the design level, and declare clocks, DFT signals and constraints. check_design_rules flattens the design and runs DRC; if it passes you're in analysis mode, where you create and process specifications, insert test logic or generate patterns, and write results to the TSDB. Everything in between is Tcl: design objects come back as collections that you filter and iterate, and the specification is a tree you edit with read_config_data, set_config_value and add_config_element.
Contexts and system modes
check_design_rules (or set_system_mode analysis) flattens the design and runs DRC; only a clean DRC moves you to analysis mode, where specs are processed, test logic inserted or patterns created. A failing DRC leaves you in setup, which is why scripts that ignore the DRC result fail later with confusing errors.| Context | Used for | Typical design ID |
|---|---|---|
set_context dft -rtl | Pass 1 and pass 2 on RTL: MBIST, boundary scan, IJTAG network, OCC, EDT, DFT signals | rtl1, rtl2 |
set_context dft -no_rtl | Same insertions on a gate-level netlist (synthesize after each pass) | gate1, gate2 |
set_context dft -scan | Scan and wrapper insertion, test points, scan modes | gate (or gate3) |
set_context dft -edt | EDT IP creation from an existing scan-stitched netlist (the chains already exist, so the tool reads them). Use it when scan was stitched elsewhere; use a spec in dft -rtl when EDT goes in before stitching. | n/a |
set_context patterns -scan | ATPG, fault simulation, graybox creation, retargeting, compression analysis | reads gate |
set_context patterns -ijtag | ICL/PDL retargeting, MBIST and ICL network sign-off simulations on any view | reads any |
set_context dft -rtl -design_id rtl2 tells the tool which ID the run will write. read_design <name> -design_id rtl1 says which one it reads. Mixing those two up is the most common reason a pass "loses" the previous pass's hardware.A dofile skeleton you can reuse
Almost every run has the same five sections. The differences between passes are in sections 3 and 4.
# ---- 1. context and database
set_context dft -rtl -design_id rtl2
set_tsdb_output_directory ../tsdb_core
# ---- 2. libraries and design
read_cell_library ../lib/tessent/stdcells.tcelllib
read_design my_core -design_id rtl1 ;# previous pass: RTL + ICL/PDL/TCD
set_current_design my_core ;# elaborate; missing modules show here
# ---- 3. setup-mode declarations
add_dft_signals ltest_en -create_with_tdr
add_clocks 0 core_clk -period 1.25ns
set_dft_specification_requirements -logic_test on
# ---- 4. DRC, then analysis-mode work
check_design_rules ;# setup -> analysis only if clean
set spec [create_dft_specification -sri_sib_list {edt occ}]
# ... edit $spec ...
process_dft_specification
extract_icl
# ---- 5. sign-off for this step
create_patterns_specification
process_patterns_specification
set_simulation_library_sources -v ../lib/verilog/stdcells.v
run_testbench_simulations
check_testbench_simulations -report_status
exit
check_design_rules as a report. It's a mode transition. With DRC errors the tool stays in setup mode. A dofile stops at the first command error by default, but if you've turned that off or you're typing interactively, the next command that needs analysis mode (create_dft_specification, insert_test_logic, create_patterns) fails with a message that doesn't mention the DRC. Read the DRC summary before anything else.Introspection: finding things in the design
Commands like get_ports, get_pins, get_instances, get_modules and get_icl_instances return collections, not Tcl lists. You pass collections to other commands directly, iterate them with foreach_in_collection, count them with sizeof_collection, and turn them into names with get_name_list (or get_single_name for exactly one).
# every port whose name looks like an EDT channel
set chan_ports [get_ports *_edt_channels_*]
puts "[sizeof_collection $chan_ports] channel ports"
# all instances of a module, anywhere below the current design
set occs [get_instances -of_module *_tessent_occ* -hierarchical -silent]
foreach_in_collection occ $occs {
puts [get_single_name $occ]
}
# attributes: ask for one by name
get_attribute_value_list [get_instances u_ctrl] -name module_name
# filter a collection by attribute
set ands [filter_collection [get_instances -hierarchical *] {module_name == "AND2"}]
# trace connectivity
puts [get_name_list [get_fanins u_mem/CLK]]
puts [get_name_list [get_fanouts u_mem/CE -stop_on net]]
# from an inserted instrument's ICL instance to its design instance
set edt_inst [get_instances -of_icl_instances \
[get_icl_instances -filter tessent_instrument_type==mentor::edt]]
extract_icl or read_icl) are separate. The -of_icl_instances and -of_instances options cross between them. That last line above is how scan insertion finds the EDT controller to hook chains onto, without hard-coding its generated name.Configuration data: the spec is a tree
If "spec" is a new word, read What a spec is first; this section only covers how to edit one from Tcl.
The DftSpecification (what to insert) and the PatternsSpecification (what to simulate or write) are configuration-data trees, written in a brace syntax. You rarely write one from scratch. You let create_dft_specification build the default and change only what you need.
set spec [create_dft_specification -sri_sib_list {edt occ}]
report_config_data $spec ;# what the tool proposes
# what properties exist under a wrapper, with defaults and legal values
report_config_syntax DftSpecification/EDT
report_config_syntax DftSpecification/OCC/Controller
# 1) paste a block of syntax into a wrapper
read_config_data -in $spec -from_string {
EDT {
ijtag_host_interface : Sib(edt);
Controller(c1) {
longest_chain_range : 250, 300;
scan_chain_count : 400;
input_channel_count : 8;
output_channel_count : 8;
}
}
}
# 2) add one element per clock, computed in Tcl
foreach {id clk} {core core_clk io io_clk} {
set occ [add_config_element OCC/Controller($id) -in $spec]
set_config_value clock_intercept_node -in $occ $clk
}
# 3) set one property by path
set_config_value $spec/EDT/Controller(c1)/scan_chain_count 420
process_dft_specification -validate_only ;# catches spec errors before any edit
process_dft_specification
Which of the three edit styles to use is about where the value comes from. Fixed decisions read best as a pasted block. Anything per clock, per memory or per port is a loop. Single overrides of a default are one set_config_value. For defaults that should apply to every spec you create (for example the boundary scan segment length), set_defaults_value before create_dft_specification keeps the dofile short.
Idioms that save time
- Make batch runs fail loudly. Put
set_tcl_shell_options -abort_dofile_on_error exitat the top of the dofile. Any command error then ends the session with a non-zero exit code, so the shell script or regression system that launched it sees the failure. Usecatch_outputaround a command you expect might fail and want to handle yourself. - Run tool commands with
dofile, Tcl procs withsource.dofiletranscripts every command to the log and honors the abort setting;sourcedoes neither, so keep it for files that only define procs and variables. - Report before and after.
report_dft_signals,report_clocks,report_config_data,report_scan_chains,report_statistics -detail. Redirect to files (report_scan_cells > scan_cells.rpt) so diffs between runs are easy. - Discover syntax in the tool. Tab completion works on commands, options and config paths, and
report_config_syntaxanswers "what can I set here" without leaving the tool. - Keep names out of scripts. Generated instance names include the design name and ID. Find them by type (
tessent_instrument_type,-of_module *_edt_*) so the same script works on every block. - Debug DRC in the GUI.
analyze_drc_violation <id>opens Tessent Visualizer on the violating gates with the simulated values from the failing procedure. - One concern per dofile. Don't generate graybox, extest and intest patterns in one run. Each gets its own run, mode name and log, and a failure costs one rerun.
Interview questions
What's the difference between setup and analysis mode? basic
Setup mode is for loading and declaring: libraries, design, clocks, DFT signals, constraints, black boxes. Leaving it (with check_design_rules or set_system_mode analysis) flattens the design and runs DRC. Only a clean DRC lands you in analysis mode, where you process specifications, insert test logic or generate patterns. You can go back with set_system_mode setup to change declarations.
How would you find every OCC instance in a netlist and print its clock input? core
Get the instances by module pattern (or by ICL instrument type), iterate, and trace the fan-in of the clock pin: foreach_in_collection o [get_instances -of_module *occ* -hierarchical] { puts "[get_single_name $o]: [get_name_list [get_fanins [get_single_name $o]/fast_clock]]" }. The exact pin name depends on the generated module, so I'd check one instance with report_attributes first.
Why not hard-code the EDT instance name in the scan insertion script? core
The generated name includes the design name, the design ID and the controller ID, so it changes per block and when you rename an insertion pass. Looking it up by instrument type through the ICL model keeps the script reusable across blocks.
How do you change one property of a generated DftSpecification? basic
set_config_value with the path to the property, for example set_config_value $spec/EDT/Controller(c1)/input_channel_count 6. To add a new element, such as another OCC controller, use add_config_element. process_dft_specification -validate_only checks the result before anything is inserted.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
Pass 1: MemoryBIST
The first insertion pass on a core puts BIST on its memories and builds the IJTAG network that will later reach everything else. This page covers what the tool needs to find and test the memories, what it inserts, how memories behave once logic test starts, and how you sign the pass off.
60-second answer: "what happens in the MBIST pass?"
I read the RTL plus a library file for every memory type, set the design level to physical_block, turn on -memory_test in the DFT requirements, and declare the functional clocks that reach the memories. DRC checks that each memory has a defined clock and a library model. create_dft_specification then groups memories into controllers, mostly by clock domain, and I review that grouping before process_dft_specification inserts the controllers, one interface per memory, the BIST access port, and the SIBs that connect it all to the IJTAG port. extract_icl writes the ICL for the block, and I generate and simulate the MBIST patterns at RTL. Later in the flow the same patterns are simulated again on the scan-inserted netlist before the block is signed off.
What the tool needs
- A memory library file per memory type, read with
set_design_sources -format tcd_memory(directory and extension). It describes ports and their functions, address and data widths, read and write timing in cycles, and which algorithms apply. A memory without one isn't recognized as a memory, so it gets no BIST. - The memory Verilog models, for elaboration and simulation.
- Clocks:
add_clocksfor each functional clock that reaches a memory, with its period. The controller runs at that clock; a memory whose clock DRC can't trace can't be assigned to one. - Design level:
physical_blockfor a core (it stays so in later passes),chipat the top, where boundary scan is also inserted in this pass.
What gets inserted
memory_bypass_en so the logic around it, the shadow logic, stays testable.| Block | What it does | Grouping rule of thumb |
|---|---|---|
| Controller | Runs the algorithm: address and data generation, operation sequencing, compare control, pass/fail and optional diagnosis or repair data | One per clock domain (and power domain), split further by distance or memory count to help timing and power |
| Interface (per memory) | Muxes the controller's access in place of functional access, compares read data, may register signals to ease timing | Placed next to its memory |
| BIST access port (BAP) | IJTAG client holding setup and status registers for the controllers | One per group, on the scan-tested side of the IJTAG network |
| SIBs | Let the network include or skip each segment | Generated with the network |
Generated instance names follow the design and ID, for example my_core_rtl1_tessent_mbist_c1_controller_inst. The controller and memory-interface settings are reachable in the spec as DftSpecification(my_core,rtl1)/MemoryBist/Controller(c1)/Step/MemoryInterface(m1)/....
The pass 1 dofile, annotated
set_context dft -rtl -design_id rtl1 ;# pass 1 writes design ID rtl1
set_tsdb_output_directory ../tsdb_core ;# the block's TSDB for the whole flow
# memory library and models
set_design_sources -format tcd_memory -y ../lib/mem -extension tcd_memory
set_design_sources -format verilog -v {../lib/mem/*.v}
read_cell_library ../lib/tessent/stdcells.tcelllib
read_verilog -f rtl.f ;# the block RTL
set_current_design my_core
set_design_level physical_block ;# kept for every later pass
set_dft_specification_requirements -memory_test on
add_clocks 0 core_clk -period 1.25ns ;# every clock that reaches a memory
add_clocks 0 io_clk -period 4ns
check_design_rules ;# memories found? clocks traced?
report_memory_instances ;# check the list against the RTL
set spec [create_dft_specification]
report_config_data $spec ;# review controller grouping here
process_dft_specification ;# writes RTL into the TSDB
extract_icl ;# ICL for the block, plus SDC
# sign-off for this pass: MBIST + ICL patterns in RTL simulation
create_patterns_specification
process_patterns_specification
set_simulation_library_sources -v ../lib/verilog/stdcells.v -y ../lib/mem -extension v
run_testbench_simulations
check_testbench_simulations -report_status
exit
report_config_data and split controllers in the spec before you process it; it's free here and expensive after layout.Algorithms, briefly
MemoryBIST algorithms are sequences of read and write operations marched across the address space in a fixed order. A simple March element is "for every address ascending: read 0, write 1". Combining elements in both address directions with both data values detects stuck-at, transition and coupling faults between neighboring cells, plus address decoder faults. Checkerboard-style backgrounds add patterns that stress adjacent cells. Tessent patterns typically run a March-based default algorithm (you'll see SMarchCHKBvcd in reports); you can add or swap algorithms per controller in the spec.
- Run time scales with size. A 10N March algorithm on a 64K-word memory is about 655K operations, at speed that's under a millisecond at 1 GHz, but memories on one controller run in sequence or in parallel depending on how you configure the steps, which sets both test time and peak power.
- Retention and other options (pauses between write and read, different backgrounds) are pattern-specification choices you make later, not insertion choices.
Memories once logic test starts
MBIST tests the array. Logic test still has to deal with the memory as a black box in the middle of the logic, and with the MBIST logic itself.
- Bypass: under the static DFT signal
memory_bypass_en(added in pass 2) the memory's inputs are routed to its outputs, so the logic feeding and fed by the memory is controllable and observable without modeling the array. Simple, but the memory's own read path isn't covered by ATPG. - Using the memory in ATPG: with an ATPG model of the memory, the tool can write and read it in multi-load patterns to test the shadow logic around it. Better coverage, more patterns, and the memory model has to be right.
- MBIST logic is scan-tested: the controllers and interfaces sit on the scan-tested side of the IJTAG network, get stitched into chains in the scan step, and need
tck_occ_enso ATPG can clock their IJTAG-side logic. - Unmodeled memories are X sources. A memory that's just a black box in ATPG drives X into downstream flops. With compression that means masking, more patterns, and lower effective compression.
Repair (if your memories have spares)
For memories with spare rows or columns, the controller computes a repair solution (built-in repair analysis) during test. Built-in self-repair (BISR) adds a repair register next to each repairable memory, chains those registers together, and connects them to a controller that can load them from fuses at power-up. That's another insertion step and another DFT signal set. Keep the functional clock that applies repairs at power-up slow (on the order of 10 MHz or less), because the BISR chains are distributed across the chip.
Signing off the pass, and again later
- RTL simulation now. The MBIST patterns and the ICL network patterns from this pass, simulated against the RTL with the memory models.
- Pass 2 re-checks MBIST. Pre-DFT DRC in pass 2 runs on the MBIST logic too, against the logic-test DFT signals.
- Gate level before pre-layout sign-off. After scan insertion, read the
gatedesign ID in thepatterns -ijtagcontext, regenerate the MBIST patterns and simulate them on the scan-inserted netlist. Synthesis and scan insertion both touch the logic MBIST relies on, so this catches what RTL simulation can't.
Interview questions
Why is MemoryBIST inserted before EDT and OCC? core
Because MBIST adds logic that logic test has to cover. Inserting it first gives the second pass an accurate flop count to size EDT, and lets pass 2's pre-DFT DRC check the MBIST logic's clocks and resets against the DFT signals. It also builds the IJTAG network early, so the EDT and OCC static controls can be added to it in pass 2.
How does the tool decide which memories share a controller? core
Mainly by clock domain, since the controller runs at the memories' functional clock, then by power domain and other constraints. You review and change the grouping in the DftSpecification before processing it, for example to split a controller whose memories are far apart or to limit how many memories run at once.
What is the memory bypass for, if MBIST already tests the memory? core
For logic test. MBIST covers the array, but the logic around the memory still needs scan patterns. Without a model the memory is an X source and a blockage. Bypass connects the memory's inputs to its outputs under memory_bypass_en, which makes that surrounding logic testable. The alternative is an ATPG memory model and multi-load patterns that write and read the memory.
MBIST passes in RTL simulation but fails on the scan-inserted netlist. Where do you look? deep
At what changed between the two: synthesis and scan insertion. Check that the interfaces and controller weren't optimized across (boundary optimization or ungrouping of DFT instances), that scan insertion didn't change a clock or reset the controller depends on, that static DFT signals that should be off in MBIST mode really are, and that the gate-level memory model matches. Then simulate with waves on the BAP and controller handshakes to see whether it's setup (IJTAG writes not landing) or the test itself failing.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
Pass 2: DFT signals, OCC and EDT
The second pass makes the block testable by scan: it defines every signal that test modes depend on, fixes what pre-DFT DRC finds, puts an on-chip clock controller on each functional clock, and adds the EDT controller. This is the pass with the most decisions in it, so this page walks through each one and ends with a complete dofile.
60-second answer: "what do you set up in the second pass?"
I load the rtl1 design and declare the DFT signals: a global logic-test enable and the internal and external mode signals for the wrapper, all as TDR bits; scan enable, test clock and EDT update as ports; and the EDT clock and shift/capture clock derived from the test clock. Then pre-DFT DRC with logic test on checks that every flop has a controllable clock and that async sets and resets can be held off, and the tool fixes what it can. In the spec I add one OCC per functional clock, at the clock's root, and one EDT controller sized by chain count, channel counts and an expected longest-chain range. Processing the spec inserts the RTL; extract_icl writes the block ICL and SDC, I write the synthesis load script, and I simulate the ICL patterns before synthesis.
DFT signals: who drives what
A DFT signal is a named test control with a known role. Declaring them lets every later step (scan insertion, ATPG setup, SDC) know which value each test mode needs, without you writing test procedures by hand. They come in three kinds.
| Signal | Kind | Source in a wrapped core | Used for |
|---|---|---|---|
ltest_en | static | TDR bit | Global logic-test mode: OCCs active, test-mode clock paths, reset control |
int_ltest_en, ext_ltest_en | static | TDR bits | Gate the wrapper cells' scan enable in intest and extest |
int_mode, ext_mode | static (scan mode) | TDR bits | Select the internal or external chain configuration built in the scan step |
memory_bypass_en | static | TDR bit | Memory bypass during logic test (or multi-load memory patterns) |
tck_occ_en | static | TDR bit | Lets the scan-tested side of the IJTAG network (SIBs, MBIST setup logic) be clocked during logic test, so ATPG covers it |
scan_en | dynamic | Port (created if missing) | Shift versus capture |
test_clock | dynamic | Port (created if missing) | Dedicated test clock, source of the two derived clocks |
edt_update | dynamic | Port (created if missing) | EDT reset and mask transfer before each load |
edt_clock, shift_capture_clock | derived | Gated copies of test_clock | EDT logic clock; the OCC slow clock for shift and slow capture |
- Static signals hold one value for a whole pattern set and live in a TDR (
-create_with_tdr), so they cost no pins and the test setup sets them through IJTAG. - Dynamic signals change inside a pattern, so they need a real source:
-source_nodesnames a port or an internal node. In a wrapped core the tool creates the port if it doesn't exist. At the chip level the port must already exist and reach a pad, and if it's shared with a function pin it needs auxiliary input logic from pass 1. - Derived clocks are made with
-create_from_other_signals: the tool inserts clock gaters ontest_clock. - At the chip you'll add
edt_modefor the top-level EDT,output_pad_disableto use boundary scan instead of contacting pins, and oneretargeting<N>_modeper group of cores tested together.
test_clock in a hierarchical design. The EDT logic needs an extra test clock pulse to initialize, which also clocks the scan cells on that clock and disturbs them. That shows up as D1 violations you can't fix by setup. Use a dedicated test clock (or TCK), and if you really must reuse a clock, put the OCC on the functional path where it doesn't intercept the free-running branch feeding the test clock gaters.Pre-DFT DRC with logic test on
set_dft_specification_requirements -logic_test on turns on the pre-DFT clock rules (DFT_C) before any logic-test hardware exists. They check that:
- every flop that should be scanned has a clock you've defined and can control;
- asynchronous sets and resets can be identified and held inactive during shift;
- clock gating can be enabled in test. Integrated clock gating cells from the library are understood; clock gating written in RTL logic needs
add_dft_clock_enablesto name its functional and test enables.
With logic test on, the tool also fixes internally generated asynchronous resets automatically: it inserts control so the reset is off during shift and still exercised in capture (you can choose to hold it off in capture too). Fixing these here, in RTL, is far cheaper than discovering S-rule violations on the netlist.
OCC: one per functional clock
shift_capture_clock) or the fast path (the PLL or functional clock). Chopping: a short shift register of condition bits, loaded by scan like any chain, decides how many capture pulses pass. Gating: glitch-free clock gaters do the actual enabling. Scan enable is resynchronized to the fast clock so the at-speed burst starts cleanly after SE falls. In functional mode (test_mode=0) the fast clock passes straight through, so no extra mux is needed after the OCC. This is a functional sketch; the generated RTL has more detail.clock_out follows it. SE falls; one slow-clock edge samples it, then two fast-clock flops resynchronize it. Only then does the OCC release the number of fast pulses the condition bits asked for: two here, launch and capture, back to back at the functional period. The tester's slow clock and the PLL are not assumed to be related, which is why the handoff costs a few fast cycles of dead time and why the tester must wait long enough before raising SE again.| Type | Does | Use it when |
|---|---|---|
| Standard | Selection, chopping and gating; slow and fast clock inputs | Default for cores and flat designs. Shift timing is simple because the test clock sources every scan clock in shift. |
| Parent mode | Clock selection only; injects the shift clock at the root | At the chip, feeding child OCCs in cores |
| Child mode | Chopping and gating only, on one clock used for shift and capture | Cores where a clock mux isn't allowed (clock meshes). Costs shift timing closure and needs two timeplates for fast capture. |
| Synchronous OCC | Aligns launch and capture across synchronous domains | At-speed test between related clocks |
- Where it goes:
clock_intercept_nodeis the root of the clock domain, after the PLL or clock generator and before the clock tree. If there's no clean point, add a buffer as an anchor. - Condition bits are scan cells. The OCC's shift register is stitched into the chains by scan insertion (see the compression page for why placement matters). The register length sets the most capture pulses per pattern; shorter means fewer bits to encode in every pattern.
- Static controls through IJTAG. With
ijtag_host_interface : Sib(occ)the OCC's static inputs come from the network, so the core needs no extra pins and test setup configures it. - Keep the hierarchy. Don't ungroup the OCC in synthesis or layout; ATPG DRC and the SDC rely on its pins.
The EDT specification
EDT {
ijtag_host_interface : Sib(edt); // static controls via IJTAG
Controller(c1) {
longest_chain_range : 250, 300; // expected longest internal chain
scan_chain_count : 400; // internal chains this controller drives
input_channel_count : 8;
output_channel_count : 8;
ShiftPowerOptions { // optional low-power shift hardware
present : on;
min_switching_threshold_percentage : 15;
}
}
}
- scan_chain_count and channel counts set the chain:channel ratio, which caps the compression. How to pick them is on the compression page.
- longest_chain_range lets you change chain lengths later without regenerating the EDT, as long as the longest chain stays in range. It's a range for the longest chain, not for all chains.
- Bypass is built in. The generated controller includes bypass muxes that concatenate the internal chains onto the channels for debug and fallback.
- Hierarchical blocks get one EDT per internal mode. External mode chains go to the parent's EDT (or to pins); see the scan insertion page.
- Connections: in a wrapped core the channels become ports automatically. At the chip you connect each channel to a pad's auxiliary pin with
set_config_value port_pin_nameandget_auxiliary_pins.
The pass 2 dofile, annotated
set_context dft -rtl -design_id rtl2
set_tsdb_output_directory ../tsdb_core
read_cell_library ../lib/tessent/stdcells.tcelllib
read_design my_core -design_id rtl1 ;# pass 1 result + its ICL/PDL
set_current_design my_core ;# design level stays physical_block
# ---- DFT signals
add_dft_signals ltest_en -create_with_tdr
add_dft_signals scan_en edt_update test_clock \
-source_nodes {scan_en edt_update test_clock} ;# ports created if missing
add_dft_signals edt_clock shift_capture_clock -create_from_other_signals
add_dft_signals memory_bypass_en tck_occ_en -create_with_tdr
add_dft_signals int_ltest_en ext_ltest_en int_mode ext_mode ;# wrapper + modes (static: TDR bits by default)
report_dft_signals
# ---- clocks and pre-DFT DRC
add_clocks 0 core_clk -period 1.25ns
add_clocks 0 io_clk -period 4ns
set_dft_specification_requirements -logic_test on
check_design_rules ;# DFT_C rules; read the summary
# ---- spec: SIBs for EDT and OCC on the scan-resource side
set spec [create_dft_specification -sri_sib_list {edt occ}]
read_config_data -in $spec -from_string {
OCC { ijtag_host_interface : Sib(occ); }
}
foreach {id clk} {core core_clk io io_clk} {
set occ [add_config_element OCC/Controller($id) -in $spec]
set_config_value clock_intercept_node -in $occ $clk
}
read_config_data -in $spec -from_string {
EDT {
ijtag_host_interface : Sib(edt);
Controller(c1) {
longest_chain_range : 250, 300;
scan_chain_count : 400;
input_channel_count : 8;
output_channel_count : 8;
}
}
}
report_config_data $spec
process_dft_specification -validate_only
process_dft_specification
# ---- collateral for the next steps
extract_icl ;# block ICL + SDC procs
write_design_import_script ../3.synth/load_rtl.tcl -replace
# ---- sign-off: ICL network patterns at RTL
create_patterns_specification
process_patterns_specification
set_simulation_library_sources -v ../lib/verilog/stdcells.v -y ../lib/mem -extension v
run_testbench_simulations
check_testbench_simulations -report_status
exit
Interview questions
Static versus dynamic DFT signals: what's the difference and why does it matter? basic
Static signals keep one value for a whole test (logic-test enable, wrapper mode, memory bypass), so they can sit in a TDR and be set once through IJTAG in test setup. Dynamic signals change inside a pattern (scan enable, test clock, EDT update), so they need a direct, timed source: a port or an on-chip generator like an SSN host. Putting a dynamic signal in a TDR doesn't work because IJTAG can't toggle it cycle by cycle.
Why does a wrapped core need its own OCCs? core
So its patterns are self-contained. With OCCs inside the core, the capture clock pulses are programmed by condition bits in the core's own chains. The parent doesn't have to recreate the core's clocking, so the core's patterns can be retargeted and merged with other cores' patterns regardless of the clock waveforms at the top.
Standard versus child OCC in a core? deep
A standard OCC has its own slow and fast clock inputs and does selection, chopping and gating. In shift the test clock drives every scan clock, so shift timing closes without balancing functional clock branches. A child OCC only chops and gates a single incoming clock, with clock selection done by a parent OCC at the top. It's for designs where a mux isn't allowed in the core clock path, such as clock meshes, but shift timing then depends on the top-level clock path and fast capture needs two timeplates. Default to standard.
What does longest_chain_range buy you? core
The EDT hardware is built for a range of longest-chain lengths rather than one value. If scan insertion, ECOs or rebalancing change the longest chain but keep it inside the range, the EDT doesn't have to be regenerated and the RTL doesn't change.
An RTL clock gate isn't a library ICG. What does pre-DFT DRC need from you? core
Its enables. Use add_dft_clock_enables to tell the tool which pin is the functional enable and which is the test enable, so it can verify the gate can be forced on in test and that the clocks behind it are controllable.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
IJTAG plumbing in the flow: ICL, PDL, SIBs and TDRs
You don't build the IJTAG network by hand in Tessent; each insertion pass extends it. But every static test control in the partition goes through it, and every ATPG run starts by programming it. This page is the practical side: what the generated network looks like, what ICL and PDL you write yourself, how ATPG uses the network in test setup, and what breaks in extraction. The IJTAG (1687) page covers the standard itself.
60-second answer: "how does IJTAG fit into the Tessent flow?"
Pass 1 builds the network with the MBIST BAP on it; pass 2 adds SIBs for the EDT and OCC static controls and a TDR for the static DFT signals. Each pass ends with extract_icl, which traces the network through the actual design and writes the block's ICL. Every Tessent instrument comes with its own ICL and PDL; for third-party instruments I write them myself and read them in, and create_dft_specification connects them. In ATPG, import_scan_mode creates a test_setup procedure that iCalls those PDL procedures to put every static signal at the value the scan mode needs, and the PDL retargeting engine turns that into the TAP or IJTAG port sequence. At the parent, the core's ICL is just another instance, so the same setup is retargeted up one level.
The network a partition ends up with
tck_occ_en so ATPG can clock them. The tool computes the exact path for every iWrite, so you never hand-count bits.- Scan resource side (SRI): instruments that must stay active and configured during scan test: the TDR with static DFT signals, EDT and OCC static controls. Their state is set in test setup and must not be disturbed by scan shifting.
- Scan-tested side (STI): instruments that are themselves tested by logic test: the MBIST BAP, controllers and interfaces. ATPG covers them like any logic, which needs
tck_occ_en. - The TAP (chip level only) isn't scan-tested; it's made non-scan in ATPG.
- Ordering: by default instruments are chained in name order at each level; with a DEF file loaded, the tool orders them by placement to shorten routes.
ICL you write: a third-party instrument
For a Tessent instrument the tool writes ICL. For anything else on the network, a PLL control register, a sensor, a vendor PHY's test port, you provide an ICL module whose ports match the Verilog module. Here is a small one: an 8-bit control TDR with two decoded fields.
Module pll_ctrl {
ScanInPort si;
ScanOutPort so { Source R[0]; }
SelectPort en;
ShiftEnPort se;
CaptureEnPort ce;
UpdateEnPort ue;
TCKPort tck;
ResetPort rst;
DataOutPort bypass { Source R[7]; }
DataOutPort div[2:0] { Source R[6:4]; }
ScanRegister R[7:0] {
ScanInSource si;
ResetValue 8'b0;
}
Attribute keep_active_during_scan_test = "true"; // SRI-side resource
}
The port keywords carry the semantics (shift enable, update enable, select), which is what lets the tool check connections and compute access. R[7:0] shifts from bit 7 toward bit 0, so so comes from R[0] by definition. The keep_active_during_scan_test attribute marks this as a scan resource the network must keep configured during logic test.
PDL you write: how to operate it
iProcsForModule pll_ctrl
iProc setup { div_val } {
iWrite bypass 0b0
iWrite div $div_val
iApply ;# one scan access does both writes
}
iProc bypass_on {} {
iWrite bypass 0b1
iApply
}
PDL is written at the instrument's own boundary. The retargeting engine finds the path from the current design's IJTAG port (the TAP at the chip, the IJTAG client port in a core) to that instance, opens the SIBs it needs, and generates the shifts. You call it from the level you're at, for example iCall u_pll_ctrl.setup 0b011, and the same iProc works unchanged in the core, in the chip, or on the bench.
# reading the instrument and the PDL before the design is elaborated
read_icl ../ip/pll_ctrl/pll_ctrl.icl
dofile ../ip/pll_ctrl/pll_ctrl.pdl
set_current_design my_core
# create_dft_specification now includes pll_ctrl in the network
How ATPG uses the network
import_scan_mode int_modereads the scan mode recorded by scan insertion: which chains, which EDT, and which DFT signal values define the mode.- Test setup is generated: a test_setup procedure that iCalls the setup iProcs (EDT, OCC, the DFT-signal TDR) with the values the mode needs, for example
ltest_en 1,int_ltest_en 1,int_mode 1. - Retargeting turns those iCalls into the IJTAG or TAP vector sequence and simulates it, so DRC starts from the configured state.
- You only change defaults.
set_static_dft_signal_valuesoverrides a value for a pattern set (for example, at the chip,int_ltest_en 1andoutput_pad_disable 1to use boundary scan instead of pads), andreport_static_dft_signal_settingsshows what will be applied.
setup iProc that takes parameter-value pairs, for example iCall u_edt.setup edt_bypass on. Only values that differ from the default need to be given.extract_icl, and what breaks it
extract_icl traces the IJTAG connections through the actual design netlist (or RTL), matches them against each instance's ICL module, runs the ICL extraction rules (I rules), and writes the block's ICL. It also writes the SDC procs for the instruments. The common failures:
| Symptom | Typical cause | Fix |
|---|---|---|
| ICL port not found on the design module | Hand-written ICL port name differs from the Verilog port (case, bus range, escaped name) | Make the names match; every ICL port must exist on the Verilog module |
| Connection can't be traced | Logic between instruments that the tracer can't sensitize (a mux whose select isn't constant in the setup, a hand-inserted gate) | Constrain the select, or describe the logic in ICL (ScanMux) if it's a real network element |
| Instance not recognized as an instrument | ICL module not loaded, or module name differs from the design module | read_icl before set_current_design; names must match |
| Extraction fine at RTL, broken on the netlist | Synthesis renamed ports or bit-blasted buses | Preserve DFT instance boundaries in synthesis; Tessent Scan updates the ICL for its own renames, third-party flows may need port-matching rules |
analyze_drc_violation opens the failing connection in Tessent Visualizer. After extraction, the ICL verify patterns (written by create_patterns_specification) check that every TDR can actually be written and read through the network; run them at RTL in each pass and again on the netlist after scan insertion.
Interview questions
What's the difference between the SRI and STI sides of the network? core
The scan resource side holds what logic test depends on: the TDR with static DFT signals, EDT and OCC configuration. It must keep its state while scan chains shift. The scan-tested side holds instruments that logic test covers, like MBIST controllers and BAPs, so they're in the scan chains and need to be clockable during ATPG (tck_occ_en).
How do static DFT signals get their values during ATPG? core
Through test setup. import_scan_mode creates a test_setup procedure that iCalls the setup iProcs of the TDR, EDT and OCC instruments with the values the scan mode needs. The PDL retargeting engine converts those iCalls into IJTAG (or TAP) shift sequences from the current design's ports, and the tool simulates them before DRC. You override a value with set_static_dft_signal_values.
Why write PDL at the instrument level instead of at the chip? basic
So it's reusable. The iProc describes operations on the instrument's own registers. Retargeting computes the network path from whatever level you're at, so the same PDL works in the core, at the chip after the core is instantiated twice, and on the bench, without rewriting bit positions.
extract_icl passes at RTL but fails after synthesis. What happened? deep
Most likely synthesis changed the names or structure the extractor relies on: ports of a DFT instance were renamed or bit-blasted, a hierarchy was ungrouped, or constant propagation crossed a boundary. Check that DFT instances were preserved with the Tessent synthesis procs, compare the instance's ports with its ICL module, and if a third-party tool did the renaming, add port-matching rules. Tessent Scan handles its own renames automatically.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
Synthesis and the SDC hand-off
After two insertion passes, the block's RTL contains MBIST, the IJTAG network, OCCs and EDT. Synthesis runs once, in your synthesis tool, and the main way DFT goes wrong at this step is the synthesis tool doing its job too well: optimizing across a DFT boundary, ungrouping an OCC, or timing paths that can never happen. Tessent writes SDC procs that handle most of this. This page is about using them correctly, and about the layout and STA steps that follow.
60-second answer: "how do you synthesize a block with Tessent DFT in it?"
Pass 2 writes a design load script with write_design_import_script, so synthesis reads exactly the RTL the TSDB holds. extract_icl also writes an SDC file (in the pass's dft_inserted_designs directory in the TSDB) with Tcl procs for every instrument. In the synthesis script I apply my functional constraints, source that file, call tessent_set_default_variables, fix the TCK period and the clock-name mapping to match my functional SDC, then call tessent_set_non_modal, which constrains functional and test paths together without case analysis. Before compile I preserve the DFT instances the procs list, so boundary optimization and ungrouping don't break them, and keep Tessent's library cells size-only. I write the merged SDC for layout. In CTS I apply the OCC stop points from the SDC so the OCC's own flops aren't balanced to the leaves. For sign-off STA I switch to the modal procs: shift, slow capture, fast capture, MBIST.
Loading the inserted RTL
# in pass 2, after extract_icl
write_design_import_script ../3.synth/load_rtl.tcl -replace
# or let Tessent drive DC directly / just generate a script for another tool
# run_synthesis -generate_script_only
The script lists the original RTL plus every Tessent-generated file in the right order, so synthesis can't pick up a stale copy. It's written for Design Compiler; for another tool, keep the file list and convert the read commands.
run_synthesis can do it), then scan-insert. The SDC rules below still apply each time.What the generated SDC gives you
The file sits at tsdb_core/dft_inserted_designs/my_core_rtl2.dft_inserted_design/my_core.sdc. The latest pass's file is a superset of earlier ones, so you only source the last one. It defines procs, not constraints; nothing happens until you call them.
| Proc or variable | What it's for |
|---|---|
tessent_set_default_variables | Mandatory. Sets every Tessent variable to its design default. Override variables after this call, in your script, never by editing the file. |
tessent_tck_period | TCK period (100 ns default). Set it to the TCK you'll really run. |
tessent_clock_mapping(<label>) | Maps the clock names you used in Tessent (add_clocks) to the names in your functional SDC. Check every entry: wrong mapping means MBIST constraints point at nonexistent clocks. |
tessent_set_non_modal | For synthesis and layout: constrains all functional and test modes at once, no case analysis, so the tool optimizes both. |
tessent_get_preserve_instances, tessent_get_optimize_instances, tessent_get_size_only_instances | Lists of what to protect from boundary optimization and ungrouping, what to re-enable inside them, and which Tessent-instantiated cells may only be resized. |
tessent_get_cts_skew_groups_dict | Clock-tree stop points for every OCC, for your CTS script. |
tessent_set_ltest_modal_*, tessent_set_memory_bist_modal | Per-mode constraints for sign-off STA. |
tessent_scan_en_setup_extra_cycles and related | Optional multicycle allowance on scan enable and edt_update (default 0: single cycle of the slow clock). |
Synthesis script, the DFT-relevant part
set design my_core
set tsdb ../tsdb_core
set id rtl2
source ./load_rtl.tcl ;# from write_design_import_script
# ... functional constraints first ...
source $tsdb/dft_inserted_designs/${design}_${id}.dft_inserted_design/${design}.sdc
tessent_set_default_variables ;# mandatory, then override:
set tessent_tck_period 50.0 ;# 20 MHz TCK on this project
set tessent_clock_mapping(core_clk) CLK_CORE ;# Tessent label -> functional SDC name
set_app_var timing_enable_multiple_clocks_per_reg true ;# DC: MBIST clock muxing
tessent_set_non_modal ;# functional + test, no case analysis
# protect DFT structure
set_app_var compile_enable_constant_propagation_with_no_boundary_opt false
set keep [tessent_get_preserve_instances scan_insertion]
set_boundary_optimization $keep false
set_ungroup $keep false
set_boundary_optimization [tessent_get_optimize_instances] true
set_size_only -all_instances [tessent_get_size_only_instances]
set_app_var compile_seqmap_propagate_high_effort false
set_app_var compile_delete_unloaded_sequential_cells false
compile_ultra
write_sdc ${design}.merged.sdc ;# functional + Tessent, for layout
write -format verilog -hier -output ${design}.vg
compile_* variables and the preserve lists above are there for exactly this.The argument to tessent_get_preserve_instances says what comes next: scan_insertion when Tessent Scan will run on this netlist (as in this flow). The set of instances to preserve differs when more DFT insertion follows instead.
Layout and clock tree synthesis
Two things from the Tessent SDC matter in layout:
- Persistent cells stay. Tessent places "persistent" cells (buffers on DFT signals, clock gaters) as anchor points for constraints. Keep them size-only through layout too, from
tessent_get_size_only_instances. - OCC CTS stop points. At three places in each standard OCC (the SE synchronizer, the fast-clock gater, and the shift-register clock mux), balancing must stop. Don't put a stop point at the OCC output instead: you still want the shift clock balanced across OCCs and functionally synchronous clocks balanced to each other. Feed the dictionary from
tessent_get_cts_skew_groups_dictinto your CTS tool's exclude-pin or skew-group commands.
Sign-off STA: one mode at a time
Non-modal constraints are good for optimization but pessimistic for sign-off: a single shift_capture_clock reaching every domain makes cross-domain paths look single-cycle at shift speed, and shift-only paths get checked at functional frequency. For sign-off you run one STA mode per test mode, each with its own case analysis.
| STA mode | Constrain with | Checks |
|---|---|---|
| Functional | Your functional SDC (+ DFT disabled) | Nothing test-related should limit function |
| Shift | tessent_set_ltest_modal_shift | Chains, EDT, lockups at shift frequency; hold dominates |
| Slow capture | tessent_set_ltest_modal_edt_slow_capture | Capture with the slow clock, stuck-at patterns |
| Fast capture | tessent_set_ltest_modal_edt_fast_capture | At-speed launch and capture through OCCs; OCC internal enable paths |
| MemoryBIST | tessent_set_memory_bist_modal | Controller to interface to memory at functional speed; multicycle paths from controller registers |
| IJTAG | TCK constraints (non-modal includes them) | Network at TCK; TDR outputs into the functional design are static |
The scan PD and SDC page covers the per-mode constraint content in more depth.
Interview questions
Why use non-modal constraints in synthesis but modal ones in sign-off? core
In synthesis you want one constraint set that makes the tool optimize functional and test paths together, so you don't fix one mode by breaking another. That means letting test and functional clocks propagate through the muxes with no case analysis, which creates some false paths. For sign-off, accuracy matters more, so each test mode gets its own case analysis and only the paths that really exist in that mode are checked.
What can boundary optimization break in DFT logic? core
It can propagate constants across a DFT instance's ports (for example a static DFT signal that's tied at RTL), invert or rename ports, and remove logic it thinks is unused. Results: ICL extraction can't match ports, an OCC or TDR loses bits, or a test mode loses control. Tessent's preserve list turns boundary optimization and ungrouping off on those instances while allowing optimization inside them.
Why must CTS not balance the OCC's internal flops with the clock tree it drives? deep
The OCC's synchronizer and condition-bit register launch the enables of the clock gaters at the root of the domain. If CTS treats those flops as leaves, it delays their clocks by the full insertion delay, so the enables launch late relative to the clock at the gater. In fast capture that eats the setup margin of the enable paths and can make them impossible to close. Stop points keep those flops near the root.
The MBIST STA mode shows paths to clocks that don't exist. Likely cause? core
The clock mapping. Tessent's SDC refers to functional clocks through tessent_clock_mapping, keyed by the labels used with add_clocks. If your functional SDC names the clock differently and you didn't override the mapping after tessent_set_default_variables, the MBIST constraints point at the wrong name.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
Scan insertion and wrapper chains
Scan insertion runs on the synthesized netlist with all the pass-2 collateral loaded, so the tool already knows the DFT signals, the EDT controller and the OCC sub-chains. For a wrapped core it does three things: decides which flops become wrapper cells, stitches the cells into an internal and an external scan mode, and writes the netlist plus a scan-mode description that ATPG imports. This is the step most people who start from "here's a netlist" have never seen.
60-second answer: "how does scan insertion work for a wrapped core?"
I read the netlist, then read_design the rtl2 ID with -no_hdl so the DFT signals, EDT and OCC information come along, and run DRC, which checks scannability of every flop. Wrapper analysis traces from every input and back from every output: if a port reaches only a few flops, those functional flops become shared wrapper cells; if it reaches 32 or more, a dedicated wrapper cell goes on the port. Input wrapper cells have their scan enable ORed with int_ltest_en, output cells with ext_ltest_en. Then I define two scan modes: int_mode with every cell, hooked to the EDT controller, and ext_mode with only the wrapper cells in a couple of chains. analyze_scan_chains previews the result; insert_test_logic stitches, writes the netlist into the TSDB under ID gate, and records the modes for ATPG.
Wrapper analysis
in_a reaches a few flops, so those existing functional flops become shared input wrapper cells. Input in_b fans out to 32 or more flops (the default threshold), so a dedicated cell is inserted at the port instead of converting all of them. Outputs work the same way in reverse. Input wrapper cells get SE ORed with int_ltest_en, so in intest they never capture from the port; output wrapper cells get SE ORed with ext_ltest_en, so in extest they never capture from the core.| Mode | Core cells | Input wrapper cells | Output wrapper cells |
|---|---|---|---|
| Unwrapped (normal scan) | capture | capture | capture |
Intest (int_ltest_en=1) | capture | held in shift: isolate from the ports, act as controllable inputs | capture: observe the core's outputs |
Extest (ext_ltest_en=1) | not used | capture: observe the ports | held in shift: drive the outputs, isolate from the core |
- Shared cells reuse existing functional flops at the boundary. No area, no extra delay on functional paths, but the analysis also has to pull in any flops that control their set, reset or clock, and those become wrapper cells too.
- Dedicated cells are inserted when a port fans out to (or in from) 32 or more scannable flops by default. Tune with
set_wrapper_analysis_options -input_fanout_flop_thresholdand-output_fanin_flop_threshold; force one withset_dedicated_wrapper_cell_options on -ports {...}. - Ports left alone: clocks, IJTAG ports, DFT signals, scan enable and other test ports, and inputs that reach no sequential cell. The IJTAG and
edt_updateports are excluded automatically; exclude the EDT channel ports yourself. - Debug:
report_wrapper_cells -verboselists every port's wrapper and why. A "wrapper_analysis" simulation context shows the values the analysis assumed.
What wrapper cells do during capture
In the capture window of their test mode (scan enable off, int/ext_ltest_en on), wrapper cells either keep shifting or hold. You choose with set_wrapper_analysis_options -capture_window_behavior.
| Setting | Behavior | Cost |
|---|---|---|
shift | Cell keeps shifting from SI during capture | SO to SI connections between wrapper cells become at-speed paths in fast capture; separate scan enables per wrapper chain type |
hold | Cell holds its value (feedback loop) | A mux per cell; no at-speed shift paths, one scan enable is enough |
invert_hold | Cell toggles each capture cycle | Lets a held value still launch a transition |
programmable_hold | Hold or toggle chosen at run time by the static signal wrapper_toggle_en | One more TDR bit |
Two scan modes on one netlist
int_mode every cell, wrapper and core, is in a chain that hangs off the EDT block, so intest patterns load and observe everything. In ext_mode only the wrapper segments are stitched, into a few short chains that the parent level will connect to its own EDT or pins. The mode is selected by the DFT signal of the same name, so add_scan_mode needs no explicit enable when the names match.add_scan_mode int_mode -edt_instances $edt: all cells, chain count taken from the EDT controller, connected to its decompressor and compactor.add_scan_mode ext_mode -chain_count 2: wrapper cells only, here two chains with their own scan-in and scan-out. Keep the count small; the parent has to connect every one. When several cores' external chains go to one parent EDT, balance their lengths (use-chain_lengthinstead).- Because
int_modeandext_modewere declared as DFT signals in pass 2, the mode type and enable are inferred from the names. - Other modes you may add: a single long bypass-style chain mode for debug, a controller-chain mode for LBIST, or a short-chain mode. Each extra mode adds muxes at segment boundaries.
Stitching rules worth knowing
- OCC sub-chains. If all OCC condition bits add up to about 25% of the longest chain or less, Tessent Scan stacks them into one or a few compressed chains (see the compression page for why). If they'd fill 75% or more of a chain, consider an uncompressed chain for them, which costs a pin pair per core at the chip, but run ATPG first to see whether you actually have an encoding problem.
- OCC bits and wrapper chains. OCC bits normally go only in internal mode. If an OCC must also be active in external mode (deeper hierarchies), plan for its bits to be in the external chains too.
- Clock domains and edges. Chains are ordered so that domain and edge crossings are minimized, with lockup cells where a chain crosses clocks.
- Unused EDT chains. If the EDT was built for more chains than scan insertion fills, the extra chain inputs and outputs get pipeline registers so the EDT still sees full-length chains.
- Chain length versus count.
set_scan_insertion_options -chain_lengthor-chain_countfor modes without EDT; with EDT, the controller's chain count decides.
The scan insertion dofile, annotated
set_context dft -scan -design_id gate
set_tsdb_output_directory ../tsdb_core
read_cell_library ../lib/tessent/stdcells.tcelllib
read_verilog ../3.synth/my_core.vg ;# the synthesized netlist
read_design my_core -design_id rtl2 -no_hdl ;# DFT signals, ICL, TCD, no RTL
set_current_design my_core
add_black_boxes -modules {sram_2kx64} ;# no ATPG model for this RAM yet
check_design_rules ;# S, T, C rules on the real netlist
report_clocks
# ---- wrapper cells
set_wrapper_analysis_options -exclude_ports [get_ports *_edt_channels_*]
set_wrapper_analysis_options -capture_window_behavior hold
# set_dedicated_wrapper_cell_options on -ports {cfg_bus[*]}
analyze_wrapper_cells
report_wrapper_cells -verbose > wrapper_cells.rpt
# ---- scan modes
set edt [get_instances -of_icl_instances \
[get_icl_instances -filter tessent_instrument_type==mentor::edt]]
add_scan_mode int_mode -edt_instances $edt
add_scan_mode ext_mode -chain_count 2
analyze_scan_chains ;# preview, nothing changed yet
report_scan_chains
insert_test_logic ;# stitch, write netlist + TCD to TSDB
report_scan_chains > chains.rpt
report_scan_cells > scan_cells.rpt
exit
Right after insertion
- Check the chains. Count, longest and shortest length per mode against the plan (longest inside the EDT's
longest_chain_range), and that the wrapper chain lengths are what the parent expects. - Re-verify the network. In
patterns -scanorpatterns -ijtag, read IDgate, create and simulate the ICL verify patterns on the scan-inserted netlist. Scan insertion edits the netlist the IJTAG network runs through. - Hand the netlist to layout. The scan-inserted netlist and merged SDC go to place and route. If layout reorders chains or ungroups DFT logic, the post-layout validation flow re-checks the IJTAG, MBIST and ATPG patterns on the final netlist against the same TSDB.
import_scan_mode's automation.Interview questions
Shared versus dedicated wrapper cells: trade-offs? core
Shared cells reuse functional boundary flops, so they cost no area and add nothing to functional timing, but only work where a port reaches a few flops, and they pull in any flops that control their set, reset or clock. Dedicated cells add a scan cell (and a mux on a functional path) per port, but isolate a port that fans out widely with one cell instead of converting dozens of flops. Tessent uses shared cells by default and dedicated cells above a fan-out threshold of 32.
Why is an input wrapper cell's scan enable ORed with int_ltest_en? core
In intest the core's patterns must not depend on whatever drives the core's inputs at the chip level. Holding the input wrapper cells in shift during capture means they never capture from the ports; they only provide values loaded by scan. The output wrapper cells use ext_ltest_en the same way in extest, so they drive the outputs from scan and ignore the core.
What's the risk of letting wrapper cells shift during capture? deep
If wrapper cells keep shifting during capture, the scan path from one wrapper cell to the next is active in the capture window, so in fast capture those SO-to-SI connections become at-speed timing paths. Holding cells (hold, invert_hold or programmable_hold) remove that, at the cost of a feedback mux per cell, and also let input and output wrapper chains share one scan enable.
Why define int_mode and ext_mode at scan insertion instead of letting ATPG figure it out? core
Because they're physical stitching choices: different chains, different scan-in and scan-out connections, different muxes at segment boundaries. Scan insertion has to build both. It also records each mode (cells, chains, EDT connection, DFT signal values) so ATPG can load it with import_scan_mode instead of you describing chains and test procedures by hand.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
Patterns: graybox, intest, extest and retargeting
You already know ATPG on a netlist someone hands you. In the partition flow, three things are different: the setup comes from the TSDB instead of a hand-written dofile, the core is tested in two modes that must add up to one coverage number, and the results are stored so the parent can reuse them. This page covers that, then follows the patterns up to the chip.
60-second answer: "how do you generate patterns for a wrapped core?"
First the graybox: load the scan-inserted design, import the external scan mode, run analyze_graybox and write the graybox view into the TSDB. Then extest ATPG on the graybox, which covers the logic between the ports and the wrapper cells; those patterns are only for coverage accounting. Then intest on the full core: import int_mode, give the pattern set its own mode name, stuck-at first, then transition with fast capture through the OCCs. Each run saves its flat model, fault list and patterns with write_tsdb_data, and I merge the extest fault list into the intest run to get the core's total coverage. I simulate all patterns in parallel mode and a sample in serial mode. At the chip, the TAM connects pins to the core's channels in a retargeting mode, and the stored intest patterns are retargeted to chip pins without running ATPG on the core again.
The order of runs, and why
- Graybox (needs the external mode): the parent will need it, and extest ATPG runs on it.
- Extest, stuck-at on the graybox: coverage for the boundary logic. Not reused at the chip; the chip covers this logic with its own ATPG on the graybox.
- Intest, stuck-at on the full view: the main pattern set, retargeted later.
- Intest, transition: at-speed through the OCCs, also retargeted.
- Merge and report: read the extest fault list into the intest result for the core's total coverage.
- Simulate: parallel testbenches for every pattern, serial for a few per type.
Graybox
set_context patterns -scan
set_tsdb_output_directory ../tsdb_core
read_cell_library ../lib/tessent/stdcells.tcelllib
read_design my_core -design_id gate ;# scan-inserted netlist + modes
set_current_design my_core
add_black_boxes -modules {sram_2kx64}
import_scan_mode ext_mode ;# graybox is built for this mode
check_design_rules
analyze_graybox ;# keep only extest-relevant logic
write_design -tsdb -graybox ;# stored under the same design ID
exit
Writing the graybox under the same design ID (gate) lets any later run pick the full or graybox view of this core with read_design ... -view.
Extest on the graybox
set_context patterns -scan
set_tsdb_output_directory ../tsdb_core
read_cell_library ../lib/tessent/stdcells.tcelllib
read_design my_core -design_id gate -view graybox
set_current_design my_core
import_scan_mode ext_mode ;# first: it sets the mode type
set_current_mode ext_sa -type external ;# pattern-set name, not the scan mode name
report_static_dft_signal_settings ;# ext_ltest_en, ext_mode, ltest_en...
check_design_rules
create_patterns
write_tsdb_data -replace ;# fault list for the merge later
exit
Intest: stuck-at, then transition
set_context patterns -scan
set_tsdb_output_directory ../tsdb_core
read_cell_library ../lib/tessent/stdcells.tcelllib
read_cell_library ../lib/mem/sram_2kx64.atpglib ;# ATPG model: no X source
# (no model? keep add_black_boxes as in the graybox run and
# set_static_dft_signal_values memory_bypass_en 1 so the RAM is bypassed)
read_design my_core -design_id gate ;# full view
set_current_design my_core
import_scan_mode int_mode ;# before set_current_mode
set_current_mode int_sa -type internal
report_core_instances ;# the EDT, OCCs it found
check_design_rules
add_faults -all
create_patterns
report_statistics -detail
write_tsdb_data -replace
# total for the core: pull in what extest detected
read_faults -mode ext_sa -fault_type stuck -merge
report_statistics -detail
write_patterns pat/int_sa_par.v -verilog -parallel -replace -parameter_list {SIM_KEEP_PATH 1}
set_pattern_filtering -sample_per_type 2
write_patterns pat/int_sa_ser.v -verilog -serial -replace -parameter_list {SIM_KEEP_PATH 1}
exit
The transition run differs in four lines:
import_scan_mode int_mode -fast_capture_mode on ;# OCCs supply the fast pulses
set_current_mode int_tdf -type internal
set_fault_type transition
set_external_capture_options -pll_cycles 5 [lindex [get_timeplate_list] 0]
- Mode names:
import_scan_modetakes the scan mode from scan insertion;set_current_modenames the pattern set and must be different. Import first, because the import sets the mode type. - Fast capture: with OCCs in fast mode, the tool masks primary outputs, holds primary inputs and restricts clock interaction as needed (or you describe capture explicitly with named capture procedures). The external capture options tell it how many fast-clock cycles the capture window lasts.
- Timing exceptions: for transition patterns, read the functional false and multicycle paths (
read_sdc) so ATPG doesn't create at-speed patterns that test paths that never need to meet one cycle. - Black boxes and X: a RAM without an ATPG model is an X source; prefer the model (as in the read above) or bypass it.
Coverage that adds up
fault coverage = (DT + PD·posdet_credit) ÷ all faults
ATPG effectiveness = (DT + UT + AU + PU + PT·posdet_credit) ÷ all faults
posdet_credit defaults to 50%. A fault in the boundary logic is untestable in intest (the input wrapper cells isolate it) and testable in extest. That's why the merge matters: read alone, the intest run reports those faults as undetected or ATPG-untestable, and the core's coverage looks worse than it is. After read_faults -merge, a fault detected in either mode counts once. At the chip, merging each core's intest fault list into the top-level run (with -graybox) gives the chip-level number. The fault models and ATPG page covers the fault classes in detail.
What to write, and where it goes
| Output | Command | Used by |
|---|---|---|
| Flat model, fault list, PatDB, TCD for the mode | write_tsdb_data | Retargeting at the parent; fault merging; reruns |
| Parallel Verilog testbench | write_patterns -verilog -parallel | Fast simulation of every pattern (forces chain contents directly) |
| Serial Verilog testbench, sampled | set_pattern_filtering -sample_per_type then -serial | Proves real shifting through EDT, lockups and pipelines; slow, so only a few |
| STIL / WGL | write_patterns -stil | The tester (usually from the chip level, after retargeting) |
At the parent: graybox for the top, retargeting for the cores
edt_mode connects them to the top-level EDT for the logic between cores. Identical cores can share broadcast inputs and need their own outputs. The pin assignments are illustrative: you plan them top-down from pin count, tester channels and test time, then implement them with add_dft_modal_connections.The chip goes through the same steps as the core (its own insertion passes, synthesis, scan insertion and ATPG), with every child loaded as a graybox. Its own ATPG covers top-level logic plus the wrapper chains (the cores' external modes). The cores' internal patterns are retargeted in a separate context:
set_context patterns -scan_retargeting
set_tsdb_output_directory ../tsdb_top
open_tsdb ../../my_core/tsdb_core ;# every child core's TSDB
read_cell_library ../lib/tessent/stdcells.tcelllib
read_design chip_top -design_id gate
read_design my_core -design_id gate -view graybox
set_current_design chip_top
set_current_mode r1_my_core_sa
set_static_dft_signal_values retargeting1_mode 1 ;# TAM connects pins to this core
add_core_instances -instances {u_core0} -core my_core -mode int_sa
check_design_rules
read_patterns -module my_core -fault_type stuck -mode int_sa
write_patterns pat/r1_my_core_sa.stil -stil -replace
exit
Identical cores in the same retargeting mode can be added together and share broadcast inputs. Patterns from cores in the same mode are merged and padded to the longest; this is where matching internal chain lengths across cores pays off.
Interview questions
Why run extest ATPG on a core if those patterns are never used on the tester? core
For coverage accounting. The logic between the ports and the wrapper cells can't be tested in intest, so it would count against the core. Running extest on the graybox detects those faults at the core level; merging that fault list into the intest result gives the core's real coverage. On silicon, the same logic is tested by the chip's own ATPG on the graybox.
What's the difference between the scan mode and the current mode? basic
The scan mode (int_mode, ext_mode) is a stitching configuration built by scan insertion and loaded with import_scan_mode. The current mode (int_sa, int_tdf) names one pattern set generated on top of it, with its fault type and settings. One scan mode usually has several pattern sets, and their names must differ from the scan mode's name.
Parallel simulation passes, serial fails on the first patterns. Where do you look? deep
At everything parallel simulation skips: the test setup through IJTAG (static signals not landing), the EDT update and initialization sequence, lockups between the EDT clock and chain clocks, channel pipeline counts, and scan enable timing at the start and end of shift. Waves on edt_update, edt_clock and the first cells of a failing chain usually show which.
How does a core's pattern end up on chip pins? core
In the retargeting context, the chip design is loaded with the core as a graybox, a retargeting mode is enabled (which configures the TAM to connect chip pins to the core's EDT channels), and add_core_instances tells the tool which instance gets which stored core mode. The tool reads the core's patterns from its TSDB and maps them through the TAM and the chip-level test setup, producing chip-level patterns without re-running ATPG on the core.
Why does transition ATPG need the functional SDC exceptions? core
Without them, ATPG treats every path as single-cycle at the capture frequency and creates patterns that launch transitions down false paths or multicycle paths. Those fail on good silicon or force you to slow the test down. Reading the exceptions lets ATPG avoid or mask them.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
Compression math and tuning
How to turn a flop count, a pin budget and a tester into an EDT configuration, how to predict what you'll get, and what to change when the result disappoints. The formulas are simple; the judgment is in knowing which effect is limiting you. There's a calculator at the end to play with the numbers.
60-second answer: "how do you pick the compression ratio?"
Channels usually come from the pin and tester budget, so the free variable is the number of internal chains. The chain-to-channel ratio sets the ceiling: shift length per pattern drops by about that factor. But the effective compression is always lower, because each pattern carries fewer care bits, so you need more patterns, and each pattern pays a few extra initialization cycles. Push the ratio too far and patterns stop being encodable: coverage drops through EDT-aborted faults and pattern count climbs, so data volume stops improving. So I run analyze_compression on the scan-stitched netlist, which emulates EDT at different ratios and reports where coverage starts to drop, pick a ratio just below that knee, check test time and tester memory, and check that the chain count is routable around the EDT block.
The model
init = ⌈decompressor size ÷ input channels⌉ (more if masking or low-power bits are added)
shift cycles per pattern = L + init (+ channel pipeline stages)
input data volume ≈ input channels × (L + init) × patterns
effective compression ≈ (cells × patternsno EDT) ÷ (input channels × (L + init) × patternsEDT)
The last line rewrites into the three effects you can reason about separately:
- Chain:channel ratio, the ceiling. With 8 chains you can't beat 8x no matter what.
- Overhead ratio, close to 1 unless chains are very short. A 64-bit decompressor with 4 channels adds 16 cycles; on 50-cell chains that's a 24% loss.
- Pattern inflation, usually the biggest loss. EDT patterns are smaller but there are more of them. X sources make this much worse because masking patterns observe fewer faults each.
report_edt_configurations gives the decompressor size and the extra shift cycles per pattern; report_scan_volume gives the data volume for a pattern set; report_statistics gives coverage and pattern counts. For the uncompressed reference, a scan-load's volume is about the cell count whatever the chain count, so you can baseline with any chain configuration.A worked example
A partition with 120,000 scan cells. The chip gives it 8 input and 8 output channels. An uncompressed baseline run needs about 3,000 patterns (an assumption for the example). We try 400 internal chains, a 64-bit decompressor, and say the compressed run needs 4,500 patterns.
| Quantity | No EDT, 8 chains | EDT, 400 chains |
|---|---|---|
| Chain length L | 15,000 | 300 |
| Extra cycles per load | 0 | ⌈64 ÷ 8⌉ = 8 |
| Shift cycles per pattern | 15,000 | 308 |
| Patterns | 3,000 | 4,500 |
| Input data volume | 8 × 15,000 × 3,000 = 360 Mbit | 8 × 308 × 4,500 ≈ 11.1 Mbit |
| Shift time at 100 MHz | ≈ 450 ms | ≈ 14 ms |
| Chain:channel ratio | 1 | 50 |
| Effective compression | n/a | ≈ 32x |
Check it with the three-factor form: 50 × (300 ÷ 308) × (3,000 ÷ 4,500) = 50 × 0.97 × 0.67 ≈ 32. Almost all of the gap between 50x and 32x is pattern inflation. That tells you where to look: X sources and masking, not the decompressor size.
Picking the ratio
- Fix the channels. From pins and tester channels, per core and per test group. Asymmetric is allowed: designs with few X sources often need fewer output than input channels.
- Run compression analysis on a scan-stitched netlist (any chain configuration; the tool emulates the one you ask for). With fault sampling for speed:
The first form reports chain:channel ratios from the point where coverage loss becomes noticeable up to about a 1% predicted drop. The second emulates one configuration and reports coverage, pattern count and scan volume.set_context patterns -scan # ... read netlist, libraries, define clocks and scan chains (or import a mode) ... set_fault_type stuck set_fault_sampling 10 analyze_compression ;# ratios from "negligible" to "1% drop" analyze_compression -chains 400 -channels 8 ;# emulate one configuration in detail set_fault_type transition analyze_compression -chains 400 -channels 8 ;# transition usually limits first - Pick below the knee, for the fault model that limits first (often transition).
- Experiment with channels, not netlists. Stitch generously (more chains than you expect to need) and vary the channel count in analysis; the ratio is what matters, so 100:10 behaves like 50:5. Then size the real chain count. In a different, smaller example: if the target compression is about 4x and analysis shows that takes a 100:22 configuration (ratio 4.55), then with 16 channels you'd build about 16 × 4.55 ≈ 73 chains.
- Check the physical side. Chain count drives routing around the decompressor and compactor; very high counts congest. Channel pipelines, if needed for distance, add cycles to every pattern.
- Final runs without sampling. Sampling is for exploring; sign-off coverage comes from the full fault list.
OCC condition bits and encoding
Care bits are what the decompressor has to produce, and each shift cycle can only supply a limited number of them. OCC condition bits are care bits in every pattern. Aligned across many chains, they all land in a few shift cycles and compete with the bits that actually detect faults, which shows up as more patterns and more EDT-aborted faults. Stacked into one chain they cost one care bit per cycle. Roughly: up to about 25% of the longest chain, stack them in one compressed chain (Tessent Scan does this automatically); if they'd fill more than about 75% of a chain, an uncompressed chain is worth considering, but check with ATPG first because it costs two pins per core at the chip.
When the result is worse than expected
| Symptom | Likely cause | What to do |
|---|---|---|
| Compression well below the ratio, many masking patterns (over about 25% of the set) | Observable X sources | set_drc_handling e5 note to list them; model or bypass memories, bound black boxes, initialize non-scan flops; the Xpress compactor masks only the X chains |
| Compression low, few X | Chains too short relative to the extra cycles | Check report_edt_configurations; fewer, longer chains or more channels |
| Coverage lower than the uncompressed baseline, EDT-aborted faults reported | Ratio too aggressive, many ATPG constraints, or a small design | report_aborted_faults, look for the EDT class; reduce the ratio (fewer chains); relax constraints |
| Coverage low, no aborts | Internal chain ends (the nets between EDT and the first and last scan cells) also used by functional logic or pins; the tool constrains them to X and masks them | Only the EDT channel pins may be shared with function; the chain ends must be test-only |
| Runtime much higher than uncompressed ATPG | X sources, hard-to-encode patterns | Same as the first row; compare with an uncompressed run on the same fault sample |
| No EDT aborts and coverage fine | There's headroom | Try a more aggressive ratio |
report_scan_volume) and test cycles, at the same coverage.Shift power control
Random-fill patterns toggle about half the cells every shift cycle. The EDT power controller fills chains that carry no care bits with constants, capping switching. You size the hardware with a minimum switching threshold when the EDT is generated, then set the actual threshold per pattern set:
| Hardware threshold | Range usable in patterns | Hardware size |
|---|---|---|
| < 12% (bias 2) | 0-11% | largest |
| 12% to < 25% (bias 1) | 12-24% | medium |
| ≥ 25% (bias 0) | 25-50% | smallest |
Pattern and hardware thresholds must fall in the same range. The tool will exceed the threshold rather than lose coverage, unless you set a hard limit with set_power_control -rejection_threshold. Lower switching means more patterns, so it eats into effective compression too.
Calculator
Change any input; everything recomputes. "Decompressor bits" is an estimate until the EDT exists (the real size comes from report_edt_configurations); 32 to 64 is a reasonable starting guess for planning. "Capture + update cycles" covers the non-shift cycles each pattern also costs (the update cycle and the capture window); the worked example above ignores them, so the calculator's test time comes out slightly higher. Pattern counts are yours to estimate (from a baseline run or analyze_compression); the calculator only does the arithmetic.
Interview questions
Why is effective compression always below the chain:channel ratio? basic
Because EDT reduces the data per pattern, not the number of patterns. Each compressed pattern can carry fewer care bits, so the tool needs more patterns, and each one has a few extra initialization cycles. Effective compression is roughly the ratio times L/(L+init) times the pattern-count ratio, and the last factor is usually well below 1.
8 channels, 160,000 cells, 64-bit decompressor. What do 400 versus 800 chains give you? core
400 chains: L = 400, init = 8, 408 shift cycles per pattern, ratio 50. 800 chains: L = 200, 208 cycles, ratio 100. If pattern count stayed equal, 800 would nearly halve test time. In practice the higher ratio raises pattern count and EDT-aborted faults, so you'd run compression analysis on both and compare data volume and coverage, and check that 800 chains route around the EDT.
Compression is half what you expected. How do you find out why? deep
First split it into the three factors. If the transcript shows many masking patterns (more than about a quarter of the set), X sources are inflating the pattern count: turn on E5 reporting and fix the sources. If almost no masking, check the extra shift cycles against chain length with report_edt_configurations. If EDT-aborted faults show up in report_aborted_faults, the ratio is too aggressive or constraints are too heavy. If none of those, there may be room for a more aggressive configuration.
Why would you use fewer output channels than input channels? core
Input bandwidth limits how many care bits each pattern can load; output bandwidth limits how much response you can observe without aliasing or masking. In a design with few X sources, the compactor can squeeze many chains into few outputs with little loss, while the decompressor still benefits from more inputs. Giving the pins to inputs often lowers pattern count more than symmetric channels would.
Where should OCC condition bits go in the chains, and why? deep
They're care bits in every pattern. Spread across many chains at the same shift position, they all have to be encoded in the same few shift cycles and compete with fault-detection care bits there. Stacked in one chain (when they're a small fraction of a chain), they cost one care bit per cycle. If they're large enough to fill most of a chain, an uncompressed chain can make sense, but it costs pins, so verify there's an encoding problem first.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
DRC failures and how to fix them
Every Tessent step ends in a design rule check, and each step has its own rule family. Most failures come from a short list of causes: a clock that isn't off when it should be, a reset that fires during shift, a gated clock embedded the wrong way, an X that reaches the compactor, or a name that synthesis changed. This page maps rule families to steps, then goes through the classic failures with the cause and the fix.
60-second answer: "what DRC failures do you see most, and how do you debug them?"
Trace failures and clock rule violations, mostly. A T3 trace failure means the tool simulated load_unload and the chain doesn't shift end to end: usually scan enable not reaching, a reset active during shift, a clock not pulsing, or a Type-B clock gater making leading-edge flops miss the first shift edge. C1 means a clock input isn't at a known off state when all clocks are off, often the same badly embedded gater. D1 means something disturbs scan cell contents during shift, like a set or reset that changes with scan enable or an extra test clock pulse. For EDT, K19 and K22 simulate the decompressor and compactor and tell you where along the path the data first goes wrong. My method is always the same: get the violation's gate and the procedure, report the simulated values in that procedure with set_gate_report drc_pattern, trace back with report_gates or analyze_drc_violation in Visualizer until the value is wrong, and fix the cause in the design or the setup rather than downgrading the rule.
Rule families, by step
The rule IDs below are the ones that come up most in practice. The tool's DRC message and the rule reference give the exact wording for each.
| Family | Checks | When you see it | Common examples |
|---|---|---|---|
| DFT_C | Pre-DFT clocks: every scannable flop has a defined, controllable clock; async set/reset identified; clock gating enableable | Pass 2, -logic_test on | undefined or uncontrollable clocks |
| I | ICL extraction: network traced through the design matches each instance's ICL | extract_icl, every pass | port mismatches, untraceable connections |
| G, P | General setup and test procedure file: syntax and each procedure's rules | Scan insertion, ATPG | P3, P34, P13/P54/P66 (serial register load/unload) |
| T | Scan chain tracing: simulate load_unload, follow each chain from out to in | Scan insertion (pre-existing chains), ATPG | T3, T24 |
| D | Data transfer within the chain during shift | ATPG | D1, D2 |
| C | Clock behavior: off states, capture stability, races | ATPG | C1, C2, C3, C4, C6 |
| S | Scannability of each memory element | Scan insertion | S1-S4 (warnings; S3 handling can change) |
| E | Extra checks, mostly off by default | When enabled | E5 (observable X), E10 (bus contention), E9, E11 |
| K | EDT logic: pins, connections, decompressor and compactor behavior | EDT IP creation, ATPG with EDT | K5, K13, K15, K19, K20, K22 |
| W | Procedure file warnings | Reading procedures | W5, W42 |
The debug toolkit
report_drc_rules ;# what failed, how many, handling
report_drc_rules t3 ;# occurrences of one rule
analyze_drc_violation t3-1 ;# open one violation in Visualizer
set_gate_report drc_pattern load_unload ;# show simulated values per procedure
report_gates /u_core/u_ctrl/state_reg[3] ;# on any gate you report
report_gates -backward /u_core/u_ctrl/state_reg[3]/SE ;# walk the cone
set_gate_report drc_pattern K19 ;# every shift event for EDT rules
set_drc_handling e5 note ;# turn on an extra rule
report_clocks ;# what the tool thinks your clocks are
set_drc_handling S1 warning is legitimate when you've deliberately made some cells non-scan; it's not a fix for a reset nobody controls. Downgraded clock and trace violations come back as coverage loss, X in the compactor, or simulation mismatches, which are all harder to debug than the DRC was.The classic failures
| Rule | What it means | Usual causes | Fix |
|---|---|---|---|
| T3 | A chain can't be traced: the value shifted in doesn't reach the scan-out through the expected cells | Scan enable not reaching the cell; async set/reset active during shift; clock not pulsing in shift; Type-B clock gater driving leading-edge flops; wrong scan-in/out or missing test_setup | Report the failing cell's SE, clock and reset values in load_unload; fix the control that's wrong; for Type-B gaters see below |
| C1 | A clock input isn't at its off state when all clocks are off | Type-B clock gater (gclk holds the latch's old value); clock logic that depends on non-constant state | Fix the gater embedding; otherwise initialize the gaters in test_setup and constrain their enables (below) |
| D1 | Scan cell contents are disturbed during shift | Set/reset gated only by SE, which changes before load_unload ends; an extra test clock pulse (EDT initialization) on a shared functional clock | Gate set/reset off in both shift and capture; delay the capture clock with a stretched timeplate instead of post-shift dead cycles; use a dedicated test clock |
| S1-S4 | A memory element can't be made scannable | Uncontrollable clock, set or reset; RTL clock gating with unknown enables | Fix in pass 2 (auto reset control, add_dft_clock_enables); or declare it non-scan on purpose |
| C3, C4 | Capture behavior depends on clock and data racing: a clock captures data that the same clock changes (sequential loops, RAM paths) | Clock used as data, loops through latches or RAMs, trailing-edge elements fed from the same clock | set_split_capture_cycle on lets the tool simulate it correctly; fix the structure if coverage suffers |
| C6 | A clock captures data read from a RAM by the same clock | RAM read port and capturing flops on one clock | Set clock timing so the read data is stable before capture; set_clock_off_simulation avoids the resulting mismatches |
| C2 | An external clock reaches both a PLL and other logic (named capture procedures) | Reference clock also used directly in the design | Separate the paths, or restructure the capture procedures |
| E5 | X sources observable at scan cells | Unmodeled memories and black boxes, non-scan flops, floating nets, bus contention | Model or bound them; matters most with compression |
| P34 | A reset defined as a clock and constrained off isn't forced off in load_unload or named capture procedures | Procedure missing the force | Force it in those procedures (the tool adds clock off-states to load_unload automatically when missing) |
| P3 | Shift timeplate has no delay between the clock's trailing edge and the end of the period | Hand-edited timeplate after EDT added its clock | Leave time after the trailing edge in the shift timeplate |
| W42 | A timing variable in the procedure file evaluates to an invalid time unit | Arithmetic on timing variables without units | Make every timing expression end in a valid unit |
| T24, C6 | The violations most often behind simulation mismatches | see above | Treat them as must-fix before trusting simulation |
Clock gaters: the most common root cause
The same latch-and-AND clock gater can be wired two ways. Type-A (the clock's off state reaches the gater uninverted) is fully supported: the gater turns on as soon as scan enable rises, gclk is a known 0 when clocks are off, and the enable logic stays testable. Type-B (an inversion in front of the gater) causes C1 for everything behind it, and if the downstream flops are leading-edge, T3 because the first shift edge is suppressed: the latch still holds its capture value when load_unload starts.
Fix it in the design if you can (move the inversion after the gater). If you can't, for ATPG:
- Initialize the gaters in one cycle of test_setup: scan enable high, pulse the clocks.
set_stability_check on -sim_static_atpg_constraints onadd_atpg_constraints 1 <functional enable pin> -staticon the functional enable of each Type-B gater.
Type-B gaters driving only trailing-edge flops are handled automatically: the tool ties downstream latches, leading-edge non-scan flops, RAMs and POs to X, which avoids C1 at the cost of some coverage in the enable cone.
EDT rules (K)
| Rule | What it checks | Usual causes when it fails |
|---|---|---|
| K5 | EDT control pins | A control (for example edt_update) driven internally, by a TDR or JTAG, but not declared as such: false violations until you specify the internal driver |
| K13 | Pins added to the wrapper in IP creation | Informational: tells you how many channel and control pins the EDT adds |
| K15 | Every channel and control pin has a proper top-level pin | Missing top-level connection; channel sharing set up without the sharing declaration |
| K19 | Decompressor path: data reaching the first cell of each chain matches the model | Wrong edt_clock/edt_update/bypass values; inverted signals; channel or chain order swapped; X from the decompressor; input pipeline count wrong |
| K20 | Number of pipeline stages between chains and output pins | Specified count differs from the netlist; first output pipeline stage trailing-edge instead of leading-edge (one cycle less than expected) |
| K22 | Compactor path, in non-masking and masking modes: chain outputs reach the channels correctly | Inverted signals, chain order, masking logic problems, output pipeline issues |
- K19 to K22 can't find EDT pins when synthesis renamed them or flattened the EDT hierarchy. Preserve the EDT module and its pin names in synthesis; it also gives you much better diagnostic messages.
- Read the location in the message. "Data at core chain 2 input is correct, erroneous at first cell" points at the netlist between those two points. "Incorrect at the EDT module output" points at the EDT controls or the procedure.
- Bypass first. If bypass-mode DRC and simulation are clean but compressed mode fails K19, the chains are fine and the problem is in what EDT adds: controls, channel mapping, pipelines.
set_drc_handling."Interview questions
You get a T3 on one chain after scan insertion. How do you debug it? core
Find where the trace stops: the message names the cell. Set set_gate_report drc_pattern load_unload and report that cell: is SE at its shift value, does the clock pulse, is any set or reset active? Walk backward with report_gates -backward from whichever input is wrong. Common answers: an SE branch not connected or gated, a reset not held off during shift, a clock gater that isn't enabled at the start of shift (Type-B), or an inversion making a leading-edge flop miss the first edge.
What's the difference between a Type-A and a Type-B clock gater and why does DRC care? core
It's whether the clock's off state reaches the gater uninverted. In Type-A, with the clock off, the latch is transparent and the AND input is 0, so gclk is a known 0 and a rising scan enable takes effect immediately. In Type-B, an inversion in front makes the latch opaque and the AND input 1 when the clock is off, so gclk equals the latch's stored value: not a known off state (C1), and leading-edge flops behind it can miss the first shift edge (T3).
Why can a functional clock used as test_clock cause D1 violations? deep
The EDT logic needs a clock pulse to initialize before shifting. If the test clock is also the functional clock of scan cells, that pulse clocks those cells too, outside the shift sequence, and disturbs what they hold. The tool reports D1 and there's no setup-only fix. A dedicated test clock (or TCK), with the OCC placed on the functional path, avoids it.
K19 says the data at the core chain input is correct but the first cell is wrong. Where's the problem? core
Between the chain input and the first cell, so in the netlist, not in the EDT logic: a wrong connection from the EDT output to the chain, a scan cell with SE or clock wrong in shift, a missing lockup where the EDT clock and chain clock are skewed, or an inversion the model doesn't expect. Report the first cell's inputs in the load_unload pattern.
When is downgrading an S1 or S2 violation the right call? basic
When the cells involved are deliberately non-scan, for example in a design with pre-existing scan where some instances were excluded on purpose, and you need to get to analysis mode to continue (test point insertion is the typical case). Otherwise S-rule violations point at uncontrollable clocks or resets that should be fixed in pass 2.
Notes: command, signal and file names follow Tessent Shell conventions. Scripts use generic names (my_core, core_clk) and need adapting to your design and library.
Run triage: grep, regex and Python for DRC, ATPG and simulation logs
Most of a DFT engineer's debugging starts with a log that's too long to read. This page is a toolkit: grep and awk one-liners for the questions you ask every day, a short regex reference, and five small Python scripts for the jobs one-liners can't do cleanly. All sample logs are made up but shaped like real transcripts; every output shown was produced by running the command on them.
60-second answer: "how do you go through a failing run's logs?"
First the first error: grep -n -m1 -B3 'Error' on the transcript, because everything after it is usually a consequence. If DRC failed, count violations per rule with grep -o on the rule tags and sort | uniq -c, then look at the instances of the worst rule; a T3 points at one chain, a burst of C1 usually at one clock gater. If ATPG ran, diff the statistics against the last good run to see which fault classes moved. If simulation failed, group mismatches by scan cell: one cell failing in many patterns is a local problem, adjacent cells point at the shift path, and X values point at initialization or timing. One-liners answer the first questions; when I need to pair lines, carry state between lines or compare runs, I write a short Python script with one regex per line type and a dictionary.
Regex essentials for logs
| Piece | Means | Log example |
|---|---|---|
^ $ | Start, end of line | ^// Error: only real errors, not quoted text |
\d+ [0-9]+ | One or more digits (\d needs grep -P or Python; use [0-9] with grep -E) | pattern [0-9]+ |
\w+ | Letters, digits, underscore | chain (\w+) |
\S+ | Anything up to whitespace (Python, grep -P) | a full hierarchical path |
( ) | Group, and capture in Python or sed -E | \((T3)-([0-9]+)\) |
a|b | Alternative | (Error|Warning) |
(?: ) | Group without capturing (Python, -P) | (?:chain (\w+)|PO (\S+)) |
.* vs .*? | Greedy vs shortest match (non-greedy in Python, -P) | detected at (.+?) (/\S+) |
\( \) \[ \] | Literal brackets must be escaped in -E and Python | \(K19-[0-9]+\), edt_si\[3\] |
grep -E is extended regex and works everywhere. grep -P is Perl-style (\d, \S, non-greedy, lookarounds) on GNU grep. rg (ripgrep), if installed, is much faster on big log trees, uses Perl-style regex by default and takes the same everyday options (-n -o -c -A -B -l). Quote patterns in single quotes so the shell leaves the backslashes alone.| grep option | Does |
|---|---|
-n / -c / -l / -H | Line numbers / count only / file names only / always show file name |
-o | Print only the matched text (one match per line) |
-v | Lines that don't match |
-i | Ignore case |
-m N | Stop after N matches |
-A N / -B N / -C N | Lines of context after / before / both |
-r --include='*.log' | Recurse, limited to some files |
zgrep | Same, on .gz files |
One-liners, tested
Sample inputs first, so you can see what the patterns match.
drc.log (DRC transcript)
// Tessent-style transcript excerpt (made up for practice)
// command: check_design_rules
// ------------------------------------------------------
// Begin scan chain tracing.
// Error: Chain chain_14 blocked at gate /u_core/u_alu/acc_reg_7_/SI (13521) after tracing 41 cells. (T3-1)
// Error: Chain chain_22 blocked at gate /u_core/u_mul/p_reg_0_/SI (20877) after tracing 3 cells. (T3-2)
// Warning: 2 scan cells have a clock not at off state when all clocks are off. (C1-1)
// /u_core/u_dma/st_reg_1_ (8811)
// /u_core/u_dma/st_reg_2_ (8812)
// Warning: Clock /u_core/u_cg3/gclk may capture data affected by its own capture. (C3-1)
// Warning: Non-scan cell /u_io/sync_q (944) drives X into 12 scan cells. (E5-1)
// Warning: Non-scan cell /u_io/sync_q2 (945) drives X into 3 scan cells. (E5-2)
// Warning: Black box /u_core/u_ram0 output drives X into 64 scan cells. (E5-3)
// Error: Scan cell data disturbed during shift for /u_core/u_tmr/cnt_reg_3_ (7710). (D1-1)
// Rule summary:
// T3 : 2 errors
// D1 : 1 error
// C1 : 1 warning
// C3 : 1 warning
// E5 : 3 warnings
// DRC failed. Remaining in SETUP mode.stats_a.rpt (statistics report)
Statistics Report
Stuck-at Faults
----------------------------------------------
Fault Classes #faults
(total)
---------------------------- ----------------
FU (full) 2,184,120
---------------------------- ----------------
UC (uncontrolled) 1,120 ( 0.05%)
UO (unobserved) 18,233 ( 0.83%)
DS (det_simulation) 1,701,442 ( 77.90%)
DI (det_implication) 344,020 ( 15.75%)
PU (posdet_untestable) 1,104 ( 0.05%)
PT (posdet_testable) 611 ( 0.03%)
UU (unused) 12,400 ( 0.57%)
TI (tied) 26,010 ( 1.19%)
BL (blocked) 18,330 ( 0.84%)
RE (redundant) 30,050 ( 1.38%)
AU (atpg_untestable) 30,800 ( 1.41%)
----------------------------------------------
Coverage
--------------------------
test_coverage 97.61%
fault_coverage 93.71%
atpg_effectiveness 99.12%
----------------------------------------------
#test_patterns 2,310sim.log (testbench mismatches)
# serial testbench log, made up for practice
Time 1200ns: pattern 0 load ok
Mismatch at pattern 3, chain chain_7, cell 118: expected 1, got 0 (time 44210ns)
Mismatch at pattern 3, chain chain_7, cell 119: expected 0, got 1 (time 44210ns)
Mismatch at pattern 5, PO /out_valid: expected 1, got X (time 61002ns)
Mismatch at pattern 6, chain chain_7, cell 118: expected 1, got 0 (time 72990ns)
Mismatch at pattern 9, chain chain_7, cell 118: expected 1, got 0 (time 101320ns)
Mismatch at pattern 9, chain chain_31, cell 4: expected 0, got 1 (time 101320ns)
Mismatch at pattern 12, chain chain_7, cell 118: expected 1, got 0 (time 133800ns)
Simulation complete: 20 patterns, 8 mismatchesk19.log (EDT DRC messages)
// Error: Non-masking mode: 1 of 400 EDT module chain outputs (sink) failed. (K22-1)
// Erroneous bit(s) detected at EDT module chain 57 output (sink) /u_core/u_lsu/q_reg_9_/Q (51321).
// Data at core chain 57 output /u_core/edt_so[57] (60112) is correct.
// Error: Erroneous bit(s) detected at core chain 12 first cell /u_core/u_fp/a_reg_0_ (9133). (K19-1)
// Data at core chain 12 input /u_core/edt_si[12] (60004) is correct.
// Error: Erroneous bit(s) detected at core chain 13 first cell /u_core/u_fp/a_reg_1_ (9134). (K19-1)
// Data at core chain 13 input /u_core/edt_si[13] (60005) is correct.
// Error: Erroneous bit(s) detected at core chain 2 input /u_core/edt_si[2] (60001). (K19-1)
// Data at EDT module chain 2 input (source) /u_edt/u_dec/ix31/Y (216) is correct.run.log (a run that stopped)
// command: set_context patterns -scan
// command: read_cell_library ../lib/tessent/stdcells.tcelllib
// command: read_verilog ../netlist/my_core_scan.vg
// Warning: Module 'pll_wrap' has no definition. Treated as black box.
// command: set_current_design my_core
// command: read_core_descriptions ../ip/my_core_edt_c1.tcd
// command: add_core_instances -core my_core_edt_c1 -modules my_core_edt_c1
// command: check_design_rules
// Begin scan chain tracing.
// Error: Chain chain_14 blocked at gate /u_core/u_alu/acc_reg_7_/SI (13521) after tracing 41 cells. (T3-1)
// DRC failed. Remaining in SETUP mode.
// command: create_patterns
// Error: Command create_patterns is not available in SETUP mode.
// Dofile aborted.Count DRC violations per rule drc.log
grep -oE '\(([A-Z]+[0-9]*)-[0-9]+\)' drc.log | tr -d '()' | cut -d- -f1 | sort | uniq -c | sort -rn-o prints only the match; the regex matches (T3-1)-style tags; cut drops the occurrence number; uniq -c counts.
Output
3 E5
2 T3
1 D1
1 C3
1 C1First error, with two lines before it drc.log
grep -nE -m1 -B2 -A1 '^// Error:' drc.log-n line numbers, -m1 stop after the first match, -B/-A context lines.
Output
3-// ------------------------------------------------------
4-// Begin scan chain tracing.
5:// Error: Chain chain_14 blocked at gate /u_core/u_alu/acc_reg_7_/SI (13521) after tracing 41 cells. (T3-1)
6-// Error: Chain chain_22 blocked at gate /u_core/u_mul/p_reg_0_/SI (20877) after tracing 3 cells. (T3-2)Every flop instance named in a log, once drc.log
grep -oE '/[A-Za-z0-9_/]+_reg_[0-9]+_' drc.log | sort -uSynthesized flops are usually named <reg>_reg_<bit>_; adjust the pattern to your library's naming.
Output
/u_core/u_alu/acc_reg_7_
/u_core/u_dma/st_reg_1_
/u_core/u_dma/st_reg_2_
/u_core/u_mul/p_reg_0_
/u_core/u_tmr/cnt_reg_3_Coverage and pattern count from two runs stats_*.rpt
grep -E '^\s*(test_coverage|fault_coverage|#test_patterns)' stats_a.rpt stats_b.rptWith more than one file, grep prefixes each line with the file name.
Output
stats_a.rpt: test_coverage 97.61%
stats_a.rpt: fault_coverage 93.71%
stats_a.rpt: #test_patterns 2,310
stats_b.rpt: test_coverage 96.97%
stats_b.rpt: fault_coverage 93.11%
stats_b.rpt: #test_patterns 2,655Fault class counts as name/number pairs stats_a.rpt
awk '/^ *[A-Z][A-Z] \(/ {gsub(",","",$3); printf "%s %s\n", $1, $3}' stats_a.rptawk splits on whitespace: $1 is the class, $3 the count; gsub removes the thousands separators.
Output
FU 2184120
UC 1120
UO 18233
DS 1701442
DI 344020
PU 1104
PT 611
UU 12400
TI 26010
BL 18330
RE 30050
AU 30800Which scan cells mismatch in simulation, and how often sim.log
grep -oE 'chain (\w+), cell ([0-9]+)' sim.log | sort | uniq -c | sort -rnOne cell failing many times is the first thing to look at.
Output
4 chain chain_7, cell 118
1 chain chain_7, cell 119
1 chain chain_31, cell 4How many mismatches are X sim.log
grep -cE 'got X' sim.log-c counts matching lines.
Output
1Chains named in K19/K22 messages k19.log
grep -oE '(core|EDT module) chain [0-9]+' k19.log | grep -oE '[0-9]+$' | sort -nuTwo greps in a row: the first finds the phrase, the second keeps only the number; sort -nu sorts numerically and removes duplicates.
Output
2
12
13
57Errors and warnings, without the echoed commands run.log
grep -vE '^// command:' run.log | grep -E 'Error|Warning'-v inverts the match: drop the transcript's command echoes first.
Output
// Warning: Module 'pll_wrap' has no definition. Treated as black box.
// Error: Chain chain_14 blocked at gate /u_core/u_alu/acc_reg_7_/SI (13521) after tracing 41 cells. (T3-1)
// Error: Command create_patterns is not available in SETUP mode.First failing pattern number sim.log
grep -E 'Mismatch at pattern' sim.log | sed -E 's/.*pattern ([0-9]+).*/\1/' | sort -n | head -1sed -E with a capture group keeps just the number.
Output
3The same value across many run directories runs/*/
grep -H 'test_coverage' runs/*/int_sa.log-H forces the file name even for one file; the shell glob expands to every run.
Output
runs/r1/int_sa.log: test_coverage 97.61%
runs/r2/int_sa.log: test_coverage 96.97%Search compressed logs without unzipping sim.log.gz
zgrep -c 'Mismatch' sim.log.gzzgrep takes the same options as grep.
Output
7Which logs in a tree mention something runs/
grep -rl --include='*.log' 'test_coverage' runs | sort-r recursive, -l file names only, --include limits the file types.
Output
runs/r1/int_sa.log
runs/r2/int_sa.logPython scripts, tested
Each one follows the same shape: one compiled regex per kind of line, a loop over the file, a dictionary to collect, a short report. They run with plain Python 3.8+ and no packages.
T1DRC summary by rule and instance core
Read a check_design_rules transcript and print each rule once, errors first, with the instances it names, including instance lists printed on the lines under a message.
Input (drc.log)
// Tessent-style transcript excerpt (made up for practice)
// command: check_design_rules
// ------------------------------------------------------
// Begin scan chain tracing.
// Error: Chain chain_14 blocked at gate /u_core/u_alu/acc_reg_7_/SI (13521) after tracing 41 cells. (T3-1)
// Error: Chain chain_22 blocked at gate /u_core/u_mul/p_reg_0_/SI (20877) after tracing 3 cells. (T3-2)
// Warning: 2 scan cells have a clock not at off state when all clocks are off. (C1-1)
// /u_core/u_dma/st_reg_1_ (8811)
...Think it through
- Match lines that start with
// Error:or// Warning:and end with a rule tag like(T3-1). - Keep a dictionary: rule to list of messages.
- Remember the last rule you saw, so indented instance lines underneath can be added to it.
- Sort errors before warnings, then by count, and print the first path in each message.
Hint
A regex with three groups gets severity, message and rule in one match: ^//\s*(Error|Warning):\s*(.*)\((\w+?)-\d+\)$.
Python solution
"""T1: summarize a DRC transcript by rule, severity and instance."""
import re, sys
from collections import defaultdict
RULE = re.compile(r"^//\s*(Error|Warning):\s*(.*)\((\w+?)-\d+\)\s*$")
INST = re.compile(r"(/[\w/\[\]]+)") # first hierarchical path on the line
def summarize(path):
by_rule = defaultdict(list) # rule -> [messages / instances]
sev_of = {}
last = None
for line in open(path):
m = RULE.match(line.rstrip())
if m:
sev, msg, rule = m.groups()
by_rule[rule].append(msg.strip())
sev_of[rule] = sev
last = rule
elif last and re.match(r"^//\s{3,}/", line): # indented instance list under a message
by_rule[last].append(line.split("//", 1)[1].strip())
else:
last = None
for rule in sorted(by_rule, key=lambda r: (sev_of[r] != "Error", -len(by_rule[r]))):
msgs = by_rule[rule]
print(f"{rule:4} {sev_of[rule]:7} {len(msgs)} line(s)")
for msg in msgs:
inst = INST.search(msg)
print(" ", inst.group(1) if inst else msg[:60])
if __name__ == "__main__":
summarize(sys.argv[1] if len(sys.argv) > 1 else "data/drc.log")Output on the sample:
T3 Error 2 line(s)
/u_core/u_alu/acc_reg_7_/SI
/u_core/u_mul/p_reg_0_/SI
D1 Error 1 line(s)
/u_core/u_tmr/cnt_reg_3_
C1 Warning 3 line(s)
2 scan cells have a clock not at off state when all clocks a
/u_core/u_dma/st_reg_1_
/u_core/u_dma/st_reg_2_
E5 Warning 3 line(s)
/u_io/sync_q
/u_io/sync_q2
/u_core/u_ram0
C3 Warning 1 line(s)
/u_core/u_cg3/gclkFollow-ups
- Group by the module instead of the full instance (strip the last path element).
- Read the rule summary at the end of the transcript and check it against your own counts.
- Make it read every log in a directory and print a table of rule by run.
T2What changed between two ATPG runs core
Parse two statistics reports (fault classes, coverage, pattern count) and print only what changed. The use case: you changed a constraint, a library or a netlist and want to know what it cost.
Input (stats_a.rpt)
Statistics Report
Stuck-at Faults
----------------------------------------------
Fault Classes #faults
(total)
---------------------------- ----------------
FU (full) 2,184,120
---------------------------- ----------------
...Think it through
- One regex per kind of line: fault class rows, coverage rows, the pattern count.
- Strip the thousands separators before converting to numbers.
- Store each report in a dictionary with the same keys.
- Print keys whose values differ, with the delta.
Hint
Python 3.8+ lets you match and test in one line: if m := CLASS.match(line):.
Python solution
"""T2: parse two report_statistics outputs and show what changed."""
import re, sys
CLASS = re.compile(r"^\s*([A-Z]{2})\s+\((\w+)\)\s+([\d,]+)") # 'AU (atpg_untestable) 30,800'
COV = re.compile(r"^\s*(test_coverage|fault_coverage|atpg_effectiveness)\s+([\d.]+)%")
PAT = re.compile(r"^\s*#test_patterns\s+([\d,]+)")
def parse(path):
d = {}
for line in open(path):
if m := CLASS.match(line):
d[m.group(1)] = int(m.group(3).replace(",", ""))
elif m := COV.match(line):
d[m.group(1)] = float(m.group(2))
elif m := PAT.match(line):
d["patterns"] = int(m.group(1).replace(",", ""))
return d
def diff(a_path, b_path):
a, b = parse(a_path), parse(b_path)
print(f"{'item':20}{'run A':>12}{'run B':>12}{'delta':>12}")
for k in a:
if k in b and a[k] != b[k]:
dv = b[k] - a[k]
fmt = "{:+.2f}" if isinstance(dv, float) else "{:+,}"
print(f"{k:20}{a[k]:>12,}{b[k]:>12,}{fmt.format(dv):>12}")
if __name__ == "__main__":
a = sys.argv[1] if len(sys.argv) > 2 else "data/stats_a.rpt"
b = sys.argv[2] if len(sys.argv) > 2 else "data/stats_b.rpt"
diff(a, b)Output on the sample:
item run A run B delta
UC 1,120 2,910 +1,790
UO 18,233 24,640 +6,407
DS 1,701,442 1,688,120 -13,322
AU 30,800 35,980 +5,180
test_coverage 97.61 96.97 -0.64
fault_coverage 93.71 93.11 -0.60
patterns 2,310 2,655 +345Follow-ups
- Flag a coverage drop over a threshold with a non-zero exit code so a regression script can catch it.
- Add percent change next to the absolute delta.
- Explain the result: here AU, UC and UO all grew; what kinds of change make that happen?
T3Group simulation mismatches and guess the cause core
Read a testbench log, group mismatches by scan cell or primary output, and print a first guess at the kind of problem for each.
Input (sim.log)
# serial testbench log, made up for practice
Time 1200ns: pattern 0 load ok
Mismatch at pattern 3, chain chain_7, cell 118: expected 1, got 0 (time 44210ns)
Mismatch at pattern 3, chain chain_7, cell 119: expected 0, got 1 (time 44210ns)
Mismatch at pattern 5, PO /out_valid: expected 1, got X (time 61002ns)
Mismatch at pattern 6, chain chain_7, cell 118: expected 1, got 0 (time 72990ns)
Mismatch at pattern 9, chain chain_7, cell 118: expected 1, got 0 (time 101320ns)
Mismatch at pattern 9, chain chain_31, cell 4: expected 0, got 1 (time 101320ns)
...Think it through
- Parse each mismatch into pattern, location (chain and cell, or PO) and expected/got values.
- Group by location and count distinct patterns.
- Apply simple rules: X involved, one cell with the same polarity in many patterns, or only a few patterns.
- Look for neighboring cells in the same chain failing together, which points at the shift path.
Hint
A single regex with an alternation handles both forms: (?:chain (\w+), cell (\d+)|PO (\S+)); unused groups come back as None.
Python solution
"""T3: group simulation mismatches by location and guess the kind of problem."""
import re, sys
from collections import defaultdict
MIS = re.compile(r"Mismatch at pattern (\d+), (?:chain (\w+), cell (\d+)|PO (\S+)): "
r"expected (\w), got (\w)")
def triage(path):
hits = defaultdict(list) # location -> [pattern numbers]
total_pats = None
for line in open(path):
if m := MIS.search(line):
pat, chain, cell, po, exp, got = m.groups()
loc = f"{chain}[{cell}]" if chain else f"PO {po}"
hits[loc].append((int(pat), exp, got))
elif m := re.search(r"complete: (\d+) patterns", line):
total_pats = int(m.group(1))
for loc, h in sorted(hits.items(), key=lambda kv: -len(kv[1])):
pats = sorted({p for p, _, _ in h})
kinds = {f"{e}->{g}" for _, e, g in h}
if any("X" in k for k in kinds):
guess = "X in simulation: uninitialized cell, timing violation or bus contention"
elif len(pats) > 1 and len(kinds) == 1:
guess = "same cell, same polarity, many patterns: look at that cell's capture path or a hold issue"
else:
guess = "few patterns: likely a specific path (timing) or a pattern-dependent issue"
print(f"{loc:18} fails in {len(pats)} pattern(s), first {pats[0]} {sorted(kinds)}")
print(f"{'':18} -> {guess}")
chains = defaultdict(set)
for loc in hits:
if "[" in loc:
chains[loc.split("[")[0]].add(int(loc.split("[")[1][:-1]))
for c, cells in chains.items():
if len(cells) > 1 and max(cells) - min(cells) == len(cells) - 1:
print(f"note: {c} fails on adjacent cells {sorted(cells)}: check the shift path between them")
if total_pats:
print(f"{len({p for h in hits.values() for p, _, _ in h})} of {total_pats} patterns have a mismatch")
if __name__ == "__main__":
triage(sys.argv[1] if len(sys.argv) > 1 else "data/sim.log")Output on the sample:
chain_7[118] fails in 4 pattern(s), first 3 ['1->0']
-> same cell, same polarity, many patterns: look at that cell's capture path or a hold issue
chain_7[119] fails in 1 pattern(s), first 3 ['0->1']
-> few patterns: likely a specific path (timing) or a pattern-dependent issue
PO /out_valid fails in 1 pattern(s), first 5 ['1->X']
-> X in simulation: uninitialized cell, timing violation or bus contention
chain_31[4] fails in 1 pattern(s), first 9 ['0->1']
-> few patterns: likely a specific path (timing) or a pattern-dependent issue
note: chain_7 fails on adjacent cells [118, 119]: check the shift path between them
5 of 20 patterns have a mismatchFollow-ups
- Map chain and cell back to an instance name using the scan cell report.
- Separate parallel and serial testbench logs: which kinds of failure only show up in serial?
- Count failures per pattern instead of per cell. What would a single bad pattern suggest?
T4Turn K19/K22 messages into a location deep
K19 and K22 report where the simulated data first goes wrong and the nearest point where it's still right. Pair those two lines up so each failure reads as "look between here and here".
Input (k19.log)
// Error: Non-masking mode: 1 of 400 EDT module chain outputs (sink) failed. (K22-1)
// Erroneous bit(s) detected at EDT module chain 57 output (sink) /u_core/u_lsu/q_reg_9_/Q (51321).
// Data at core chain 57 output /u_core/edt_so[57] (60112) is correct.
// Error: Erroneous bit(s) detected at core chain 12 first cell /u_core/u_fp/a_reg_0_ (9133). (K19-1)
// Data at core chain 12 input /u_core/edt_si[12] (60004) is correct.
// Error: Erroneous bit(s) detected at core chain 13 first cell /u_core/u_fp/a_reg_1_ (9134). (K19-1)
// Data at core chain 13 input /u_core/edt_si[13] (60005) is correct.
// Error: Erroneous bit(s) detected at core chain 2 input /u_core/edt_si[2] (60001). (K19-1)
...Think it through
- Track the current rule from the
(K19-n)or(K22-n)tag. - Remember the last "Erroneous bit(s) detected at ..." location.
- When the next "Data at ... is correct" line arrives, print the pair.
Hint
Non-greedy (.+?) stops at the first space before the path, so the description and the path come out as separate groups.
Python solution
"""T4: turn K19/K22 messages into 'bad between X and Y' lines."""
import re, sys
BAD = re.compile(r"Erroneous bit\(s\) detected at (.+?) (/\S+) \(\d+\)")
GOOD = re.compile(r"Data at (.+?) (/\S+) \(\d+\) is correct")
def locate(path):
rule, bad = None, None
for line in open(path):
if m := re.search(r"\((K19|K22)-\d+\)", line):
rule = m.group(1)
if m := BAD.search(line):
bad = (m.group(1), m.group(2))
elif (m := GOOD.search(line)) and bad:
where_bad, node_bad = bad
where_ok, node_ok = m.group(1), m.group(2)
print(f"{rule}: correct at {where_ok} {node_ok}")
print(f" wrong at {where_bad} {node_bad}")
print(f" -> check the connection or logic between those two points")
bad = None
if __name__ == "__main__":
locate(sys.argv[1] if len(sys.argv) > 1 else "data/k19.log")Output on the sample:
K22: correct at core chain 57 output /u_core/edt_so[57]
wrong at EDT module chain 57 output (sink) /u_core/u_lsu/q_reg_9_/Q
-> check the connection or logic between those two points
K19: correct at core chain 12 input /u_core/edt_si[12]
wrong at core chain 12 first cell /u_core/u_fp/a_reg_0_
-> check the connection or logic between those two points
K19: correct at core chain 13 input /u_core/edt_si[13]
wrong at core chain 13 first cell /u_core/u_fp/a_reg_1_
-> check the connection or logic between those two points
K19: correct at EDT module chain 2 input (source) /u_edt/u_dec/ix31/Y
wrong at core chain 2 input /u_core/edt_si[2]
-> check the connection or logic between those two pointsFollow-ups
- Group the results by where they fail (first cell, chain input, EDT output). One group failing on every chain points at a control signal, not a connection.
- Neighboring chains failing the same way (12 and 13 here): what would you check first?
T5Why did the run stop? basic
Find the first error in a transcript, the command that was running, and a few lines of context. Most failed runs are explained by their first error; the rest are consequences.
Input (run.log)
// command: set_context patterns -scan
// command: read_cell_library ../lib/tessent/stdcells.tcelllib
// command: read_verilog ../netlist/my_core_scan.vg
// Warning: Module 'pll_wrap' has no definition. Treated as black box.
// command: set_current_design my_core
// command: read_core_descriptions ../ip/my_core_edt_c1.tcd
// command: add_core_instances -core my_core_edt_c1 -modules my_core_edt_c1
// command: check_design_rules
...Think it through
- Remember the last
// command:line as you read. - Stop at the first line with
Error:and print the context before it. - Count warnings and print the last line, which often says how the run ended.
Hint
for ... else in Python: the else runs only if the loop didn't break, which is a clean way to say "no errors".
Python solution
"""T5: why did the run stop? Last command, mode, first error with context."""
import re, sys
def first_error(path, before=3):
lines = open(path).read().splitlines()
last_cmd = None
for i, line in enumerate(lines):
if m := re.search(r"// command: (.*)", line):
last_cmd = m.group(1)
if re.search(r"\bError:", line):
print(f"first error at line {i + 1}, during: {last_cmd}")
for ctx in lines[max(0, i - before): i + 1]:
print(" ", ctx)
break
else:
print("no errors")
warnings = [l for l in lines if "Warning:" in l]
print(f"{len(warnings)} warning(s); last line: {lines[-1]}")
if __name__ == "__main__":
first_error(sys.argv[1] if len(sys.argv) > 1 else "data/run.log")Output on the sample:
first error at line 10, during: check_design_rules
// command: add_core_instances -core my_core_edt_c1 -modules my_core_edt_c1
// command: check_design_rules
// Begin scan chain tracing.
// Error: Chain chain_14 blocked at gate /u_core/u_alu/acc_reg_7_/SI (13521) after tracing 41 cells. (T3-1)
1 warning(s); last line: // Dofile aborted.Follow-ups
- Make it scan a directory of runs and print one line per run: status, first error, coverage if present.
- Ignore known, accepted warnings listed in a waiver file of regexes.
grep or Python?
| Use a one-liner when | Write a script when |
|---|---|
| Each answer is on one line (count, list, first match) | The answer spans lines (a message and the instances under it, a K19 pair) |
| You'll run it once while looking at a failure | It runs in regressions or on every block |
| The input is one or a few files | You compare runs, join with another file (scan cell report, chain map) or need thresholds |
| The output is for you | The output is a table someone else reads, or an exit code a flow checks |
More drills on file lists, netlists, chain maps and timing reports are on the scripting drills page.
Notes: sample logs are made up for practice and only approximate real transcript formats; adjust the patterns to the exact messages your tool version prints.
Verilog refresher: the RTL behind the netlist
If you mostly read gate netlists, the RTL rules fade. This page brings back the ones that decide what hardware you get and the ones interviewers check: blocking versus non-blocking, how latches and resets are inferred, what synthesis ignores, and how a register in RTL turns into the instance name you grep for in a netlist. Every code example here was simulated, and the output shown is the real output.
60-second answer: "blocking or non-blocking, and why?"
Non-blocking (<=) in clocked blocks, blocking (=) in combinational blocks. A non-blocking assignment reads its right-hand side when the clock edge happens and updates the left-hand side only after every block triggered by that edge has read its inputs, which is exactly how flip-flops behave: they all sample at the same edge, then all change. Blocking assignments update immediately, so in a clocked block a later line sees the new value. Three lines meant as a shift register collapse into one flop, and two clocked blocks that share a variable give a result that depends on which block the simulator runs first. Synthesis builds the hardware the code describes, so a blocking mistake in RTL becomes a real difference in the netlist, or a mismatch between RTL and gate-level simulation.
Three constructs, three kinds of hardware
| You write | You get | Netlist cells |
|---|---|---|
assign y = a & b; | Combinational logic | Gates: AND2, NAND2, AOI, MUX2 ... |
always @* begin ... = ... end | Combinational logic, if every path assigns every output. Otherwise a latch | Gates (or a latch cell) |
always @(posedge clk) q <= d; | Flip-flops, one per bit assigned | DFF, then SDFF after scan insertion |
always @(posedge clk or negedge rst_n) if (!rst_n) q <= 0; else q <= d; | Flip-flops with an asynchronous active-low reset | DFFR / SDFFR (reset pin RN or CDN, names vary by library) |
regdoesn't mean register. It only means "assigned inside analwaysblock". Aregin analways @*block is a wire after synthesis. SystemVerilog'slogicreplaces bothregandwirefor most uses.- SystemVerilog states intent.
always_ff,always_combandalways_latchmake the tools check that you got the hardware you meant: analways_combthat would infer a latch is flagged. - Edges.
posedge clkis a rising-edge flop;negedge clka falling-edge one. In a netlist, a falling-edge flop is either its own cell (often with an N in the name) or a rising-edge flop with an inverter on the clock.
Blocking vs non-blocking
<=) every right-hand side is read before any register updates, so each register gets the old value of the one before it: a three-stage shift register. With blocking assignments (=) each line finishes before the next starts, so q2 reads the q1 that was just written, which is d. Synthesis builds one flop and wires its output to all three names. The scan tool then sees one scan cell where the designer expected three.Simulation runs every block triggered by a clock edge in some order. Blocking assignments write immediately, so order matters. Non-blocking assignments are collected and applied together after all the triggered blocks have read their inputs, so order doesn't matter, which is how real flops behave.
The shift register, both ways (simulated)
// Three-stage shift register written two ways.
module shift_nb (input clk, input d, output reg q1, q2, q3);
always @(posedge clk) begin
q1 <= d; // non-blocking: every right-hand side is read
q2 <= q1; // before any left-hand side is updated
q3 <= q2;
end
endmodule
module shift_b (input clk, input d, output reg q1, q2, q3);
always @(posedge clk) begin
q1 = d; // blocking: q1 changes right here,
q2 = q1; // so q2 reads the NEW q1 (which is d)
q3 = q2; // and q3 reads the new q2 (also d)
end
endmodule
module tb;
reg clk = 0, d = 0;
wire a1, a2, a3, b1, b2, b3;
shift_nb nb (clk, d, a1, a2, a3);
shift_b bl (clk, d, b1, b2, b3);
integer i;
initial begin
nb.q1 = 0; nb.q2 = 0; nb.q3 = 0; bl.q1 = 0; bl.q2 = 0; bl.q3 = 0;
$display("edge d | non-blocking q1 q2 q3 | blocking q1 q2 q3");
for (i = 1; i <= 4; i = i + 1) begin
d = (i == 1); // a single 1, then 0s
#5 clk = 1; #1;
$display(" %0d %b | %b %b %b | %b %b %b", i, d, a1, a2, a3, b1, b2, b3);
#4 clk = 0;
end
end
endmoduleSimulation output:
edge d | non-blocking q1 q2 q3 | blocking q1 q2 q3
1 1 | 1 0 0 | 1 1 1
2 0 | 0 1 0 | 0 0 0
3 0 | 0 0 1 | 0 0 0
4 0 | 0 0 0 | 0 0 0Non-blocking: the single 1 walks one stage per edge. Blocking: all three take the 1 on the first edge and drop together on the second. In hardware that's one flop.
Two clocked blocks sharing a variable (simulated)
// Two always blocks on the same edge, both with blocking assignments.
// The modules are identical except for the order the blocks are written in.
module race_ab (input clk, input d, output reg a, output reg b);
always @(posedge clk) a = d;
always @(posedge clk) b = a; // old a or new a?
endmodule
module race_ba (input clk, input d, output reg a, output reg b);
always @(posedge clk) b = a;
always @(posedge clk) a = d;
endmodule
module tb;
reg clk = 0, d = 0;
wire a1, b1, a2, b2;
race_ab r1 (clk, d, a1, b1);
race_ba r2 (clk, d, a2, b2);
initial begin
r1.a = 0; r1.b = 0; r2.a = 0; r2.b = 0;
d = 1; #5 clk = 1; #1;
$display("after one edge, a was 0 and d is 1:");
$display(" race_ab: a=%b b=%b", a1, b1);
$display(" race_ba: a=%b b=%b", a2, b2);
$display(" two real flops: a=1 b=0");
end
endmoduleSimulation output:
after one edge, a was 0 and d is 1:
race_ab: a=1 b=0
race_ba: a=1 b=1
two real flops: a=1 b=0Both modules are the same logic written in a different order, and they give different answers in the same simulator. Another simulator may order them differently again. Synthesis builds two flops in both cases, so the netlist behaves like a=1 b=0: the RTL simulation of race_ba disagrees with its own netlist. Using <= in both blocks removes the race.
The four rules that avoid all of this:
- Clocked block (
posedge/negedge): use<=only. - Combinational block (
always @*): use=only. - Don't mix
=and<=in one block. - Assign each variable in one block only. Two blocks writing the same variable is two drivers in hardware.
q3 = q2; q2 = q1; q1 = d;) does give a shift register in that one block, but it breaks as soon as another block reads those variables on the same edge, and it hides the intent. Interviewers want the rule, then the reason.Latches: what you get when a path doesn't assign
In an always @* block, if some path through the ifs and cases doesn't assign an output, that output has to remember its old value when that path is taken. Remembering without a clock is a latch. The usual causes: an if with no else, a case with no default, or an output assigned in some branches but not others.
Missing else (simulated)
// An always @* block that does not assign q on every path.
module mux_latch (input en, input d, output reg q);
always @* begin
if (en) q = d; // no else: when en=0, q must keep its old value -> latch
end
endmodule
module mux_ok (input en, input d, output reg q);
always @* begin
q = 1'b0; // default first: every path assigns q -> plain logic
if (en) q = d;
end
endmodule
module tb;
reg en = 1, d = 1;
wire ql, qc;
mux_latch l (en, d, ql);
mux_ok c (en, d, qc);
initial begin
$display(" en d | latch q | combinational q");
#1 $display(" %b %b | %b | %b", en, d, ql, qc);
en = 0; #1 $display(" %b %b | %b | %b", en, d, ql, qc);
d = 0; #1 $display(" %b %b | %b | %b", en, d, ql, qc);
d = 1; #1 $display(" %b %b | %b | %b", en, d, ql, qc);
end
endmoduleSimulation output:
en d | latch q | combinational q
1 1 | 1 | 1
0 1 | 1 | 0
0 0 | 1 | 0
0 1 | 1 | 0With en low, the latch version keeps the 1 it had, whatever d does. The version with a default line is plain logic and follows the code.
- The fix is a default assignment at the top of the block, or a complete
else/default. - Why DFT cares. A latch isn't a scan cell. ATPG has to control its enable to make it transparent or treat its output as unknown, and an unexpected latch in a data path often costs coverage. In a netlist, look for cell names with LAT or TLAT.
- Deliberate latches exist: clock-gating cells and lockup latches. Those are library cells or written with
always_latch, not accidents.
Resets: synchronous and asynchronous
| Synchronous | Asynchronous | |
|---|---|---|
| Code | always @(posedge clk) if (!rst_n) q <= 0; else q <= d; | always @(posedge clk or negedge rst_n) if (!rst_n) q <= 0; else q <= d; |
| Hardware | Logic in front of D; a plain DFF | A flop with a reset pin; acts without a clock |
| In shift (SE=1) | No effect: the scan mux picks SI, so the reset logic is bypassed | Acts directly on the flop: if it fires, the chain is cleared |
| What DFT needs | Nothing special | The reset must be controllable from a pin and held inactive during shift |
- The edge in the sensitivity list must match the test:
negedge rst_nwithif (!rst_n), orposedge rstwithif (rst). A mismatch simulates oddly and synthesizes into something you didn't intend. - The
_nsuffix means active low by convention. In a netlist, the reset pin is oftenRN,CDNorR(check whether the cell's reset is active low). - Reset synchronizers (two flops whose output is the block's async reset) are where scan most often goes wrong. See the scan puzzles.
Sensitivity lists
An always @(a or b) block only runs in simulation when a or b changes. Synthesis ignores the list and builds the logic from the body. Leave a signal out and RTL simulation stops matching the netlist.
Missing signal in the list (simulated)
// Incomplete sensitivity list: what RTL simulation does vs the gates synthesis builds.
module and_or_rtl (input a, input b, input c, output reg y);
always @(a or b) // c is missing from the list
y = (a & b) | c;
endmodule
module and_or_gates (input a, input b, input c, output y);
assign y = (a & b) | c; // what synthesis builds: it ignores the list
endmodule
module tb;
reg a = 0, b = 0, c = 0;
wire y_rtl, y_net;
and_or_rtl r (a, b, c, y_rtl);
and_or_gates g (a, b, c, y_net);
initial begin
$display(" a b c | RTL y | netlist y");
#1 a = 1; #1 $display(" %b %b %b | %b | %b", a, b, c, y_rtl, y_net);
c = 1; #1 $display(" %b %b %b | %b | %b", a, b, c, y_rtl, y_net);
b = 1; #1 $display(" %b %b %b | %b | %b", a, b, c, y_rtl, y_net);
c = 0; #1 $display(" %b %b %b | %b | %b", a, b, c, y_rtl, y_net);
b = 0; #1 $display(" %b %b %b | %b | %b", a, b, c, y_rtl, y_net);
end
endmoduleSimulation output:
a b c | RTL y | netlist y
1 0 0 | 0 | 0
1 0 1 | 0 | 1
1 1 1 | 1 | 1
1 1 0 | 1 | 1
1 0 0 | 0 | 0Second line: c went to 1, the netlist output follows, the RTL doesn't, because c isn't in the list. Use always @* (or always_comb) and the list is always complete.
What synthesis ignores or treats differently
| In the RTL | Simulation | Synthesis (ASIC) | What you see in gate-level sim |
|---|---|---|---|
initial q = 0; | Starts at 0 | Ignored | X until reset or a scan load |
#5 delays | Waits | Ignored | Real cell delays from the library or SDF |
| Sensitivity list | Controls when the block runs | Ignored | Logic follows all inputs |
y = 1'bx; (don't care) | X | Free to pick 0 or 1 | A real 0 or 1 |
$display, $finish | Runs | Ignored | Nothing |
// synopsys full_case and similar pragmas | No effect | Changes the logic | Can differ from RTL sim |
if / else if chain | First true branch wins | Priority logic (a chain of muxes) | Same behavior |
case with distinct items | Matching item | A parallel mux | Same behavior |
Most "RTL passes, gate-level sim fails" problems come from the first, third and sixth rows.
RTL to netlist, one register at a time
A 2-bit counter with an enable and an async reset, then the same block as it looks after synthesis and scan insertion. The netlist was written by hand to look like typical tool output, then checked against the RTL in simulation: the same stimulus gives the same count sequence, and with test_se high the bits shift through the chain.
RTL
// RTL: a 2-bit counter with enable and async active-low reset
module ctr2 (input clk, input rst_n, input en, output reg [1:0] cnt);
always @(posedge clk or negedge rst_n)
if (!rst_n) cnt <= 2'b00;
else if (en) cnt <= cnt + 2'b01;
endmoduleNetlist after synthesis and scan insertion
// Netlist: the same counter after synthesis and scan insertion
module ctr2 ( clk, rst_n, en, cnt, test_si, test_se, test_so );
input clk, rst_n, en, test_si, test_se;
output [1:0] cnt;
output test_so;
wire n1, n2, n3;
XOR2X1 U3 ( .A(cnt[0]), .B(en), .Y(n1) );
AND2X1 U4 ( .A(cnt[0]), .B(en), .Y(n2) );
XOR2X1 U5 ( .A(cnt[1]), .B(n2), .Y(n3) );
SDFFRQX1 cnt_reg_0_ ( .D(n1), .SI(test_si), .SE(test_se), .CK(clk),
.RN(rst_n), .Q(cnt[0]) );
SDFFRQX1 cnt_reg_1_ ( .D(n3), .SI(cnt[0]), .SE(test_se), .CK(clk),
.RN(rst_n), .Q(cnt[1]) );
assign test_so = cnt[1];
endmoduleTestbench, cell models and simulation output
module tb;
reg clk = 0, rst_n = 0, en = 0;
wire [1:0] cnt;
`ifdef NETLIST
reg si = 0, se = 0;
wire so;
ctr2 dut (.clk(clk), .rst_n(rst_n), .en(en), .cnt(cnt), .test_si(si), .test_se(se), .test_so(so));
`else
ctr2 dut (.clk(clk), .rst_n(rst_n), .en(en), .cnt(cnt));
`endif
reg [7:0] ens = 8'b11011101;
integer i;
initial begin
#2 rst_n = 1;
for (i = 0; i < 8; i = i + 1) begin
en = ens[i];
#5 clk = 1; #1 $write("%0d", cnt); #4 clk = 0;
end
$display("");
`ifdef NETLIST
// shift mode: load 1 then 0 through test_si, watch it walk the chain
se = 1;
si = 1; #5 clk = 1; #1 $display("shift 1: cnt[0]=%b cnt[1]=%b so=%b", cnt[0], cnt[1], so); #4 clk = 0;
si = 0; #5 clk = 1; #1 $display("shift 2: cnt[0]=%b cnt[1]=%b so=%b", cnt[0], cnt[1], so); #4 clk = 0;
`endif
end
endmodule// Tiny behavioral models of the library cells used in ctr2_net.v
module XOR2X1 (input A, B, output Y); assign Y = A ^ B; endmodule
module AND2X1 (input A, B, output Y); assign Y = A & B; endmodule
module SDFFRQX1 (input D, SI, SE, CK, RN, output reg Q);
always @(posedge CK or negedge RN)
if (!RN) Q <= 1'b0;
else Q <= SE ? SI : D;
endmodule
RTL:
11230012
Netlist:
11230012
shift 1: cnt[0]=1 cnt[1]=0 so=0
shift 2: cnt[0]=0 cnt[1]=1 so=1
Same count sequence from both (the enable pattern is 1,0,1,1,1,0,1,1). In shift mode the 1 loaded at test_si moves from cnt[0] to cnt[1] and out of test_so.
| RTL | Netlist |
|---|---|
reg [1:0] cnt assigned in a clocked block | One flop instance per bit: cnt_reg_0_, cnt_reg_1_. Other tools write cnt_reg[0] as an escaped name: \cnt_reg[0] (backslash, and a space before the next token) |
cnt + 2'b01 when en | Gates with generated names (U3, U4) and nets (n1, n2). These names change every synthesis run |
| The reset branch | A flop with a reset pin, .RN(rst_n) |
| Nothing (no scan in RTL) | New ports test_si, test_se, test_so; scan flops; each Q wired to the next SI |
Hierarchy u_core.u_alu.acc | Kept: u_core/u_alu/acc_reg_3_. Flattened: u_core_u_alu_acc_reg_3_ or an escaped name with slashes in it |
| A module used twice with different parameters | Uniquified copies: fifo_0, fifo_1, or fifo_DEPTH8 |
generate loop instance lane[3].u_ff | lane_3__u_ff or \lane[3].u_ff |
A constant 1'b0 | 1'b0 on a pin, or a tie cell (TIELO) driving a net |
Reading a netlist quickly
- An instance line is
CELL instance ( .PIN(net), ... );. The cell name tells you the function and drive strength (SDFFRQX1: scan flop, reset, Q only, size 1). The pin list is the connection. - To find what drives a pin, take the net on it and search for that net on an output pin (
.Q(,.Y(,.Z(). To find what it drives, search for the net on input pins. - An
assignin a netlist is just a rename or a feedthrough between two nets (as withtest_soabove), not logic. - Unconnected pins show as
.QN(). A scan flop with.SE(1'b0)and.SI(1'b0)is a scan cell that was never stitched. - From a failing cell back to RTL: strip the
_regand the bit suffix, and the hierarchy path tells you which module and register.
grep -oE '^\s*S?DFF\w*\s+\S+' block.v. Scan flops whose SE is tied off: grep -E 'SDFF.*\.SE\(1.b0\)' block.v (works when the instance is on one line; netlists often split it, so a short Python script that joins lines up to the ; is more reliable). Cell names differ between libraries; adjust the patterns.Interview questions
What's the difference between blocking and non-blocking assignments? basic
Blocking (=) updates the variable immediately, so the next statement sees the new value. Non-blocking (<=) reads the right-hand side now and updates at the end of the time step, after every block triggered by the same event has read its inputs. Use <= for flops so every flop samples the old values, and = for combinational logic.
What does this synthesize to: always @(posedge clk) begin b = a; c = b; end? basic
One flop. b gets a, then c gets the new b, which is also a. Synthesis builds one flop sampling a and drives both b and c from it. With <= it would be two flops in series.
How do you get a latch you didn't want, and how do you avoid it? basic
A combinational block where some path doesn't assign an output: an if without else, a case without default. The output has to hold, so synthesis builds a latch. Avoid it with a default assignment at the top of the block or complete branches. always_comb makes the tool warn.
Why is reg not always a register? basic
reg is a variable type: anything assigned in an always block must be one. What it becomes depends on the block. In a clocked block it's a flop; in always @* it's a wire driven by gates.
Why can RTL simulation pass and gate-level simulation fail on the same test? core
Things the simulator honors and synthesis ignores: initial values (netlist starts at X), incomplete sensitivity lists, x assignments that synthesis turned into 0 or 1, full_case/parallel_case pragmas, races between blocking assignments. Plus things only the netlist has: real delays and timing violations from SDF, and scan or DFT logic that's wired but not held in its functional state by the testbench.
Sync or async reset: which does DFT prefer, and why? core
Synchronous resets need nothing: in shift the scan mux bypasses the reset logic. Async resets act on the flop directly, so they must come from a pin (or be forced off by test_mode) and be held inactive during shift. Async resets are common for good functional reasons, so the answer is "either, as long as async resets are controllable", not "never use async".
Given a netlist flop name u_dma_u_ch2_cnt_reg_5_, where is it in the RTL? core
The hierarchy was flattened with underscores: instance u_dma, then u_ch2 inside it, register cnt, bit 5. Underscores are ambiguous (a module could be named u_ch2_cnt), so confirm against the RTL hierarchy or the synthesis name map if there is one.
What's the difference between if/else if and case in hardware? deep
An if/else if chain has priority: the first true condition wins, which synthesizes to a chain of muxes or priority logic. A case with mutually exclusive items synthesizes to a parallel mux. If the conditions in an if chain can't overlap, synthesis often optimizes the priority away. Pragmas like parallel_case force the parallel version even when items overlap, which is how RTL and netlist end up disagreeing.
Notes: simulation output on this page was produced by running the code shown. Cell names (SDFFRQX1, XOR2X1, CKGATE_X1) are generic and stand in for whatever your library uses.
What's wrong with this module for scan?
A classic interview format: here's a small module, what's the problem? The answers come from a short list of things scan needs from a design, so the page starts with that list, then gives fourteen modules and netlist snippets to diagnose. Try each one before opening the answer.
60-second answer: "how would you review an RTL block for scan?"
I check what has to be true while scan shifts and captures. Every flop's clock must come from a pin ATPG controls, through gaters whose test enable is on during shift, never from a flop or a data-driven mux. Every async set or reset must be controllable and held inactive in shift, so no reset driven by a register or a synchronizer without a test bypass. Then the things that make X or break the model: latches, combinational loops, tri-state buses that can fight or float, clocks used as data, uninitialized memories and black boxes. And the RTL coding issues that make the netlist differ from what the designer meant: blocking assignments in clocked blocks, incomplete sensitivity lists, initial blocks. Most of these show up in pre-DFT DRC, but finding them in review saves an iteration.
The checklist
| Ask | Bad sign in RTL | Bad sign in a netlist |
|---|---|---|
| Does every flop get a controllable clock? | always @(posedge some_reg), clk & en, clock mux with a register select | A flop's CK traced back to a flop Q or plain logic; a gater with TE tied 0 |
| Is every async set/reset held off in shift? | Reset from a synchronizer, a soft-reset register or logic, with no test_mode term | RN/SN driven by logic or a flop, not from a pin through test gating |
| Is every flop a scan cell? | (not visible in RTL) | Scan cell with SI/SE tied off; plain DFF cells left after scan insertion |
| Any latches? | always @* with a missing else/default | LAT / TLAT cells that aren't clock gaters or lockups |
| Any combinational loops? | Two assigns that feed each other | Loop warnings in synthesis and DRC |
| Tri-state or wired logic? | Several assign bus = en ? x : 'bz | Tri-state buffer cells on one net |
| Clocks used as data? | A clock on the right-hand side of a data assignment | A clock net on a D or logic input |
| Mixed clock edges in one domain? | negedge clk next to posedge clk | Falling-edge cells or inverted clocks |
| Will RTL and netlist agree? | Blocking in clocked blocks, incomplete sensitivity lists, initial, pragmas | Gate-level sim mismatches the RTL |
| X sources? | Memories, black boxes, analog, uninitialized registers | Undriven nets, black-box instances, non-scan flops |
One worked example: a reset driven by a register
soft_rst_q is a normal register, so it's a scan cell, and during shift its output is whatever pattern bit is passing through. Every 0 that passes resets blk_q (and anything else on that reset), so the bits behind it are lost and the chain test fails. Bottom: OR the active-low reset with test_mode (or mux in the chip reset pin) so the flop-driven reset can't fire in test. ATPG then controls the reset only from the pin, which it holds inactive during shift.The bug, simulated: a 6-flop chain where flop 0 is a soft-reset register whose output is the async reset of flops 3 to 5. A chain test shifts a pattern in and reads it back out. Without a test bypass the pattern never comes out; with the bypass it does.
Chain test with and without the bypass (simulated)
// A 6-flop scan chain. Flop 0 is a soft-reset control register; its output
// drives the async reset of flops 3..5. Same chain, with and without a test bypass.
module chain_rst #(parameter FIX = 0) (
input clk, input rst_n, input test_mode, input se, input si, output so);
reg [5:0] q;
wire soft_rst_n = q[0]; // functional soft reset
wire blk_rst_n = FIX ? (soft_rst_n | test_mode) // fix: forced inactive in test
: soft_rst_n; // bug: free to fire during shift
// flops 0..2: chip reset only
always @(posedge clk or negedge rst_n)
if (!rst_n) q[2:0] <= 3'b000;
else q[2:0] <= se ? {q[1:0], si} : q[2:0];
// flops 3..5: reset by the soft-reset register
always @(posedge clk or negedge blk_rst_n)
if (!blk_rst_n) q[5:3] <= 3'b000;
else q[5:3] <= se ? q[4:2] : q[5:3];
assign so = q[5];
endmodule
module tb;
reg clk = 0, rst_n = 0, tm = 1, se = 1, si = 0;
wire so_bug, so_fix;
chain_rst #(0) bug (clk, rst_n, tm, se, si, so_bug);
chain_rst #(1) fix (clk, rst_n, tm, se, si, so_fix);
reg [11:0] pat = 12'b110100101011; // shifted in LSB first
reg [11:0] got_bug, got_fix;
integer i;
initial begin
#2 rst_n = 1;
for (i = 0; i < 12; i = i + 1) begin // load 12 bits; the last 6 come out after 6 more edges
si = pat[i];
#5 clk = 1; #5 clk = 0;
end
for (i = 0; i < 12; i = i + 1) begin // unload: read so before each edge
got_bug[i] = so_bug; got_fix[i] = so_fix;
si = 0; #5 clk = 1; #5 clk = 0;
end
$display("chain test, 6-flop chain, pattern shifted in LSB first");
$display("expected out (last 6 bits loaded) : %b", pat[11:6]);
$display("no bypass (bug) : %b", got_bug[5:0]);
$display("with test_mode bypass (fix) : %b", got_fix[5:0]);
end
endmoduleSimulation output:
chain test, 6-flop chain, pattern shifted in LSB first
expected out (last 6 bits loaded) : 110100
no bypass (bug) : 000000
with test_mode bypass (fix) : 110100Every 0 that reaches flop 0 resets flops 3 to 5. During the unload the testbench shifts in 0s, so the reset stays on and the output is all 0. With real patterns the failure depends on the data, which makes it look intermittent until you find the reset.
The AND-gate clock gater vs a latch-based gater (simulated)
`timescale 1ns/1ps
// Clock gating written as an AND gate vs a latch-based clock gater.
module cg_and (input clk, input en, output gclk);
assign gclk = clk & en;
endmodule
module cg_latch (input clk, input en, input te, output gclk);
reg en_l;
always @* if (!clk) en_l = en | te; // latch, transparent while clk is low
assign gclk = clk & en_l;
endmodule
module tb;
reg clk = 0, en = 0;
wire g_and, g_icg;
cg_and a (clk, en, g_and);
cg_latch c (clk, en, 1'b0, g_icg);
always #5 clk = ~clk; // 10 ns period, rises at 5, 15, 25 ...
// en comes from a flop on the same clock: it changes shortly after a rising edge
initial begin
$display(" time clk en | AND gate | latch gater");
$monitor("%6.1f %b %b | %b | %b", $realtime, clk, en, g_and, g_icg);
#15.5 en = 1; // just after the edge at 15
#20 en = 0; // just after the edge at 35
#10 $finish;
end
endmoduleSimulation output:
time clk en | AND gate | latch gater
0.0 0 0 | 0 | 0
5.0 1 0 | 0 | 0
10.0 0 0 | 0 | 0
15.0 1 0 | 0 | 0
15.5 1 1 | 1 | 0
20.0 0 1 | 0 | 0
25.0 1 1 | 1 | 1
30.0 0 1 | 0 | 0
35.0 1 1 | 1 | 1
35.5 1 0 | 0 | 1
40.0 0 0 | 0 | 0
45.0 1 0 | 0 | 0Time in ns, clock period 10 ns, enable from a flop changing 0.5 ns after the rising edge. The AND gate output rises at 15.5 (half a pulse) and pulses again for only 0.5 ns at 35. The latch-based gater gives full pulses at 25 and 35 and nothing else.
Puzzles
P1div_clk basic
This block stores data on a divided clock. What happens in scan?
module div_clk (input clk, input rst_n, input [7:0] d, output reg [7:0] q);
reg clk_div2;
always @(posedge clk or negedge rst_n)
if (!rst_n) clk_div2 <= 1'b0;
else clk_div2 <= ~clk_div2;
always @(posedge clk_div2)
q <= d;
endmoduleAnswer
The data flops' clock comes from a flop. clk_div2 is a normal register, so it becomes a scan cell, and during shift its output is whatever pattern bit is passing through. The eight q flops get a rising edge only when a 0 followed by a 1 passes through it, so they can't shift in step with the chain. DRC reports them as having an uncontrollable clock and they end up non-scan: lost coverage, and X sources for logic they feed.
Fix: a clock mux that selects a clock ATPG controls in test mode, or an OCC at the root of the divided clock if it must be tested at speed. The mux is a library clock-mux cell, not generic logic, so timing and CTS treat it as a clock cell.
Fixed:
module div_clk (input clk, input rst_n, input test_mode,
input [7:0] d, output reg [7:0] q);
reg clk_div2;
always @(posedge clk or negedge rst_n)
if (!rst_n) clk_div2 <= 1'b0;
else clk_div2 <= ~clk_div2;
// in silicon this is a library clock-mux cell, not a behavioral ?:
wire q_clk = test_mode ? clk : clk_div2;
always @(posedge q_clk)
q <= d;
endmoduleP2rst_sync core
A standard reset synchronizer. Its output resets the rest of the block asynchronously. What's the scan problem?
module rst_sync (input clk, input rst_in_n, output rst_n);
reg r1, r2;
always @(posedge clk or negedge rst_in_n)
if (!rst_in_n) {r2, r1} <= 2'b00;
else {r2, r1} <= {r1, 1'b1};
assign rst_n = r2; // async reset for the rest of the block
endmoduleAnswer
The block's async reset comes from scan cells. r1 and r2 are ordinary flops and get stitched. During shift, r2 takes the pattern bits passing through it, and every 0 asserts rst_n, clearing every flop on that reset in the middle of the shift. The chain test fails, or those flops are excluded. The worked example above simulates the same failure with a soft-reset register.
Fix: in test mode, bypass the synchronizer so the reset comes straight from the pin, which ATPG holds inactive during shift and can pulse in capture if it wants to test the reset. Many tools add this bypass automatically; if your RTL is hand-written, you add it.
Fixed:
module rst_sync (input clk, input rst_in_n, input test_mode, output rst_n);
reg r1, r2;
always @(posedge clk or negedge rst_in_n)
if (!rst_in_n) {r2, r1} <= 2'b00;
else {r2, r1} <= {r1, 1'b1};
// test: the pin drives the reset directly, so ATPG controls it
assign rst_n = test_mode ? rst_in_n : r2;
endmoduleP3gated basic
Clock gating written in RTL. Two problems, one functional and one for test.
module gated (input clk, input en, input [15:0] d, output reg [15:0] q);
wire gclk = clk & en;
always @(posedge gclk)
q <= d;
endmoduleAnswer
Functional: en usually comes from a flop on clk, so it changes just after the rising edge, while clk is still high. The AND gate passes that change straight through: a late, short pulse or an extra edge. The figure above shows it.
Test: during shift en is driven by scan data, so the gated flops get a clock only when the pattern happens to have a 1 in that cell. The chain behind the gate doesn't shift reliably.
Fix: use the library clock-gating cell (a latch that only opens while the clock is low, then the AND), and tie its test enable to scan enable, so the clock always runs during shift and the functional enable is used in capture.
Fixed:
module gated (input clk, input en, input scan_en, input [15:0] d, output reg [15:0] q);
wire gclk;
// library clock-gating cell: latch + AND, with a test enable
CKGATE_X1 u_cg (.CK(clk), .E(en), .TE(scan_en), .GCK(gclk));
always @(posedge gclk)
q <= d;
endmoduleP4a clock gater in a netlist core
From a netlist. The gater is the right cell type. What's wrong?
CKGATE_X1 u_cg_dma ( .CK(clk), .E(dma_active), .TE(1'b0), .GCK(gclk_dma) );Answer
The test enable is tied to 0. In shift, gclk_dma only pulses if dma_active is 1, and dma_active is driven by functional logic that's being loaded with scan data. Flops on gclk_dma stop shifting whenever it's 0. DRC shows a clock that isn't on during shift and chain tracing fails at the first cell behind the gater.
Fix: connect TE to scan enable. Tying it to test_mode also works, but then the gater is always on in test and the logic that makes dma_active is never observed through the gater, so you lose that coverage.
Fixed:
CKGATE_X1 u_cg_dma ( .CK(clk), .E(dma_active), .TE(scan_en), .GCK(gclk_dma) );P5sel_hold basic
Meant as plain combinational logic. What does synthesis build, and why does DFT care?
module sel_hold (input en, input [3:0] d, output reg [3:0] q);
always @* begin
if (en)
q = d;
end
endmoduleAnswer
A 4-bit latch. With en low no path assigns q, so it has to hold its value. A latch isn't a scan cell: ATPG has to control en to make it transparent or treat q as unknown, and it adds a timing path that's hard to constrain.
Fix: a default assignment first, or a complete else.
Fixed:
module sel_hold (input en, input [3:0] d, output reg [3:0] q);
always @* begin
q = 4'b0000; // default: every path assigns q
if (en)
q = d;
end
endmoduleP6handshake core
Look at busy and ack. What's the problem?
module handshake (input req, input clr, output ack);
wire busy;
assign busy = req | ack; // ack feeds busy ...
assign ack = busy & ~clr; // ... and busy feeds ack
endmoduleAnswer
A combinational loop: ack depends on busy, which depends on ack, with no flop in between. It's written to act as a set/reset memory, but it has no defined timing, can oscillate in simulation, and ATPG has to cut the loop somewhere and treat the cut point as unknown, which loses coverage around it. STA can't time it either.
Fix: put the memory in a flop, as below. If the loop is really needed (rare), a test-mode mux that breaks it at a known point in test.
Fixed:
module handshake (input clk, input rst_n, input req, input clr, output reg ack);
// the loop now goes through a flop: ack holds until clr
always @(posedge clk or negedge rst_n)
if (!rst_n) ack <= 1'b0;
else ack <= (req | ack) & ~clr;
endmoduleP7edges deep
One flop on each edge. What does the scan tool have to do about it?
module edges (input clk, input d, output reg a, output reg b);
always @(posedge clk) a <= d;
always @(negedge clk) b <= a; // b samples a half a cycle later
endmoduleAnswer
Mixed edges in one chain need the right order. With a clock that rests low, each shift pulse has its rising edge first, then its falling edge. If a rising-edge cell feeds a falling-edge cell on the chain, the falling-edge cell captures the value its neighbor took on the same pulse, and one bit is lost. If a falling-edge cell feeds a rising-edge cell, each cell sees its neighbor's previous value, and the shift is correct. So falling-edge cells go before rising-edge cells in a chain, or in separate chains. Scan insertion tools do this ordering automatically.
Also: the functional path a to b is only half a clock period long, which matters for timing and for at-speed (transition) tests. That's a design choice, not a scan bug, but expect it to be asked.
P8bus2 core
Two tri-state drivers on one bus. What can go wrong in test?
module bus2 (input en_a, input en_b, input [7:0] a, input [7:0] b, output [7:0] bus);
assign bus = en_a ? a : 8'bz;
assign bus = en_b ? b : 8'bz;
endmoduleAnswer
Bus contention during shift. en_a and en_b come from functional flops. While shifting, the pattern can make both 1 at once, so two drivers fight. It can also leave both off, and a floating bus is an X source. ATPG avoids contention in its capture cycles, but it can't control what the enables do while bits are moving through the chain.
Fix: decode so at most one driver can be on, and turn all drivers off when scan enable is high (a bus keeper or pull keeps the value known). Better still: replace an internal tri-state bus with a mux.
Fixed:
module bus2 (input en_a, input en_b, input scan_en,
input [7:0] a, input [7:0] b, output [7:0] bus);
// at most one driver: b only if a is off; nobody drives during shift
wire drv_a = en_a & ~scan_en;
wire drv_b = en_b & ~en_a & ~scan_en;
assign bus = drv_a ? a : 8'bz;
assign bus = drv_b ? b : 8'bz;
endmoduleP9clk_sel core
The core clock is chosen by a configuration register. Scan problem?
module clk_sel (input clk_fast, input clk_slow, input clk_cfg_d,
input clk_cfg_we, input [31:0] d, output reg [31:0] q);
reg use_fast;
always @(posedge clk_slow)
if (clk_cfg_we) use_fast <= clk_cfg_d; // a config register
wire core_clk = use_fast ? clk_fast : clk_slow;
always @(posedge core_clk)
q <= d;
endmoduleAnswer
The clock source is chosen by a scan cell. use_fast is a register, so it's loaded with scan data. As bits pass through it, core_clk switches between two clocks in the middle of the shift, and the q flops shift at unpredictable times. A switch while either clock is high also makes a glitch.
Fix: in test mode force the select (OR it with test_mode, or a test-controlled override) so a single, ATPG-controlled clock is used, and use a glitch-free clock-mux design for the functional switch. For at-speed test, an OCC on the selected clock.
P10edge_det deep
A clock is sampled as data. Is that a problem for ATPG?
module edge_det (input clk, input sample_clk, output reg seen);
always @(posedge clk)
seen <= sample_clk; // a clock used as data
endmoduleAnswer
Yes, if sample_clk is a test clock. In capture, ATPG pulses clocks to capture responses. If sample_clk pulses while seen is being clocked, the value at its D input is changing at the capture edge: a race, so ATPG treats it as unknown and masks it. DRC flags clocks that reach data inputs.
Fix: avoid sampling clocks directly; if it's functionally needed (a clock monitor), accept the masking, or make sure the two clocks are never pulsed in the same capture cycle and constrain ATPG accordingly.
P11and_or basic
The RTL simulation of this block passes. Gate-level simulation of the same test fails. Why?
module and_or (input a, input b, input c, output reg y);
always @(a or b)
y = (a & b) | c;
endmoduleAnswer
Incomplete sensitivity list. The block only runs in RTL simulation when a or b changes. Synthesis ignores the list and builds (a & b) | c, so the netlist reacts to c and the RTL doesn't. The refresher page has the simulation.
Fix: always @*.
Fixed:
module and_or (input a, input b, input c, output reg y);
always @*
y = (a & b) | c;
endmoduleP12cfg basic
Fine in RTL simulation. What happens in the netlist, and does it matter for scan?
module cfg (input clk, input we, input [7:0] wdata, output reg [7:0] mode);
initial mode = 8'h00;
always @(posedge clk)
if (we) mode <= wdata;
endmoduleAnswer
Synthesis ignores initial. In the netlist, mode starts as X and stays X until the first write. Gate-level functional simulation sees X propagating from it where RTL saw 0s. For scan test it's not a problem by itself, since a scan load sets every cell, but anything that relies on that value before the first load (a test setup sequence, a functional pattern) does.
Fix: a real reset if the value matters.
Fixed:
module cfg (input clk, input rst_n, input we, input [7:0] wdata, output reg [7:0] mode);
always @(posedge clk or negedge rst_n)
if (!rst_n) mode <= 8'h00;
else if (we) mode <= wdata;
endmoduleP13a status flop in a netlist core
From a scan-inserted netlist. Two things are wrong.
SDFFRQX1 status_reg_3_ ( .D(n142), .SI(1'b0), .SE(1'b0), .CK(clk),
.RN(n17), .Q(status[3]) );
NAND2X1 U88 ( .A(sw_rst_q), .B(cfg_q[2]), .Y(n17) );Answer
1. Not stitched. It's a scan cell type, but SI and SE are tied to 0, so it was left out of every chain. It only gets a value through capture, so it's a non-scan cell and a likely X source and coverage hole. Check whether that was intentional (an exclusion list) or a stitching miss.
2. Async reset from functional logic. RN comes from a NAND of two register outputs. If those two are scan cells, a pattern that loads both with 1 resets status_reg_3_. The reset should be forced inactive in test, for example by ORing n17 with test_mode (an ECO in the netlist, or fixed in RTL for the next release).
P14pipe basic
A three-stage pipeline. How many scan cells does the netlist have?
module pipe (input clk, input [7:0] din, output reg [7:0] dout);
reg [7:0] s1, s2;
always @(posedge clk) begin
s1 = din;
s2 = s1;
dout = s2;
end
endmoduleAnswer
8, not 24. Blocking assignments make s1, s2 and dout all equal to din after each edge, so synthesis builds one 8-bit register. The pipeline delay is gone, which is a functional bug, and the scan cell count won't match what the designer expects. The refresher page has the simulation.
Fix: non-blocking assignments.
Fixed:
module pipe (input clk, input [7:0] din, output reg [7:0] dout);
reg [7:0] s1, s2;
always @(posedge clk) begin
s1 <= din;
s2 <= s1;
dout <= s2;
end
endmoduleFrom a symptom back to the RTL
| You see | Look for |
|---|---|
| Chain test fails at a fixed cell, or bits come out as 0 or 1 regardless of the pattern | An async reset or set on that cell or its neighbors that isn't held off; a clock gater whose TE isn't on in shift |
| Flops reported as having uncontrollable clocks | A generated or divided clock, a clock mux with a register select, an AND-gate clock gate |
| Many non-scan cells in one block | A clock or reset problem upstream of all of them; unstitched scan cells |
| Coverage hole around one module | Latches, a combinational loop, a black box or memory feeding X, bus contention constraints |
| Gate-level sim differs from RTL sim | Blocking assignments, sensitivity lists, initial, full_case/parallel_case, X handling |
| Fewer flops in the netlist than expected | Blocking assignments that collapsed a pipeline; registers synthesis removed because nothing reads them |
Notes: simulation output on this page was produced by running the code shown; every puzzle module and fix compiles. Cell names are generic. DRC rule names and messages differ by tool, so the page describes the condition rather than a rule number.
Wrapper cells from the ground up
A wrapper cell is a scan cell placed at a core's boundary so the core can be tested without caring what's connected to it, and so the wires around it can be tested without caring what's inside it. This page builds one from a flop and two muxes, wraps a tiny core with it, and simulates both test modes with the pins driven to X. It then covers how a tool decides where cells go, which ports never get one, and how the cells form chains.
60-second answer: "what's a wrapper cell and why do we need it?"
A wrapper cell is a scan cell on a core's input or output port. In internal test, the input cells drive the core's inputs from values loaded by scan, so the core's patterns don't depend on whatever drives it at the chip level, and the output cells capture the core's outputs and hold the outputs steady toward the rest of the chip. That lets a core's patterns be generated once on the core alone and reused wherever the core is placed. In external test it's the other way round: output cells launch values onto the wires and logic outside the core, input cells of the next core capture them, and the cores' insides don't matter, so top-level ATPG only needs the wrapper cells, not the full core netlist. A cell is either dedicated, a new flop and mux on the port, or shared, an existing functional flop at the boundary reused for the job. Tools pick per port based on how many flops the port reaches.
Why a core needs a boundary
Scan testing works because every flop is controllable (scan loads it) and observable (scan unloads it). Inside one core that holds. At the core's ports it doesn't:
- Inputs come from somewhere you don't control. When a core is tested on its own, its inputs are driven by other cores or top-level logic that may be in a different test mode, unpowered, or simply not part of this pattern set. To the core's ATPG run they're X, and X on an input blocks every fault behind it.
- Outputs go somewhere you can't observe, and while the core is being tested, its outputs toggle into logic that may be running its own test. Both sides get corrupted.
- The wires between cores belong to nobody. A core's ATPG stops at its ports, the next core's starts at its ports, and the connection between them is in neither.
Wrapper cells solve all three by putting a scan cell on each port. The boundary of the core becomes controllable and observable from scan, from both sides.
| Wrapper cell | Boundary-scan cell | |
|---|---|---|
| Where | On a core's ports, inside the chip | On the chip's pins, between pad and core |
| Accessed by | Scan chains (often through EDT), at ATPG shift speed | The JTAG TAP, one long register shifted by TCK |
| Tests | The core (intest) and the logic and wires between cores (extest) | Board traces and solder joints between chips (EXTEST) |
| Standard | IEEE 1500 (and tool conventions) | IEEE 1149.1 |
| Update stage | Usually not: outputs may ripple while shifting | Required on pins that drive: pins hold while the register shifts |
Same idea in two places. The extest and boundary scan page covers the chip-pin version.
The cell: a flop and two muxes
fi (capture) or the previous cell's so (shift). The right mux picks what goes out on fo: the functional input straight through (functional mode) or the stored value (test). The same cell works on either side of the core. On an input port, fi is the pin and fo feeds the core. On an output port, fi comes from the core and fo drives the pin.The cell in Verilog
// A dedicated wrapper cell: one scan flop, a load mux and an output mux.
module wcell (
input clk,
input fi, // functional in (from the port, or from the core)
input si, // scan in (from the previous wrapper cell)
input se, // scan enable: 1 = shift
input cap_en, // 1 = capture fi when not shifting, 0 = hold
input drive, // 1 = drive fo from the flop (test), 0 = pass fi (functional)
output fo, // functional out (to the core, or to the port)
output so); // scan out (to the next wrapper cell)
reg q;
always @(posedge clk)
q <= se ? si : (cap_en ? fi : q); // shift, capture, or hold
assign fo = drive ? q : fi;
assign so = q;
endmoduleTwo control questions decide everything the cell does: what the flop loads on the next clock (se, cap_en), and where fo comes from (drive). Real cells add details on top (an inverting hold, a safe value, an update stage), but every wrapper cell answers the same two questions.
What the cell does in each mode
| Mode | Input cell (fi = pin, fo = core) | Output cell (fi = core, fo = pin) | What's tested |
|---|---|---|---|
| Functional | Pass the pin to the core (drive=0) | Pass the core to the pin (drive=0) | Nothing; cells are transparent |
| Internal (int_mode) | Drive the core from the flop; don't capture the pin (drive=1, cap_en=0) | Capture the core's output; hold the pin at the flop's value (cap_en=1, drive=1) | The core's own logic |
| External (ext_mode) | Capture the pin (cap_en=1); keep driving the core from the flop so it stays quiet (drive=1) | Drive the pin from the flop (drive=1); capturing the core doesn't matter (cap_en=0) | Logic and wires outside the core |
- Shift is the same in every test mode:
se=1and every cell takes the previous cell's value. - An input cell never captures its pin in int_mode. If it did, the captured value would depend on whatever drives the pin, which is X to this ATPG run, and the next pattern would load an X into the core.
- Output cells hold the pin in int_mode. This is what stops one core's test from disturbing its neighbors. With no update stage, the pin ripples during shift; that's acceptable as long as whatever it feeds is also in a test mode that ignores it.
Both modes, simulated
The wrapped core (Verilog)
// A tiny wrapped core: two input wrapper cells, one core scan flop, one output wrapper cell.
// core logic: x = a ^ b, captured by core flop cf; y = ~cf
// int_mode: test the core. ext_mode: test what is outside the core.
module wcore #(parameter ISO = 1) (
input clk, input a, input b, output y,
input si, input se, input int_mode, input ext_mode, output so);
wire a_c, b_c, y_c, so_a, so_b, so_y;
reg cf; // the core's own scan flop
wire test = (int_mode | ext_mode) & ISO; // ISO=0: wrapper never isolates (a broken wrapper)
// input cells: drive the core in any test mode, capture from the port only in ext_mode
wcell wi_a (.clk(clk), .fi(a), .si(si), .se(se), .cap_en(ext_mode), .drive(test), .fo(a_c), .so(so_a));
wcell wi_b (.clk(clk), .fi(b), .si(so_a), .se(se), .cap_en(ext_mode), .drive(test), .fo(b_c), .so(so_b));
// core logic and core scan flop
always @(posedge clk)
cf <= se ? so_b : (a_c ^ b_c);
assign y_c = ~cf;
// output cell: capture the core in int_mode, drive the port in any test mode
// in ext_mode the chain skips the core flop: only wrapper cells are in the ext chain
wire si_y = ext_mode ? so_b : cf;
wcell wo_y (.clk(clk), .fi(y_c), .si(si_y), .se(se), .cap_en(int_mode), .drive(int_mode | ext_mode), .fo(y), .so(so_y));
assign so = so_y;
endmoduleIntest with every input pin at X (simulated)
// Intest on one core whose input pins are unknown (X).
module tb;
reg clk = 0, se = 0, si = 0;
wire y1, so1, y0, so0;
// same core twice: with a working wrapper (ISO=1) and with one that never isolates (ISO=0)
wcore #(1) good (.clk(clk), .a(1'bx), .b(1'bx), .y(y1), .si(si), .se(se), .int_mode(1'b1), .ext_mode(1'b0), .so(so1));
wcore #(0) bad (.clk(clk), .a(1'bx), .b(1'bx), .y(y0), .si(si), .se(se), .int_mode(1'b1), .ext_mode(1'b0), .so(so0));
task pulse; begin #5 clk = 1; #5 clk = 0; end endtask
// int chain order from si: wi_a, wi_b, cf, wo_y. Load bits so that wi_a=1, wi_b=0, cf=0, wo_y=0
reg [3:0] load = 4'b0001; // load[3] goes in first and ends in wo_y; load[0] goes in last and ends in wi_a
reg [3:0] out1, out0;
integer i;
initial begin
se = 1;
for (i = 3; i >= 0; i = i - 1) begin si = load[i]; pulse; end
$display("loaded wi_a=%b wi_b=%b cf=%b wo_y=%b pins a=x b=x", good.wi_a.q, good.wi_b.q, good.cf, good.wo_y.q);
$display("core sees a_c=%b b_c=%b (working wrapper) a_c=%b b_c=%b (no isolation)", good.a_c, good.b_c, bad.a_c, bad.b_c);
se = 0; pulse; // one capture clock
$display("captured working wrapper: cf=%b wo_y=%b no isolation: cf=%b wo_y=%b",
good.cf, good.wo_y.q, bad.cf, bad.wo_y.q);
$display("expected cf = 1 ^ 0 = 1, wo_y = ~cf(before capture) = ~0 = 1");
se = 1;
for (i = 0; i < 4; i = i + 1) begin out1[i] = so1; out0[i] = so0; si = 0; pulse; end
$display("unloaded working wrapper: %b%b%b%b no isolation: %b%b%b%b (first bit out first)",
out1[0], out1[1], out1[2], out1[3], out0[0], out0[1], out0[2], out0[3]);
end
endmoduleSimulation output:
loaded wi_a=1 wi_b=0 cf=0 wo_y=0 pins a=x b=x
core sees a_c=1 b_c=0 (working wrapper) a_c=x b_c=x (no isolation)
captured working wrapper: cf=1 wo_y=1 no isolation: cf=x wo_y=1
expected cf = 1 ^ 0 = 1, wo_y = ~cf(before capture) = ~0 = 1
unloaded working wrapper: 1101 no isolation: 1x01 (first bit out first)With a working wrapper, the core sees the loaded values (1 and 0) even though both pins are X, the core flop captures 1 ^ 0 = 1, and every unloaded bit is known. The second instance is the same core with a wrapper that never isolates: the X on the pins reaches the core, the core flop captures X and the unload carries it out. That X is what ATPG would have to mask, and every fault behind it would be untestable.
Extest between two cores, with and without a short (simulated)
// Extest between two cores: core A's output y drives core B's input a.
// Only wrapper cells are in the ext chain; the core logic plays no part. B's other input pin is X.
module tb;
reg clk = 0, se = 0, si = 0, short_to_0 = 0;
wire ya, yb, so_a, so_b;
wire net = short_to_0 ? 1'b0 : ya; // the wire between the cores, optionally shorted to ground
wcore A (.clk(clk), .a(1'bx), .b(1'bx), .y(ya), .si(si), .se(se), .int_mode(1'b0), .ext_mode(1'b1), .so(so_a));
wcore B (.clk(clk), .a(net), .b(1'bx), .y(yb), .si(so_a), .se(se), .int_mode(1'b0), .ext_mode(1'b1), .so(so_b));
task pulse; begin #5 clk = 1; #5 clk = 0; end endtask
// ext chain from si: A.wi_a, A.wi_b, A.wo_y, B.wi_a, B.wi_b, B.wo_y (6 cells; core flops not in it)
task run(input v);
integer i; reg [5:0] ld;
begin
ld = 6'b000000;
ld[2] = v; // bit k ends up in cell k counted from si: A.wo_y is cell 2
se = 1;
for (i = 5; i >= 0; i = i - 1) begin si = ld[i]; pulse; end
$display(" A.wo_y loaded with %b -> wire = %b", A.wo_y.q, net);
se = 0; pulse;
$display(" after capture: B.wi_a = %b -> %s", B.wi_a.q, (B.wi_a.q === v) ? "pass" : "FAIL");
end
endtask
initial begin
$display("good wire:");
run(1); run(0);
short_to_0 = 1;
$display("wire shorted to 0:");
run(1); run(0);
end
endmoduleSimulation output:
good wire:
A.wo_y loaded with 1 -> wire = 1
after capture: B.wi_a = 1 -> pass
A.wo_y loaded with 0 -> wire = 0
after capture: B.wi_a = 0 -> pass
wire shorted to 0:
A.wo_y loaded with 1 -> wire = 0
after capture: B.wi_a = 0 -> FAIL
A.wo_y loaded with 0 -> wire = 0
after capture: B.wi_a = 0 -> passCore A's output cell drives the wire and core B's input cell captures it. With the wire shorted to ground, loading a 1 fails and loading a 0 passes. One value isn't enough: a stuck-at-0 wire is only caught by driving a 1, and a stuck-at-1 only by driving a 0. That's why extest patterns drive both values onto every connection.
Dedicated or shared
| Dedicated | Shared | |
|---|---|---|
| What it is | A new scan flop and mux on the port, like the cell above | An existing functional scan flop near the port, given wrapper behavior in test modes |
| Area | One cell per port | None added |
| Functional timing | Adds a mux on the port's path | Nothing added to the path |
| Fits when | The port fans out to (or in from) many flops, or reaches them through deep logic | The port reaches a few flops through shallow logic, e.g. a registered port |
| Catch | The logic between the port and the flop is outside what intest covers, and any flop that controls the shared cell's clock, set or reset must become a wrapper cell too |
Shared cells are why "registered I/O" is good DFT practice: a core whose ports are all registered can be wrapped with no added cells at all.
Ports that get no wrapper cell
- Clocks. A wrapper cell is a data element; clocks are controlled by the clocking architecture (OCC, test clock muxes), not by scan data.
- Scan and compression ports: scan in and out, EDT channels, SSN bus. They are the test access, not something to test through.
- Test controls: scan enable, test mode, DFT signals, IJTAG/TAP ports. Their values must be fixed by the test setup, not loaded as pattern data.
- Async set and reset inputs usually stay under direct test control so they can be held inactive in shift.
- Analog, power and ports you choose to exclude. An excluded port isn't covered by intest or extest; something else has to cover it, or you accept the loss.
Wrapper chains
- Two chain sets on one netlist. In int_mode, wrapper cells and core flops are in chains together, balanced and usually behind the core's EDT. In ext_mode, only the wrapper cells are in chains, so those chains are short: tens or hundreds of cells instead of the whole core.
- Why ext chains stay separate: the parent runs extest with every core in ext_mode at once. If the core flops were in those chains, the parent would shift through every flop of every core to test some wires.
- Input and output cells in separate chains is a common choice. It lets the tool give them different scan-enable behavior during capture (input cells hold in int_mode; output cells capture).
- Clocking. A wrapper cell is clocked by the domain of the port it sits on. Extest between two cores in different clock domains is tested like any other cross-domain path: the capture clocks have to be chosen so launch and capture are both controlled.
Planning a wrapper: pseudo-code
for each port of the core:
if port is clock, scan/EDT/SSN, test control, async reset, analog, or excluded:
no cell; record why
continue
cone = flops reached from the port (inputs: forward; outputs: backward)
if len(cone) >= threshold or port has no flops in reach:
add a dedicated cell on the port, clocked by the port's domain
else:
mark the cone's flops as shared wrapper cells
add any flop that controls their clock, set or reset
for each test mode:
input cells: int -> drive core, hold (no pin capture)
ext -> capture pin, keep driving core
output cells: int -> capture core, hold pin
ext -> drive pin
stitch: int_mode chains = core flops + all wrapper cells (balanced, into EDT)
ext_mode chains = wrapper cells only (few, short)
check: every port has a cell or a reason; ext chains short; modes set by static signals
Interview questions
What does an input wrapper cell do in intest and in extest? basic
In intest it drives the core input from its scan-loaded value and doesn't capture the pin, so the core is isolated from whatever is outside. In extest it captures the value arriving at the pin from outside, while still driving the core from its own value so the core stays quiet.
Why don't input wrapper cells capture in intest? core
The pin's value comes from outside the core, which is X to the core-level ATPG. Capturing it would load X into the cell and corrupt the next pattern, or force ATPG to mask the cell. So input cells hold (or keep shifting) during the capture cycle in intest.
Dedicated or shared wrapper cells: how does a tool decide? core
By the port's cone. If a port reaches only a few flops through logic, those flops become shared wrapper cells, which costs no area and nothing on the functional path. If it reaches many (a threshold, 32 by default in Tessent), one dedicated cell on the port is cheaper than making all of them wrapper cells. Shared cells also pull in any flop that controls their clock, set or reset.
Why are ext_mode chains made of wrapper cells only? core
Extest is run at the parent with all cores in ext_mode. Only the wrapper cells matter to it, and short chains make that run fast and let the parent model each core as a graybox. If core flops were in the ext chains, every extest pattern would shift through the whole core.
A core's output pin toggles while its wrapper chain shifts. Is that a problem? deep
Only if something downstream is sensitive to it. Wrapper cells usually have no update stage, so the pins follow the shifting data. That's fine when the logic they feed is in a test mode that doesn't use it, or is itself shifting. It's a problem if they feed something functional or asynchronous during test (a reset, a clock control, another core in functional mode), in which case that port needs a cell with a hold or safe value, or a gate in test mode.
What's not covered by intest plus extest on a wrapped core? deep
Ports with no wrapper cell (excluded, analog, clocks), and the logic between a port and its shared cell is covered from one side only, so it depends on extest to be complete. Clock and test-control paths are covered by other means. The coverage report per mode, merged, is what shows the gaps.
Notes: simulation output on this page was produced by running the code shown. Signal and mode names (int_mode, ext_mode) follow Tessent conventions; IEEE 1500 names its instructions for the same modes WS_INTEST_* and WS_EXTEST. Cell structure is simplified to one storage element.
Extest and boundary scan
"Extest" means testing what's outside a block from the block's boundary cells. On a board, it's IEEE 1149.1 boundary scan: cells on every chip pin, driven through the JTAG TAP, used to check traces and solder joints. Inside a chip, it's the same idea one level down: wrapper cells on cores, driven by scan, used to test the logic and wires between cores. This page covers both, from the cell up to the test algorithm and the file that describes a chip to board test tools.
60-second answer: "what is boundary scan and how does EXTEST work?"
Boundary scan puts a cell between every chip pin and the core and chains the cells into one shift register, the boundary-scan register, accessed through the JTAG TAP. Each cell has a capture/shift stage and an update stage, so values can be shifted in without disturbing the pins and then applied all at once. For a board test, you first PRELOAD the values the pins should drive, then load the EXTEST instruction: the output pins now drive from the cells, the next Capture-DR samples every input pin into its cell, and shifting out the captured values while shifting in the next set gives the next pattern. Driving a unique code onto each net over a few patterns finds opens (the receiver sees a constant) and shorts (two nets see the same merged code). The chip's BSDL file tells the board tester the cell order, the cell types and the opcodes. Inside a chip, extest is the same idea with wrapper cells and scan chains, used to test the logic between wrapped cores.
Two kinds of extest
| Board level (IEEE 1149.1) | Core level (wrapped cores) | |
|---|---|---|
| Boundary of | A chip | A core inside a chip |
| Cells | Boundary-scan cells at the pads | Wrapper cells at the core ports |
| Access | TAP: TCK, TMS, TDI, TDO (TRST optional) | Scan chains, usually through EDT, in ext_mode |
| Tests | PCB traces, solder joints, connectors, other chips' pins | Top-level logic and wires between cores |
| Patterns from | A board test tool reading each chip's BSDL and the board netlist | ATPG on the top level with each core as a graybox |
| Speed | TCK, usually tens of MHz or less; DC test | Scan shift speed; stuck-at and at-speed capture |
| Who cares | Board manufacturing and system bring-up | Chip DFT and the tester |
The rest of the page is mostly the board-level kind, since the core-level kind is covered on the wrapper cell page; the inside the chip section ties them together.
Boundary scan on a board
Boundary scan exists because modern boards have fine-pitch and ball-grid packages whose pins can't be reached with probes. Instead of probing a net, you drive it from one chip's output cell and read it in another chip's input cell. What it finds: missing or wrong parts (wrong IDCODE, no response), parts rotated or misplaced, pins stuck, shorted or open, and bad bonds. Nets that touch chips without boundary scan (a memory, a buffer) can often still be tested by driving and reading them from the chips around them.
Inside each chip, the TAP controller and the instruction register decide which register sits between TDI and TDO. The JTAG page covers the state machine and timing; for extest you need four facts: data is shifted in Shift-DR, the cells sample in Capture-DR, the update stages load in Update-DR, and which register is selected (boundary, bypass, ID) depends on the current instruction.
The boundary-scan cell
- Capture/shift stage (clocked in Capture-DR and Shift-DR): takes the pin or core value on capture, the previous cell's value on shift.
- Update stage (clocked in Update-DR): copies the shift stage and holds it. This is the difference from a plain wrapper cell: while a new pattern shifts through, the pins keep driving the previous pattern. On a board, a pin that rippled during shift could switch a neighbor's chip select or reset.
- Mode mux: chooses whether the pin is driven by the core (normal operation, SAMPLE) or by the update stage (EXTEST, CLAMP).
Cells per pin type
| Pin | Cells | Notes |
|---|---|---|
| Input | One input cell | Captures the pin; some types can also drive the core (needed for INTEST), observe-only types can't |
| 2-state output | One output cell | Drives the pin in EXTEST |
| 3-state output | Output cell + control cell | The control cell drives the buffer's enable; one control cell may serve a group of pins |
| Bidirectional | Output + control + input, or one combined bidirectional cell plus control | Disabled: it's an input. Enabled: it drives |
| Differential pair | Usually one set of cells for the pair | AC-coupled pairs need 1149.6 (below) |
| Clock, TAP, power, analog | None, or observe-only | TAP pins are never in the register; clocks may get an observe-only cell |
A pad's own input path may have gating (an input enable) that stops the core seeing pin activity. For boundary scan that gating has to be open in test, so the input cell can see the pin. Insertion tools add the logic for it.
Instructions, by what they do to the pins
| Instruction | Register between TDI and TDO | Pins | Used for |
|---|---|---|---|
| SAMPLE | Boundary | Normal operation; Capture-DR snapshots them | Looking at live pin values without disturbing the system |
| PRELOAD | Boundary | Normal operation; Update-DR loads the update stages | Setting the values the pins will drive before EXTEST takes over |
| EXTEST | Boundary | Driven from the update stages; inputs captured in Capture-DR | Board interconnect test |
| BYPASS | 1-bit bypass | Normal operation | Shortening the board chain past chips not being tested |
| IDCODE | 32-bit ID | Normal operation | Checking the right part is fitted. Selected automatically after TAP reset if the chip has one |
| CLAMP | Bypass | Driven from the update stages | Holding pins at fixed values while testing other chips through a short chain |
| HIGHZ | Bypass | All outputs disabled | Keeping a chip off the nets while other equipment drives them |
| INTEST (optional) | Boundary | Isolated; the core is driven from the input cells | Testing the chip's core through its pins' cells; rarely used now that internal scan exists |
An EXTEST, step by step
- Reset the TAP (five TCK with TMS=1, or TRST). The chip runs normally; IDCODE or BYPASS is selected.
- Load PRELOAD into the instruction register and shift the first pattern into the boundary register. Update-DR copies it into the update stages. Pins still run normally.
- Load EXTEST. At Update-IR the pins switch to the update stages, which already hold pattern 1. Without step 2 they'd drive whatever was left there, possibly two chips driving one net against each other.
- Capture-DR: every input cell samples its pin. On a board, that's U2 seeing what U1 drives.
- Shift-DR: shift the captured values out on TDO while shifting pattern 2 in on TDI.
- Update-DR: pattern 2 goes to the pins. Repeat capture, shift, update for each pattern.
- Compare what came out against what each net should have carried, and diagnose.
Finding shorts and opens with few patterns
The obvious test, a walking one (one net high per pattern), needs one pattern per net. The counting sequence gives each net a unique binary code and sends one bit of every code per pattern, so N nets need about log2(N+2) patterns. Codes of all 0s and all 1s are left out, because those are what an open or a stuck net looks like. The model below has ten nets between two chips, two shorts and one open; the shorts behave as wired-AND.
The board model (Python)
"""Board interconnect test with a counting sequence.
Chip U1 drives 10 nets through its boundary-scan output cells; chip U2 receives them in its
input cells. Each net gets a unique code, sent one bit per EXTEST pattern. A good net delivers
its own code. A short merges codes (wired-AND here), an open floats to the pull-up value.
"""
from math import ceil, log2
NETS = [f"D{i}" for i in range(10)]
N = len(NETS)
W = ceil(log2(N + 2)) # +2: never use all-0s or all-1s as a code
# faults on this board
SHORTS = [("D2", "D5"), ("D3", "D6")] # solder bridges, behave as wired-AND
OPENS = ["D7"] # lifted pin; U2's input has a pull-up, reads 1
def board(driven):
"""driven: net -> value U1 drives. Returns net -> value U2 captures."""
got = dict(driven)
for a, b in SHORTS:
got[a] = got[b] = driven[a] & driven[b]
for n in OPENS:
got[n] = 1
return got
def run(code, width, show):
received = {n: 0 for n in NETS}
if show:
print("pattern U1 drives D0..D9 U2 captures")
for p in range(width - 1, -1, -1): # one EXTEST pattern per code bit
driven = {n: (code[n] >> p) & 1 for n in NETS}
got = board(driven)
for n in NETS:
received[n] = (received[n] << 1) | got[n]
if show:
print(f" {width-1-p} {''.join(str(driven[n]) for n in NETS)} {''.join(str(got[n]) for n in NETS)}")
return received
def diagnose(code, received, width):
all1 = (1 << width) - 1
bad = [n for n in NETS if received[n] != code[n]]
cw = max(width, 8)
print(f"{'net':<4} {'sent':<{cw}} {'received':<{cw}} verdict")
for n in NETS:
s, r = code[n], received[n]
if n not in bad:
v = "ok"
elif r == all1:
v = "open (all 1s: floating input pulled up)"
elif r == 0:
v = "stuck at 0, or open with a pull-down"
else:
partners = [m for m in bad if m != n and received[m] == r]
v = "short with " + ", ".join(partners) if partners else "fails, partner not identified"
print(f"{n:<4} {s:0{width}b}{' ' * (cw - width)} {r:0{width}b}{' ' * (cw - width)} {v}")
# 1. plain counting sequence: codes 1..N, W patterns
code = {net: i + 1 for i, net in enumerate(NETS)}
print(f"Counting sequence: {N} nets, {W} patterns (a walking one would need {N})\n")
rx = run(code, W, True)
print()
diagnose(code, rx, W)
# 2. true/complement: send each code, then its complement, 2W patterns
code2 = {n: (c << W) | (~c & ((1 << W) - 1)) for n, c in code.items()}
print(f"\nTrue/complement counting sequence: {2*W} patterns\n")
diagnose(code2, run(code2, 2 * W, False), 2 * W)Output:
Counting sequence: 10 nets, 4 patterns (a walking one would need 10)
pattern U1 drives D0..D9 U2 captures
0 0000000111 0000000111
1 0001111000 0001101100
2 0110011001 0110010101
3 1010101010 1000100110
net sent received verdict
D0 0001 0001 ok
D1 0010 0010 ok
D2 0011 0010 short with D5
D3 0100 0100 ok
D4 0101 0101 ok
D5 0110 0010 short with D2
D6 0111 0100 fails, partner not identified
D7 1000 1111 open (all 1s: floating input pulled up)
D8 1001 1001 ok
D9 1010 1010 ok
True/complement counting sequence: 8 patterns
net sent received verdict
D0 00011110 00011110 ok
D1 00101101 00101101 ok
D2 00111100 00101000 short with D5
D3 01001011 01001000 short with D6
D4 01011010 01011010 ok
D5 01101001 00101000 short with D2
D6 01111000 01001000 short with D3
D7 10000111 11111111 open (all 1s: floating input pulled up)
D8 10010110 10010110 ok
D9 10100101 10100101 ok
- Counting sequence, 4 patterns. The open on D7 shows as all 1s (U2's input has a pull-up). The D2/D5 short is found: both nets receive the same merged code. But the D3/D6 short is only half found. D3's code (0100) ANDed with D6's (0111) is 0100, D3's own code, so D3 passes and D6 fails with no partner. The fault is detected, but not fully diagnosed.
- True/complement, 8 patterns. Sending every code and then its inverse means no merged code can equal either net's own, so both nets of every short fail and pair up.
- That's the general trade-off: more patterns, better diagnosis. Board test tools offer several sequences and pick by how much diagnosis the line needs.
BSDL: the file that describes a chip's boundary scan
BSDL (Boundary Scan Description Language) is part of IEEE 1149.1 and uses VHDL syntax. Board test tools read it for each chip, together with the board netlist, to generate and diagnose patterns. An illustrative file for a chip with one input, one output and one bidirectional pin:
entity my_chip is
generic (PHYSICAL_PIN_MAP : string := "PKG1");
port (TCK, TMS, TDI : in bit; TDO : out bit;
D_IN : in bit; D_OUT : out bit; IO : inout bit;
VDD, VSS : linkage bit);
use STD_1149_1_2001.all;
attribute COMPONENT_CONFORMANCE of my_chip : entity is "STD_1149_1_2001";
attribute PIN_MAP of my_chip : entity is PHYSICAL_PIN_MAP;
constant PKG1 : PIN_MAP_STRING :=
"TCK:A1, TMS:A2, TDI:A3, TDO:A4, D_IN:B1, D_OUT:B2, IO:B3, VDD:C1, VSS:C2";
attribute TAP_SCAN_IN of TDI : signal is true;
attribute TAP_SCAN_MODE of TMS : signal is true;
attribute TAP_SCAN_OUT of TDO : signal is true;
attribute TAP_SCAN_CLOCK of TCK : signal is (20.0e6, BOTH);
attribute INSTRUCTION_LENGTH of my_chip : entity is 4;
attribute INSTRUCTION_OPCODE of my_chip : entity is
"BYPASS (1111), EXTEST (0000), SAMPLE (0001), PRELOAD (0010), " &
"IDCODE (0011), CLAMP (0100), HIGHZ (0101)";
attribute INSTRUCTION_CAPTURE of my_chip : entity is "0001";
attribute IDCODE_REGISTER of my_chip : entity is
"0001" & "0000000000000001" & "00000000001" & "1"; -- version, part, manufacturer, 1
attribute REGISTER_ACCESS of my_chip : entity is
"BOUNDARY (EXTEST, SAMPLE, PRELOAD), BYPASS (BYPASS, CLAMP, HIGHZ), DEVICE_ID (IDCODE)";
attribute BOUNDARY_LENGTH of my_chip : entity is 5;
attribute BOUNDARY_REGISTER of my_chip : entity is
-- num cell port function safe control disable result
"4 (BC_1, D_IN, input, X), " &
"3 (BC_1, D_OUT, output2, X), " &
"2 (BC_1, *, control, 0), " &
"1 (BC_1, IO, output3, X, 2, 0, Z), " &
"0 (BC_1, IO, input, X)";
end my_chip;
- BOUNDARY_REGISTER lists every cell. Cell 0 is the one closest to TDO. Each entry gives the cell type, the port it belongs to (
*for a control cell, which has no port of its own), its function, and a safe value. - output3 entries also name their control cell (here cell 2), the value that disables the driver (0), and what the pin does when disabled (Z).
- INSTRUCTION_OPCODE and REGISTER_ACCESS tell the tool which bits to load into the instruction register and which register each instruction connects.
- IDCODE_REGISTER: 4-bit version, 16-bit part number, 11-bit manufacturer code, and a 1 in the last bit.
- A BSDL that doesn't match the silicon (wrong cell order, missing pin) makes every board test fail in confusing ways, so the BSDL is generated by the insertion tool and checked by simulating patterns against the netlist.
Boundary scan inside the chip's own test
- The boundary-scan register also wraps the chip. For logic test of the whole chip, the boundary cells are cut into segments and stitched into the internal scan chains. They then act like wrapper cells for the chip's pins: patterns can be applied with only a few pins contacted (scan, clocks, control), and the other pins are isolated.
- Embedded boundary scan. When I/O pads sit inside a core (common in partitioned designs), the boundary cells can be placed in that core next to their pads. Those cells can then serve as the core's wrapper cells for those ports instead of adding dedicated wrapper cells.
- Core-level extest runs at the top level with every core in ext_mode, the cores modeled as grayboxes, and the boundary-scan segments and top-level logic in the same chains. See patterns and retargeting.
set_dft_specification_requirements -boundary_scan on and set_design_level chip. The TAP pins are identified with set_attribute_value <port> -name function -value tck (and tdi, tms, tdo, optional trst), special pins with set_boundary_scan_port_options, and the register order and package pin names with a pin order file. create_dft_specification and process_dft_specification insert the TAP and the cells; the tool writes the BSDL and, after extract_icl, generates and simulates the boundary-scan patterns in the patterns -ijtag context. The BoundaryScan wrapper's max_segment_length_for_logictest sets how the register is cut for logic test.# chip-level boundary scan insertion (generic names)
set_context dft -rtl
read_cell_library my_lib.tcelllib
read_cell_library my_pads.tcelllib
read_verilog my_chip.v
set_current_design my_chip
set_dft_specification_requirements -boundary_scan on
set_design_level chip
foreach {p f} {tck_p tck tdi_p tdi tms_p tms trst_p trst tdo_p tdo} {
set_attribute_value $p -name function -value $f
}
set_boundary_scan_port_options -pin_order_file my_chip.pinorder
check_design_rules
set spec [create_dft_specification]
set_config_value $spec/BoundaryScan/max_segment_length_for_logictest 200
process_dft_specification
extract_icl
set_context patterns -ijtag
check_design_rules
create_patterns_specification
process_patterns_specification
run_testbench_simulations
AC-coupled pins and IEEE 1149.6
High-speed serial links (PCIe, SerDes) are often AC-coupled: a capacitor in series on each line. A DC level driven by EXTEST charges the capacitor and then disappears, so the receiver never sees a stable value. IEEE 1149.6 adds instructions (EXTEST_PULSE, EXTEST_TRAIN) that drive edges instead of levels, and test receivers that detect those edges. It also covers differential pairs, so a single-ended short or open in a pair can be found. If you work on PHY integration, this is the boundary scan that applies to the PHY's high-speed pins.
Interview questions
Why does a boundary-scan cell have an update stage? basic
So the pins hold their values while the register shifts. Without it, every pin would toggle with the data moving through, which on a board could enable drivers, trigger resets or cause contention. The update stage loads all at once in Update-DR, so the pins change once per pattern.
Why PRELOAD before EXTEST? basic
EXTEST makes the pins drive from the update stages the moment the instruction takes effect. If they hold leftover values, chips can drive against each other or enable something on the board. PRELOAD loads known, safe values first, then EXTEST applies them.
What's the difference between SAMPLE and EXTEST? basic
SAMPLE leaves the chip in normal operation and only takes a snapshot of the pins into the boundary register. EXTEST takes the pins over: outputs are driven from the boundary register and inputs are captured into it.
How many patterns to test 1000 nets for shorts and opens? core
With a counting sequence, about log2(1000+2), so 10 patterns, compared with 1000 for a walking one. For full diagnosis of every short, a true/complement sequence doubles that to 20, and more elaborate sequences add patterns to avoid aliasing between faults.
How does a board tester know a 3-state pin's control cell? core
From the BSDL. The pin's output3 entry in BOUNDARY_REGISTER names the control cell, the value that disables the driver, and the disabled state. The tool sets control cells so each net has exactly one driver per pattern.
Can boundary scan test a SerDes link? deep
Not with plain 1149.1 if the link is AC-coupled: the capacitor blocks DC, so the static EXTEST level fades. IEEE 1149.6 adds EXTEST_PULSE and EXTEST_TRAIN, which drive edges, and test receivers that detect them, so shorts and opens on AC-coupled and differential lines can be found.
How are boundary-scan cells used in the chip's own logic test? deep
The boundary register is split into segments and stitched into the internal scan chains, so in logic test the pins' cells behave like wrapper cells: they control and observe the logic next to the pins and isolate the rest of the chip from the pins. That lets the tester contact only the test pins.
Notes: the interconnect model's output on this page was produced by running it. The BSDL is an illustrative example of IEEE 1149.1-2001 syntax, not a real device. Command and wrapper names in the Tessent notes are tool-specific; the dofile uses generic names and needs adapting.