Matched to your VM. The source course used older 65 nm TSMC teaching libraries. Every Cadence step on this page has been rewritten against the environment report of your machine (cadence_env_report.txt, CentOS 6.5 32-bit, user buet): the exact install paths, tool versions, the GPDK045 example kit (477 cells, Metal1–Metal9, CoreSite), its cap table, and the cell names that really exist. Where the kit is missing something a full flow needs (cell Verilog models, scan information in the .lib, cell GDS, a 45 nm DRC/LVS deck), the page says so and gives the working alternative — Step 0.5 generates the two missing library views with a small Python script. Step 0.0 summarises the whole machine.
Pasting on this VM. Your VM console drops characters when a long block is pasted into the terminal. Paste only short command blocks into the terminal. For every file (anything with a file name in its title bar) open it with gedit <file> &, paste there and save — or use the Download button that appears next to Copy on every file block, then copy the downloaded file into the project. After saving, the page tells you how many lines the file must have (wc -l).
Conventions used on this page.monospace = something you type or a file name. Bold → arrows = a menu path you click. Blue boxes show the output you should expect. Orange collapsible boxes are troubleshooting: open them only when something goes wrong. Every code block has a Copy button.
How each chapter is organised. Every chapter opens with the same three blocks, then the hands-on steps:
1 · At a glance — inputs, outputs, tools, time2 · THEORY card — the why, with diagrams (collapsible)3 · Step list — jump to any step4 · Steps — do, see, check
Inside each theory card a gold DEEP DIVE divider starts the maths: derivations, worked numbers, and interactive widgets you can play with. Equations are typeset from LaTeX into native MathML when the page is built, so they display offline in any current browser. Each step now starts with Why this step, ends with a link to the next step, and every checkpoint has a tick box that fills the progress bar in the side menu.
Theory cards are clearly separated (blue border, THEORY badge). Read them once, then collapse them — or use Hide theory cards in the side menu when you only want the commands.
The textbook core (Weste & Harris, Rabaey) that every later chapter builds on. Read it once; chapters link back here.
You learnHow transistors make gates, why gates have delay, and how flip-flops store bits
Used inCh 2 (timing), Ch 3 (power), Ch 4 (sizing), Ch 7 (IR drop)
PrerequisiteOhm’s law, basic Boolean algebra
Time≈ 90 min
THEORYTransistors, gates, delay and storage≈ 100 min read · seventeen sections
F1The MOSFET: a voltage-controlled switch
A MOSFET has four terminals: gate (G), source (S), drain (D) and body. The gate voltage controls whether a conducting channel forms between source and drain. For an NMOS transistor with threshold voltage , the classic long-channel (“square-law”) model is:
Output characteristics from the equations above ( V). Left of the dashed parabola the transistor acts like a resistor; right of it, like a current source.
Width is the designer’s knob. Doubling doubles and the current — this is what the X1 / X2 / X4 drive strengths in the library are.
PMOS is weaker. Hole mobility is roughly 2–3× lower than electron mobility, so a PMOS needs about twice the width of an NMOS to deliver the same current.
Short-channel reality. In a 45 nm transistor carriers hit their maximum velocity, and the current grows more slowly: with . This “alpha-power law” is the one used for IR-drop in Chapter 7.
F2The CMOS inverter and its noise margins
Connect a PMOS from to the output and an NMOS from the output to ground, gates tied together. For any steady input exactly one of them is on, so no static current flows — the reason CMOS dominates.
The voltage transfer characteristic (VTC). In the steep middle region a small input change causes a large output change: the gain magnitude is well above 1.
Switching threshold. At both transistors are saturated and carry the same current:
With (PMOS made about 2× wider) and , : a symmetric inverter.
Noise margins. and are the inputs where the slope is ; , the corresponding outputs:
From the plot: , , , V → V, about 31 % of . Any noise smaller than that on a wire is removed by the next gate. Because the gain exceeds 1, noise shrinks stage after stage — logic is regenerative, which is why digital circuits can be chained millions of times.
F3Static CMOS gates: how transistors make logic
Every gate in the library is built from two switch networks that share one output wire:
A pull-down network (PDN) of NMOS transistors between the output and GND. An NMOS conducts when its gate is 1.
A pull-up network (PUN) of PMOS transistors between VDD and the output. A PMOS conducts when its gate is 0.
The design rule is simple: for every input combination, exactly one network conducts. If both conducted there would be a short from VDD to GND; if neither did the output would float. Inside a network, the switch logic is equally simple:
CONNECTION
CONDUCTS WHEN…
BOOLEAN MEANING
Two transistors in series
both are on
AND
Two transistors in parallel
either is on
OR
NAND2 and NOR2. The PUN is always the series/parallel mirror image (the dual) of the PDN.
Walk through NAND2 one input combination at a time. The PDN is two NMOS in series, so it pulls the output low only when A = 1 and B = 1. The PUN is two PMOS in parallel, so it pulls high when A = 0 or B = 0:
A B
NMOS A · NMOS B
PDN (series)
PMOS A · PMOS B
PUN (parallel)
Y
0 0
off · off
open
on · on
conducts
1
0 1
off · on
open
on · off
conducts
1
1 0
on · off
open
off · on
conducts
1
1 1
on · on
conducts
off · off
open
0
In every row exactly one network conducts — that is . The same recipe builds any gate of the form :
Write using AND and OR.
Build the PDN so it conducts when : AND → series, OR → parallel.
Build the PUN as the dual: swap every series for parallel and vice versa. De Morgan’s law guarantees it conducts exactly when .
Example — AOI21, : PDN = (NMOS A in series with NMOS B) in parallel with NMOS C. PUN = (PMOS A in parallel with PMOS B) in series with PMOS C. Six transistors, one stage of delay. Building the same function from a NAND and a NOR would need two stages and eight transistors — which is why libraries include complex cells like AOI and OAI.
Why every CMOS gate inverts. NMOS transistors pass a clean 0 but a degraded 1 (Section F11), and PMOS the opposite. So NMOS must sit next to GND and PMOS next to VDD. Inputs at 1 turn NMOS on and pull the output down: a single static CMOS stage can only make inverting functions. An AND2 cell in the library is really a NAND2 followed by an inverter.
F4aSizing a gate for equal drive — and what “logical effort” means
To compare gates fairly we size each one so its output is exactly as strong as a reference inverter’s. Three simple facts are all we need:
A transistor’s on-resistance is inversely proportional to its width: a unit-width NMOS has resistance ; width 2 has .
A PMOS conducts about half as well (holes are slower than electrons), so it needs width 2 to reach resistance .
Resistances in series add; a gate’s input capacitance is proportional to the total width of the transistors that input connects to (call one unit of width one unit of capacitance ).
Every gate sized so that its worst-case pull-up and pull-down each have resistance , just like the reference inverter.
Now work out each gate in the figure:
Inverter. NMOS width 1 (resistance ), PMOS width 2 (resistance ). The input connects to both gates: input capacitance units.
NAND2. The two NMOS are in series, so their resistances add. To total , each must be → width 2. The PMOS are in parallel, but the worst case is when only one of them is on, so each PMOS alone must reach → width 2. Input A touches one NMOS (2) and one PMOS (2): input capacitance units.
NOR2. Now the PMOS are in series: each must be → width 4. The NMOS are in parallel, worst case one on → width 1 each. Input capacitance units.
All three gates now drive their output equally hard, but they demand different amounts of input capacitance from whatever drives them. That ratio is the logical effort:
In plain words: logical effort is the price of computing. An inverter only inverts; a NAND2 also computes an AND, and the series transistors that do it cost 33 % more input capacitance for the same output strength. A NOR2 costs 67 % more, because it stacks the weak PMOS.
The same counting gives the parasitic delay : the capacitance a gate must charge on its own output (the drain areas of the transistors touching it), relative to an inverter. Inverter: units → . NAND2: PMOS plus the top NMOS = 6 units → . NOR2: PMOS plus NMOS = 6 → . Generalising to inputs:
GATE
LOGICAL EFFORT g (per input)
PARASITIC DELAY p
WHY
Inverter
1
1
the reference
NAND
NMOS in series, each width
NOR
PMOS in series, each width
2:1 multiplexer
2
4
transmission-gate structure
XOR2 / XNOR2
4
4
needs both true and complemented inputs
Two lessons follow immediately: wide NOR gates are expensive (), and wide gates of any kind have large . Libraries stop at 3–4 inputs for exactly this reason.
F4bThe delay of one gate:
Measure time in units of : the delay of an ideal inverter driving one identical inverter, ignoring its own parasitics. Since the inverter’s resistance drives 3 units of capacitance, — about 3–5 ps in a 45 nm process.
Deriving the formula. Take a gate whose input capacitance is . An inverter with the same drive strength would have input capacitance , i.e. it would be times a unit inverter, so its resistance is
This resistance charges the load , and also the gate’s own parasitic capacitance (which gives the term):
Each symbol has a physical meaning you can point at:
SYMBOL
NAME
WHAT IT MEASURES
WHO SETS IT
logical effort
how much harder this gate type is to drive than an inverter
the gate’s function and topology
electrical effort (fan-out)
how much bigger the load is than the gate’s own input
the size you choose for the gate and what it drives
stage effort
the part of delay that depends on load — “how hard the gate is working”
both
parasitic delay
the fixed delay of charging its own output, even with no load
the gate type (not its size: bigger gates have proportionally bigger drain caps and lower resistance)
Delay is a straight line in : the slope is , the intercept is . NOR2 gets slower fastest as its load grows.
Worked example. A NAND2 drives four identical NAND2 gates. Each load has the same input capacitance as the driver, so : . Compare the FO4 inverter: . The NAND2 is about 47 % slower at the same fan-out. With ps that is 29 ps vs 20 ps.
F4cFrom one gate to a whole path: , , , and
Real timing paths are chains of gates. Suppose the path has stages. Its delay is simply the sum of the stage delays:
The and are fixed by which gates the logic needs. The depend on how big you make each gate — and that is the design question: given the first gate’s input capacitance and the final load, how big should the gates in between be? Four quantities answer it. Each one is a “whole-path” version of a single-gate idea.
1 · Path logical effort
The product of the gates’ logical efforts: how much harder the path’s logic makes the job compared with a chain of plain inverters (for which ). Inverters, NAND2, NOR2, inverter gives .
2 · Path electrical effort
The final load divided by the input capacitance of the first gate. It is the total current amplification the path must provide. A small gate driving a long, heavily loaded wire has a large .
3 · Branching effort
Often a gate’s output drives not only the next gate on the path but also other gates that are not on this path (off-path loads). The on-path stage must supply current to all of them:
One stage driving the on-path gate plus two equal side loads.
With no side loads . With the two equal side loads in the figure : the path must work three times harder at that node.
4 · Path effort — the key fact
Here is why this product matters. The electrical effort of stage is , and stage ’s output load is the next stage’s input times its branching, . Multiply all the together and watch the intermediate sizes cancel:
Every appears once on top and once underneath. Therefore
The product of the stage efforts is the same no matter how you size the gates. Sizing only decides how that fixed product is shared between the stages.
5 · Why sharing it equally is best
We want to minimise the sum while their product is fixed at . The arithmetic–geometric mean inequality says that for positive numbers
with equality only when all the are equal. So the smallest possible sum is , reached when every stage carries the same effort
Intuition: it is like a bicycle with several gears in series that must give a fixed total ratio. Putting all the ratio in one gear makes that gear work extremely hard; spreading it evenly keeps every gear in its comfortable range.
6 · Sizing the gates: work backwards from the load
Once is known, every stage must have , i.e. . Start at the load and compute each gate’s input capacitance in turn:
Full worked example — INV → NAND2 → NOR2 → INV, first input 10 fF, final load 120 fF, no branching.
Step 1: , , → .
Step 2: . . .
Step 3 — sizes, backwards:
STAGE
GATE
g
Cout (fF)
Cin = g·Cout/f̂ (fF)
h = Cout/Cin
d = gh + p
4
INV
1
120
52.9
2.27
3.27
3
NOR2
5/3
52.9
38.8
1.36
4.27
2
NAND2
4/3
38.8
22.8
1.70
4.27
1
INV
1
22.8
10.0 ✓
2.27
3.27
The last line comes back to the given 10 fF — a built-in check that the arithmetic is right. Total 15.1 τ.
Compare a naive sizing: make every gate the same size as the first (10 fF). Then stages 1–3 have and the last inverter has : — 46 % slower, because the last stage is overworked while the first three idle.
7 · How many stages?
Adding inverters (or buffers) changes but not (an inverter has ). Section F10 shows the delay is minimised when each stage’s effort is about 3.6–4, so the best number of stages is roughly
For , : four stages is a little more than needed but close to optimal. For a gate driving a 1 pF bus from a 2 fF input (), — insert a chain of 4–5 buffers. This is exactly what RC and optDesign do when they add buffers to a high-fan-out net.
8 · Try it yourself
Pick the gates on a path, the electrical effort and the branching. The calculator follows the eight steps above and also shows the naive “all gates equal” delay for comparison.
Limits of the model. Logical effort assumes equal rise/fall delays, ignores input slope and treats wires as part of the load. The Liberty tables (Chapter 2, D6) capture all of those. Logical effort is the tool for understanding and quick hand estimates; the synthesis tool does the exact version.
F5Storing a bit: latches and flip-flops
A latch is level-sensitive: while its enable is active the output follows the input (transparent); otherwise it holds. A flip-flop is edge-triggered and is built from two latches with opposite enables:
Master–slave D flip-flop.
Setup time exists because D must propagate through the master’s internal loop before it closes at the edge.
Hold time exists because the master needs a moment after the edge to cut D off completely.
Clock-to-Q is the slave’s delay after it opens. All three numbers are stored in the Liberty file for each flop.
F6Metastability — when setup/hold is violated anyway
If D changes inside the setup/hold window the flop’s internal node can balance near . The cross-coupled inverters then amplify the tiny difference exponentially with time constant :
Resolution therefore takes an unbounded but exponentially unlikely time. For a synchroniser with clock frequency , data change rate , and of resolution time allowed:
ps, ps, MHz, MHz. Each extra 46 ps of waiting multiplies MTBF by 10.
Numbers: with ns, MTBF ≈ s ≈ 42 days — a guaranteed field failure. With ns, MTBF ≈ s, comparable to the age of the universe. A two-flop synchroniser gives a whole clock period to resolve, which is why every asynchronous input (including a reset release in a real chip) passes through one.
F7Where the pieces of this primer reappear
CONCEPT
WHERE IT MATTERS IN THE LAB
, drive strength
Cell sizing in RC (Step 2.2) and optDesign (Ch 4)
Gate delay
Why fanout and load appear in every timing report
Setup, hold,
STA equations in Ch 2
switching
Power in Ch 3 and Ch 7
Alpha-power law
IR drop slowing gates (Ch 7)
Metastability
Why reset is a false path and needs a synchroniser in real designs
DEEP DIVE device physics and circuit-level derivations
F8MOS capacitances and the body effect
The gate is a parallel-plate capacitor: gate metal, a thin oxide of thickness , and the channel.
Where a MOSFET’s capacitances come from. The gate over its thin oxide forms the big gate capacitance : this is the input load that logical effort counts. The reverse-biased source/drain junctions add diffusion capacitance , which the gate has to charge at its own output. That is the parasitic delay .The body effect. When the source sits above the body (), the threshold rises along a square-root curve. The upper NMOS of a series stack has its source above ground, so it turns on more weakly. This is one reason tall stacks are slow.
Order of magnitude for an effective oxide of about 1.2 nm: . A transistor with , has . A NAND2 input (two such gates, one wider) is therefore around 0.5–1 fF — consistent with the pin capacitances in the Liberty file.
Besides , every drain has a reverse-biased junction capacitance to the body. These drain capacitances form the gate’s parasitic (self-loading) capacitance — the term in logical effort.
Body effect. When the source sits above the body (), as for the upper NMOS in a NAND stack, the threshold rises:
with body-effect coefficient and Fermi potential . Stacked transistors therefore conduct a little less than the simple model predicts: one more reason wide-fan-in NAND/NOR gates are slow and libraries rarely go beyond 4 inputs.
F9Deriving the inverter’s propagation delay
Delay is measured between 50 % points of input and output:
: output falling; : output rising. The average is the number a library calls “delay”.
When the input rises, the NMOS discharges from to . Its current is roughly constant at over that range, so it behaves like an equivalent resistance equal to the average of over the swing:
Discharging through to the 50 % point (Chapter 0, deep dive D2) gives
Split into the inverter’s own drain capacitance and the external load . Making the inverter times larger divides by and multiplies by :
Upsizing helps only until ; after that the gate just loads itself and its own driver. That is why sizing is a chain problem (F10).
F10Driving a large load: the optimal inverter chain
To drive a large from a small , use inverters, each times larger than the previous, with . With (≈ 1), each stage has delay and the total is
Differentiate with respect to (using ) and set to zero:
For (no self-loading) the solution is ; for the realistic it is . Optimum delay is very flat around it, so designers use a fan-out of about 4 per stage — the FO4 rule of thumb, derived.
F11Pass transistors and transmission gates
An NMOS used as a switch passes a strong 0 but a weak 1: it stops conducting when its source reaches .
Passing a logic 1. An NMOS alone stops conducting once its output reaches , so it delivers a degraded ‘weak 1’ (here 0.55 V). A transmission gate puts a PMOS in parallel, which keeps conducting near and restores a full 0.9 V.
A degraded 1 of 0.55 V is barely above the next inverter’s and causes static current in it. A transmission gate (NMOS ∥ PMOS, complementary controls) passes both levels fully, which is why library multiplexers (MX2) and many flip-flop internals use transmission gates.
F12Scaling laws: Dennard and its end
Under ideal constant-field scaling by a factor (Dennard, 1974) every quantity changes predictably:
One technology generation (linear shrink ), compared in two eras. Under Dennard scaling the supply voltage shrank too: gates got 30 % faster and twice as dense, and power density stayed flat. Once stopped scaling (after about 2005), density kept doubling but so did power per area. That is why clock rates plateaued.
QUANTITY
SCALES AS
REASON
, wire pitch
Lithography
Keep the electric field constant
Capacitance
Current
, constant
Gate delay
Faster
Power per gate
Gates per area
Area per gate
Power density
1
Around 2005 could no longer fall (leakage grows as , Chapter 3, D4), so stopped scaling too. With fixed, power density grows as : the power wall. It is why clock frequencies plateaued, why chips went multi-core, and why power analysis (Chapters 3 and 7) became a signoff item.
F13Energy metrics and the best supply voltage
The power–delay product is the energy per switching event, and the energy–delay product balances speed against energy:
Supply voltage trades delay against energy. Energy falls as , but delay rises sharply as approaches . Their product, the energy–delay product, has a minimum in between (about 0.62 V in this model). That minimum is the efficient operating point when speed and energy matter equally.
Using and the alpha-power delay :
Example: V, : V. Running faster than that costs disproportionate energy; running slower saves little energy but loses much speed. This is the principle behind dynamic voltage–frequency scaling (DVFS) in phones and laptops.
F14Dynamic (domino) logic — a faster but fragile alternative
Static CMOS pays for its robustness with a full PMOS pull-up network, which is slow (weak, series PMOS) and loads every input. Dynamic logic replaces the whole PUN with a single clocked PMOS:
A domino AND gate, transistor by transistor. While the clock is low the precharge PMOS charges the dynamic node X high. When the clock goes high the foot NMOS turns on, and X falls only if the pull-down network (A·B) conducts. The output inverter turns ‘X falls’ into ‘Y rises’, so Y can only make 0→1 transitions during evaluation. That property makes it safe to drive the next domino gate. The weak keeper holds X high against leakage.The same gate in time. Each cycle has a precharge half (X = 1, Y = 0) and an evaluate half. In the first evaluate phase the inputs are true, so X discharges and Y rises. In the second they are false, but charge sharing with an internal stack node makes X dip. The keeper restores it before Y can misfire. Too large a dip is the classic domino failure.
Precharge (clock = 0): the PMOS charges the output node to VDD; a clocked NMOS “foot” at the bottom is off, so the PDN cannot discharge it.
Evaluate (clock = 1): the PMOS turns off and the foot turns on. If the PDN’s inputs make it conduct, the node discharges to 0; otherwise it simply stays at 1 — held only by its own capacitance.
Each input now drives only an NMOS, so logical effort drops sharply (a dynamic NAND2 input is roughly 2 units of capacitance instead of 4), and there is no PMOS fighting the pull-down. Dynamic gates can be 1.5–2× faster.
The catches:
Monotonicity. During evaluation the output can only fall, never rise. A dynamic gate feeding another dynamic gate directly could wrongly discharge it, so each one is followed by an inverter (“domino” logic: a rising wave of outputs topples through the chain).
Charge sharing. If internal nodes of the PDN with capacitance were at 0 and connect to the output node during evaluation, the charge redistributes:
With the output drops to — possibly below the next gate’s switching threshold. A weak keeper PMOS fed back from the output tops the node up.
Leakage and noise. A floating node slowly leaks and is easily disturbed by crosstalk.
That is why dynamic logic lives in hand-designed, high-performance datapaths and memories, while standard-cell flows like this lab use only static CMOS: every cell is self-restoring, and the timing tools can verify it automatically.
F15Latch-based timing and time borrowing
A flip-flop pipeline forces every stage to fit inside one clock period: if one stage needs 6 ns and the next only 3 ns, the clock must still be 6 ns and 3 ns is wasted. Latches remove that rigidity.
Time borrowing in a two-latch pipeline with T = 10 ns. Half-stage 1 needs 6.0 ns, overrunning its 5 ns half-period by 1.2 ns once the 0.2 ns latch delay is included. Latch L2 is transparent at that moment, so the data simply flows through and half-stage 2 starts late. The sum still arrives at 9.8 ns, inside the cycle. With flip-flops this would have been a timing violation.
Replace each flop with two latches on opposite clock phases ( transparent in the first half-period, in the second) and put half of the logic between them. A latch is transparent for half a cycle: if data arrives late — while the latch is already open — it simply flows through and continues into the next half-stage. The late half-stage has borrowed time from the next one.
For two half-stages with logic delays and and a latch D-to-Q delay , the requirement is only on their sum:
How much one half-stage may borrow is limited by how long the next latch stays open:
Example: ns, ns. Half-stages of 6.0 and 3.4 ns: ✓. The first half-stage overruns its 5 ns half-period by about 1.2 ns, well below the borrow limit of . With flip-flops this logic would need two 6 ns cycles.
Latch-based design also tolerates clock skew better. The cost is harder timing analysis (a path’s slack depends on how much its neighbours borrowed) and two clock phases to distribute. High-speed processors use it; standard-cell flows like this lab use edge-triggered flops for simplicity.
F16The 6T SRAM cell — memory built from two inverters
Almost every on-chip memory (caches, register files, the SRAM macros a real chip would add next to this counter) stores each bit in six transistors. Two cross-coupled inverters form a loop with two stable states, Q = 1/QB = 0 or the reverse. Two NMOS access transistors, switched by the word line (WL), connect the storage nodes to a pair of bit lines (BL, BLB).
The 6T cell: two cross-coupled inverters (four transistors) store Q and QB; the word line WL turns on the two access NMOS that connect the storage nodes to the complementary bit lines BL and BLB for reading and writing.
Reading without destroying the bit
Both bit lines are precharged to , then WL goes high. On the side storing 0, current flows from BL through the access transistor and the pull-down NMOS to ground, so BL slowly discharges. A sense amplifier detects the small difference between BL and BLB. Meanwhile the “0” node rises a little, to a value set by the fight between the access transistor (pulling up) and the pull-down (pulling down). If exceeds the other inverter’s switching threshold, the read flips the cell. This is a read upset. Equating the two currents (access in saturation, pull-down in its linear region):
The ratio is the cell ratio. A larger β makes the pull-down win more decisively and keeps small. Designs use .
Example: V, V, . Solving the equation gives V, comfortably below an inverter threshold of about 0.45 V, so the read is safe. With , rises to about 0.16 V, and process variation can push individual cells over the edge.
Writing — the opposite requirement
To write, drivers force one bit line to 0. The access transistor must now overpower the PMOS pull-up holding the node at 1. So the pull-up ratio must be small (weak PMOS). The sizing order that satisfies both reads and writes is .
How fast is a read?
The cell current must discharge the whole bit-line capacitance (hundreds of cells hang on it) by the sense-amplifier threshold:
This is why SRAMs use small-swing sensing: waiting for a full 0.9 V swing would take about 4.5 ns. It is also why long bit lines are split into banks. At 45 nm a 6T cell occupies roughly 0.3–0.35 µm², several times denser than a flip-flop. Memories are therefore compiled as dense macros rather than built from standard cells.
F17The ring oscillator — measuring gate delay on silicon
Connect an odd number of inverters in a loop. No combination of values is consistent all the way around (an odd number of inversions turns a 0 back into a 1), so the circuit can never settle. A transition races around the ring forever.
A five-stage ring oscillator. An odd number of inversions has no consistent stable state, so an edge circulates forever; one period is two trips around the ring, .
A rising edge must pass all stages to return inverted, then another stages to return to its original value. The period is two trips around the ring:
Example: with ps (Chapter 0) an inverter driving one identical inverter has , so ps. An 11-stage ring then oscillates at GHz. If the measured frequency on a die is 5 % lower, that die’s gates are 5 % slower: it sits toward the slow corner.
Why foundries put them on every wafer. A frequency can be measured with a simple counter far more precisely than a single gate delay. So ring oscillators in the scribe lines and in each chip are the standard process monitors: they place each die on the SS–TT–FF spectrum of Chapter 7 and track ageing over the chip’s life. Loading each stage with three extra inverters (FO4) makes the measured directly comparable to the logical-effort unit used in F4.
Why even rings do not oscillate. With an even the loop has two consistent stable states (alternating 0101… or 1010…). It behaves like a latch, not an oscillator, which is exactly how the SRAM cell of F16 () stores a bit.
Remember
Wider transistors = more current = faster, at the cost of input capacitance.
CMOS is regenerative: noise margins clean up signals every stage.
Delay = effort × fanout + parasitic; equal effort per stage is optimal.
Flip-flops are two latches; violating their window risks metastability.
? Check yourself
Q1Doubling a transistor’s width W (everything else fixed) roughly…
β = μCoxW/L, so current doubles; gate area W·L doubles too, so does Cg. That trade-off is the whole sizing problem.
Q2Why are NOR gates usually avoided in favour of NAND?
Series PMOS (already weak) must each be ~4× wider, giving gNOR2 = 5/3 vs gNAND2 = 4/3.
Q3Allowing a synchroniser 46 ps more resolution time (τ = 20 ps) multiplies its MTBF by about…
MTBF ∝ et/τ; 46/20 = 2.3 = ln 10, so ×10.
Q4In the logical-effort model, the product of all stage efforts f₁·f₂·…·f_N…
The intermediate input capacitances cancel in the product of the hi, leaving B·H; multiplying by the gi gives F = GBH.
Q5For minimum path delay, the stage efforts should be…
With the product fixed, the sum is smallest when all terms are equal (arithmetic–geometric mean inequality).
Q6A gate drives the next gate on the path plus two equal side loads. Its branching effort b is…
b = (Con + Coff)/Con = (1 + 2)/1 = 3.
CHAPTER 0
Before you begin
Make the environment reproducible before touching RTL.
You start withAn empty VM login
You end withA loaded tool environment, a clean project tree, a map of your library files, and the two generated library views (cell models, scan .lib)
Toolsbash, find, grep, python 2.6, gedit
Time≈ 45 min
THEORYThe big picture — what “RTL to GDS” actually means≈ 8 min read · collapse if you know it
T1A chip is designed at five levels of detail
You never draw transistors for a digital chip. You describe behavior, and tools refine it step by step until it becomes polygons a foundry can print. Each step adds detail and each step is checked.
The same design at five levels of abstraction, from RTL text to GDSII polygons. Each step to the right adds detail (gates, then positions, then wires, then shapes). Each step also adds its own check: simulation, then STA, then DRC/LVS.
LEVEL
WHAT EXISTS
WHAT YOU CHECK
CHAPTER
RTL
Registers and the logic between them, written in Verilog
Function (does it count?)
1
Gate netlist
Real library cells connected by nets
Function again + timing estimate
2–3
Placed design
Every cell has an (x, y) location
Congestion, timing with estimated wires
4
Routed design
Every net is metal wires and vias
Timing with real wires, power, IR drop
4, 7
GDSII
Polygons on numbered layers
DRC (manufacturable?) and LVS (same circuit?)
7
T2How the tools hand work to each other
Four tools, each consuming the previous one’s output plus data from the process kit (PDK):
The whole lab on one page. Blue boxes are inputs you supply or the PDK supplies; the arrows between gold boxes are the hand-off files.
T3Standard cells — the LEGO bricks
A standard-cell library is a set of pre-designed gates (NAND, NOR, flip-flops, buffers…) in several drive strengths.
Every cell has the same height, so cells can be lined up in rows like books on a shelf; widths differ.
The power rails run along the top and bottom edge of each cell, so neighbours’ rails touch automatically.
What Encounter knows about a cell (its LEF “abstract”): outline, pins and blocked metal — not the transistors.
The same cell is described in four different files, each for a different tool:
VIEW
CONTAINS
USED BY
Liberty .lib
Function, delay tables, power tables, pin capacitance
RC, Encounter timing, power analysis
LEF .lef
Size, pin shapes, blockages; tech LEF = metal layers and rules
Encounter
Verilog model .v
Logic behavior (+ specify blocks for delays)
Gate-level simulation
GDS .gds
The real polygons of the layout
Stream-out, DRC, LVS
T4What a PDK is
A Process Design Kit is the foundry’s package for one manufacturing process: the cell library views above, the metal-stack description, extraction models (QRC / cap tables), and the DRC/LVS rule decks. Everything in one flow must come from one PDK — a 90 nm rule deck cannot judge a 45 nm layout.
What is inside a PDK and who reads it. Liberty files feed timing and power to RC, Encounter and the power tools. LEF gives Encounter the layers, rules and cell outlines. QRC or cap tables model wire R and C for extraction. Verilog models drive gate-level simulation. GDS plus the layer map supply the real shapes at stream-out. When a tool says “cannot find …”, this picture tells you which file is missing.
Libraries come in corners: slow (worst-case slow transistors), typical, fast. You use slow to prove the design is fast enough and fast to prove it is not too fast (hold). Chapter 7 explains why.
DEEP DIVE the numbers behind the picture
D1Units you will meet — and how they relate
Every tool report mixes units. Keep this table open the first time you read one.
The time scales on this page on one logarithmic axis. The intrinsic gate time constant τ is a few picoseconds, an FO4 inverter about 20 ps, the counter’s critical path about 0.6 ns, and the clock period 10 ns. A clock cycle holds hundreds of gate delays, which is why this lab meets timing with huge slack.
QUANTITY
TYPICAL UNIT
SCALE IN THIS LAB
Time
ns, ps
clock period ; a gate ≈ 20–80 ps
Capacitance
pF, fF
a cell input ≈ 1–3 fF; set_load 0.05 = 50 fF
Resistance
Ω
Metal1 ≈ 0.1–1 Ω per µm of length
Length
µm (1 dbu = 1/2000 µm)
cell height ≈ 1.7 µm in gsclib045
Power
mW, µW, nW
this counter ≈ µW at 100 MHz
A useful identity: . Any time you see a resistance and a capacitance, their product is a time constant — that is the root of every delay in this lab.
D2Why everything is an RC delay
A transistor that turns on behaves (to first order) like a resistor charging the capacitance of whatever it drives. Charging a capacitor through a resistor from 0 to :
Charging a capacitor through a resistor. The voltage follows : it crosses 50 % at (the point STA measures delay to) and 63 % at one time constant. Every gate and wire delay on this page is a version of this curve.
A logic gate “switches” when its output crosses the 50 % point:
So: a bigger driver (smaller ) is faster; a bigger load (more fanout, longer wire → larger ) is slower. Synthesis sizing cells (X1 → X4) and placement shortening wires are both attacks on the same product.
D3Why technology nodes matter
If every dimension shrinks by a factor (e.g. 65 nm → 45 nm gives ), area per cell scales as :
Moving from 65 nm to 45 nm shrinks each linear dimension by 45/65. Cell area therefore falls by about , so roughly two cells fit where one used to. This density gain is the economic engine behind every node.
About twice as many gates fit in the same area. That is why the VT course’s 65 nm values (ring widths, cell names) cannot simply be copied to the 45 nm kit on your VM.
Remember
RTL → netlist → placement → routing → GDS; verify at every level.
One cell, four views: .lib (timing), .lef (shape), .v (sim), .gds (polygons).
Never mix files from different PDKs.
0.0
Know exactly what your VM contains
Why this stepEvery value used later (paths, versions, layers, cell names) comes from this table; when a later step says “on your VM”, this is the evidence behind it.
This table condenses the environment report you generated on the VM. Read it once; you will recognise every row in the steps that follow.
ITEM
ON THIS VM (from the report)
WHAT IT MEANS FOR THE LAB
Operating system
CentOS 6.5, 32-bit (i686), kernel 2.6.32, bash 4.1.2, GNU awk 3.1.7, GNU grep 2.6.3, Python 2.6, 12 GB RAM, no swap
All commands are written for these versions (no sort -V, no \s in grep, Python-2.6-safe scripts).
Simulation
Incisive 10.20-s100 — irun ncvlog ncelab ncsim simvision in /home/buet/cadence/installs/INCISIV102/tools/bin
Chapters 1, 2.4, 3, 6.4, 6.5, 7.2.
Synthesis + DFT
RTL Compiler v12.10-s012_1 — rc in /home/buet/cadence/EDI/tools/bin
rc -version crashes with a segmentation fault on this VM; start RC normally instead (Step 0.1 D).
Step 7.6 reuses that cds.lib from a separate folder, so the project folder stays clean.
Why gpdk090 is not used for the digital flow
Synthesis needs a Liberty file and place-and-route needs a cell LEF — both describe standard cells. gpdk090 on this VM only contains transistors, resistors and capacitors for hand-drawn layout. The GPDK045 example kit is therefore the only library that supports RTL→GDS here; that is why every chapter below uses it.
CheckpointYou can say, without looking, which library the digital flow uses (GPDK045 example), which two library views you will generate (cell models, scan .lib), and why gpdk090 only appears in Step 7.6.
0.1
Confirm the legacy toolchain
Why this stepOld and new Cadence tool names differ; confirming paths and versions first avoids following commands that cannot exist on this VM.
Cadence renamed most of its tools after 2015. Tutorials you find online often use the new names, which do not exist on your VM. Your VM does not contain xrun, genus, innovus, tempus, voltus, or modus. Use the older command names shown here — the report confirmed that genus, innovus and icfb are not on the PATH.
Simulationirun, ncvlog, ncelab, ncsim, SimVision (old name of today's Xcelium xrun)
Synthesis / scanrc — scan insertion is built in (old name of today's Genus)
Physical designencounter, NanoRoute (old name of today's Innovus)
Start the VM and log in as the college user (buet on this machine).
From the CentOS desktop choose Applications → System Tools → Terminal.
Type bash and press Enter. Everything on this page assumes Bash syntax (export, $(...)); the C-shell uses setenv and will reject these lines.
BCreate the lab folder and the environment file
The environment file is a tiny shell script that adds each Cadence installation's bin directory to your PATH and tells the tools where the license file is. You will source it in every new terminal. The block below uses cat > … <<'EOF', which writes everything up to the line EOF into the file. It is short, so pasting it into the terminal usually works on your VM; check the result with the wc -l line at the end, and if the count is wrong use the gedit route described under the block.
Create /home/buet/cds_work/asic_lab/setup_cadence.sh · shellmkdir -p /home/buet/cds_work/asic_lab
cd /home/buet/cds_work/asic_lab
cat > setup_cadence.sh <<'EOF'
#!/bin/bash
# ---- Cadence environment for the ASIC lab (source this file, do not execute it) ----
export CDS_ROOT=/home/buet/cadence/IC615
export CDSHOME=$CDS_ROOT
export CDS_INSTALL_DIR=$CDS_ROOT/tools/dfII
export CDS_LIC_FILE=$CDS_ROOT/ic6151license.dat
export PATH=$CDS_ROOT/tools/dfII/bin:$CDS_ROOT/tools/bin:$PATH
export PATH=/home/buet/cadence/MMSIM121/tools/bin:$PATH
export PATH=/home/buet/cadence/ASSURA41/tools/bin:$PATH
export PATH=/home/buet/cadence/EDI/tools/bin:$PATH
export PATH=/home/buet/cadence/installs/INCISIV102/tools/bin:$PATH
# Example 45 nm library shipped with Encounter (used by every later chapter)
export PDK45=/home/buet/cadence/EDI/share/FoundationFlows/EXAMPLES/EDI/DESIGN/GPDK/LIBS/GPDK045
# Technology data of the same example kit: capTable, qrcTechFile, mapFile, qrc.conf
export PDK45_TECH=/home/buet/cadence/EDI/share/FoundationFlows/EXAMPLES/EDI/DESIGN/GPDK/TECH
# 90 nm transistor-level PDK (no standard cells) - used only to VIEW the final GDS in Virtuoso
export GPDK090=/home/buet/cadence/gpdk090_v4.6
EOF
chmod +x setup_cadence.sh
wc -l setup_cadence.sh # must print 19
ls -l setup_cadence.sh
Already created it? The file you made earlier is identical except for the last four lines (PDK45_TECH and GPDK090). Re-run the block: cat > overwrites the old file. If the terminal drops characters, open gedit setup_cadence.sh & and paste only the part between the two EOF lines.
Why source and not ./setup_cadence.sh? Running a script starts a child shell; its exports disappear when it exits. source runs the lines inside your shell, so the variables stay set.
CLoad the environment and check every tool
Verify the toolchain · shellsource setup_cadence.sh
which irun ncvlog ncelab ncsim simvision rc encounter virtuoso spectre assura strmin
irun -version
encounter -version | head -1
virtuoso -version
echo $PDK45
ls $PDK45 $PDK45_TECH
ANNOTATED OUTPUTExpected output on your VMcopied from your environment report
Every tool resolves to the installation listed in Step 0.0 — Incisive under installs/INCISIV102, RC and Encounter under EDI, Virtuoso/strmin under IC615.
The exact versions on your VM: Incisive 10.20-s100, Encounter 13.10-p003_1 (32-bit build), Virtuoso 6.1.5.
The library folder holds just one LEF and a timing/ folder — no qrc, gds or Verilog folders. That is normal for this example kit.
The extraction data lives in the sibling TECH folder. The searches in the course used *captbl*, which misses a file named capTable — Step 0.2 uses the right pattern.
DCheck RTL Compiler separately (it is interactive)
On this VM rc -version prints a crash report — Segmentation Fault accessing address 74 … Product Version: v12.10-s012_1 — instead of a clean version line. The report itself proves the version, and the crash is limited to that option. Check RC the way you will actually use it: start it, read the banner, leave it.
Start RC once · shellrc -nogui -logfile logs/rc_check.log
# wait for the rc:/> prompt, then type:
# exit
What you should see
The terminal shows the banner Cadence Encounter(R) RTL Compiler with v12.10-s012_1, then the prompt rc:/>.
After exit you are back at the Bash prompt and logs/rc_check.log exists. (Create logs/ first if Step 0.2 has not been done: mkdir -p logs.)
Troubleshooting — a tool is "not found", RC crashes, or licenses fail
which rc prints nothing. The setup file was not sourced in this terminal, or a line was mistyped. Run grep EDI setup_cadence.sh: it must show export PATH=/home/buet/cadence/EDI/tools/bin:$PATH. Then source setup_cadence.sh again.
RC crashes at start-up too (not only with -version). Try, one at a time: LANG=C rc -nogui (old tools dislike UTF-8 locales), then env -u DISPLAY rc -nogui, then start it from a fresh terminal opened from the desktop. Write down which one works and prefix every later rc command the same way.
"License checkout failed". Check ls -l $CDS_LIC_FILE — it must list /home/buet/cadence/IC615/ic6151license.dat. If a tool still refuses, add export LM_LICENSE_FILE=$CDS_LIC_FILE to setup_cadence.sh and source it again.
"export: command not found". You are in csh/tcsh. Type bash first.
CheckpointEvery which line prints the path shown above; Incisive reports 10.20-s100, Encounter 13.10-p003_1 and the RC banner v12.10-s012_1; ls lists gsclib045.lef timing and capTable mapFile qrc.conf qrcTechFile.
0.2
Create one clean project tree and map your library files
Why this stepEvery later script reads library paths and cell names from one file, so a wrong path is fixed once instead of in six places.
Keeping generated files away from RTL prevents accidental edits and makes every Tcl path predictable. Each folder has exactly one job:
FOLDER
WHAT GOES IN IT
rtl/
Your synthesizable Verilog (the design).
tb/
Testbenches. Never synthesized.
constraints/
SDC timing constraints and the clock-tree specification.
scripts/
Tcl for RC and Encounter, plus lib_paths.tcl (one place for every library path).
The screenshot shows the course's project directory with its inputs. Yours will hold the same kinds of files once Chapter 1 is done; you write the RTL and testbench yourself in Steps 1.0 and 1.1 instead of copying them. You will also add a libs/ folder in Step 0.5 for the two generated library views.
AFind the real library files on your VM
Every later stage needs the same process data in different formats. Run these searches once. The comments say what each one finds on your VM — an empty answer is itself information.
Library discovery · shellcd /home/buet/cds_work/asic_lab
source setup_cadence.sh
find $PDK45 -name "*.lib" # Liberty timing/power: slow, fast, typical
find $PDK45 -name "*.lef" # technology + cell abstracts: gsclib045.lef
find $PDK45_TECH -iname "*cap*" -o -iname "*qrc*" # cap table + QRC files (in the TECH folder)
find $PDK45 $PDK45_TECH -name "*.gds*" -o -name "*.map" # cell GDS / stream map: none in this kit
find $PDK45 -name "*.v" # cell Verilog models: none in this kit
ls -l $PDK45/timing $PDK45_TECH
ANNOTATED OUTPUTExpected output on your VMpaths shortened with …; sizes copied from your environment report
Expected output on your VM.../GPDK045/timing/fast.lib
.../GPDK045/timing/slow.lib
.../GPDK045/timing/typical.lib [1]
.../GPDK045/gsclib045.lef [2]
.../GPDK/TECH/capTable
.../GPDK/TECH/qrc.conf
.../GPDK/TECH/qrcTechFile [3]
[4]
[5]
-rwxr-xr-x. 1 buet buet 9902384 Feb 21 2013 fast.lib
-rwxr-xr-x. 1 buet buet 9808361 Feb 21 2013 slow.lib
-rwxr-xr-x. 1 buet buet 9874071 Feb 21 2013 typical.lib
-rwxr-xr-x. 1 buet buet 727767 Feb 21 2013 capTable
-rwxr-xr-x. 1 buet buet 549 Feb 21 2013 mapFile
-rwxr-xr-x. 1 buet buet 133 Feb 21 2013 qrc.conf
-rwxr-xr-x. 1 buet buet 201249287 Feb 21 2013 qrcTechFile [6]
Three corners. slow.lib is library gpdk045bc (1.08 V, 125 °C) and is used for setup; fast.lib is gpdk045wc (1.32 V, 0 °C) and is used for hold.
One LEF file of ~45 900 lines: its first part is the technology (layers, vias, CoreSite), the rest are 487 cell macros. There is no separate tech LEF to order first.
The cap table is called capTable, so a *captbl* search misses it. mapFile is printed by the next command; it is the LEF-to-QRC layer map that belongs to qrcTechFile.
No GDS and no stream map anywhere in the kit — the final GDS (Step 7.5) is written with LEF cell abstracts and a map file you create.
No cell Verilog models — Step 0.5 generates them from slow.lib.
Sizes from your VM. The 201 MB QRC file is optional in this lab (Step 4.3).
Now extract the cell names you will need later (tie cells, fillers, clock buffers, scan flops) and the routing layers from the LEF. The paths are already the right ones for your VM.
What you should see (verified against your report)
477 logs/cell_names.txt and 487 logs/lef_macros.txt.
The physical-only list (in the LEF but not the .lib) contains ANTENNA and FILL1 FILL16 FILL2 FILL32 FILL4 FILL64 FILL8. Fillers therefore come from the LEF — that is normal: they have no logic, so they have no timing.
Tie cells TIEHI/TIELO (the course’s 65 nm library called them TIEH/TIEL); clock cells CLKBUFX2 X3 X4 X6 X8 X12 X16 X20 and CLKINVX1 … X20; resettable flops DFFRX1, DFFRHQX1 …; scan flops SDFFRX1, SDFFRHQX1 ….
Nine routing layers, alternating: Metal1 HORIZONTAL, Metal2 VERTICAL … Metal8 VERTICAL, Metal9 HORIZONTAL. There is no Metal10/Metal11 in this LEF — so the power grid uses Metal9 (horizontal) and Metal8 (vertical).
DATABASE MICRONS 2000 and SITE CoreSite … SIZE 0.2 BY 1.71.
BWrite every path into one Tcl file
Every RC and Encounter script on this page starts with source scripts/lib_paths.tcl. If a path is wrong you fix it here once, not in six scripts. The file below already contains the real values for your VM; two of its entries point to files that Step 0.5 creates (libs/…).
Open the file in an editor · shellgedit scripts/lib_paths.tcl &
scripts/lib_paths.tcl · Tcl# ---------- One source of truth for library data (values verified on this VM) ----------
# Project root = the folder that contains scripts/ (works in RC and in Encounter)
set ROOT [file normalize [file join [file dirname [info script]] ..]]
set PDK45 /home/buet/cadence/EDI/share/FoundationFlows/EXAMPLES/EDI/DESIGN/GPDK/LIBS/GPDK045
set TECH45 /home/buet/cadence/EDI/share/FoundationFlows/EXAMPLES/EDI/DESIGN/GPDK/TECH
set GPDK090 /home/buet/cadence/gpdk090_v4.6
# Liberty (.lib): cell timing + power. 477 cells each.
set LIB_SLOW $PDK45/timing/slow.lib ;# library gpdk045bc : 1.08 V, 125 C (setup corner)
set LIB_TYP $PDK45/timing/typical.lib
set LIB_FAST $PDK45/timing/fast.lib ;# library gpdk045wc : 1.32 V, 0 C (hold corner)
# Generated in Step 0.5 by scripts/gpdk045_libtool.py (the kit does not ship these)
set LIB_SLOW_SCAN $ROOT/libs/slow_scan.lib ;# slow.lib + test_cell groups (for RC DFT)
set CELL_VLOG $ROOT/libs/gsclib045_cells.v ;# cell Verilog models (gate-level simulation)
# LEF: ONE file holds the technology section (layers, vias, CoreSite) AND all 487 cell macros
set LEF_FILES [list $PDK45/gsclib045.lef]
# Parasitic extraction data from the same example kit
set CAPTBL $TECH45/capTable ;# used by every Encounter extraction in this lab
set QRC_TECH "" ;# optional: $TECH45/qrcTechFile (see Step 4.3)
set QRC_LAYERMAP $TECH45/mapFile ;# LEF-layer -> QRC-layer map that goes with it
# GDS: the kit has NO cell GDS and NO 45 nm stream map. Step 7.5 writes the routed
# design with LEF cell abstracts, using our own map file (gpdk090 layer numbers).
set GDS_CELLS ""
set STREAM_MAP $ROOT/scripts/gds_view.map
set DB_UNITS 2000 ;# LEF: DATABASE MICRONS 2000
# Power-grid layers: the two TOP routing layers of gsclib045.lef (Metal1..Metal9)
set H_LAYER Metal9 ;# HORIZONTAL, pitch 0.33
set V_LAYER Metal8 ;# VERTICAL, pitch 0.20
# Cell names (all checked against gsclib045.lef / slow.lib on this VM)
set TIE_CELLS {TIEHI TIELO}
set FILLERS {FILL64 FILL32 FILL16 FILL8 FILL4 FILL2 FILL1}
set CTS_BUFS {CLKBUFX2 CLKBUFX3 CLKBUFX4 CLKBUFX6 CLKBUFX8 CLKBUFX12 CLKINVX1 CLKINVX2 CLKINVX4 CLKINVX8}
# Supply of the slow (setup) corner, used for power and rail analysis
set VDD_VOLTS 1.08
foreach f [list $LIB_SLOW $LIB_FAST [lindex $LEF_FILES 0] $CAPTBL] {
if {![file exists $f]} { puts "**ERROR (lib_paths.tcl): file not found: $f" }
}
puts "lib_paths.tcl loaded: ROOT=$ROOT LIB_SLOW=$LIB_SLOW"
Check it · shellwc -l scripts/lib_paths.tcl # must print 47
grep -E "^set (H_LAYER|V_LAYER|CAPTBL)" scripts/lib_paths.tcl
Why the library decision comes first
Liberty defines legal cells, timing arcs and power tables. LEF defines the physical size and pins of those same cells. QRC/cap tables model the wires. GDS holds the real polygons. All of them must come from one process kit. Mixing technologies may let one stage run, but the handoff will fail or produce meaningless results.
CheckpointThe eight folders exist; logs/cell_names.txt has 477 names and logs/lef_macros.txt 487; scripts/lib_paths.tcl is saved with H_LAYER Metal9, V_LAYER Metal8 and CAPTBL …/TECH/capTable.
0.3
Open Bash and load Cadence (the routine for every new terminal)
Why this stepEach new terminal starts without the Cadence PATH; this routine is the difference between a working tool and “command not found”.
You will open several terminals during this lab (one per tool is convenient). Every new terminal starts with a clean environment, so repeat this short routine each time:
From the CentOS desktop choose Applications → System Tools → Terminal. This opens a shell window.
Type bash if the prompt is not already Bash (a Bash prompt usually ends in $; csh ends in % or >).
Move to the project directory and source the environment file created above.
Verify the current directory before starting any tool — tools write their logs and databases into the directory they were started from.
First terminal session · shellbash
cd /home/buet/cds_work/asic_lab
source setup_cadence.sh
pwd
ls
which irun rc encounter virtuoso assura
The final pwd should print /home/buet/cds_work/asic_lab. If your project is elsewhere, use that real path consistently in every later command.
About the college Cadence command. The VT course uses a site-specific wrapper named Cadence (typing it changes the prompt to [Cadence]). Your VM does not need it: your PATH already contains the Cadence directories from your login files, and setup_cadence.sh adds them again in the right order plus PDK45, PDK45_TECH and GPDK090. Always use source setup_cadence.sh.
What you should see
The prompt ends in $ (Bash).
pwd prints /home/buet/cds_work/asic_lab.
which prints one path per tool and no no … in (…) lines.
Checkpointpwd is the project root and which prints a path for every tool.
0.4
Know which program to launch
Why this stepKnowing which program owns which stage stops you from, e.g., trying to place and route in Virtuoso.
Run GUI programs with & so the terminal remains available. The shell prints a job number such as [1] 12345; that is normal and simply means the program is running in the background. Batch (non-GUI) runs are started without& so you can watch them finish.
Tool launch cheat sheet · shell# RTL simulation and waveform debug
irun -gui rtl/cnt_updown.v tb/tb_cnt_updown.v &
simvision &
# Logic synthesis (GUI) — NO "&": RC needs the terminal for its rc:/> prompt
rc -gui
# Floorplan, placement, clock tree and routing (no "&" - its prompt is in the terminal)
encounter
# Custom-layout / GDS viewing (run it from the virtuoso/ folder - Step 7.6)
virtuoso &
# Library helper used once in Step 0.5 (CentOS 6 system python 2.6)
python scripts/gpdk045_libtool.py
WHEN YOU WANT TO…
USE
CHAPTER
Check that the RTL behaves correctly
irun + SimVision
1
Turn RTL into standard cells under timing constraints
rc
2, 3, 6
Build the layout (floorplan → route)
encounter
4, 5, 7
Look at the final GDS
virtuoso (gpdk090 technology, viewing only)
7
Generate cell models and the scan .lib
python scripts/gpdk045_libtool.py
0
Virtuoso is not the place-and-route tool here
Use Encounter for the digital ASIC implementation. Virtuoso is used once, at the very end, to look at the streamed GDS. Because the GPDK045 kit has no Virtuoso technology library and no rule decks, Assura DRC/LVS cannot sign off this 45 nm layout on your VM (Step 7.6 explains why and what replaces it).
0.5
Generate the two library views the kit does not ship
Why this stepGate-level simulation needs a Verilog model of every cell and scan insertion needs test_cell data in the .lib; the GPDK045 example kit has neither, so you build both from slow.lib once.
Step 0.2 showed two holes in the kit, and both block a full flow:
MISSING VIEW
WHO NEEDS IT
WHAT THE SCRIPT BUILDS
Cell Verilog models (*.v)
Every gate-level simulation: Steps 2.4, 6.4, 6.5, 7.2
libs/gsclib045_cells.v — one module per cell, written from each cell’s Liberty function, ff, latch and three_state attributes, plus specify paths for every delay arc so the SDF from Encounter can annotate real delays.
test_cell groups in the .lib
RTL Compiler scan insertion (Step 6.3) — without them RC cannot tell that SDFFRHQX1 is the scan version of DFFRHQX1; the report counted 0test_cell groups
libs/slow_scan.lib — an exact copy of slow.lib (same timing, same library name) with a test_cell group added to every muxed-scan flop.
The script reads the Liberty file with a small brace-aware parser, so it copes with the kit’s quirks (for example the line default_max_transition : 0.8136 has no semicolon). It runs with the system Python of CentOS 6 (2.6.6) and was tested against a Liberty file written in the same style as gsclib045.
ACreate the script
Check python and open the editor · shellcd /home/buet/cds_work/asic_lab
source setup_cadence.sh
python -V # Python 2.6.6
mkdir -p libs
gedit scripts/gpdk045_libtool.py &
Paste the whole script below into gedit (or use its Download button), save with Ctrl+S, close gedit.
Open the full script (scripts/gpdk045_libtool.py, 838 lines)
scripts/gpdk045_libtool.py · Python#!/usr/bin/env python
# -*- coding: ascii -*-
# =====================================================================
# gpdk045_libtool.py - builds the two library views that the GPDK045
# example kit on this VM does not ship:
#
# verilog : Liberty (.lib) -> behavioural Verilog cell models
# (functions, flip-flops, latches, tri-states, plus
# specify paths so an SDF file can annotate delays)
# scan : Liberty (.lib) -> copy of the .lib with a test_cell
# group added to every muxed-scan flop (SDFF...), so
# RTL Compiler can map flops to scan flops.
#
# Usage (from the project root):
# python scripts/gpdk045_libtool.py verilog <in.lib> <out.v> [cells.lef]
# python scripts/gpdk045_libtool.py scan <in.lib> <out.lib>
#
# Works with Python 2.6 (CentOS 6 system python) and Python 3.
# =====================================================================
import sys
import re
# ---------------------------------------------------------------------
# Small file helpers (latin-1 so any byte in the .lib survives)
# ---------------------------------------------------------------------
def read_text(path):
data = open(path, 'rb').read()
if sys.version_info[0] >= 3:
data = data.decode('latin-1')
return data
def write_text(path, text):
if sys.version_info[0] >= 3:
text = text.encode('latin-1')
f = open(path, 'wb')
f.write(text)
f.close()
# ---------------------------------------------------------------------
# Liberty scanner
# parse_block() returns the statements found at depth 0 of a block:
# ('attr', name, value)
# ('group', name, args, body_start, body_end, header_start)
# ---------------------------------------------------------------------
TOK = re.compile(r'/\*|"|\{|\}|;|\n')
BRACE = re.compile(r'/\*|"|\{|\}')
COMMENT = re.compile(r'/\*.*?\*/', re.S)
HEADER = re.compile(r'^\s*([A-Za-z_][A-Za-z0-9_]*)\s*\((.*)\)\s*$', re.S)
def skip_comment(text, p):
q = text.find('*/', p + 2)
if q < 0:
return len(text)
return q + 2
def skip_string(text, p):
q = text.find('"', p + 1)
if q < 0:
return len(text)
return q + 1
def match_brace(text, p):
"""text[p] == '{' -> index of the matching '}'."""
depth = 0
pos = p
n = len(text)
while pos < n:
m = BRACE.search(text, pos)
if m is None:
break
tok = m.group()
q = m.start()
if tok == '/*':
pos = skip_comment(text, q)
elif tok == '"':
pos = skip_string(text, q)
elif tok == '{':
depth += 1
pos = q + 1
else:
depth -= 1
pos = q + 1
if depth == 0:
return q
raise ValueError('unbalanced braces starting at offset %d' % p)
def top_level_colon(s):
"""Index of the first ':' that is outside quotes and parentheses."""
depth = 0
inq = False
i = 0
for ch in s:
if ch == '"':
inq = not inq
elif not inq:
if ch == '(':
depth += 1
elif ch == ')':
depth -= 1
elif ch == ':' and depth == 0:
return i
i += 1
return -1
def clean_value(v):
v = v.strip()
if v.endswith(';'):
v = v[:-1].strip()
if len(v) >= 2 and v[0] == '"' and v[-1] == '"':
v = v[1:-1]
return v.strip()
def simple_attr_complete(s):
"""True when a line holds a whole 'name : value' with no ';' (sloppy libs)."""
s = COMMENT.sub(' ', s).strip()
if not s or s.endswith('\\'):
return False
if s.count('(') != s.count(')') or s.count('"') % 2:
return False
c = top_level_colon(s)
return c > 0 and s[c + 1:].strip() != ''
def parse_block(text, start, end):
items = []
pos = start
stmt = start
while pos < end:
m = TOK.search(text, pos, end)
if m is None:
break
tok = m.group()
p = m.start()
if tok == '/*':
pos = skip_comment(text, p)
continue
if tok == '"':
pos = skip_string(text, p)
continue
if tok == '{':
header = COMMENT.sub(' ', text[stmt:p])
close = match_brace(text, p)
hm = HEADER.match(header)
if hm:
args = hm.group(2).replace('"', '').strip()
items.append(('group', hm.group(1), args, p + 1, close, stmt))
pos = close + 1
stmt = pos
continue
if tok == '}':
pos = p + 1
stmt = pos
continue
if tok == ';':
add_statement(items, text[stmt:p])
pos = p + 1
stmt = pos
continue
# newline
if simple_attr_complete(text[stmt:p]):
add_statement(items, text[stmt:p])
stmt = p + 1
pos = p + 1
return items
def add_statement(items, s):
s = COMMENT.sub(' ', s).strip()
if not s:
return
c = top_level_colon(s)
if c > 0:
items.append(('attr', s[:c].strip(), clean_value(s[c + 1:])))
else:
hm = HEADER.match(s)
if hm:
items.append(('cattr', hm.group(1), hm.group(2).strip()))
def attrs_of(items):
d = {}
for it in items:
if it[0] == 'attr' and it[1] not in d:
d[it[1]] = it[2]
return d
def groups_of(items, name):
return [it for it in items if it[0] == 'group' and it[1] == name]
# ---------------------------------------------------------------------
# Liberty boolean expression -> Verilog expression
# precedence: ! and ' (highest), ^, & * space, + | (lowest)
# ---------------------------------------------------------------------
EXPR_TOK = re.compile(r"\s*([A-Za-z_][A-Za-z0-9_\[\]\.]*|[01]|[!'\^\*&\+\|\(\)])")
class ExprError(Exception):
pass
def tokenize_expr(s):
toks = []
pos = 0
s = s.strip()
while pos < len(s):
m = EXPR_TOK.match(s, pos)
if m is None:
if s[pos:].strip() == '':
break
raise ExprError('cannot parse "%s" near "%s"' % (s, s[pos:]))
toks.append(m.group(1))
pos = m.end()
return toks
class ExprParser(object):
def __init__(self, s, rename):
self.toks = tokenize_expr(s)
self.i = 0
self.rename = rename
self.names = []
def peek(self):
if self.i < len(self.toks):
return self.toks[self.i]
return None
def take(self):
t = self.peek()
self.i += 1
return t
def parse(self):
if not self.toks:
raise ExprError('empty expression')
e = self.or_expr()
if self.peek() is not None:
raise ExprError('unexpected "%s"' % self.peek())
return e
def or_expr(self):
e = self.and_expr()
while self.peek() in ('+', '|'):
self.take()
e = '(%s | %s)' % (e, self.and_expr())
return e
def starts_operand(self, t):
return t is not None and (t == '(' or t == '!' or re.match(r'[A-Za-z_01]', t) is not None)
def and_expr(self):
e = self.xor_expr()
while True:
t = self.peek()
if t in ('*', '&'):
self.take()
e = '(%s & %s)' % (e, self.xor_expr())
elif self.starts_operand(t): # implicit AND (space)
e = '(%s & %s)' % (e, self.xor_expr())
else:
return e
def xor_expr(self):
e = self.unary()
while self.peek() == '^':
self.take()
e = '(%s ^ %s)' % (e, self.unary())
return e
def unary(self):
if self.peek() == '!':
self.take()
return '(~%s)' % self.unary()
e = self.primary()
while self.peek() == "'":
self.take()
e = '(~%s)' % e
return e
def primary(self):
t = self.take()
if t is None:
raise ExprError('expression ends too early')
if t == '(':
e = self.or_expr()
if self.take() != ')':
raise ExprError('missing )')
return e
if t == '0':
return "1'b0"
if t == '1':
return "1'b1"
if re.match(r'[A-Za-z_]', t):
name = self.rename.get(t, t)
if name not in self.names:
self.names.append(name)
return vname(name)
raise ExprError('unexpected "%s"' % t)
def lib2v(expr, rename=None):
return ExprParser(expr, rename or {}).parse()
VERILOG_KEYWORDS = set(('always and assign begin buf bufif0 bufif1 case casex casez cmos deassign '
'default defparam disable edge else end endcase endfunction endmodule '
'endprimitive endspecify endtable endtask event for force forever fork '
'function highz0 highz1 if ifnone initial inout input integer join large '
'macromodule medium module nand negedge nmos nor not notif0 notif1 or '
'output parameter pmos posedge primitive pull0 pull1 pulldown pullup '
'rcmos real realtime reg release repeat rnmos rpmos rtran rtranif0 '
'rtranif1 scalared small specify specparam strong0 strong1 supply0 '
'supply1 table task time tran tranif0 tranif1 tri tri0 tri1 triand '
'trior trireg vectored wait wand weak0 weak1 while wire wor xnor xor').split())
def vname(n):
if n in VERILOG_KEYWORDS or not re.match(r'^[A-Za-z_][A-Za-z0-9_]*$', n):
return '\\' + n + ' '
return n
def edge_of(expr):
"""'CK' -> ('posedge','CK'); '!CKN' / "CKN'" -> ('negedge','CKN'); else None."""
s = expr.replace(' ', '')
while s.startswith('(') and s.endswith(')'):
s = s[1:-1]
m = re.match(r'^([A-Za-z_][A-Za-z0-9_]*)$', s)
if m:
return ('posedge', m.group(1))
m = re.match(r"^!\(?([A-Za-z_][A-Za-z0-9_]*)\)?$", s) or re.match(r"^\(?([A-Za-z_][A-Za-z0-9_]*)\)?'$", s)
if m:
return ('negedge', m.group(1))
return None
# ---------------------------------------------------------------------
# Library model
# ---------------------------------------------------------------------
class Pin(object):
def __init__(self, name, attrs, timings):
self.name = name
self.attrs = attrs
self.direction = attrs.get('direction', 'input')
self.function = attrs.get('function')
self.three_state = attrs.get('three_state')
self.timings = timings # list of attr dicts
class Cell(object):
def __init__(self, name, start, end):
self.name = name
self.start = start # body start
self.end = end # index of closing brace
self.pins = []
self.ff = None # (vars, attrs)
self.latch = None
self.statetable = False
self.has_test_cell = False
def pin(self, name):
for p in self.pins:
if p.name == name:
return p
return None
def load_library(path):
text = read_text(path)
top = parse_block(text, 0, len(text))
libs = groups_of(top, 'library')
if not libs:
raise SystemExit('ERROR: no library() group found in %s' % path)
lib = libs[0]
libname = lib[2]
lib_items = parse_block(text, lib[3], lib[4])
cells = []
for g in groups_of(lib_items, 'cell'):
cell = Cell(g[2], g[3], g[4])
citems = parse_block(text, g[3], g[4])
for it in citems:
if it[0] != 'group':
continue
gname = it[1]
if gname == 'pin':
pitems = parse_block(text, it[3], it[4])
timings = []
for t in groups_of(pitems, 'timing'):
timings.append(attrs_of(parse_block(text, t[3], t[4])))
for pname in [x.strip() for x in it[2].split(',') if x.strip()]:
cell.pins.append(Pin(pname, attrs_of(pitems), timings))
elif gname in ('ff', 'latch'):
vars_ = [x.strip() for x in it[2].split(',') if x.strip()]
gattrs = attrs_of(parse_block(text, it[3], it[4]))
if gname == 'ff':
cell.ff = (vars_, gattrs)
else:
cell.latch = (vars_, gattrs)
elif gname == 'statetable':
cell.statetable = True
elif gname == 'test_cell':
cell.has_test_cell = True
cells.append(cell)
return text, libname, cells
# ---------------------------------------------------------------------
# verilog mode
# ---------------------------------------------------------------------
CPV = {'L': "1'b0", 'H': "1'b1", 'X': "1'bx"}
def cpv_value(v, var):
v = (v or 'X').strip().upper()
if v == 'N':
return vname(var)
if v == 'T':
return '~' + vname(var)
return CPV.get(v, "1'bx")
def seq_assign(vars_, value_q, value_qn, blocking):
op = '=' if blocking else '<='
parts = ['%s %s %s;' % (vname(vars_[0]), op, value_q)]
if len(vars_) > 1:
parts.append('%s %s %s;' % (vname(vars_[1]), op, value_qn))
return 'begin ' + ' '.join(parts) + ' end'
def event_for(expr, label, lines, active_high_edge):
"""Return a sensitivity item for a clock/clear/preset expression."""
e = edge_of(expr)
if e is not None:
if not active_high_edge:
# for clear/preset the edge that ASSERTS the signal
return '%s %s' % (e[0], vname(e[1]))
return '%s %s' % (e[0], vname(e[1]))
wname = 'cdn_' + label
lines.append(' wire %s = %s;' % (wname, lib2v(expr)))
return 'posedge ' + wname
def ff_block(cell, lines, warns):
vars_, a = cell.ff
ns = a.get('next_state')
clk = a.get('clocked_on')
if ns is None or clk is None:
warns.append('%s: ff without next_state/clocked_on - modelled as X' % cell.name)
return False
lines.append(' reg %s;' % ', '.join([vname(v) for v in vars_]))
sens = [event_for(clk, 'clk', lines, True)]
clr = a.get('clear')
pre = a.get('preset')
if clr:
sens.append(event_for(clr, 'clr', lines, False))
if pre:
sens.append(event_for(pre, 'pre', lines, False))
nsv = lib2v(ns)
lines.append(' always @(%s) begin' % ' or '.join(sens))
first = True
if clr and pre:
lines.append(' if (%s && %s) %s' % (lib2v(clr), lib2v(pre), seq_assign(
vars_, cpv_value(a.get('clear_preset_var1'), vars_[0]),
cpv_value(a.get('clear_preset_var2'), vars_[-1]), False)))
first = False
if clr:
lines.append(' %sif (%s) %s' % ('' if first else 'else ', lib2v(clr),
seq_assign(vars_, "1'b0", "1'b1", False)))
first = False
if pre:
lines.append(' %sif (%s) %s' % ('' if first else 'else ', lib2v(pre),
seq_assign(vars_, "1'b1", "1'b0", False)))
first = False
body = seq_assign(vars_, nsv, '~' + nsv, False)
if first:
lines.append(' ' + body)
else:
lines.append(' else ' + body)
lines.append(' end')
return True
def latch_block(cell, lines, warns):
vars_, a = cell.latch
en = a.get('enable')
d = a.get('data_in')
if en is None or d is None:
warns.append('%s: latch without enable/data_in - modelled as X' % cell.name)
return False
lines.append(' reg %s;' % ', '.join([vname(v) for v in vars_]))
clr = a.get('clear')
pre = a.get('preset')
dv = lib2v(d)
lines.append(' always @(*) begin')
first = True
if clr and pre:
lines.append(' if (%s && %s) %s' % (lib2v(clr), lib2v(pre), seq_assign(
vars_, cpv_value(a.get('clear_preset_var1'), vars_[0]),
cpv_value(a.get('clear_preset_var2'), vars_[-1]), True)))
first = False
if clr:
lines.append(' %sif (%s) %s' % ('' if first else 'else ', lib2v(clr),
seq_assign(vars_, "1'b0", "1'b1", True)))
first = False
if pre:
lines.append(' %sif (%s) %s' % ('' if first else 'else ', lib2v(pre),
seq_assign(vars_, "1'b1", "1'b0", True)))
first = False
lines.append(' %sif (%s) %s' % ('' if first else 'else ', lib2v(en),
seq_assign(vars_, dv, '~' + dv, True)))
lines.append(' end')
return True
SKIP_TIMING = re.compile(r'^(setup|hold|recovery|removal|skew|non_seq|nochange|min_pulse|minimum_period|max_clock)')
def specify_lines(cell, inputs, outputs):
paths = []
seen = set()
def add(line):
if line not in seen:
seen.add(line)
paths.append(line)
for p in cell.pins:
if p.name not in outputs:
continue
uncond = set()
conds = {}
for t in p.timings:
ttype = t.get('timing_type', 'combinational')
if SKIP_TIMING.match(ttype):
continue
sense = t.get('timing_sense', '')
cond = t.get('sdf_cond')
if not cond and t.get('when'):
try:
cond = lib2v(t.get('when'))
except ExprError:
cond = None
for src in t.get('related_pin', '').replace('"', '').split():
if src not in inputs:
continue
edge = None
if ttype == 'rising_edge':
edge = 'posedge'
elif ttype == 'falling_edge':
edge = 'negedge'
elif ttype == 'clear':
edge = {'positive_unate': 'negedge', 'negative_unate': 'posedge'}.get(sense)
elif ttype == 'preset':
edge = {'positive_unate': 'posedge', 'negative_unate': 'negedge'}.get(sense)
key = (edge, src)
if edge:
core = '(%s %s => (%s : %s))' % (edge, vname(src), vname(p.name), vname(src))
add(' %s = (0, 0);' % core) # always keep an unconditional edge path
if cond:
add(' if (%s) %s = (0, 0);' % (cond, core))
else:
core = '(%s => %s)' % (vname(src), vname(p.name))
if cond:
conds.setdefault(key, []).append(cond)
else:
uncond.add(key)
for key in conds:
core = '(%s => %s)' % (vname(key[1]), vname(p.name))
for c in conds[key]:
add(' if (%s) %s = (0, 0);' % (c, core))
if key not in uncond:
add(' ifnone %s = (0, 0);' % core)
for key in uncond:
add(' (%s => %s) = (0, 0);' % (vname(key[1]), vname(p.name)))
return paths
def cell_module(cell, warns, with_specify):
ports = [p for p in cell.pins if p.direction in ('input', 'output', 'inout')]
inputs = [p.name for p in ports if p.direction in ('input', 'inout')]
outputs = [p.name for p in ports if p.direction in ('output', 'inout')]
lines = []
lines.append('`celldefine')
lines.append('module %s (%s);' % (cell.name, ', '.join([vname(p.name) for p in ports])))
for p in ports:
lines.append(' %s %s;' % (p.direction, vname(p.name)))
seq_ok = True
seq_vars = []
if cell.ff is not None:
seq_vars = cell.ff[0]
elif cell.latch is not None:
seq_vars = cell.latch[0]
if cell.ff is not None:
seq_ok = ff_block(cell, lines, warns)
elif cell.latch is not None:
seq_ok = latch_block(cell, lines, warns)
elif cell.statetable:
seq_ok = False
warns.append('%s: statetable cell - outputs modelled as X' % cell.name)
for p in ports:
if p.direction == 'input':
continue
if p.function is None:
if p.direction == 'output':
lines.append(" assign %s = 1'bx; // no function in .lib" % vname(p.name))
warns.append('%s: output %s has no function - modelled as X' % (cell.name, p.name))
continue
try:
f = lib2v(p.function)
known = set([q.name for q in ports] + seq_vars)
used = [x for x in re.findall(r'[A-Za-z_][A-Za-z0-9_]*', p.function)]
if (not seq_ok and [x for x in used if x in seq_vars]) or [x for x in used if x not in known]:
f = "1'bx"
warns.append('%s: output %s depends on unmodelled state - modelled as X' % (cell.name, p.name))
if p.three_state:
lines.append(" assign %s = %s ? 1'bz : %s;" % (vname(p.name), lib2v(p.three_state), f))
else:
lines.append(' assign %s = %s;' % (vname(p.name), f))
except ExprError:
lines.append(" assign %s = 1'bx; // unparsed: %s" % (vname(p.name), p.function))
warns.append('%s: could not parse function of %s' % (cell.name, p.name))
if with_specify:
sp = specify_lines(cell, inputs, outputs)
if sp:
lines.append(' specify')
lines.extend(sp)
lines.append(' endspecify')
lines.append('endmodule')
lines.append('`endcelldefine')
return '\n'.join(lines) + '\n'
def lef_macros(path):
"""{macro: [(pin, direction), ...]} for signal pins of every LEF MACRO."""
macros = {}
cur = None
pin = None
pdir = 'INPUT'
puse = 'SIGNAL'
for raw in read_text(path).splitlines():
w = raw.split()
if not w:
continue
if w[0] == 'MACRO' and len(w) > 1:
cur = w[1]
macros[cur] = []
elif cur and w[0] == 'PIN' and len(w) > 1:
pin = w[1]
pdir = 'INPUT'
puse = 'SIGNAL'
elif cur and pin and w[0] == 'DIRECTION' and len(w) > 1:
pdir = w[1]
elif cur and pin and w[0] == 'USE' and len(w) > 1:
puse = w[1]
elif cur and w[0] == 'END' and len(w) > 1:
if pin and w[1] == pin:
if puse.rstrip(';') not in ('POWER', 'GROUND'):
macros[cur].append((pin, pdir.rstrip(';').lower()))
pin = None
elif w[1] == cur:
cur = None
return macros
def do_verilog(lib_path, out_path, lef_path=None):
text, libname, cells = load_library(lib_path)
warns = []
out = []
out.append('// ' + '=' * 70)
out.append('// Behavioural Verilog models generated from %s' % lib_path)
out.append('// Library: %s cells: %d' % (libname, len(cells)))
out.append('// Generated by scripts/gpdk045_libtool.py - functional models with')
out.append('// zero-delay specify paths (annotated by SDF); no timing checks.')
out.append('// ' + '=' * 70)
out.append('`timescale 1ns/1ps')
out.append('')
names = set()
for c in cells:
out.append(cell_module(c, warns, True))
names.add(c.name)
extra = 0
if lef_path:
for m, pins in sorted(lef_macros(lef_path).items()):
if m in names:
continue
out.append('`celldefine')
if pins:
out.append('module %s (%s); // physical-only LEF macro' % (m, ', '.join([vname(p[0]) for p in pins])))
else:
out.append('module %s; // physical-only LEF macro (no signal pins)' % m)
for pn, pd in pins:
d = pd if pd in ('output', 'inout') else 'input'
out.append(' %s %s;' % (d, vname(pn)))
out.append('endmodule')
out.append('`endcelldefine')
out.append('')
extra += 1
write_text(out_path, '\n'.join(out) + '\n')
nseq = len([c for c in cells if c.ff is not None])
nlat = len([c for c in cells if c.latch is not None])
print('verilog: library %s, %d cells read from %s' % (libname, len(cells), lib_path))
print('verilog: %d flip-flop cells, %d latch cells, %d combinational cells'
% (nseq, nlat, len(cells) - nseq - nlat))
if lef_path:
print('verilog: %d physical-only LEF macros added as empty modules' % extra)
print('verilog: %d warnings' % len(warns))
for w in warns[:40]:
print(' WARNING: ' + w)
print('verilog: wrote %s' % out_path)
# ---------------------------------------------------------------------
# scan mode
# ---------------------------------------------------------------------
QUOTED = ('next_state', 'clocked_on', 'clocked_on_also', 'clear', 'preset')
SCAN_NAME = re.compile(r'^SDFF')
SCAN_SKIP = re.compile(r'^SDFFTR') # synchronous-reset scan flops: next_state is not just D
def test_cell_text(cell):
vars_, a = cell.ff
out = []
out.append(' test_cell () {')
for p in cell.pins:
if p.direction != 'input':
continue
extra = ''
if p.name == 'SI':
extra = ' signal_type : test_scan_in ;'
elif p.name == 'SE':
extra = ' signal_type : test_scan_enable ;'
out.append(' pin (%s) { direction : input ;%s }' % (p.name, extra))
ffa = []
ffa.append('next_state : "D" ;')
for k in ('clocked_on', 'clocked_on_also', 'clear', 'preset', 'clear_preset_var1', 'clear_preset_var2'):
if k in a:
if k in QUOTED:
ffa.append('%s : "%s" ;' % (k, a[k]))
else:
ffa.append('%s : %s ;' % (k, a[k]))
out.append(' ff (%s) { %s }' % (','.join(vars_), ' '.join(ffa)))
for p in cell.pins:
if p.direction != 'output':
continue
f = (p.function or '').replace(' ', '').replace('(', '').replace(')', '')
if f == vars_[0]:
st = 'test_scan_out'
elif len(vars_) > 1 and f == vars_[1]:
st = 'test_scan_out_inverted'
else:
return None
out.append(' pin (%s) { direction : output ; function : "%s" ; signal_type : %s ; }'
% (p.name, f, st))
out.append(' }')
return '\n'.join(out) + '\n '
def do_scan(lib_path, out_path):
text, libname, cells = load_library(lib_path)
inserts = []
done = []
skipped = []
for c in cells:
if not SCAN_NAME.match(c.name):
continue
why = None
if SCAN_SKIP.match(c.name):
why = 'synchronous reset (next_state is not D)'
elif c.has_test_cell:
why = 'already has a test_cell'
elif c.ff is None:
why = 'no ff group'
elif c.pin('SE') is None or c.pin('SI') is None or c.pin('D') is None:
why = 'missing D/SI/SE pin'
tc = None
if why is None:
tc = test_cell_text(c)
if tc is None:
why = 'output function is not IQ/IQN'
if why:
skipped.append('%s (%s)' % (c.name, why))
continue
# insert just before the closing brace of the cell
q = c.end
while q > c.start and text[q - 1] in ' \t':
q -= 1
inserts.append((q, tc))
done.append(c.name)
pieces = []
last = 0
for pos, t in sorted(inserts):
pieces.append(text[last:pos])
pieces.append(t)
last = pos
pieces.append(text[last:])
new = ''.join(pieces)
# sanity: the new file must still parse
match_brace(new, new.index('{', new.find('library')))
write_text(out_path, new)
print('scan: library %s, %d cells read from %s' % (libname, len(cells), lib_path))
print('scan: test_cell added to %d scan flops:' % len(done))
for i in range(0, len(done), 8):
print(' ' + ' '.join(done[i:i + 8]))
print('scan: %d SDFF cells left unchanged:' % len(skipped))
for s in skipped:
print(' ' + s)
print('scan: wrote %s' % out_path)
# ---------------------------------------------------------------------
def main(argv):
if len(argv) >= 4 and argv[1] == 'verilog':
lef = None
if len(argv) >= 5:
lef = argv[4]
do_verilog(argv[2], argv[3], lef)
elif len(argv) >= 4 and argv[1] == 'scan':
do_scan(argv[2], argv[3])
else:
sys.stderr.write(__doc__ or '')
sys.stderr.write('usage:\n python gpdk045_libtool.py verilog <in.lib> <out.v> [cells.lef]\n'
' python gpdk045_libtool.py scan <in.lib> <out.lib>\n')
return 2
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))
verilog: library gpdk045bc, 477 cells read from …/slow.lib, then the number of flip-flop, latch and combinational cells, and about ten physical-only LEF macros added as empty modules (ANTENNA, FILL1 … FILL64).
A few warnings are normal (for example a cell modelled with a statetable); each one names the cell. None of them is a cell that RC uses for this counter.
grep -c "^module" prints roughly 487 (one module per .lib cell plus the physical-only macros).
The DFFRHQX1 module shows always @(posedge CK or negedge RN), a clear branch for (~RN), assign Q = IQ; and a specify block with (posedge CK => (Q : CK)) and (negedge RN => (Q : RN)).
CGenerate the scan-aware Liberty file
libs/slow_scan.lib · shellpython scripts/gpdk045_libtool.py scan $PDK45/timing/slow.lib libs/slow_scan.lib | tee logs/libtool_scan.log
grep -c "test_cell" libs/slow_scan.lib
grep -A9 "test_cell" libs/slow_scan.lib | head -10
ls -l $PDK45/timing/slow.lib libs/slow_scan.lib
What you should see
scan: test_cell added to N scan flops with N about 40, followed by their names (SDFFRHQX1 SDFFRX1 SDFFQX1 …).
The four SDFFTR… cells are listed as unchanged: their reset is synchronous (part of next_state), so their non-scan behaviour is not simply “D” — RC will not use them for this counter anyway.
The test_cell of each flop lists its pins, marks SI as test_scan_in, SE as test_scan_enable, Q as test_scan_out, and repeats the flop with next_state : "D".
Warnings about specify paths or `celldefine are harmless. -compile stops after compilation; it only proves every module parses.
Troubleshooting — the library script
SyntaxError or IndentationError — the paste lost characters. Compare wc -l with the number above; delete the file and paste again into gedit (not the terminal), or use the Download button.
ERROR: no library() group found — the first argument is not a Liberty file; check ls $PDK45/timing/slow.lib.
irun reports *E in a cell module — note the cell name from the error and send it along with the matching cell from the .lib (grep -n -A40 "cell (NAME)" $PDK45/timing/slow.lib); that cell uses a Liberty construct the script does not model yet. All cells that RC picks for this lab (DFFR*, SDFFR*, XOR/XNOR, NAND/NOR, AOI/OAI, MX2, ADDH, INV, BUF, CLKBUF, TIE*) are covered.
Do these models replace the vendor’s? No. They are functional models with zero-delay paths that SDF annotates; they carry no setup/hold checks. Timing correctness is proven by Encounter’s static timing, not by these models (Step 7.2 states this explicitly).
Why the Liberty file is enough to build simulation models
Liberty already contains each cell’s logic: function : "(!(A B))" for a NAND2, and for a flop an ff (IQ,IQN) group with next_state, clocked_on and clear. A simulation model is the same information written in Verilog. The timing arcs (related_pin, timing_type, sdf_cond) become the specify paths that SDF annotation needs.
Checkpointlibs/gsclib045_cells.v and libs/slow_scan.lib exist, the script printed ≈477 cells and ≈40 patched scan flops, and logs/irun_cells.log has 0 *E lines.
✔ Chapter recap
Commands in order
Chapter commands, in order (condensed — every option is in the steps)bash
mkdir -p /home/buet/cds_work/asic_lab && cd /home/buet/cds_work/asic_lab
# create setup_cadence.sh (Step 0.1), then:
source setup_cadence.sh
mkdir -p rtl tb constraints scripts activity logs reports results
find $PDK45 -name "*.lib"; find $PDK45 -name "*.lef"; ls $PDK45_TECH # Step 0.2 discovery
gedit scripts/lib_paths.tcl scripts/gpdk045_libtool.py &
mkdir -p libs
python scripts/gpdk045_libtool.py verilog $PDK45/timing/slow.lib libs/gsclib045_cells.v $PDK45/gsclib045.lef
python scripts/gpdk045_libtool.py scan $PDK45/timing/slow.lib libs/slow_scan.lib
What you should now have
FILE
WHAT IT IS
setup_cadence.sh
Environment for every terminal
scripts/lib_paths.tcl
All library paths, layers and cell names
logs/cell_names.txt · logs/lef_macros.txt
The 477 .lib cells · the 487 LEF macros
libs/gsclib045_cells.v
Generated cell simulation models
libs/slow_scan.lib
slow.lib + test_cell groups for scan insertion
⚠ Common mistakes in this chapter
Running ./setup_cadence.sh instead of source setup_cadence.sh — the variables vanish with the child shell.
Using csh/tcsh syntax errors as a sign the tools are broken — type bash first.
Copying the course’s 65 nm cell names (TIEH, AP, M6) instead of the GPDK045 names (TIEHI, Metal9, Metal8).
Using Metal10 for the power grid — this LEF stops at Metal9.
Searching for *captbl* and concluding there is no cap table — it is $PDK45_TECH/capTable.
Pasting the 800-line Python script into the terminal instead of gedit.
Mixing a 90 nm Assura deck with 45 nm LEF/Liberty.
CHAPTER 1
Compile, simulate and understand the RTL
Goal: prove the counter’s functional behavior before gates or layout exist.
You start withThe project tree from Chapter 0
You end withrtl/cnt_updown.v, a self-checking testbench, a PASS, a waveform
Toolsirun, ncvlog/ncelab/ncsim, SimVision
Time≈ 45 min
THEORYHow a Verilog simulator thinks≈ 10 min read
T1Design vs testbench
The DUT (design under test) is the hardware: only synthesizable constructs.
The testbench is a program around it: it makes the clock, drives inputs, and judges outputs. It is never turned into hardware, so it may use delays (#5), loops and $display.
A self-checking testbench contains an independent reference model; a checker compares DUT and model every cycle and prints PASS or FAIL.
The testbench you write in Step 1.1.
T2Three phases: analyze → elaborate → simulate
ncvlog: parse each filencelab: connect the hierarchy into a snapshotncsim: run time forward
irun simply runs all three for you. Knowing the phases tells you where an error comes from: syntax errors are analysis; “undefined module” is elaboration; wrong values are simulation (a design bug).
Incisive’s three phases and where each kind of error appears. ncvlog parses the files into worklib/ (syntax errors). ncelab links modules into a snapshot (“undefined module”, port mismatches). ncsim runs it (wrong values mean design or testbench bugs). irun simply runs all three in order.
T3Event-driven simulation and why flops use <=
The simulator does not tick every picosecond. It keeps a queue of events (“signal X changes at time t”) and jumps from one to the next. Inside one time step it works in ordered regions:
Why flops are written with <=. With blocking assignments the first statement overwrites a before the second reads it, so both registers end up 0. With non-blocking assignments every right-hand side is sampled first and all updates land together, so the values truly swap, exactly like two flip-flops sharing a clock edge.
Active region — run triggered blocks; blocking = assignments update immediately; for non-blocking <= only the right-hand side is evaluated and remembered.
NBA region — all remembered <= updates happen together.
Monitor region — $monitor, waveform dumping see the final values.
That “evaluate everything first, update all together” behaviour is exactly how real flip-flops on one clock work. Compare two flops that should swap values:
Blocking vs non-blocking · Verilog// WRONG for flops: result depends on which always block runs first
always @(posedge clk) a = b;
always @(posedge clk) b = a; // may copy the NEW a -> both end equal
// RIGHT: both read old values, then both update -> a real swap
always @(posedge clk) a <= b;
always @(posedge clk) b <= a;
Rule of thumb:<= in clocked blocks, = in combinational blocks. Never mix them in one block.
T4Four-valued logic
VALUE
MEANING
TYPICAL CAUSE
0 / 1
Logic low / high
—
x
Unknown
Uninitialized flop, two drivers fighting, missing reset
z
High impedance (undriven)
Unconnected input, tri-state off
The four-valued AND table. A 0 on either input decides the result even if the other is unknown, but 1 & x stays x. A floating input (z) is read as x. Because x == 1 evaluates to x (treated as false), self-checking testbenches compare with ===.
== returns x if either side has an x — and an if(x) is treated as false, so a check silently passes. === compares x and z literally and always returns 0 or 1. That is why the checker uses !==.
T5Reading a timing diagram — and avoiding races
What Step 1.8 should look like (shortened). The counter changes only at rising clock edges; the testbench changes inputs at falling edges.
A race happens when the testbench changes an input in the same time step as the clock edge that samples it — the result depends on event order, not on your design.
Changing inputs half a period away from the active edge removes the race and mirrors reality: real inputs arrive well before the clock (that margin is exactly what set_input_delay describes in Chapter 2).
The asynchronous reset is the one exception: it acts immediately, between edges.
T6Waveform files
$dumpvars writes a VCD (Value Change Dump): a text log of every change of every recorded signal with its time. SimVision converts it to its faster SST2 format. The same idea — counting changes — is reused for power in Chapter 3, except only toggle counts are kept (TCF).
How a VCD file maps to the waveform you see. The header gives each signal a one-character code. After that, each #time line is followed by the value changes at that instant. SimVision simply draws a step at every change.
DEEP DIVE the counter as mathematics
D1A precise specification
Let be the count after the -th rising edge, the enable and the direction sampled at that edge. The RTL implements exactly
The counter’s 256 states form a ring: up moves one step clockwise, down one step anticlockwise, and enable = 0 makes every state loop to itself. The two arcs crossing the seam (255 → 0 and 0 → 255) are the rollover cases that Phase 3 of the testbench targets.
Compactly, with :
The testbench’s reference model is this equation written in Verilog. The “rollover” you check in Phase 3 is just the : .
D2The design is a finite-state machine
The counter has states and input combinations, so the full transition table has entries. Exhaustively checking every transition is cheap here; it becomes impossible for real designs (a 32-bit register alone has states). That is why verification relies on reference models and targeted corner cases (rollover, reset in the middle of a cycle, hold) rather than enumeration.
One state of the counter FSM with all its outgoing transitions: +1 when e = 1, u = 1; −1 when e = 1, u = 0; stay when e = 0; reset to 0 regardless. With 256 states and 8 input combinations each, there are 2048 transitions. No directed test visits them all, which motivates the coverage numbers in D5.
How long does random stimulus take to reach a rare state? Reaching count = 255 from 0 by counting up needs 255 consecutive enabled “up” edges. If inputs were random with probability per edge of being “enabled up”, the chance of 255 in a row is — effectively never. Directed tests (your Phase 3 counting down through zero) hit the corner in 11 cycles.
D3Try it: step the counter one clock at a time
Toggle the inputs, then press Clock ↑. Watch which bits flip — the pattern is exactly the toggle rule derived in Chapter 2.
D4How a simulator orders events — formally
Think of simulation time as a sequence of time slots . Inside one slot the scheduler repeatedly drains regions until nothing is left:
Inside one simulation time step. The Active region runs triggered blocks and evaluates the right-hand side of every <=. The NBA region then applies all those updates together. If that wakes up more blocks, another zero-time delta cycle runs. Only when nothing changes do $monitor/$dumpvars record the settled values and time advance.
If an NBA update triggers more blocks (it usually does — a flop output feeds logic), those go back into Active in the same time slot; each such pass is called a delta cycle. Delta cycles take zero simulated time but are ordered, which is how zero-delay RTL still produces deterministic results.
Cost model: work per time slot is proportional to the number of signals that change, not the size of the design. That is why event-driven simulation is fast for designs with low activity — and why the activity in Chapter 3 also predicts simulation speed.
D5How much has the testbench actually exercised? Coverage metrics
A PASS only says nothing went wrong in the cases you ran. Coverage measures how many cases that was:
What the counter testbench actually exercises. Line and toggle coverage reach 100 % (rollover flips all eight bits), yet only about 7 % of the 256 states are ever visited. “All lines ran” is a much weaker statement than “all behaviour was checked”.
METRIC
DEFINITION
THIS TESTBENCH
Line / statement
100 % — every branch of the if runs
Toggle
100 % — the rollover to 255 toggles every count bit
FSM state
≈ 7 % (0–10, 254, 255): fine for a counter whose logic is identical for every state
Incisive can measure these automatically (irun -coverage all, viewed in IMC). The lesson: choose stimulus so that each distinct behaviour is covered, not every state.
D6Delay models in simulation: transport vs inertial
Real gates cannot respond to arbitrarily short pulses — their internal capacitance must charge first. Simulators model this with two kinds of delay:
Transport versus inertial delay. A transport delay shifts every pulse, so a 0.4-wide glitch passes through unchanged. An inertial delay δ swallows any pulse narrower than δ, the way a real gate’s input capacitance filters short spikes. Verilog’s # delays on continuous assignments behave inertially.
MODEL
RULE
USED FOR
Transport
Every input change appears at the output after , however short
Wires
Inertial
A pulse of width is swallowed
Gates (Verilog default for assign #δ and gate primitives)
Formally, an inertial element with delay outputs
With SDF annotation (Step 7.2) the cell models use pulse-rejection limits from the SDF. Glitches narrower than a gate delay disappear in gate-level simulation, just as in silicon — and glitches wider than that consume real power (Chapter 3, D8).
Remember
Testbench = stimulus + reference model + checker.
<= for flops; inputs change away from the active edge.
Use ===/!== in checks so x cannot hide a failure.
1.0
Create the counter RTL file
Why this stepThe RTL is the single source of truth that every later stage transforms; it must be correct before anything else.
In the terminal, confirm you are inside the project, then open a text editor. CentOS 6 commonly includes gedit; use vi if it is unavailable (in vi: press i to insert, paste, press Esc, type :wq and Enter to save and quit).
Open the RTL file · shellcd /home/buet/cds_work/asic_lab
gedit rtl/cnt_updown.v &
# Alternative terminal editor:
# vi rtl/cnt_updown.v
Paste the module below, save (Ctrl+S), and close the editor. This example has an asynchronous active-high reset, an enable, and an up/down direction control.
rtl/cnt_updown.v · Verilog`timescale 1ns/1ps
module cnt_updown (
input wire clk,
input wire reset, // asynchronous, active high
input wire enable, // 1 = count, 0 = hold
input wire up_down, // 1 = up, 0 = down
output reg [7:0] count
);
always @(posedge clk or posedge reset) begin
if (reset)
count <= 8'h00;
else if (enable) begin
if (up_down)
count <= count + 8'h01;
else
count <= count - 8'h01;
end
end
endmodule
Read the code line by line before moving on:
always @(posedge clk or posedge reset) — the block reacts to a rising clock or a rising reset. Listing reset in the sensitivity list is what makes the reset asynchronous: it clears the counter immediately, without waiting for a clock edge.
if (reset) … else if (enable) — reset has priority over everything; when enable is 0 none of the assignments run, so count keeps its value (a hold).
<= is a non-blocking assignment. Always use it for flip-flops; it models all flops updating together at the clock edge.
8-bit arithmetic wraps: 255 + 1 = 0 and 0 − 1 = 255. Your testbench will check this "rollover".
What hardware this describes
count requires eight flip-flops. The enable and direction behavior becomes an incrementer/decrementer plus a multiplexer feeding their D inputs. The asynchronous reset must map to flops with compatible reset pins (in gsclib045, a DFFR… type) or be restructured by synthesis.
What you should see
ls -l rtl/ lists cnt_updown.v with a size of roughly 400–500 bytes.
grep -n module rtl/cnt_updown.v shows exactly one module cnt_updown ( and one endmodule.
Checkpointls -l rtl/cnt_updown.v shows a non-empty file, and the module/port names match what the testbench will instantiate.
1.1
Create a self-checking testbench
Why this stepA reference model plus checker turns “looks right” into a provable PASS that you can rerun on every later netlist.
Open the testbench · shellgedit tb/tb_cnt_updown.v &
A testbench is ordinary Verilog that is never turned into hardware. This one does four jobs: it generates a 100 MHz clock, drives the inputs through six phases (reset, count up, hold, count down through zero, asynchronous reset, count up again), keeps an independent reference model of what count should be, and compares the DUT against that model every cycle. It also creates the waveform database expected by the source tutorial.
tb/tb_cnt_updown.v · Verilog`timescale 1ns/1ps
module tb_cnt_updown;
reg clk;
reg reset;
reg enable;
reg up_down;
wire [7:0] count;
// ---------------- Device under test ----------------
cnt_updown dut (
.clk(clk), .reset(reset), .enable(enable),
.up_down(up_down), .count(count)
);
// ---------------- 100 MHz clock (10 ns period) ----------------
initial clk = 1'b0;
always #5 clk = ~clk; // rising edges at 5, 15, 25 ... ns
// ---------------- Waveform database for SimVision ----------------
initial begin
$dumpfile("./updown_counter.dump");
$dumpvars(0, tb_cnt_updown);
end
// ---------------- Optional SDF back-annotation (Chapter 7) ----------------
`ifdef SDF
initial $sdf_annotate("results/cnt_updown.sdf", dut, , "logs/sdf_annotate.log", "MAXIMUM");
`endif
// ---------------- Reference model: what count SHOULD be ----------------
reg [7:0] expected;
always @(posedge clk or posedge reset) begin
if (reset) expected <= 8'h00;
else if (enable) expected <= up_down ? expected + 8'h01 : expected - 8'h01;
end
// ---------------- Checker: compare on every falling edge ----------------
integer errors = 0;
integer checks = 0;
always @(negedge clk) begin
if (!reset) begin
checks = checks + 1;
if (count !== expected) begin
errors = errors + 1;
$display("ERROR t=%0t ns count=%0d expected=%0d (enable=%b up_down=%b)",
$time, count, expected, enable, up_down);
end
end
end
// ---------------- Stimulus: inputs change only on falling edges ----------------
initial begin
reset = 1'b1; enable = 1'b0; up_down = 1'b1;
#22 reset = 1'b0; // release reset between clock edges
@(negedge clk); enable = 1'b1; up_down = 1'b1; // Phase 1: count up 10 times
repeat (10) @(negedge clk); // 0 -> 10
enable = 1'b0; // Phase 2: hold for 3 cycles
repeat (3) @(negedge clk);
enable = 1'b1; up_down = 1'b0; // Phase 3: count down 12 times
repeat (12) @(negedge clk); // 10 -> 0 -> 255 -> 254
enable = 1'b0; // Phase 4: hold
repeat (2) @(negedge clk);
#2 reset = 1'b1; // Phase 5: asynchronous reset
#2 reset = 1'b0; // in the middle of a cycle
enable = 1'b1; up_down = 1'b1; // Phase 6: count up 3 times
repeat (3) @(negedge clk); // 0 -> 3
enable = 1'b0;
repeat (2) @(negedge clk);
if (errors == 0)
$display("PASS: %0d cycle checks matched, final count = %0d", checks, count);
else
$display("FAIL: %0d of %0d cycle checks mismatched", errors, checks);
$finish;
end
endmodule
Three design decisions in this file matter more than they look:
Inputs change on the falling edge. If the testbench changed enable exactly at a rising edge, the simulator could evaluate the DUT before or after the change (a race). Changing inputs half a period away from the active edge removes the ambiguity — and mimics a real input that arrives well before the clock.
Checks also happen on the falling edge, i.e. after the DUT has settled from the previous rising edge.
!== instead of != also flags x and z values. A plain != against an unknown value evaluates to unknown and the error would silently be skipped.
PHASE
INPUTS
EXPECTED COUNT AT THE END
Reset (0–22 ns)
reset=1
0
1 · up ×10
enable=1 up_down=1
10
2 · hold ×3
enable=0
10 (unchanged)
3 · down ×12
enable=1 up_down=0
254 (passes 0 → 255: rollover)
4 · hold ×2
enable=0
254
5 · async reset
2 ns pulse between edges
0 immediately, no clock needed
6 · up ×3
enable=1 up_down=1
3
A waveform is not a complete test. The reference model above is what makes this a self-checking test: you read one PASS/FAIL line instead of trusting your eyes. You will reuse the exact same testbench on the gate-level netlist (Step 2.4) and on the routed netlist with real delays (Step 7.2).
Before you move on Read the testbench once from top to bottom and find its four jobs: the clock generator (one always line), the stimulus phases (the long initial block), the reference model (a second, independent counter), and the checker (the comparison that prints FAIL). A self-checking testbench is only as good as the independence of its model: if the model were copied from the RTL, a shared bug would pass silently.
Checkpointtb/tb_cnt_updown.v is saved and instantiates cnt_updown with the same five port names as the RTL.
1.2
Understand the dump instrumentation
Why this stepThe dump file is what SimVision and later power analysis read; knowing what it records tells you what you can inspect.
The source tutorial expects a dump database containing the full testbench hierarchy. The complete testbench above already contains these calls — this step just explains them.
tb_cnt_updown.v (excerpt) · Veriloginitial begin
$dumpfile("./updown_counter.dump");
$dumpvars(0, tb_cnt_updown);
end
$dumpfile names the output file. It is a standard VCD (Value Change Dump) text file even though the extension is .dump.
$dumpvars(0, tb_cnt_updown) records every signal in tb_cnt_updown and, because the first argument is 0, every level below it (including dut). A 1 would record only the top level.
Physical meaning: none yet. This only records simulator events. Dumping everything is convenient for a tiny counter but can be expensive (gigabytes) for a large SoC.
1.3
Compile and run with Incisive
Why this stepOne command proves the RTL compiles, elaborates and behaves — the first real evidence in the lab.
Return to the terminal. irun performs analysis, elaboration and simulation in one command. Use full debug access while learning. (Your VM runs the 32-bit build of Incisive 10.20-s100, so the banner reads irun: rather than irun(64):.)
Incisive 10.20 parses .v files as Verilog-2001 by default (ANSI port lists, integer x = 0 initializers). Do not add -v2001: this release rejects it with *E,BDOPT: Unknown option -v2001. (RTL Compiler’s read_hdl -v2001 in Chapter 2 is a different tool and is correct.)
-access +rwc
Give read/write/connectivity access to every signal so SimVision and Tcl can see them. Slower, but essential while debugging.
-logfile logs/irun.log
Copy everything printed on screen into a file you can search later.
\ at line end
Shell line continuation — the three lines are one command.
The screenshot shows the compiler output. Read it top to bottom: file: … lines (each file parsed), module worklib.cnt_updown:v errors: 0, warnings: 0, then the elaborator building the design hierarchy, and finally the simulator running.
Expected end of the log
PASS: 32 cycle checks matched, final count = 3 followed by Simulation complete via $finish(1) at time 350 NS + 0 — the stimulus ends at the falling edge at 350 ns (the exact check count and time change if you edit the stimulus).
Troubleshooting — errors from irun
*E,…: Instance of undefined module 'cnt_updown' — the RTL file was not on the command line or the module name is misspelled. Both file names must be listed.
*E,EXPSMC: expecting a semicolon — a syntax error; the message gives file and line. Usually the line above is missing a ;.
*W,…: port sizes differ — the testbench declares count with a different width. Make it wire [7:0].
A line starts with ERROR t=… — the DUT disagrees with the reference model. Read enable/up_down in that line and compare with the RTL; then look at the waveform at that time (Step 1.8).
Locked database (*E,…: cannot lock) — another irun is still running. Close it or delete the stale INCA_libs folder and rerun.
ANNOTATED OUTPUTEnd of logs/irun.logillustrative — your exact numbers and names will differ
End of logs/irun.logirun: 10.20-s100: (c) Copyright 1995-2011 Cadence Design Systems, Inc.
file: rtl/cnt_updown.v [1]
module worklib.cnt_updown:v
errors: 0, warnings: 0
file: tb/tb_cnt_updown.v
module worklib.tb_cnt_updown:v
errors: 0, warnings: 0
Elaborating the design hierarchy: [2]
Building instance overlay tables: .................... Done
Writing initial simulation snapshot: worklib.tb_cnt_updown:v
Loading snapshot worklib.tb_cnt_updown:v .................... Done
ncsim> source .../tools/inca/files/ncsimrc
ncsim> run [3]
PASS: 32 cycle checks matched, final count = 3 [4]
Simulation complete via $finish(1) at time 350 NS + 0 [5]
ncsim> exit
Analysis of each file: look for errors: 0 on every module.
Elaboration: the snapshot name printed here is what you pass to ncsim later.
Simulation starts; irun issues run for you in batch mode.
The checker’s verdict — the single most important line.
Normal end through $finish. A run that ends by time-out or *F fatal message is a failure even if no ERROR was printed.
CheckpointThe run reaches $finish without compile, binding or runtime errors, and prints PASS.
1.4
Inspect what the compiler created
Why this stepRecognising generated files lets you tell a stale result from a fresh one and clean up safely.
Incisive places compiled design units and snapshots in INCA_libs/. The log explains which top was elaborated; the dump database contains activity.
Compare your listing with the screenshot. You should now see three new things: INCA_libs/ (compiled database), updown_counter.dump (waveforms), and logs/irun.log (plus irun.key/irun.history, which record the command).
Analyze versus elaborate
Analysis checks each HDL unit on its own (syntax, declarations). Elaboration resolves hierarchy, parameters and module bindings into one simulatable snapshot. A file can compile cleanly and still fail elaboration because an instance cannot be resolved — which is why tools report the two stages separately.
What you should see
A new INCA_libs/ folder containing irun.lnx86.10.20.nc/ (or similar) with the compiled design.
updown_counter.dump of a few kilobytes — open it with head to see the VCD header ($date, $timescale 1ps, $scope module tb_cnt_updown).
grep -ciE "error|warning" logs/irun.log prints 0 (or only harmless notes).
1.5
Run the three-step flow and restart the saved snapshot
Why this stepRunning the three phases separately teaches where each kind of error comes from and gives a reusable snapshot for Chapter 3.
irun hides three separate programs. Running them by hand once teaches you what each stage does, and creates a named snapshot you can rerun without recompiling (needed again in Chapter 3). This isolates runtime debugging from compilation.
ACreate the library mapping files
The NC tools look for cds.lib (which library names map to which folders) and hdl.var (which library is the default work library) in the current directory.
Watch the last line printed by ncelab: Writing initial simulation snapshot: worklib.tb_cnt_updown:…. Whatever follows the colon is the snapshot's view name. The historical course snapshot is named worklib.tb_cnt_updown:v; on your VM ncelab prints worklib.tb_cnt_updown:module, so that is the name used below and in Step 3.2. Leaving the suffix off (worklib.tb_cnt_updown) also works.
The screenshot shows ncsim loading the snapshot and running to $finish without any compile step — exactly what you should see.
Troubleshooting — snapshot not found
*E,SNAPNF / "snapshot not found" — the name after the colon is wrong, or ncsim is running in a different directory than ncelab. Run ls worklib or ncls -snapshot to list the snapshots that exist.
*F,CDSLIB — cds.lib is missing from the current directory. Repeat part A.
What you should see
ncvlog ends with no *E lines; ls worklib shows cnt_updown and tb_cnt_updown entries.
ncelab ends with Writing initial simulation snapshot: worklib.tb_cnt_updown:….
ncsim prints the same PASS line as Step 1.3, with no recompilation.
CheckpointThe snapshot runs without recompiling and produces the same PASS line.
1.6
Open the dump in SimVision
Why this stepOpening the database is the gateway to visual debugging.
AStart SimVision and open the database
Return to the terminal and type simvision &. The Console and Design Browser windows open.
Choose File → Open Database.
At the bottom of the file dialog, set the file filter (Files of type) to All Files (*) — the .dump extension is not in the default list, so the file is otherwise invisible.
Select updown_counter.dump and click Open.
BAccept the translation
SimVision's native format is SST2. Because a VCD file was selected, a dialog asks whether to convert it. Click OK (or Yes). A .trn/.dsn pair appears beside the dump after conversion.
What you are seeing: SimVision is translating the recorded event database into a browsable hierarchy. This does not rerun the simulation — if you change the RTL, you must rerun Step 1.3 to produce a new dump.
Alternative: start directly with simvision updown_counter.dump & to skip the file dialog.
What you should see
The Design Browser shows a scope tree starting with tb_cnt_updown, and under it dut.
Clicking a scope lists its signals in the right pane.
Troubleshooting — SimVision does not open or shows no signals
“cannot open display” — you are not in a graphical session or X forwarding is off; on the VM use the desktop terminal, not a text console.
The file dialog does not list the dump — change Files of type to All Files (*).
The tree is empty — the dump was written before $dumpvars ran or the simulation crashed at time 0 — rerun Step 1.3 and check the log.
1.7
Add the correct hierarchy to the waveform
Why this stepChoosing the right scope and signals is what makes a waveform readable instead of noise.
In the Design Browser (left pane), expand the scope tree and click tb_cnt_updown. Its signals appear in the right pane.
Select the signals: click clk, then hold Ctrl and click reset, enable, up_down, count and expected.
Click the Send to Waveform button on the toolbar (the waveform icon), or right-click → Send to Waveform Window.
A Waveform window opens with your signals listed on the left and their traces on the right:
If you also want the DUT's internal view, expand tb_cnt_updown → dut and send its count as well — it should be identical to the top-level count.
What you should see
A Waveform window with the six signals on the left and green traces on the right.
clk shows a regular square wave; count shows a bus with hexadecimal values.
CheckpointEvery control and the count bus are visible. Expand buses (click the + beside count[7:0]) only when bit-level behavior matters.
1.8
Run, zoom and verify edge-by-edge behavior
Why this stepEdge-by-edge inspection is how you confirm the corner cases the checker tests — and how you debug when it fails.
AShow the full time range
When opened from a dump there is nothing to run; the data is already complete. Use the run control only if you started SimVision from a live simulation (irun -gui). Then click View → Zoom → Full X (or the "zoom to fit" toolbar button) so the whole simulation fits the window.
BChange the bus radix and zoom into edges
Right-click count → Radix/Mnemonic → Unsigned Decimal so values read 0, 1, 2 … instead of hex.
Drag a box on the time ruler around a few clock periods to zoom in. Click in the trace area to place the primary cursor; the value column shows every signal at that time.
Check each item in the list below at the matching time.
WHAT TO VERIFY
WHERE TO LOOK
CORRECT BEHAVIOR
Reset priority
0–22 ns
count = 0 even though clk toggles.
Enabled up-count
~35–125 ns
+1 at each rising edge, never at falling edges.
Disabled hold
~135–155 ns
Value stays 10 for three edges.
Down-count & rollover
~165–275 ns
…, 1, 0, 255, 254.
Asynchronous reset
~302–304 ns
Drops to 0 the instant reset rises — between clock edges.
No unknowns
Everywhere after reset
No red x segments on count.
Do not accept “the waveform moves” as a pass. Also confirm that count and expected are identical traces.
CMeasuring time in SimVision
Left-click in the trace area: the primary cursor (a vertical line) jumps there and the value column shows every signal at that instant.
Add a second reference with the Create marker toolbar button (or Edit → Create → Marker) and drag it to another edge.
The time difference between cursor and marker is shown at the top of the waveform — measure the clock period (should read 10 ns) and the reset pulse in Phase 5 (2 ns).
Use the next edge / previous edge toolbar arrows with a signal selected to jump exactly from one transition of that signal to the next.
Why no delay between clk and count? RTL simulation has zero delay: count changes in the same time step as the rising edge. After synthesis with SDF (Step 7.2) you will see a real clock-to-Q delay of a few hundred picoseconds.
Debugging rule
Look immediately before and after the active edge. That separates a DUT bug from a testbench race and exposes unknown values that later resolve. A value that changes exactly on a rising edge together with an input is the classic sign of a race.
What a careful waveform review looks like Pick three moments and check them against the RTL by hand: (1) the first rising edge after reset deasserts — count goes 0 → 1 only if enable = 1; (2) the edge where up_down changes — the next value moves in the new direction immediately; (3) the 0 → 255 rollover while counting down. Use the cursor: values change just after each rising edge (non-blocking assignment), never before it.
CheckpointAll six rows of the table are confirmed visually, and the log says PASS. Close SimVision (File → Exit SimVision).
✔ Chapter recap
Commands in order
Chapter commands, in order (condensed — every option is in the steps)gedit rtl/cnt_updown.v tb/tb_cnt_updown.v &
irun -access +rwc -logfile logs/irun.log rtl/cnt_updown.v tb/tb_cnt_updown.v
echo "DEFINE worklib ./worklib" > cds.lib; echo "DEFINE WORK worklib" > hdl.var; mkdir -p worklib
ncvlog -messages rtl/cnt_updown.v tb/tb_cnt_updown.v
ncelab -messages -access +rwc worklib.tb_cnt_updown
ncsim -messages worklib.tb_cnt_updown
simvision updown_counter.dump &
What you should now have
FILE
WHAT IT IS
rtl/cnt_updown.v
The design
tb/tb_cnt_updown.v
Self-checking testbench
updown_counter.dump
Waveforms (VCD)
worklib/ snapshot
Reused by Chapter 3
? Check yourself
Q1Which assignment should a clocked always block use?
Non-blocking updates happen together in the NBA region, matching real flip-flops and avoiding order-dependent races.
Q2Why does the checker use !== instead of !=?
With !=, a comparison against x yields x, which an if treats as false — the error would be silently skipped.
Q3The counter is at 0 and counts down one step. The new value is…
cn+1 = (cn − 1) mod 256 = 255: the rollover tested in Phase 3.
⚠ Common mistakes in this chapter
Using = instead of <= in clocked blocks — races between flops.
Changing testbench inputs exactly on the active clock edge.
Comparing with !=, so x values silently pass.
Forgetting to rerun irun after editing RTL — SimVision shows the old dump.
Calling the waveform “correct” without the PASS line.
CHAPTER 2
Synthesize RTL with RTL Compiler 12.10
Goal: turn behavior into real standard cells under explicit timing constraints.
You start withVerified RTL and an idea of the target clock
You end withresults/cnt_updown_mapped.v + .sdc, clean lint, positive slack, gate-sim PASS
Toolsrc (RTL Compiler), irun
Time≈ 60 min
THEORYFrom behavior to gates — and how timing is judged≈ 15 min read · the most important theory in the lab
T1What synthesis does
The commands in your script map one-to-one onto these stages.
Elaborate recognises structures: a clocked always becomes flops, + becomes an adder.
Generic optimization simplifies the Boolean logic without knowing the library.
Mapping chooses real cells from the Liberty file and sizes them until every path meets the SDC.
T2How RTL constructs become hardware
YOU WRITE
YOU GET
always @(posedge clk)
One flip-flop per assigned bit
… or posedge reset
Flops with an asynchronous reset pin
if / else, ? :
Multiplexers
+, -
Adder / subtractor (half/full-adder cells)
Combinational always @* missing an else
A latch — the value must be “remembered” in that branch
A signal assigned in two always blocks
Multiple drivers — an error
The hardware synthesis infers from the counter’s RTL. Eight resettable D flip-flops hold count. An incrementer and a decrementer compute both candidates. Multiplexers controlled by up_down and enable pick the next value (or hold). The flops’ outputs feed back into all three blocks.
T3Reading cell names
Library cell names are compact descriptions. In gsclib045-style naming:
Decoding a library cell name field by field. SDFFRHQX1 is a scan (S) D flip-flop with reset (R), high-speed (H), Q-only output, drive strength 1. The same grammar explains every name in your netlist: NAND2X1, CLKBUFX4, TIEHI.
NAME
READS AS
NAND2X1
NAND, 2 inputs, drive strength ×1
INVX4
Inverter, ×4 drive (bigger, faster on heavy loads, more leakage)
DFFRHQX1
D flip-flop, Reset, High-speed, Q output only, ×1
SDFFRHQX1
The same flop with a Scan mux (Chapter 6)
CLKBUFX4
Clock buffer: balanced rise/fall delays, used by CTS
T4Static timing analysis (STA)
STA proves timing without simulation vectors. It breaks the design into timing paths that start at a flop clock pin or an input, and end at a flop data pin or an output — then adds up the delays along every path.
The four path groups you will see in RC and Encounter reports.
T5Setup and hold — the two rules every flop imposes
Setup: data must arrive at D some time tsetupbefore the capturing clock edge. Too slow → the flop captures garbage.
Hold: data must stay stable some time tholdafter the edge. Too fast → the new value races through and corrupts the capture.
Launch at FF1, capture at FF2 one period later. Setup slack is the gap before the orange window; hold slack the gap after the blue one.
Setup tcq + tcomb,max + tsetup ≤ T − tuncertainty
Hold tcq + tcomb,min ≥ thold
Slack required time − arrival time (positive = OK)
Worked example (numbers typical of this counter): T = 10 ns, uncertainty 0.2, tcq = 0.25, tcomb = 1.8, tsetup = 0.1. Arrival = 0.25 + 1.8 = 2.05 ns. Required = 10 − 0.2 − 0.1 = 9.7 ns. Setup slack = 7.65 ns ✓
Key insight: the hold equation has no T in it. Slowing the clock fixes setup violations but never hold violations — those must be fixed by adding delay (buffers) on short paths. That is why hold is repaired after CTS (Chapter 4).
T6How the SDC budgets the boundary
Your block is part of a bigger chip. set_input_delay 1 says “the logic before me already used 1 ns of the cycle”; set_output_delay 1 says “the logic after me needs 1 ns”. So:
How the SDC divides one 10 ns clock period for each path group. Orange parts are spent outside the logic: clock-to-Q, setup, and the input/output delays reserved for the neighbouring blocks. Blue is the clock uncertainty. Only the green window is available to the combinational logic synthesis builds, and its size is different for reg2reg, in2reg and reg2out paths.
PATH
TIME LEFT FOR LOGIC INSIDE THIS BLOCK
reg2reg
10 − 0.2 = 9.8 ns (minus tcq, tsetup)
in2reg
10 − 1 − 0.2 = 8.8 ns
reg2out
10 − 1 − 0.2 = 8.8 ns
An object the SDC forgets to constrain is simply not checked — the most dangerous kind of “pass”. That is what the lint report in Step 2.3 hunts for.
T7Why synthesis timing is only an estimate
No wires exist yet. RC guesses each net’s capacitance from its fanout (a wire-load model), and treats the clock as ideal (arriving everywhere at once). Both assumptions are replaced by real data in Chapter 4, which is why timing is checked again there.
Wire-load estimates against extracted reality (illustrative). Each dot is one net. Points on the dashed line were estimated perfectly. The spread shows why timing at synthesis is only a forecast: the same fanout can mean a 2 µm or a 200 µm wire once cells are placed.
DEEP DIVE Boolean derivation, the timing graph, and delay tables
D1Deriving the counter’s gate-level logic
Write the count as bits . Adding 1 to a binary number flips bit exactly when all lower bits are 1 (the carry reaches it). Subtracting 1 flips bit when all lower bits are 0 (the borrow reaches it). So the toggle condition of bit is
The gate-level structure behind the counter’s next-state equations. Bit toggles when enable is high and every lower bit matches the direction (all 1s counting up, all 0s counting down). The XNOR chain implements exactly the product term , and each flop’s D input is .
Here is 1 when : all-ones for counting up (), all-zeros for counting down (). The empty product for is 1, so toggles on every enabled edge.
Check with numbers: , counting up. (bits 0–2 are all 1), (bit 3 is 0). Flipping bits 0–3 gives . ✓
This is what RC builds: an XNOR per bit, an AND chain for the product, and an XOR feeding each flop’s D pin.
D2Why the critical path grows with width
Computed naïvely, needs the AND of seven terms through a chain (“ripple”), so the logic depth is for an -bit counter:
Why the critical path grows with the width of the counter. An 8-input AND built as a ripple chain is 7 gates deep. Built as a balanced tree it is only deep. Synthesis restructures chains into trees when timing demands it, trading a little wiring for logarithmic depth.
A balanced tree of 2-input ANDs computes the same product in levels:
For : 8 levels vs 3 levels. When the clock is tight, synthesis restructures ripple logic into trees (carry look-ahead) — trading area for speed. At 100 MHz this counter has so much slack that RC keeps the smaller ripple form.
D3How STA actually computes timing: a worked graph
Static timing analysis never simulates. It turns the netlist into a graph and does two sweeps of simple arithmetic over it. Here is the whole procedure on a small example.
Step 1 · Build the timing graph
Every pin becomes a vertex. Every cell arc (input pin → output pin of a gate) and every net (driver → receiver) becomes an edge labelled with its delay. Flip-flops break the graph: a flop’s Q pin is a start point, its D pin an end point. Because every loop in a synchronous design passes through a flop, the resulting graph has no cycles — it is a DAG (directed acyclic graph).
Three start points (two flops and an input port), three gates and one end point. Clock period 10 ns, uncertainty 0.2 ns, setup 0.1 ns.
Step 2 · Forward pass: arrival times
The arrival time AT is the latest moment the signal at a pin can still change after the clock edge. Start points get their launch times (flop Q pins: ns; the input: its input delay, 1.0 ns). Then visit vertices in topological order — every vertex only after all of its inputs — and apply
We take the maximum because a gate’s output is not final until its last input has arrived.
VERTEX
INPUTS (AT + delay)
AT
g1 (NAND2)
A: 0.3 + 0.5 = 0.8 · B: 1.0 + 0.5 = 1.5
1.5 (B is later)
g2 (INV)
C: 0.3 + 0.2 = 0.5
0.5
g3 (NOR2)
g1: 1.5 + 0.6 = 2.1 · g2: 0.5 + 0.6 = 1.1
2.1
D (end point)
g3: 2.1 + 0.1
2.2
Step 3 · Backward pass: required times
The required time RT is the latest moment the signal may arrive and still be captured correctly. At the end point it comes from the setup inequality: ns. Then walk the graph in reverse topological order:
We take the minimum because a pin that feeds several paths must satisfy the most demanding one.
VERTEX
OUTPUTS (RT − delay)
RT
g3
9.7 − 0.1
9.6
g1, g2
9.6 − 0.6
9.0
A, B
9.0 − 0.5
8.5
C
9.0 − 0.2
8.8
Step 4 · Slack and the critical path
Slack is how much later the signal could arrive at that pin before the design fails. Every vertex on the worst path has the same, smallest slack — here 7.5 ns along B → g1 → g3 → D. That chain is the critical path, and it is exactly what the timing report in Step 2.3 prints line by line. Paths through A or C have more slack (8.2 and 8.5 ns), so speeding them up would not help.
Step 5 · Why it scales
Each pass touches each edge once, so the work is — linear in design size. A million-gate design is analysed in seconds, and the answer covers every path, which no amount of simulation could. Hold analysis repeats the same two passes with and swapped (earliest arrival vs earliest allowed time). The price: STA checks timing, not function, and it trusts the constraints completely — the reason Step 2.3 lints them first.
D4The complete setup and hold inequalities, term by term
The simple versions in the theory card assumed the clock reaches every flop at the same instant. In a real chip it does not, so we add the clock’s travel time. Name the pieces:
Setup timing with skew δ. The data launched by the clock at L must arrive at least before the clock edge at C. If C’s clock arrives δ later than L’s, the capture edge moves right and the setup slack grows by δ. The hold check moves the opposite way and loses δ.
SYMBOL
MEANING
clock latency: time for the clock edge to reach the launching flop L and the capturing flop C
skew between the pair (positive = capture clock arrives later)
clock-to-Q delay of L
longest and shortest logic delay from L to C
setup and hold time of C
uncertainty (jitter + margin), always subtracted from your budget
Setup. Data launched by edge 0 must arrive before edge 1 at C (minus setup and uncertainty). Edge 0 reaches L at ; edge 1 reaches C at :
Hold. The same edge that launches new data at L also captures the old data at C. The new data must not arrive until C has finished capturing, after that edge:
Solving the setup inequality for gives the fastest safe clock:
Read the two inequalities side by side and three facts jump out:
appears only in setup. A slower clock cures setup violations and does nothing for hold.
Skew moves slack from one check to the other. sits on the right-hand side of both inequalities: in setup it enlarges the time allowed, in hold it raises the minimum required. 0.1 ns of positive skew gives setup 0.1 ns more room and takes 0.1 ns away from hold.
Hold is about the shortest path. Two flops connected by a bare wire () are the classic hold risk. The fix is to add delay — optDesign -hold inserts buffers on such paths.
D5Try it: a setup / hold calculator
Drag the sliders. Make the clock faster until setup fails; then add skew and watch hold fail while setup improves.
D6Where cell delays come from: NLDM tables, with a worked lookup
A gate’s delay depends on two things the logical-effort model simplifies away: how fast its input changes (the input transition or slew ) and how much capacitance it drives (). A Liberty file therefore stores each cell arc as a small 2-D table, measured by the library vendor with SPICE — the Non-Linear Delay Model:
Reading an NLDM delay table. The library gives delay at a grid of input slews and output loads. For an operating point between grid entries, STA interpolates bilinearly between the four surrounding values (highlighted). This is why a cell’s delay depends on both how sharp its input is and how much it drives.
What an NLDM table looks like inside slow.lib (illustrative)cell_rise (delay_template_3x3) {
index_1 ("0.05, 0.20, 0.80"); /* input transition s (ns) */
index_2 ("0.001, 0.010, 0.050"); /* output load C (pF) */
values ("0.031, 0.058, 0.162", \
"0.044, 0.071, 0.176", \
"0.090, 0.121, 0.231"); /* delay (ns) */
}
Rows are input transitions, columns are loads. When the actual falls between grid points, the tool interpolates bilinearly: first along one axis, then along the other. With and the surrounding grid values:
Worked lookup: ns, pF.
Neighbours: → , . → , .
ns.
A second table (rise_transition) gives the output slew the same way. That output slew becomes the next gate’s input slew, so delays are computed stage by stage along each path — the reason set_input_transition and set_load in your SDC change every number in the report. Each row of the RC timing report (Step 2.3) is one such lookup.
D7The wire-load model, quantified
Before placement a net with fanout is given an estimated length and capacitance from a lookup table, roughly linear:
A wire-load model is a lookup from fanout to estimated wire capacitance, roughly linear: . Every net with the same fanout gets the same estimate, whatever its real length. Encounter replaces these guesses with extracted values.
It is a statistical average, so individual nets can be off by 2× or more — the reason timing changes after placement and routing.
D8Technology mapping is dynamic programming
After generic optimisation RC holds a subject graph made only of NAND2 and inverters. Each library cell is also described as a small pattern of NAND2/INV. Mapping chooses a set of patterns that covers the graph at minimum cost. On a tree this has an exact, linear-time solution (the DAGON algorithm):
Technology mapping as covering a subject graph. The logic is first expressed as NAND2/INV primitives, then covered with library cells. Cover A uses two NAND2s plus an inverter (cost 3). Cover B uses one AND2 cell (cost 2.5) and wins. Dynamic programming finds the cheapest cover of a tree in linear time.
Process the nodes from inputs to outputs; each node stores its best cost and the match achieving it. For delay instead of area, replace the sum with a max of arrival times plus the cell delay.
Tiny example: the subject graph of an AND gate is NAND2 → INV. Matches at the INV output: (a) library INV on top of the best cover of the NAND2 (cost 1 + 2 = 3), or (b) the single library AND2 cell, whose pattern is exactly NAND2 → INV (cost 2.5). DP picks AND2. Real libraries offer hundreds of patterns per node, so the choice is never obvious by hand.
D9Reset strategy: why the async reset is a false path
The reset assertion is asynchronous and needs no timing. Its release must not happen inside a flop’s recovery/removal window (the reset-pin equivalent of setup/hold), or flops come out of reset on different cycles or metastable (primer F6). Real designs use a reset synchroniser: assert asynchronously, release through two flops clocked by clk. The lab’s set_false_path -from reset is acceptable only because the testbench releases reset safely between edges.
A reset synchroniser. Asserting rst_n clears both flops immediately (asynchronously). Releasing it lets a 1 ripple through two flops, so the design leaves reset on a clock edge. A metastable first flop has a full cycle to resolve before the second flop passes its output on.
D10Two-level minimisation and Karnaugh maps
Any Boolean function can be written as a sum of minterms (rows of its truth table where it is 1). Minimisation finds the fewest, largest prime implicants covering them — on a Karnaugh map, the largest power-of-two rectangles of 1s, where adjacent cells differ in exactly one variable (Gray code), including wrap-around.
. Two groups of four cover all eight 1s; each group of cells eliminates variables.
The algebra behind a group is the adjacency theorem :
K-maps stop being practical beyond 5–6 variables; the Quine–McCluskey method does the same systematically (generate all primes by repeated merging, then solve a set-cover problem). Exact set cover is NP-hard, so tools like Espresso use heuristics. Modern synthesis works on multi-level logic (factored forms such as ) because two-level forms blow up for functions like parity: -input XOR needs product terms but only XOR gates.
D11Shannon expansion and binary decision diagrams
Every Boolean function splits on any variable (Shannon’s expansion):
Applying it recursively in a fixed variable order and merging identical sub-graphs gives a reduced ordered BDD:
ROBDD of with order . Note the shared node : both the branch and the branch reuse it.
For a fixed order the ROBDD is canonical: two functions are equal if and only if their ROBDDs are the same graph — equality is a pointer comparison. The catch is order sensitivity: for the comparator the order gives nodes, while needs about .
D12Proving the netlist equals the RTL: equivalence checking
Simulation shows the netlist matches the RTL for the vectors you tried. Logic equivalence checking (LEC — Cadence Conformal, driven by the write_do_lec file from Step 6.3) proves it for all inputs:
Equivalence checking with a miter. The golden RTL and the revised netlist receive the same inputs, and their outputs are XORed into one signal M. A SAT or BDD engine asks “can M ever be 1?”. If not, the designs are equivalent for all inputs; if so, the solver returns the input that shows the difference.
Map key points. Pair every flop and primary output in the RTL with its counterpart in the netlist (by name, then by structure).
Build a miter for every pair of next-state functions (golden) and (revised): .
Prove unsatisfiability. , decided with BDDs or a SAT solver.
A satisfying is a concrete counter-example. Because flops are matched first, only combinational clouds are compared — that is why scan insertion (which changes flops into scan flops) needs the extra constraints written into the dofile.
D13Pipelining, throughput and latency
Split logic of delay into balanced stages separated by registers with overhead (plus skew/uncertainty):
9 ns of logic, 0.5 ns register overhead.
The speed-up saturates:
For the example the ceiling is , but already gives while latency grows from 9.5 to 10.5 ns. Retiming (Leiserson–Saxe) moves existing registers across logic instead of adding them: give each node a lag ; edge register counts become . The number of registers around any cycle is invariant, so the circuit’s function is preserved while its critical path changes.
D14Adders: from ripple carry to parallel prefix
The counter is an adder in disguise (it adds 1), and adders are the most studied circuits in VLSI because their carry chain is usually the critical path. For two -bit numbers , , define per bit:
Generate means “this bit creates a carry by itself” (both inputs 1). Propagate means “this bit passes an incoming carry along” (exactly one input is 1). The sum bit is the propagate bit XOR the incoming carry.
Ripple carry: simple and slow
Evaluating bit after bit lets the carry ripple through all positions: delay , area . For 64 bits that is 64 gate delays.
Carry look-ahead: unroll the recurrence
Every carry can be computed directly from the s and s in two logic levels — but the expressions grow quickly, so in practice they are applied to groups of 4 bits.
Parallel prefix: the clever generalisation
Treat each bit as a pair and define a combining operator for two adjacent groups (left = more significant):
In words: the combined group generates a carry if the left part generates one, or if the left part propagates a carry generated by the right part; it propagates only if both parts do. The operator is associative, so the bits can be combined in a balanced tree of depth instead of a chain:
Kogge–Stone network for 8 bits. Level combines each bit with the bit positions to its right.
ARCHITECTURE
LOGIC DEPTH
PREFIX CELLS
TRADE-OFF
Ripple carry
smallest, slowest
Brent–Kung
few cells, low fan-out
Kogge–Stone
fastest, many wires
Back to the counter. Adding 1 means and , so , (the counter bit), and the carry into bit is — exactly the toggle condition derived in D1. When the clock is tight, synthesis turns the incrementer’s AND chain into a prefix tree; at 100 MHz it has no reason to, so the ripple form (the ADDHX1 chain in the gates report) is kept.
Remember
Slack = required − arrival. Negative = violation.
Setup depends on the clock period; hold does not.
Unconstrained paths are invisible failures — lint first, then trust slack.
2.0
Open RTL Compiler from a fresh Bash terminal
Why this stepRC keeps a live database you can query after the script ends; knowing its prompt and GUI saves time when reports surprise you.
Open Applications → System Tools → Terminal.
Type bash if the prompt is not already Bash.
Go to the lab directory and source the college setup file. You must source it once in every new terminal.
Start the graphical shell. Wait for the rc:/> command prompt in the terminal (RC's command line stays in the terminal; the GUI window is a viewer) before continuing.
Terminal · shellbash
cd /home/buet/cds_work/asic_lab
source setup_cadence.sh
which rc
rc -gui
No & here. RTL Compiler reads its commands from the terminal (rc:/>); the window is an extra view. Started in the background with &, the shell suspends it as soon as it wants the terminal, and no window ever appears (jobs then shows Stopped — type fg to resume it). The window can take 20–40 s to open the first time. Use a second terminal if you need a shell while RC runs.
Try two commands at the rc:/> prompt to get a feel for the tool. RC stores everything (libraries, designs, settings) in a virtual directory tree you can browse like a file system:
rc:/> prompt · Tclls /
help synthesize
Inside RTL Compiler, File → Source runs a Tcl script interactively. For a repeatable run you will normally use the command shown in Step 2.2 instead. Type exit at the prompt to quit.
Do not use rc -version as a health check on this VM — it crashes with a segmentation fault after identifying itself (Step 0.1 D). rc -gui, rc -nogui and rc -files … are the commands used in this lab. If RC also crashes when it starts normally, use the fallbacks listed in Step 0.1’s troubleshooting box (LANG=C rc …).
If which rc prints nothing, stop here. The environment setup did not load, the path in setup_cadence.sh is wrong, or the tool is not installed. Go back to Step 0.1's troubleshooting box. Do not compensate by hard-coding random executable paths.
What you should see
The terminal shows a banner Cadence Encounter(R) RTL Compiler with version v12.10-s012_1 and then the prompt rc:/>.
ls / lists designs, libraries, hdl_libraries, messages and others — RC’s virtual directory tree.
2.1
Write constraints before optimizing
Why this stepWithout constraints the synthesis tool has no target and the timing reports are meaningless.
Synthesis without constraints is meaningless: the tool has no target, so it cannot tell a "fast enough" circuit from a broken one. The SDC (Synopsys Design Constraints) file is the contract between you and every timing-driven tool that follows — RC, Encounter and signoff all read the same constraints. The clock defines the timing budget. Input/output delays reserve time for logic outside this block. Uncertainty reserves margin for skew and jitter.
Create the file · shellgedit constraints/cnt_updown.sdc &
constraints/cnt_updown.sdc · SDC# ---------- Clock: 10 ns period = 100 MHz, on input port clk ----------
create_clock -name core_clk -period 10.000 [get_ports clk]
set_clock_uncertainty 0.20 [get_clocks core_clk]
# ---------- Inputs: arrive 1 ns after the clock edge (outside logic uses it) ----------
set_input_delay 1.00 -clock core_clk [get_ports {enable up_down reset}]
# ---------- Outputs: must be valid 1 ns before the next edge ----------
set_output_delay 1.00 -clock core_clk [all_outputs]
# ---------- Electrical environment of the boundary ----------
set_input_transition 0.10 [get_ports {enable up_down reset}]
set_load 0.05 [all_outputs]
# ---------- Asynchronous reset is not a timed single-cycle path ----------
set_false_path -from [get_ports reset]
COMMAND
WHAT IT TELLS THE TOOL
UNITS
create_clock
A periodic clock exists on port clk. Every flop clocked by it is checked against this period.
ns (from the .lib)
set_clock_uncertainty
Subtract 0.2 ns from each cycle for skew/jitter you do not model yet.
ns
set_input_delay
Logic outside this block already used 1 ns of the cycle, so inside paths get 10 − 1 − 0.2 = 8.8 ns.
ns
set_output_delay
Logic outside needs 1 ns after this block's output, so internal-to-output paths also get 8.8 ns.
ns
set_input_transition / set_load
Realistic slew on inputs and capacitive load on outputs, so boundary cells are sized properly.
ns / pF
set_false_path
Do not time paths from reset (it is asynchronous; its release is handled by a reset synchronizer in a real chip).
—
Note: the clock port is deliberately not given an input delay — a clock is a reference, not data. That is why the ports are listed explicitly instead of using [all_inputs].
Edit the names. If the RTL uses rst_n rather than reset, change the constraint. A command that matches zero objects often leaves the design silently unconstrained — RC prints a warning such as Could not find port 'rst', which is easy to miss. Step 2.3 shows how to catch this.
What you should see
When RC reads the file (Step 2.2) the log shows Statistics for commands executed by read_sdc with every command counted, and no Could not find warnings.
report clocks later lists one clock, core_clk, period 10000 ps.
Troubleshooting — constraints that silently do nothing
get_ports clk returns nothing — the port name differs (e.g. clock). RC prints a warning, not an error, and every path becomes unconstrained. After reading the SDC, run report timing -lint (Step 2.3) and look for “unconstrained” endpoints.
Input delay applied to the clock port — the file above lists the data inputs explicitly. If you shorten it to [all_inputs], that collection includes clk itself; keep the explicit list (or use [remove_from_collection [all_inputs] [get_ports clk]]).
Units — RC reads SDC times in ns and capacitances in pF by default for this library; a 10 ps period written as 10 means 10 ns. Check with report clocks.
2.2
Read, elaborate, constrain and map
Why this stepThis converts behaviour into real library cells sized to meet the clock — the netlist every later stage builds on.
The only standard-cell library on your VM is the Encounter example kit GPDK045. Its slow corner — slow.lib, library name gpdk045bc, 1.08 V and 125 °C — gives the longest delays, so it is the right target for setup timing: if the design meets timing there, it meets it everywhere.
Create the script · shellgedit scripts/rtl_rc.tcl &
scripts/rtl_rc.tcl · Tcl# ================= RTL Compiler 12.10 synthesis: cnt_updown =================
set TOP cnt_updown
set ROOT [file normalize .]
source scripts/lib_paths.tcl
file mkdir reports
file mkdir results
# ---- 1. Tool verbosity and library (slow corner: gpdk045bc, 1.08 V, 125 C) ----
set_attribute information_level 7 /
set_attribute hdl_search_path [list $ROOT/rtl] /
set_attribute library [list $LIB_SLOW] /
# ---- 2. Read and elaborate the RTL ----
read_hdl -v2001 [list rtl/cnt_updown.v]
elaborate $TOP
check_design -unresolved
check_design -all > reports/check_design.rpt
# ---- 3. Apply constraints and lint them ----
read_sdc constraints/cnt_updown.sdc
report timing -lint -verbose > reports/timing_lint.rpt
report clocks > reports/clocks.rpt
# ---- 4. Synthesize in three passes ----
synthesize -to_generic -effort medium
synthesize -to_mapped -effort medium
synthesize -incremental
# ---- 5. Reports ----
report gates > reports/gates.rpt
report area > reports/area.rpt
report timing > reports/timing.rpt
report power > reports/power_vectorless.rpt
report qor > reports/qor.rpt
# ---- 6. Outputs for the next tools ----
write_hdl > results/cnt_updown_mapped.v
write_sdc > results/cnt_updown_mapped.sdc
puts "==== RC synthesis of $TOP finished. Type 'exit' to quit. ===="
Check the file · shellwc -l scripts/rtl_rc.tcl # must print 40
COMMAND
WHAT HAPPENS
set_attribute library
Loads the Liberty file: the menu of legal cells, their delays and power.
read_hdl
Parses the Verilog (syntax only).
elaborate
Builds the design hierarchy, infers flops, adders and muxes. After this the design is at /designs/cnt_updown.
Maps to real gsclib045 cells and optimizes for your SDC.
synthesize -incremental
Extra clean-up pass: fixes remaining violations, recovers area.
write_hdl / write_sdc
Gate-level netlist and constraints rewritten for that netlist — the inputs to Encounter.
ARun it
Run · shellcd /home/buet/cds_work/asic_lab
rc -files scripts/rtl_rc.tcl -logfile logs/rc_synth.log
# RC stops at the rc:/> prompt when the script ends. Inspect, then:
# exit
To run the same script and look at the result graphically, start rc -gui -files scripts/rtl_rc.tcl -logfile logs/rc_synth_gui.log (again without &). In the GUI, the HDL Viewer/Schematic tabs show the mapped gates.
What you should see
The log ends with ==== RC synthesis of cnt_updown finished ==== and no Error lines.
results/cnt_updown_mapped.v contains cell instances such as DFFRHQX1, ADDHX1, XOR2XL, MXI2XL (exact names depend on optimization).
reports/gates.rpt lists roughly 25–45 cells including 8 sequential cells.
Troubleshooting — RC errors
Error : Could not find library file — $LIB_SLOW in scripts/lib_paths.tcl is wrong. Run ls on the path; fix it.
Error : The design 'cnt_updown' was not found — elaborate failed earlier; scroll up for the first error (usually a Verilog syntax problem).
Warning : Port ... not found while reading SDC — a name in the SDC does not match the RTL. Fix the SDC; never ignore this warning.
"Cannot check out license" — the license file/server variable in Step 0.1 is wrong.
What changes physically
Operators become gates, muxes and flops. Cell selection creates real area, pin capacitance, leakage and delay. Wires are still estimates (a statistical wire-load model); placement and routing do not exist yet, so timing is optimistic-to-approximate.
ANNOTATED OUTPUTreports/gates.rpt and reports/area.rptillustrative — your exact numbers and names will differ
reports/gates.rpt and reports/area.rpt Gate Instances Area Library
---------------------------------------------
ADDHX1 6 30.8 gpdk045bc [1]
DFFRHQX1 8 65.7 gpdk045bc [2]
INVX1 3 2.1 gpdk045bc
MXI2XL 2 4.8 gpdk045bc
NAND2XL 4 5.5 gpdk045bc
XNOR2X1 5 15.4 gpdk045bc
---------------------------------------------
total 28 124.2 [3]
Type Instances Area Area %
-----------------------------------------
sequential 8 65.7 52.9 [4]
inverter 3 2.1 1.7
logic 17 56.4 45.4
-----------------------------------------
total 28 124.2 100.0
Half-adder cells: RC recognised count + 1 and built an incrementer chain (Chapter 2, D1–D2).
Exactly 8 resettable flip-flops — one per bit. Check this number first.
Total cell area in µm² — the areas here are the real GPDK045 footprints from gsclib045.lef (e.g. DFFRHQX1 = 4.8 × 1.71 µm = 8.208 µm²). This is the that, divided by utilization, sets the core size in Step 4.5.
Flops dominate the area of small designs — typical for counters and control logic.
2.3
Read the reports as evidence (and fix what they reveal)
Why this stepReports are only trustworthy if every path is constrained and no unintended hardware (latches, loops) was inferred.
Work through the reports in this exact order. Each one guards against a different silent failure.
1Timing lint — is every path actually constrained?
Open the lint report · shellless reports/timing_lint.rpt # q to quit, / to search
cat reports/clocks.rpt
The lint report is a list of categories, each followed by a count and the objects in it. A correct run of this lab shows 0 in every category except possibly "inputs with no clocked fanout" for reset (expected — it is a false path). Here is what each category means and exactly how to fix it:
LINT CATEGORY
WHAT IT MEANS
HOW TO FIX IT
Sequential clock pins without clock waveform
Flip-flops whose clock pin is not reached by any create_clock. Their timing is not checked at all.
Run report clocks. If it is empty, create_clock failed — usually the port is named differently (CLK, clock). Check with ls /designs/cnt_updown/ports_in in RC and fix the get_ports name in the SDC.
Inputs without clocked external delays
A data input has no set_input_delay, so its paths are untimed.
Add the port to the set_input_delay list. Never add one to the clock port itself.
Outputs without clocked external delays
An output has no set_output_delay.
Make sure [all_outputs] is used, or list the bus as [get_ports count*].
Unconstrained / timing exceptions with no effect
A set_false_path or similar matched nothing.
The object name is wrong; check spelling against the RTL.
Multiple clocks on a pin / generated clocks
Not expected in this single-clock design.
Remove duplicate create_clock lines.
After editing the SDC, rerun the whole script (Step 2.2) — RC does not reread a changed file automatically. Repeat until the lint report is clean.
2Log scan — did synthesis infer something you did not intend?
Search the log for structural problems · shellgrep -inE "latch|unresolved|multiple driver|combinational loop|undriven|black ?box" logs/rc_synth.log
grep -c -i "^Error" logs/rc_synth.log
less reports/check_design.rpt
Inferred latch — an if without else or a case without default in a combinational block. Fix the RTL by assigning every output in every branch. (This counter has none.)
Unresolved reference — a submodule file was not read. Add it to read_hdl.
Multiple drivers — two always blocks assign the same signal. Merge them.
Combinational loop — an output feeds back to its own input without a flop. Break it with a register.
3Timing report — does the design meet 100 MHz?
Read the worst path · shellless reports/timing.rpt
The report shows the single worst path: a start point (a flop clock pin or an input), every cell it passes through with its incremental delay, and an end point (a flop D pin or an output). The last lines compare Required Time with Data Arrival. Slack = required − arrival. A positive slack (several ns here) means the path is fast enough; a negative slack (marked VIOLATED) means it is not.
If slack were negative: first confirm the constraints are sensible (a 1 ns period would be unrealistic for this library). Then try synthesize -to_mapped -effort high, or relax the period. Do not "fix" timing by deleting constraints.
4Area, gates and QoR
Open reports/gates.rpt and reports/area.rpt. Count the sequential cells: there must be exactly 8 (one per count bit). Fewer means bits were optimized away (check that outputs are really connected); more means unwanted registers.
5Confirm the cells come from the right library
In the GUI use Tools → Object Browser, expand libraries, and confirm only one library — gpdk045bc, i.e. slow.lib — is loaded and the netlist cells belong to it. From the command line:
The library used — gpdk045bc is the library name inside slow.lib (operating condition slow: 1.08 V, 125 °C). It must be the slow corner for setup analysis.
Wires are estimated by a wire-load model (Chapter 2 theory, D7).
Columns: Fanout and Load are what the cell drives; Slew its output transition; Delay this stage; Arrival the running total.
The launching clock edge at time 0 — the start of the path (an Rising edge).
Clock-to-Q of the launching flop: = 281 ps. Each following line adds one gate of .
The endpoint (<<<): data arrives at 573 ps = .
The setup requirement of the capturing flop: 112 ps.
The capturing edge one period later (10 000 ps) minus 200 ps uncertainty → 9 800 ps.
Slack = 9 800 − 112 − 573 = 9 115 ps. Positive → met. Notice it is exactly the setup inequality from the theory card.
CheckpointLint is clean, no latches/unresolved/multi-driver messages, 8 sequential cells, positive slack, and results/cnt_updown_mapped.v plus .sdc exist.
2.4
Re-simulate the mapped netlist (gate-level simulation)
Why this stepProves synthesis preserved function; any mismatch here is far cheaper to fix than after layout.
Synthesis tools are very reliable, but your constraints and RTL style can still produce a netlist that behaves differently (a classic example is an RTL simulation/synthesis mismatch from an incomplete sensitivity list). The rule is simple: the same self-checking testbench must pass on the gates.
AUse the generated cell models
The netlist instantiates library cells; the simulator needs a Verilog model for each one. The GPDK045 kit ships none (Step 0.2), so you generated libs/gsclib045_cells.v from slow.lib in Step 0.5. Check that every cell type in the netlist has a model, then simulate.
Every netlist cell must have a model · shellcd /home/buet/cds_work/asic_lab
source setup_cadence.sh
CELL_VLOG=libs/gsclib045_cells.v
ls -l $CELL_VLOG # created in Step 0.5
for c in $(grep -oE "^ *[A-Z][A-Z0-9]+ " results/cnt_updown_mapped.v | sort -u); do
grep -qE "^module $c[ (;]" $CELL_VLOG || echo "NO MODEL: $c"
done; echo "model check done"
-nospecify -notimingchecks ignore the cell delays; this run checks function only. Real delays are added after routing (Step 7.2).
-timescale 1ns/1ps supplies a default for the RC netlist, which has no `timescale (the generated model file declares its own).
The RTL file is not on the command line: the mapped netlist replaces it (both define module cnt_updown).
Troubleshooting — gate-level simulation
*E,CUVMUR: instance of module/UDP 'DFFRHQX1' is not defined — $CELL_VLOG is empty in this terminal (set it again) or Step 0.5 was skipped. grep -c "^module DFFRHQX1" libs/gsclib045_cells.v must print 1.
All count bits are x — usually a flop without reset in the netlist, or reset not reaching it. Check that the netlist flops have an RN/R pin connected to reset (or its inverse).
"Duplicate module cnt_updown" — you passed both RTL and netlist. Remove the RTL file.
What you should see
The model check prints only model check done (no NO MODEL: lines).
The log lists libs/gsclib045_cells.v being compiled (hundreds of module worklib.…:v lines), then the netlist, then the testbench.
PASS: 32 cycle checks matched, final count = 3 and $finish at 350 NS — identical to the RTL run. (This exact flow — models generated by the script, a mapped netlist, this testbench — was checked before publishing and prints the same PASS line.)
CheckpointEvery sequential element is mapped, timing paths are constrained, and the gate-level simulation prints the same PASS line as the RTL simulation.
✔ Chapter recap
Commands in order
Chapter commands, in order (condensed — every option is in the steps)gedit constraints/cnt_updown.sdc scripts/rtl_rc.tcl &
rc -files scripts/rtl_rc.tcl -logfile logs/rc_synth.log # then: exit
less reports/timing_lint.rpt reports/timing.rpt
grep -inE "latch|unresolved|multiple driver|loop" logs/rc_synth.log
irun -nospecify -notimingchecks -timescale 1ns/1ps -logfile logs/irun_gate.log \
libs/gsclib045_cells.v results/cnt_updown_mapped.v tb/tb_cnt_updown.v
What you should now have
FILE
WHAT IT IS
results/cnt_updown_mapped.v
Gate-level netlist
results/cnt_updown_mapped.sdc
Constraints for Encounter
reports/timing*.rpt, area.rpt, gates.rpt
Synthesis evidence
logs/irun_gate.log
Gate-level PASS
? Check yourself
Q1Slowing the clock (larger T) can fix…
T appears only in the setup inequality; hold must be fixed by adding delay to short paths.
Q2A port name in the SDC is misspelt. The most likely effect is…
Commands that match zero objects only warn; the timing-lint report is how you catch it.
Q3STA runs in time linear in the design size because…
AT(v) = max over fan-in of AT(u)+d(u,v) — each edge is visited once per pass.
Q4In the STA forward pass, a gate’s arrival time is the…
For setup, the output is not final until the latest input has arrived.
⚠ Common mistakes in this chapter
Port names in the SDC that do not match the RTL — the constraint silently does nothing.
Putting set_input_delay on the clock port.
Trusting the slack before reading the lint report.
Editing the SDC but not rerunning the whole RC script.
Simulating the netlist and the RTL together (duplicate module).
CHAPTER 3
Generate activity and estimate early power
Goal: replace guessed toggle rates with behavior from simulation.
You start withThe RTL snapshot and the mapped netlist
You end withactivity/dut.tcf and an activity-annotated power report
Toolsncsim, rc
Time≈ 30 min
THEORYWhere the power goes in CMOS≈ 8 min read
T1Three kinds of power
COMPONENT
CAUSE
DEPENDS ON
Switching
Charging and discharging wire + pin capacitance
Activity, C, V², f
Internal (short-circuit)
Inside a cell during a transition both transistor stacks conduct briefly; internal nodes switch
Activity, input slew
Leakage
Transistors never fully turn off
Cell type, temperature, V — not activity
Where the counter’s ≈ 1.52 µW goes (slow corner, 100 MHz, from the Step 3.3 report). Flop internal power dominates because every clock pin toggles every cycle, whether or not the count changes. Switching power in the logic and wires is smaller, and leakage is a sliver at this node and temperature.
RC calls switching + internal together dynamic power.
T2Where α·C·V²·f comes from
Every 0→1→0 cycle of a gate output costs one C·V² from the supply.
Pswitching = α · C · VDD² · f
α = fraction of clock cycles in which the net switches (0…1)
Worked example: α = 0.5, C = 2 fF, V = 0.9 V, f = 100 MHz → 0.5 × 2×10⁻¹⁵ × 0.81 × 10⁸ = 8.1×10⁻⁸ W = 81 nW for one net. A chip has millions of nets.
T3Activity is the term you can measure
C comes from the library and layout, V and f from the spec — but α depends on the workload. A counter shows this beautifully: bit 0 toggles every cycle, bit 1 every other cycle, bit 7 almost never.
Real activity of each counter bit vs. a flat default guess — the reason a TCF changes the dynamic-power number.
Toggle rate — how many transitions per unit time (or per clock).
Static probability — fraction of time the net is 1. Leakage of some cells depends on it.
T4Activity file formats
FORMAT
CONTENT
TYPICAL USE
VCD
Every change with its time (big)
Waveforms, time-based (dynamic) power
TCF
Per net: toggle count + probability (small)
Cadence average power (this lab)
SAIF
Same idea as TCF
Synopsys tools (Chapter 8)
From a full waveform dump to a compact activity file. A VCD stores every change with its time, so it grows with simulation length. TCF and SAIF keep only, per net, how often it toggled and how long it spent at 1, a fixed-size summary. Power tools need exactly that and nothing more.
T5The levers designers pull
LEVER
EFFECT
Lower VDD
Quadratic saving, but cells get slower
Clock gating
Stops α on idle registers (the “Clock Gating Awareness” option in Chapter 4)
Smaller cells / shorter wires
Lower C
High-Vt cells
Less leakage, slower — used on non-critical paths
Switching power scales with . Dropping the supply from 0.9 V to 0.8 V alone saves about 21 %. That is why voltage is the strongest power lever, and why it is limited by the slower gates it causes.
DEEP DIVE deriving the power equation
D1Energy drawn from the supply in one 0→1 transition
While the output charges from 0 to , the supply delivers current at constant voltage :
Energy in one charge–discharge cycle, as areas on a charge–voltage plot. The supply delivers charge at constant voltage : energy (the rectangle). The capacitor stores only the triangle, ; the other half is dissipated in the PMOS while charging. The stored half is burnt in the NMOS on discharge.
The energy that ends up stored on the capacitor is
The other is dissipated as heat in the PMOS resistance — independent of how large that resistance is. On the 1→0 transition the stored half is dissipated in the NMOS. Net result: one full charge/discharge cycle costs .
D2From energy to average power
If the node makes a 0→1 transition in a fraction of the clock cycles per second:
Counting activity on one node over eight cycles. Two rising transitions give , the factor in . Tools often report the toggle rate instead, which counts both edges (4/8 = 0.5 here). Mixing the two definitions is a common factor-of-two error.
Watch the convention. Tools often count toggles (both 0→1 and 1→0). With toggle rate (toggles per cycle), , so . Many textbooks write for this reason — both are the same physics.
D3The counter’s total activity — a neat result
While counting continuously, bit toggles once every cycles, so . Summing over all bits:
Total toggles per clock in an n-bit counter. Bit 0 toggles every cycle, bit 1 every second cycle, bit 2 every fourth, and so on. The geometric series approaches 2, so even a wide counter flips only about two bits per clock on average.
An -bit binary counter flips on average fewer than two bits per clock, no matter how wide it is — 1.992 for 8 bits. A flat default guess of, say, on every one of the 8 outputs would predict 1.6 toggles per cycle and put them in the wrong places (too many on the high bits, too few on bit 0). That is the quantitative reason the TCF changes the report.
D4Leakage is exponential
Below threshold a transistor still conducts a sub-threshold current:
Subthreshold current on a log scale. Below the current falls by one decade for every ~90 mV of gate voltage. A low- transistor (shifted by 90 mV) is faster but leaks about 10× more at . Hence the multi- libraries that tools mix per path.
With , lowering by just increases leakage 10×. Temperature raises and lowers , so leakage climbs steeply when the chip is hot. This is why libraries offer high- cells (slower, far less leaky) and why leakage reports must state the corner.
D5Try it: dynamic power calculator
Notice the : dropping from 0.9 V to 0.8 V saves 21 %, more than a 20 % frequency reduction would.
D6Short-circuit power and why slew limits exist
While the input of an inverter ramps between and , both transistors conduct and current flows straight from supply to ground. For a symmetric inverter with input rise/fall time (Veendrick’s result):
Short-circuit current. While a slow input ramp sits between and , both the PMOS and NMOS conduct and current flows straight from supply to ground. The longer the input slew, the wider this window. This is why tools enforce a maximum transition time.
Short-circuit power grows linearly with input slew. Slow edges waste energy as well as time — one reason libraries and tools enforce a max_transition design rule (the DRV column in optDesign reports). Note also: if the term vanishes, as both devices can never be on together.
D7Clock power and clock gating
The clock toggles every cycle (, ), so the clock network is often 30–50 % of dynamic power:
An integrated clock-gating cell. A latch, transparent while the clock is low, captures the enable. It is ANDed with the clock, so gclk pulses are removed cleanly while en = 0, with no glitches even if en changes mid-cycle. Every flop behind the ICG stops burning clock power.
If a group of registers is idle a fraction of the time, an integrated clock-gating cell stops their clock in those cycles, saving roughly of their clock-pin and local-tree power (minus the gating cell’s own power). For this counter, enable is exactly such a signal: synthesis could gate the 8 flops’ clock with it instead of using a mux to hold the value.
D8Glitches: activity that does nothing useful
If two inputs of an XOR change at the same clock edge but arrive apart, the output goes 0 → 1 → 0: two extra transitions, real energy, no logical effect. The effective activity is
A glitch from unequal arrival times. A and B both switch, but B arrives later, so A ⊕ B briefly goes to 1 and back. The final value is unchanged, but the two extra transitions still cost . Balanced path delays reduce glitch power.
A glitch survives only if exceeds the gate’s inertial delay (Chapter 1, D6). Glitch power is worst in deep arithmetic (adders, multipliers) where path depths differ, and is reduced by path balancing or by registering intermediate results. Zero-delay RTL simulation sees no glitches at all — another reason post-layout, delay-annotated activity gives a better power estimate.
D9Energy per operation and the stack effect
For computation, energy per operation matters more than power:
The stack effect. A single OFF transistor sees the full . In a series stack of two OFF transistors the middle node floats up to tens of millivolts. The upper device then has a negative and a smaller , both of which enter the exponent of the leakage equation, so stacks leak 5–10× less.
The dynamic part is independent of frequency; the leakage part grows as the clock slows (each operation takes longer while leakage keeps flowing) — so running too slowly also wastes energy. Leakage itself is reduced by the stack effect: two series OFF transistors leak much less than one, because the intermediate node rises a little, making of the upper device negative and reducing its — both enter the leakage equation exponentially (D4).
Remember
Dynamic = α·C·V²·f; leakage ignores activity.
Simulation gives α; without it, power is a guess.
Pre-layout power is for comparison, not signoff.
3.1
Understand the activity path
Why this stepUnderstanding the data flow tells you which file feeds which number in the power report.
The report power you ran in Step 2.2 was vectorless: RC assumed a default toggle rate for every net, so the dynamic-power number is a guess. To make it realistic you record how often each net really toggles while running a representative workload, save it as a TCF (Toggle Count Format) file, and give that to RC. TCF records toggle rate and static probability for each net. RTL Compiler combines activity with cell power tables and the clock definition.
Read the diagram left to right: the testbench drives the design in NCSim, a Tcl command (dumptcf) counts toggles inside the DUT, and RTL Compiler reads the resulting TCF together with the library and constraints to produce the power report.
The core equation
Dynamic power is approximately αCV²f. TCF supplies activity α (how often a net switches per clock); Liberty supplies cell capacitance/power and the supply voltage V; the constraints supply frequency f. Leakage power is independent of activity and comes straight from the Liberty tables.
3.2
Run NCSim and dump the DUT activity
Why this stepReal switching activity replaces a guess, and it must come from the DUT, not the testbench.
AWrite the TCF script
The VT course gives you a script called dumptcf.tcl. Here is a complete version for this testbench. It starts counting toggles inside dut only (not the testbench), runs the simulation to just before $finish (the testbench finishes at 350 ns, so the script stops at 345 ns), and writes the file.
dumptcf.tcl · NCSim Tcl# Count toggles of every net inside the DUT and write them to a TCF file.
# The testbench calls $finish at 350 ns, so stop at 345 ns and close the file first.
dumptcf -scope tb_cnt_updown.dut -output activity/dut.tcf -overwrite
run 345 ns
dumptcf -end
puts "TCF written to activity/dut.tcf"
Save it in the project root · shellcd /home/buet/cds_work/asic_lab
gedit dumptcf.tcl &
Why stop at 345 ns?$finish runs at 350 ns and ends the simulator; commands after it in the script would never run, and the TCF would not be closed (a run 370 ns would hit $finish first). Stopping 5 ns earlier captures the whole workload — the last counting edge is at 335 ns.
BOpen NCSim in GUI mode on the snapshot from Step 1.5
NCSim · shellncsim -gui worklib.tb_cnt_updown:module
# :module is the view name your ncelab printed in Step 1.5 (the course used :v)
# "*F,NOSNAP" means Step 1.5 was not run in this folder: rerun its ncvlog + ncelab lines
SimVision opens attached to a live simulation, stopped at time 0. The Console window at the bottom has an ncsim> prompt where Tcl commands are typed.
CSource the script in the console
Click in the ncsim> console and type the command below, then press Enter. The script runs reset, idle, up-count, down-count and rollover intervals — all the phases from Step 1.1 — so the activity is representative.
NCSim console · Tclsource dumptcf.tcl
The console prints the TCF message and the current simulation time (345 ns). Close SimVision afterwards, then inspect the file:
Check the TCF · shellls -l activity/dut.tcf
head -40 activity/dut.tcf
What a good TCF looks like
A header with duration, then an instance("tb_cnt_updown.dut") block listing nets such as "count[0]" : "… …" (toggle count and probability). count[0] toggles most; count[7] only a couple of times — exactly what a counter should do.
Troubleshooting — empty or missing TCF
File not created — the simulation ended before dumptcf -end (the console shows Simulation complete via $finish); keep the run time below 350 ns. Also make sure the activity/ folder exists.
Scope not found — the snapshot was elaborated without -access +rwc, or the instance path is different. Type scope -list in the console to see the exact names.
Checkpointactivity/dut.tcf exists and its hierarchy corresponds to the DUT instance—not only the testbench clock generator.
3.3
Annotate activity in RTL Compiler
Why this stepAnnotating activity is what makes the dynamic-power figure meaningful enough to compare design versions.
Rerun synthesis exactly as before, but read the TCF before reporting power. Create a small wrapper script so the original stays untouched:
scripts/rc_power.tcl · Tcl# Re-run the full synthesis script, then annotate real activity and report power
source scripts/rtl_rc.tcl
read_tcf -instance tb_cnt_updown.dut activity/dut.tcf
report power > reports/power_tcf.rpt
report power -verbose > reports/power_tcf_verbose.rpt
puts "==== Power with simulation activity written to reports/power_tcf.rpt ===="
Run and compare · shellrc -files scripts/rc_power.tcl -logfile logs/rc_power.log
# (type exit at the rc:/> prompt)
grep -iE "asserted|annotat" logs/rc_power.log
diff reports/power_vectorless.rpt reports/power_tcf.rpt
In the GUI you can see the same result through the power-estimation view: the RC window shows the design with leakage, dynamic (internal + switching) and total power per instance.
How to read the comparison
The log reports the percentage of nets whose activity was asserted from the TCF. It should be close to 100 %.
Leakage is nearly identical in both reports (it does not depend on activity).
Dynamic power changes, because real toggle rates (high bits rarely toggle) replace the default guess.
Troubleshooting — 0 % of nets annotated
The -instance name must match the instance name written inside the TCF. Open the file (head activity/dut.tcf) and copy the exact string after instance(. Try in turn: -instance tb_cnt_updown.dut, -instance tb_cnt_updown/dut, -instance dut. The right one makes the annotation percentage jump.
This is not signoff power. The clock tree, routed capacitance, coupling, actual slew and IR drop do not exist yet. Use the result to compare versions and catch gross mistakes (e.g. a counter that is always enabled).
ANNOTATED OUTPUTreports/power_tcf.rptillustrative — your exact numbers and names will differ
reports/power_tcf.rpt Instance Cells Leakage Dynamic Total
Power(nW) Power(nW) Power(nW)
---------------------------------------------------------
cnt_updown 28 1.840 1520.311 1522.151 [1]
Asserted activity: 100.0% of nets [2]
Type Leakage Internal Switching Total [3]
---------------------------------------------------------
sequential 1.070 980.4 140.2 1121.7
logic 0.770 260.1 139.6 400.5
Total for the block. Dynamic power dwarfs leakage at the slow corner and 100 MHz.
All nets got their activity from the TCF — if this is low, revisit the -instance option.
Breakdown: internal power of the flops is large because their clock pins toggle every cycle (Chapter 3, D7) — even when enable = 0.
Checkpointreports/power_tcf.rpt exists, annotation is near 100 %, and you can explain why its dynamic power differs from the vectorless report.
✔ Chapter recap
Commands in order
Chapter commands, in order (condensed — every option is in the steps)gedit dumptcf.tcl &
ncsim -gui worklib.tb_cnt_updown # in the console: source dumptcf.tcl
head -40 activity/dut.tcf
rc -files scripts/rc_power.tcl -logfile logs/rc_power.log # then: exit
diff reports/power_vectorless.rpt reports/power_tcf.rpt
What you should now have
FILE
WHAT IT IS
activity/dut.tcf
Switching activity of the DUT
reports/power_tcf.rpt
Activity-annotated power
? Check yourself
Q1Halving the supply voltage changes switching power by a factor of…
P ∝ V².
Q2On average, how many bits of a long binary counter flip per clock?
Σ 2−i = 2(1 − 2−n) → 2.
Q3Which power component is independent of switching activity?
Leakage flows whether or not the gate switches; it depends on Vt, temperature and supply.
⚠ Common mistakes in this chapter
Dumping TCF for the testbench scope instead of tb_cnt_updown.dut.
Letting $finish run before dumptcf -end — the file is never closed.
Reading a TCF with the wrong -instance and accepting 0 % annotation.
Treating pre-layout power as a signoff number.
CHAPTER 4
Physical implementation in Encounter 13.10
Goal: create a legal, powered, placed, clocked and routed layout.
You start withMapped netlist + SDC, LEF, Liberty, (QRC)
You end withA placed, clock-tree-built, routed and verified layout saved as cnt_updown_postRoute.enc
Toolsencounter, NanoRoute
Time≈ 2 h the first time
THEORYTurning a netlist into geometry≈ 18 min read · one section per stage, read each before its step
T1Floorplan anatomy → Steps 4.5–4.9
Die, core, power ring, stripes, rails and pins — every word used in Steps 4.5–4.9.
Die — the whole piece of silicon. Core — the inner area where standard cells go. Margin — space between them for the ring and pins.
Rows — horizontal slots exactly one cell high; each row is divided into sites (the smallest width step).
Utilization = total cell area ÷ core area. At 0.72, 28 % of the core stays empty for buffers, clock tree and routing detours.
Example: 40 cells totalling 72 µm² at 0.72 utilization → core area 100 µm² → a 10 µm × 10 µm square (aspect ratio 1).
T2Rows, rails and special cells → Steps 4.9, 4.10, 4.14
Alternate rows are mirrored so two rows share one VDD or VSS rail. Gaps become filler cells.
CELL
WHY IT EXISTS
Filler
Keeps the N-well, implant layers and power rails continuous across gaps (a broken well is a DRC error).
Tie-high / tie-low
Gives a logic constant through a transistor instead of wiring a gate input straight to VDD/VSS (ESD and reliability).
Decap
A capacitor between VDD and VSS that supplies charge locally during switching, reducing dynamic IR drop.
T3The metal stack → Steps 4.7, 4.8, 4.13
Cross-section above the transistors. Each layer has a preferred direction; vias connect neighbouring layers.
Alternating preferred directions (horizontal, vertical, …) let the router cross nets without collisions.
Lower metals are thin and dense: great for short local wires, but high resistance.
Top metals are thick: low resistance — so the power grid and clock use them. That is why the ring and stripes go on the top two layers.
On your VM: the diagram shows a generic ten-layer stack; gsclib045.lef has nine routing layers (Metal1 horizontal … Metal9 horizontal). Its top two layers are therefore Metal9 (horizontal) and Metal8 (vertical) — the layers used in Steps 4.7–4.8.
Current flows from the supply down this chain. Every piece has resistance, so voltage is lost along the way (IR drop, Chapter 7). More/wider stripes = less drop but fewer tracks left for signals.
The power grid as a resistor network. Current flows from the pad through the ring, down the stripes and along the Metal1 follow-pin rails into each cell. Every metal segment has resistance, so the farther a cell is from the pad (counting through the grid), the lower its supply voltage. More stripes mean more parallel paths and less IR drop.
T5Placement → Steps 4.10–4.11
Global placement — spreads cells to minimise total wire length, estimated as the half-perimeter of each net’s bounding box (HPWL). Cells that talk a lot end up close.
Legalization — snaps every cell onto a row and site with no overlaps.
Detailed placement — local swaps and shifts to improve further.
Encounter’s placer is timing-driven (pulls critical-path cells together) and congestion-driven (avoids packing too many nets in one area).
What placement optimises. The same ten cells and nine nets are shown placed randomly (left) and after wire-length-driven placement (right). Connected cells are pulled next to each other, cutting total wire length by more than half. Shorter wires mean less capacitance, less delay, less power and an easier routing job.
T6Clock tree synthesis → Step 4.12
Until now the clock was ideal. In reality one clk pin must drive every flop, through wires and buffers. CTS builds a balanced buffer tree.
The ideal: an H-tree. Real CTS builds a balanced tree that follows where the flops actually are.
Latency (insertion delay) — time from clock pin to a flop.
Skew — difference in latency between two flops. CTS minimises skew.
Skew enters the STA equations: if the capture flop’s clock is late, setup gets easier but hold gets harder — this is why hold is fixed only after CTS.
T7Routing → Step 4.13
Global routing divides the chip into tiles (gcells) and decides which tiles each net passes through, balancing demand against available tracks.
Track assignment picks actual tracks.
Detailed routing draws exact wires and vias that obey every spacing/width rule.
A congestion map: red gcells need more tracks than exist, forcing detours. Trial Route shows this map quickly.
Trial Route = a fast global-only estimate (for checking congestion). NanoRoute = the real global + detailed router.
T8Wires are resistors and capacitors → Steps 4.13, 7.1
A routed wire behaves as a chain of R and C; coupling to neighbours adds crosstalk.
Wire delay grows roughly with R × C, and both grow with length — so delay grows with length². Long nets get buffers inserted to break them up.
Capacitance to a neighbouring wire (Cc) means a switching neighbour can speed up, slow down or glitch your net: signal integrity (SI). “SI driven” routing spaces sensitive nets apart.
After routing, extraction computes these R and C values; that is when timing becomes accurate.
T9Why optDesign runs three times
STAGE
CLOCK
WIRES
MAINLY FIXES
pre-CTS
Ideal
Estimated (from placement)
Setup, max transition/cap/fanout
post-CTS
Real tree
Estimated
Setup and now hold
post-Route
Real tree
Extracted R/C
Final setup/hold, SI
Each optDesign stage sees more reality than the last. Pre-CTS, the clock is ideal and wires are estimated. Post-CTS, the real clock tree (and therefore skew and hold) appears. Post-route, wires are extracted. Slack usually gets worse at each stage, and each run repairs what the new information revealed.
DEEP DIVE the algorithms and physics behind each stage
D1Sizing the die from utilization → Step 4.5
For total cell area , utilization , aspect ratio 1 and margin on each side:
This lab’s floorplan to scale. A 10 µm core inside a 210 µm die is only 0.2 % of the area, which is why the core looks like a speck in Encounter. The zoom shows the alternating VDD/VSS rails and the cells sitting in rows at 72 % utilisation.
This lab: , → . With : . The core is only of the die — that is why your floorplan looks like a speck inside a big empty square. Real chips use margins of a few µm around much larger cores.
D2How the placer decides where cells go → Step 4.11
The objective a placer optimises is wirelength. The exact measure for one net is the half-perimeter of its bounding box:
Quadratic placement as a system of springs. A cell connected to a fixed pin at x = 0 (weight 1) and one at x = 10 (weight 3) settles where the spring forces balance: at the weighted average, x = 7.5. Making a net more critical means giving it a stiffer spring.
HPWL has kinks (max/min), so analytical placers first minimise a smooth quadratic substitute where every two-pin connection acts like a spring of stiffness :
Solving gives each movable cell at the weighted average of its neighbours; for all cells at once it is a sparse linear system (same for ).
1-D example: a cell wired to a fixed pin at (weight 1) and to one at (weight 3, e.g. a critical net): . Raising the weight of timing-critical nets is exactly how “timing-driven” placement pulls critical cells together.
The quadratic solution piles cells in the middle, so the placer then spreads them to respect density, legalizes them onto rows and sites, and refines with local swaps.
D3Wire delay: the Elmore model, explained and worked
After routing, a net is a tree of wire segments, each with some resistance and some capacitance to ground. The Elmore delay is the standard way to turn that tree into one number per receiver. The rule is easy to say:
To find the delay to a node, go along the path from the driver to that node. For every resistor on the path, multiply its resistance by all the capacitance downstream of it (everything it has to charge). Add the products.
Why it works. Current to charge a capacitor must flow through every resistor between it and the driver, so a capacitor near the far end “sees” the whole path resistance, while one right at the driver sees almost none. Formally, is the first moment (the mean) of the node’s impulse response — a good estimate of the time constant, and for a single RC it equals exactly.
A driver feeding two receivers through a branching net.
Worked example. R1 is on the path to both sinks and has all three capacitors downstream: ps.
To sink A we also cross R2, which only charges C2: ps → ps.
To sink B we cross R3, which only charges C3: ps → ps.
Note that C3 slows down sink A too (through R1) even though it sits on the other branch — every load on a net costs every receiver something.
A uniform wire
Now let the tree be one straight wire of length with ohms and farads per unit length. Cut it into tiny slices of length . The slice at position has resistance , and everything beyond it — length — is downstream, capacitance . Summing (integrating) the products:
Adding a driver of resistance (which charges the whole wire and the receiving pin ) and the wire’s own charging of :
The middle term is the important one: doubling a wire’s length quadruples its own delay, because both its resistance and its capacitance double. (For a 50 % delay rather than a time constant, multiply a lumped RC by 0.69 and a distributed wire’s by about 0.76, giving .)
D4Why tools insert buffers on long wires
The term means long wires get disproportionately slow. The cure is to cut the wire into equal pieces and put a buffer (repeater) in front of each piece. Each buffer costs a fixed delay , but each piece is now only long, so its own delay is :
More buffers make the first term grow and the second shrink. The best is where the curve bottoms out — set the derivative to zero:
Substituting back, both terms become equal (a sign the balance is optimal) and
With optimal buffering, delay grows linearly with length instead of quadratically.
Normalised delay vs wire length (, ): unbuffered against optimally buffered . Beyond buffering wins, and the gap grows fast.
Rule of thumb: the critical length beyond which buffering pays is where . In 45 nm on mid-level metal it is a few hundred microns — this counter has no wire that long, so optDesign adds few or no buffers. A large chip has thousands.
D5IR drop along a rail — and why stripes help → Step 4.8
Model a cell rail of length (resistance per unit length) drawing uniform current per unit length, fed with at both ends. Current conservation and Ohm’s law give
The worst point is the middle: . Fed from one end only, the worst drop is — four times worse.
Drop along a rail fed from both ends (parabola) vs one end. Stripes every µm replace by : halving the stripe pitch cuts the worst drop by 4×.
D6Clock skew, formally → Step 4.12
With the clock latency to flop :
Clock latency and skew. Each flop sees the clock after its own latency ℓ (wire plus buffer delay from the root). Skew is the spread between the latest and earliest, here 214.6 − 207.9 = 6.7 ps. That is the kind of number Encounter’s CTS report prints.
Only local skew between flops that talk to each other enters the setup/hold inequalities of Chapter 2. CTS minimises global skew because it bounds every local one. In an ideal H-tree all are equal by symmetry, so skew is zero.
D6bJitter and the clock-uncertainty budget
Skew is a spatial difference — two flops see the same edge at different times. Jitter is a temporal variation — the edges themselves are not perfectly evenly spaced, because of noise in the PLL that generates the clock and supply noise in the clock buffers.
Jitter: real clock edges scatter around their ideal positions (the Gaussian shows where one edge may land). The worst case for setup is a short cycle, a late edge followed by an early one. That is why part of the clock uncertainty in the SDC is reserved for jitter.
MEASURE
DEFINITION
MATTERS FOR
Period jitter
: how much one cycle differs from ideal
setup (a short cycle steals time)
Cycle-to-cycle jitter
PLL quality specification
Long-term jitter
drift of edge from its ideal time
I/O interfaces
For a single-cycle setup check, the danger is the shortest possible cycle, so the effective period is . Hold is checked on one edge, and jitter largely cancels (the same edge launches and captures). Independent random jitter sources add in quadrature:
This is what set_clock_uncertainty represents. Before CTS it must cover both future skew and jitter (the 0.2 ns in your SDC). After CTS the real skew is computed from the tree, so good practice is to reduce the uncertainty to jitter only — otherwise skew is counted twice and the design is over-constrained.
D7Congestion as a number → Step 4.13
Each gcell edge has a capacity = number of routing tracks crossing it (tile width ÷ track pitch, summed over the layers in that direction) and a demand = nets the global router wants through it. The router minimises
Congestion as numbers. The global router divides the chip into gcells. Each edge between neighbouring gcells has a capacity (tracks crossing it) and a demand (nets that want to cross). Orange edges are over capacity, and their excess adds up to the overflow (7 here) that detailed routing must resolve with detours.
Overflow left after global routing becomes detours or DRC violations in detailed routing — the reason Trial Route is used as an early warning.
D8Crosstalk changes delay
A wire with ground capacitance and coupling to a neighbour behaves as if its capacitance were
Why one net’s delay is a window. The coupling capacitance to a neighbour counts 0, 1 or 2 times depending on what the neighbour does at the same moment. 0× if it switches the same way, 1× if it is quiet, 2× if it switches the opposite way (the Miller effect). SI-aware timing analyses the worst case for critical nets.
So one net’s delay is not a single number but a window. SI-aware timing (the -routeWithSiDriven option) accounts for the worst on critical nets and spaces them apart.
D9Rent’s rule: how wiring demand scales
Empirically, a block of gates has a number of external connections
Rent’s rule on log–log axes. The number of external pins of a block grows as a power of its gate count, , which appears as a straight line of slope . Higher (more irregular logic) means more wiring demand per gate as blocks grow.
where is the average pins per gate and the Rent exponent. Donath showed that for the average wire length in a good placement grows as (in gate pitches). Bigger designs therefore need proportionally more long wires — the reason chips gained ever more metal layers and why top layers are reserved for long global nets.
D10Why utilization should not be pushed to 100 %
Routing demand in a region is roughly proportional to the pins in it. If a region has cells with pins each and the available tracks per unit area is fixed, raising utilization from to raises the local pin density by while track supply stays constant. From 0.72 to 0.95 that is +32 % demand on the same tracks — congestion overflow (D7) appears quickly, and there is no room left for the buffers that optDesign inserts. 60–80 % is the usual range for standard-cell regions.
Routing overflow against core utilisation (illustrative). Up to about 70 % there is room for detours and overflow stays near zero. Beyond that it rises steeply as cells crowd out routing space. Typical flows target 60–80 %, and this lab uses 72 %.
D11Partitioning: the Kernighan–Lin and Fiduccia–Mattheyses idea
Before or during placement the design is cut into halves to keep strongly connected cells together. For a cell in part A, let = edges to the other part, = edges inside its own part, and . Swapping with reduces the cut by
One Kernighan–Lin swap, with the numbers from the text. Cell a has three nets to part B and one inside A (D = 2). Cell b has two nets to A and none inside B (D = 2). They share one net, so swapping them reduces the cut by 2 + 2 − 2 = 2, from 4 nets to 2.
(the term corrects for an edge between them, which stays cut). KL repeatedly makes the best swap, locks the moved cells, and keeps the best prefix of the sequence; Fiduccia–Mattheyses moves single cells with bucket lists in linear time per pass. Encounter’s placer uses recursive partitioning and analytical methods built on these ideas.
Example: cell has 3 nets to part B and 1 inside A → . Cell has 2 nets to A and 0 inside B → . They share one net: . The cut shrinks by 2.
D12Simulated annealing: accepting bad moves on purpose
Greedy improvement gets stuck in local minima. Annealing accepts a move that worsens the cost by with probability
Simulated annealing’s acceptance rule . At high temperature even a costly move is often accepted, so the search can climb out of local minima. As the temperature falls the curve collapses and only improving moves survive.
High “temperature” early on lets the placement escape local minima; as it becomes greedy. It is slow but robust, and was the workhorse of classic placers (TimberWolf); modern tools use it for local refinement.
D13Maze routing (Lee’s algorithm) and Steiner trees
Detailed routing of one connection is a shortest-path search on a grid. Lee’s algorithm expands a breadth-first wavefront from the source, labelling each free cell with its distance, then backtraces from the target along decreasing labels. It always finds a shortest path if one exists, in for an grid. Try it — click cells to add blockages:
S = source, T = target · click a cell to toggle a blockage
A multi-pin net needs a rectilinear Steiner minimum tree (RSMT) — extra “Steiner” points may be added. Useful bounds:
HPWL equals the RSMT for nets of 2 or 3 pins, which is why it is such a good placement estimate; the minimum spanning tree (RMST) is never more than 50 % worse than the optimum (Hwang’s theorem). Finding the exact RSMT is NP-hard, so routers use fast near-optimal constructions.
D14Clock skew scheduling as a system of inequalities
Zero skew is not always best. For every launch–capture pair with path delays (including ), the setup and hold conditions of Chapter 2 become constraints on the clock arrival times :
Useful-skew scheduling as a constraint graph. Every setup or hold inequality becomes an edge u → v of weight c. Clock arrival times satisfying all of them exist exactly when the graph has no negative cycle, which Bellman–Ford checks.
Every inequality has the form — a difference constraint. Draw an edge of weight for each; the system is feasible if and only if this constraint graph has no negative cycle, and Bellman–Ford finds a solution (or the cycle) in . Binary-searching on gives the minimum clock period achievable with useful skew — which can be shorter than with zero skew when path delays are unbalanced.
D15Wire resistance in practice: sheet resistance
A wire of resistivity , thickness , width and length :
Counting squares. A wire’s resistance is : a strip four times as long as it is wide is four squares. Doubling the width halves the count. Square size does not matter, which is why sheet resistance is quoted in ohms per square.
Resistance depends only on the number of “squares” . Thick top metals have small , which is why power stripes live there.
Example: 100 µm of a 0.07 µm-wide Metal1 at : squares → 286 Ω. With about 0.2 fF/µm the wire has 20 fF, so its own Elmore delay is ps — negligible here, but it grows with : at 1 mm it would be ≈ 290 ps.
D16Latch-up, well taps and end caps
A CMOS inverter does not only contain two transistors. The p+ source of the PMOS, the n-well, the p-substrate and the n+ source of the NMOS form a four-layer PNPN stack — two parasitic bipolar transistors wired in a positive-feedback loop (a thyristor):
The parasitic PNP lives in the n-well, the NPN in the substrate. Each one’s collector drives the other’s base.
Normally both are off. But if a disturbance (an I/O overshoot, a radiation strike, a supply glitch) injects current into the substrate or well, it flows through the well or substrate resistance and raises the local potential. If that voltage drop reaches about 0.7 V it forward-biases a base–emitter junction:
Once triggered, each transistor keeps the other on; a low-resistance path from VDD to VSS forms and stays until power is removed — often destroying the chip.
The cure is to keep and small, so no realistic current can build up 0.7 V. That is done with frequent well taps (n+ contacts tying the n-well to VDD and p+ contacts tying the substrate to VSS). Since the resistance grows with distance to the nearest tap, the PDK sets a maximum spacing:
Older libraries put taps inside every cell. Most modern libraries are “tapless”: standalone tap cells must be placed in a regular checkerboard before standard-cell placement (Encounter: addWellTap), and end-cap cells close each row to protect the well edges. Step 4.10 shows how to check whether your library needs them.
Remember
Floorplan → power grid → place → CTS → route → optimize, each with more realism.
Top metals carry power and clock; Metal1 rails feed the cells.
Hold is only meaningful once the real clock tree exists.
Why this stepLaunching from the project root makes every relative path in the scripts resolve correctly.
Open a new terminal.
Enter Bash, return to the project, and load the same Cadence environment.
Confirm that the mapped netlist, SDC and physical libraries exist.
Launch Encounter in the background so the terminal remains usable.
Terminal · shellbash
cd /home/buet/cds_work/asic_lab
source setup_cadence.sh
ls results/cnt_updown_mapped.v results/cnt_updown_mapped.sdc
which encounter
encounter -log logs/encounter_gui.log
No &. Like RTL Compiler, Encounter reads Tcl from the terminal prompt encounter 1>; started in the background it is suspended and the window never appears (fg resumes it). Keep this terminal for Encounter and open a second one for other commands.
Two things appear: the Encounter main window (a black layout canvas with menus File, Edit, View, Partition, Floorplan, Power, Place, Optimize, Clock, Route, Timing, Verify, Tools) and, in the terminal, the encounter 1> Tcl prompt. Every GUI action is echoed as its Tcl command in the terminal and in encounter.cmd — a free way to learn the commands used in Chapter 5.
Why launch from the project directory
Relative paths in Tcl, saved design databases and reports resolve from the directory that started Encounter. Starting elsewhere is a common reason a correct script suddenly cannot find its LEF, Liberty or SDC files.
What you should see
The Encounter window opens with a black canvas, a menu bar and a layer panel on the right.
The terminal shows the banner Encounter v13.10-p003_1 (32bit) and the prompt encounter 1>; every GUI action you take from now on is echoed there.
BEncounter GUI survival kit
Spend two minutes learning the window before importing anything. The canvas responds to single keys when the mouse is over it:
KEY / CONTROL
WHAT IT DOES
f
Fit the whole design in the window
z / Z
Zoom in / zoom out (or right-drag a box to zoom into it)
Arrow keys
Pan
q
Show the attributes of the selected object (net name, layer, cell, coordinates)
k / K
Draw a ruler / clear all rulers — measure widths and spacings
Three view buttons (top right)
Floorplan view (blocks and rows), Amoeba view (module areas), Physical view (every cell and wire)
Layer panel (right)
Tick boxes to show/hide each layer and object type; toggle All Colors to isolate one metal
Bottom status bar
Cursor coordinates in µm — useful to check margins and the ring position
If the drawing ever looks stale after a command, press f or use View → Redraw.
CheckpointBoth result files are listed, and the encounter 1> prompt is waiting.
4.1
Insert I/O pads and rename pad-side nets (course step — decide whether you need it)
Why this stepDecides whether your chip connects to the outside through pads or plain pins; the rest of the flow depends on it.
A real chip connects its core to the package through I/O pad cells: large cells with ESD protection and strong drivers that sit on the die edge. An input pad receives a package-side signal and drives a distinct core-side net. An output pad receives the core result and drives the package-side pin. The VT course edits the synthesized netlist by hand to add them. The first screenshot is the synthesized module before editing:
The second shows the same module after pad insertion: the top-level ports now connect to pad instances, and new internal nets (for example clk_core) connect each pad to the original logic.
The first command prints nothing on your VM — the GPDK045 kit used in this lab has no pad cells. Do a core-only implementation: skip pad insertion, keep results/cnt_updown_mapped.v as-is, and Encounter places plain pins on the die boundary. Everything else in this chapter is identical. This is the path every script on this page uses.
The second command finds PROTO/…/GPDK045/lef/pdkIO.lef and timing/pdkIO.lib — an I/O library that belongs to Encounter’s separate prototyping example. It is not needed for this lab, and mixing an extra example library into the flow adds pad-ring and power-pad work that the course screenshots do not cover. Leave it alone.
Why rename constraints
After pad insertion, the old top-level port may be on the package side while the timed core endpoint has a new name. Update the SDC so delays attach to the intended boundary — otherwise Encounter reports "port not found" and your input/output delays silently vanish (the same trap as Step 2.3).
4.2
Prepare the MMMC view file, then import the design
Why this stepImport binds logical netlist, physical cells and timing views into one database.
AWrite the view definition (MMMC) file
Encounter 13 imports timing data through an MMMC (multi-mode multi-corner) file — the course calls it viewDefinition.view. It says which Liberty belongs to which corner, which SDC belongs to which mode, and which cap table models the wires. Create it now; the Import dialog loads it in Step 4.3, and the scripted flow in Chapter 5 reuses it. On your VM: setup uses slow.lib (gpdk045bc), hold uses fast.lib (gpdk045wc), and the RC corner uses $PDK45_TECH/capTable.
Create the file · shellgedit scripts/mmmc.tcl &
scripts/mmmc.tcl · MMMC view definition · Tcl# ---------- MMMC view definition for Encounter 13.10 ----------
source scripts/lib_paths.tcl
# Which SDC to time with: RC's functional SDC unless a caller (Step 6.5) chose another
if {![info exists SDC_FILE]} { set SDC_FILE results/cnt_updown_mapped.sdc }
# Library sets: one per corner
create_library_set -name LIB_SLOW -timing [list $LIB_SLOW]
create_library_set -name LIB_FAST -timing [list $LIB_FAST]
# Interconnect (RC) corner: the kit's cap table; the QRC tech file only if you enabled it
if {$QRC_TECH ne ""} {
create_rc_corner -name RC_TYP -cap_table $CAPTBL -qx_tech_file $QRC_TECH
} else {
create_rc_corner -name RC_TYP -cap_table $CAPTBL
}
# Delay corners = library set + RC corner
create_delay_corner -name DC_SLOW -library_set LIB_SLOW -rc_corner RC_TYP
create_delay_corner -name DC_FAST -library_set LIB_FAST -rc_corner RC_TYP
# Constraint mode = the SDC written by RTL Compiler
create_constraint_mode -name FUNC -sdc_files [list $SDC_FILE]
# Analysis views: slow corner for setup, fast corner for hold
create_analysis_view -name VIEW_SETUP -constraint_mode FUNC -delay_corner DC_SLOW
create_analysis_view -name VIEW_HOLD -constraint_mode FUNC -delay_corner DC_FAST
set_analysis_view -setup [list VIEW_SETUP] -hold [list VIEW_HOLD]
Check the file · shellwc -l scripts/mmmc.tcl # must print 28
BFill in the Basic tab of Import Design
In Encounter choose File → Import Design. On the Basic tab enter:
Replaces separate timing-library and SDC fields in 13.x.
In the course screenshot the timing libraries and constraint file (cnt_updown_syn.sdc) are entered here directly; in Encounter 13 the MMMC file supplies the same information, so leave the separate timing fields empty if your dialog shows them.
Troubleshooting — Import Design fails or the design loads empty
“ERROR: Cannot find cell … in LEF” — the LEF field is empty or points somewhere else. It must be exactly …/GPDK045/gsclib045.lef; every cell RC can use is in that one file.
“The view definition file … could not be sourced” — a Tcl error inside scripts/mmmc.tcl. Source it on its own in the Encounter console (source scripts/mmmc.tcl) to see the exact line; the usual cause is an empty $LIB_SLOW because lib_paths.tcl was not sourced first.
Top cell not found — the module name in the netlist differs from the Top Cell field (e.g. the course’s updown_counter). Use grep "^module" results/cnt_updown_mapped.v and type exactly that name.
Timing reports later say “no constrained paths” — the SDC path in create_constraint_mode is wrong or relative to a different directory. Encounter must be started from the project root (Step 4.0).
How the pieces fit The MMMC file is a small dependency tree: library sets (Liberty per corner) + an RC corner → delay corners; the SDC → a constraint mode; mode + delay corner → an analysis view. Setup is then checked in the slow view and hold in the fast view. Every later timing report names one of these views, so knowing the tree lets you read any report header.
CheckpointEvery path in the dialog points to an existing file (no red text, no "file not found" in the terminal when you browse).
4.3
Define power, MMMC and extraction (Advanced tab)
Why this stepPower nets, timing views and extraction models must be declared before any physical or timing step can run.
Still in Import Design, switch to the Advanced tab. It has a list of categories on the left; set three of them.
1Power
Select Power. Set Power Nets = VDD and Ground Nets = VSS. These match the power pins of every gsclib045 macro (the report shows PIN VDD … USE POWER and PIN VSS … USE GROUND on TIEHI, FILL1, INVX1, DFFRHQX1 …; check with grep -m4 "PIN VDD\|PIN VSS" $PDK45/gsclib045.lef).
2MMMC
Select MMMC. If the view-definition field is not already filled from the Basic tab, load scripts/mmmc.tcl here (the course loads viewDefinition.view).
3RC Extraction
Select RC Extraction (if your dialog shows it — with an MMMC file the RC corner already carries the same data). Set the Capacitance Table File to /home/buet/cadence/EDI/share/FoundationFlows/EXAMPLES/EDI/DESIGN/GPDK/TECH/capTable (= $CAPTBL) and leave the QRC Technology File empty (the course points to its TSMC 65 nm qrcTechFile).
Why not the QRC file?$PDK45_TECH/qrcTechFile describes an 11-metal stack (its strings mention Metal10 and Metal11) while gsclib045.lef has nine; it only works together with mapFile and the integrated QRC engine, and it is 201 MB. The cap table is made for this kit and is what Encounter’s native extractor uses (setExtractRCMode -effortLevel low). If you want to experiment later, set QRC_TECH in lib_paths.tcl to $TECH45/qrcTechFile; scripts/mmmc.tcl then adds it to the RC corner.
Three different models
Liberty models cell delay and power. LEF models abstract geometry. QRC models interconnect resistance and capacitance. They must describe the same process and metal stack.
What you should see
Each of the three Advanced categories shows your values when you click it again.
No red text in the file fields (red = file not found).
4.4
Save the import configuration and inspect the initial floorplan
Why this stepSaving the configuration makes re-imports one click; inspecting the import log catches missing cells early.
At the bottom of the Import Design dialog click Save… and save the settings as default.conf in the project directory. Next time you can click Load… and pick this file instead of retyping everything.
Click OK. Watch the terminal: Encounter reads the LEF, the netlist, the MMMC file and the SDC.
Inspect the loaded rows, pads and core boundary in the main window. Use View → Fit (key F) to fit the design.
The screenshot shows the course design right after import: a default floorplan with the pads around the edge and the unplaced standard cells stacked to the left of the core. In your core-only design you see only the core box with the cells beside it — that is normal; nothing has been placed yet.
Scan the import messages · shellgrep -nE "\*\*ERROR|\*\*WARN" logs/encounter_gui.log | head -40
Troubleshooting — import errors
**ERROR: (ENCVL-…) cell 'XYZ' not defined in LEF — the netlist uses a cell that has no physical view. Either a LEF is missing from the list, or synthesis used a library that does not match the LEF. Both must come from $PDK45.
Cannot find port 'xxx' while reading SDC — the SDC refers to a name not in this netlist. Use results/cnt_updown_mapped.sdc, not the RTL-level SDC.
Layers missing / "no routing layers" — the technology LEF was not first in the list, or was omitted.
ANNOTATED OUTPUTImport messages in the Encounter terminalillustrative — your exact numbers and names will differ
Import messages in the Encounter terminalReading LEF file .../GPDK045/gsclib045.lef ... [1]
**WARN: (ENCLF-200): Pin 'VDD' in macro 'FILL1' has no ANTENNA...
Reading verilog netlist 'results/cnt_updown_mapped.v'
Top level cell is cnt_updown. [2]
Hooked 28 DB cells to tlib cells. [3]
Reading MMMC file scripts/mmmc.tcl ...
Reading timing library '.../slow.lib' ...
Reading timing library '.../fast.lib' ...
Reading timing constraints file 'results/cnt_updown_mapped.sdc' [4]
INFO (CTE): Constraints read successfully.
*** Netlist is unique. [5]
Set DBUPerIGU to M2 pitch 400.
LEF read first: technology layers, then cell abstracts. Antenna warnings on filler cells are harmless.
The top cell you named — a wrong name here means nothing else will match.
Every netlist instance was matched to a timing cell. Any “unresolved” count must be zero.
The SDC from RC is read per constraint mode; errors here mean names in the SDC do not exist in the netlist.
Each instance has its own module definition — required before placement can resize cells individually.
CheckpointAll instances exist, pads are visible when used, and the tool reports no missing routing layers.
4.5
Size the core
Why this stepThe floorplan fixes the area every later step works inside; utilization trades wire length against routability.
Choose Floorplan → Specify Floorplan. The course uses a square core, 0.72 utilization, and 100 units of core-to-boundary spacing on all sides. Enter:
FIELD
VALUE
MEANING
Specify By
Size → Core Size by: Aspect Ratio
Let utilization decide the size.
Ratio (H/W)
1.0
Square core.
Core Utilization
0.72
72 % of row area filled by cells; 28 % left for buffers, CTS and routing detours.
Core Margins by
Core to IO Boundary
—
Core to Left / Right / Top / Bottom
100 each
Microns of empty space around the core for the power ring and pins.
Click OK. The die outline grows, the core box appears in the middle with horizontal standard-cell rows, and the I/O pins (or pads) move to the boundary:
Sanity check: hover over the core corners — the bottom-left status bar shows coordinates. The gap between core and die edge should read 100 µm on each side. For this counter (≈124 µm² of cells at 72 %) the core is only about 13–14 µm on a side — about eight rows of 1.71 µm — so the margin dominates the ≈214 µm die; that is fine for a lab.
Physical effect
Higher utilization shortens some wires but removes space for legalization, clock buffers and routing detours. The margin holds power rings and I/O connections.
What you should see
The die outline (outer box) and core boundary (inner box) appear with horizontal rows inside the core.
The unplaced cells still sit to the left of the die — placement has not happened yet.
The terminal echoes floorPlan -site CoreSite -r 1 0.72 100 100 100 100 — CoreSite (0.2 × 1.71 µm) is the only site in gsclib045.lef.
Troubleshooting — floorplan
“site not found” — the LEF did not load (check the import log); the site name must be exactly CoreSite.
Rows overlap the ring area later — the margins are too small for the ring width + spacing + offset; keep margins ≥ 2 × (width + spacing) + offset.
Core looks tiny inside the die — expected for this 28-cell design with 100 µm margins — see Chapter 4, D1.
4.6
Connect global VDD and VSS
Why this stepCells’ power pins are not in the netlist; without this step nothing is powered.
Each standard cell has its own VDD and VSS pins, but the netlist from synthesis does not connect them (logical netlists usually omit power). This step tells Encounter that every cell's VDD pin belongs to the global net VDD, and likewise for ground. Choose Power → Connect Global Nets and add two rules:
Rule 1: select Pins; Pin Name(s) = VDD; Instance Basename = *; To Global Net = VDD. Click Add to List.
Rule 2: Pin Name(s) = VSS; Instance Basename = *; To Global Net = VSS. Click Add to List.
(Recommended) Rule 3/4: select Tie High → To Global Net VDD, Add to List; Tie Low → VSS, Add to List. This connects any constant logic 1/0 in the netlist.
Click Apply, then Check, then Close.
Course dialog version. In the course’s release the dialog has a Pin Name(s) field, an Apply All check box and a To Global Net field: type VDD, tick Apply All (= every instance, the same as *), type VDD, Add to list; repeat for VSS; then Apply, Check, and close with Cancel.
Lines like N pgpin(s) connected to net VDD with N equal to your cell count, and no "pin not found" warnings.
Troubleshooting — global nets
“Pin VDD not found” — your library names its power pins differently. Open one cell in the LEF (grep -A3 "PIN VDD\|PIN VPWR\|PIN vdd" $PDK45/gsclib045.lef | head — on your VM every macro uses VDD/VSS, so this message means a typo) and use those names in the Pin Name(s) field.
The count of connected pins is smaller than the instance count — rule 1 was added but not applied. Click Apply before Check; the list on the left is only a draft until applied.
Later, verifyConnectivity reports unconnected power pins on fillers or tie cells — those cells were added after this step. Rerun the same globalNetConnect lines after addFiller/addTieHiLo (the script in Chapter 5 does this at the end).
CheckpointThe global-net check reports that power and ground pins are attached to the intended nets.
4.7
Build the core power ring
Why this stepThe ring distributes current around the core with low resistance.
Use Power → Power Planning → Add Ring. A ring is a pair of wide metal loops (one VDD, one VSS) around the core.
FIELD
COURSE VALUE (65 nm)
VALUE ON YOUR VM (GPDK045)
Net(s)
VDD VSS (click … and pick both)
Ring Type
Core ring(s) contouring → Around core boundary
Layer Top / Bottom (horizontal)
AP
Metal9 (= $H_LAYER; the top layer, HORIZONTAL)
Layer Left / Right (vertical)
M6
Metal8 (= $V_LAYER; the highest VERTICAL layer)
Width (all sides)
3 µm
Spacing (all sides)
4 µm
Offset → Specify
3 µm
The course's AP/M6 do not exist in GPDK045, and the dialog's layer drop-downs only list layers from your LEF: Metal1 … Metal9. Step 0.2 showed Metal9 is horizontal and Metal8 vertical, so use Metal9 for top/bottom and Metal8 for left/right. (There is no Metal10 — an earlier draft of this lab used it, and Encounter would stop with “layer not found”.) Click OK.
Equivalent Encounter Tclsource scripts/lib_paths.tcl
addRing -nets {VDD VSS} -type core_rings -follow core \
-layer [list top $H_LAYER bottom $H_LAYER left $V_LAYER right $V_LAYER] \
-width {top 3 bottom 3 left 3 right 3} \
-spacing {top 4 bottom 4 left 4 right 4} \
-offset {top 3 bottom 3 left 3 right 3}
What you should see
Two concentric rectangles around the core, each 3 µm wide, 4 µm apart, starting 3 µm from the core edge. Click one and press q to see its net name.
Physical effect
The ring spreads current around the core perimeter and gives stripes multiple low-resistance paths to the pads. Wider metal reduces resistance but consumes routing area.
Troubleshooting — the ring
The layer drop-down offers no Metal10 — correct for this LEF; it ends at Metal9. Metal9 = horizontal, Metal8 = vertical (grep -A2 "^LAYER Metal" $PDK45/gsclib045.lef | grep DIRECTION).
“Ring is outside the die” / nothing appears — the offset + 2 × width + spacing (3 + 6 + 4 = 13 µm) must fit inside the 100 µm margin from Step 4.5. With a smaller margin, reduce width and spacing.
Only one ring appears — both nets must be selected in the Net(s) field (VDD VSS), otherwise Encounter builds a single loop.
4.8
Add horizontal and vertical stripes
Why this stepStripes shorten the path from supply to every cell, reducing IR drop.
Stripes are straight power wires crossing the core and connecting to the ring on both ends, so the middle of the core is not far from a supply. Open Power → Power Planning → Add Stripes and run it twice.
The course values (3 µm wide stripes every 15–20 µm) are for a much larger 65 nm core. Your core is ≈13.7 µm wide, so those values give no stripes at all. The YOUR VM column is sized so that two VDD/VSS pairs cross the core in each direction.
AHorizontal stripes
FIELD
COURSE (65 nm)
YOUR VM (GPDK045)
Net(s)
VDD VSS
VDD VSS
Layer / Direction
AP, Horizontal
Metal9 (= $H_LAYER), Horizontal
Width / Spacing
3 / 5
1 / 1
Set Pattern → Set-to-set distance
20
6
Stripe Boundary
Core ring
Core ring
First/Last Stripe → Start from bottom, relative offset
Are 1 µm stripes legal? Yes: the LEF spacing table for Metal8 asks for at most 0.25 µm between wires up to 1.5 µm wide, and 1 µm spacing is four times that. Width 1 µm is far above the 0.07 µm minimum.
After applying both directions, inspect the mesh rather than trusting the dialog:
Small-core note: with a 6 µm set-to-set distance you get two VDD/VSS pairs per direction (at about 2 µm and 8 µm from the core edge). If your core came out smaller and only one pair appears, that is not an error — the ring alone can feed a core this small. On a larger design the mesh looks like the screenshot.
Physical effect
Smaller stripe pitch shortens current paths and reduces IR drop, but blocks more signal-routing tracks. Power planning is a resistance-versus-congestion tradeoff.
What you should see
Straight vertical and horizontal metal lines across the core, connected to the ring at both ends.
Clicking a stripe and pressing q shows its net (VDD or VSS) and layer.
Troubleshooting — stripes
No stripes appear — you typed the course values (set-to-set 20 or 15), which are larger than the ≈13.7 µm core. Use 6.
“layer not found” — the layer must be Metal9 or Metal8; AP, M6 and Metal10 do not exist in gsclib045.lef.
Stripes block signal routing later — increase the pitch or move stripes to the top layers only.
4.9
Special-route the power network
Why this stepConnects the grid to each row’s rails — the last link from supply to cell.
So far the ring and stripes float in metal; nothing connects them to the cells. Choose Route → Special Route. This connects pads, rings, stripes, macro pins and standard-cell rails using power-routing rules.
Net(s): VDD VSS.
In SRoute, tick Block pins, Pad pins, Pad rings, Follow pins (the standard-cell rails — the most important one) and Floating stripes.
Thin horizontal rails now run along every standard-cell row, alternating VDD and VSS, connected to the ring at both ends (and to stripes through vias where they cross).
What you should see
Thin horizontal rails appear along every row boundary, alternately connected to VDD and VSS.
The terminal reports the number of follow-pin wires created and 0 DRC violations for the special routes.
CheckpointNo standard-cell row is left without a continuous VDD/VSS rail connection. verifyConnectivity -nets {VDD VSS} reports no opens (dangling stripe ends on a tiny core are warnings, not opens).
4.10
Configure placement
Why this stepTells the placer which special cells exist (tie, filler) and how to treat clock gating.
0Before placement — does your library need well taps and end caps?
Modern “tapless” libraries require separate tap cells to prevent latch-up (Chapter 4 theory, D16). Check once:
Look for tap and end-cap cells · shellgrep -iE "^(TAP|WELLTAP|ENDCAP|CAP|FILLTIE)" logs/cell_names.txt logs/lef_macros.txt
grep -i -A3 "MACRO .*TAP" $PDK45/*.lef | head -20
Nothing found — this is what your VM prints: gsclib045.lef has no TAP, WELLTAP or ENDCAP macros (the report’s cell groups list only TIE, FILL, CLK*, BUF, INV, DFF/SDFF and ANTENNA). The well taps are built into every cell — skip this part.
A tap cell exists: insert a checkerboard of taps before placement, with the spacing from the PDK documentation (typical 20–60 µm):
Only if your library has a tap cell · TcladdEndCap -preCap ENDCAP -postCap ENDCAP ;# only if an end-cap cell exists
addWellTap -cell TAPCELL -cellInterval 30 -checkerBoard -prefix WELLTAP
verifyWellTap -cell TAPCELL -rule 15
Choose Place → Place Standard Cell. The Place dialog opens; do not click OK yet. Click its Mode… button to open Mode Setup. You set four tabs of Mode Setup in turn, exactly in the order of the course screenshots.
1Placement tab
Leave the defaults and additionally tick Enable Clock Gating Awareness. This keeps clock-gating cells close to the flops they control, which matters if synthesis inserted any.
2TieHiLo tab
Click Select. In the cell list choose the tie-high cell and click Add, then the tie-low cell and Add. The course library calls them TIEH/TIEL; gsclib045 calls them TIEHI/TIELO (both 0.6 µm wide, output pin Y). When both appear in the Selectable Cell List, click Close.
3Filler tab
Click Select. Add all seven gsclib045 fillers one by one: FILL64, FILL32, FILL16, FILL8, FILL4, FILL2, FILL1 (they exist only in the LEF, which is why they were missing from logs/cell_names.txt; FILL1 is one site, 0.2 µm, so every gap can be closed). Click Close and tick ECO route.
They generate safe constant logic values without directly tying a signal pin to the power rail (a gate oxide wired straight to VDD is an ESD/reliability risk). Filler candidates are selected now but inserted after routing (Step 4.14).
What you should see
The Mode Setup dialog keeps your choices when reopened (it applies to the whole session).
The terminal echoes setPlaceMode, setTieHiLoMode and setFillerMode commands — copy them into your script.
4.11
Configure CTS behavior, then place
Why this stepGives every cell a legal location and fixes timing with estimated wires.
Still in Mode Setup, open the CTS tab. It has sub-tabs; set them to match the three course screenshots.
1CTS → Trace
Controls how the tool traces the clock network from the clock root to the flops (which gates it may pass through and where it stops). Match the check-boxes in the screenshot; the defaults plus the shown options are fine for a single-clock design.
2CTS → Route/EM
Controls how clock nets are routed (clock nets are routed first, with preferred layers and double-width/spacing rules to reduce coupling) and electromigration checks on clock wires. Match the screenshot.
3CTS → Optimization
Controls post-CTS optimization: whether CTS may resize buffers/gates and whether it optimizes skew and insertion delay. Match the screenshot.
4Apply and place
Click OK to apply and close Mode Setup.
Back in the Place dialog, leave Include Pre-Place Optimization on and click OK.
When placement finishes, run Place → Tie Hi/Lo Cell → Add (Tcl addTieHiLo) if the netlist has constants, then Optimize → Optimize Design with Design Stage: Pre-CTS, Optimization Type: Setup, OK.
The cells move into the rows inside the core (zoom in with right-drag).
optDesign ends with a summary table: WNS (worst negative slack) ≥ 0, TNS 0, violating paths 0, plus DRV counts (max_tran/max_cap/max_fanout) all 0.
reports/checkPlace.rpt reports 0 overlapping or unplaced instances.
Troubleshooting — placement
Negative WNS pre-CTS — check that the clock was found (report_clocks), then rerun optDesign -preCTS. For this tiny counter at 100 MHz a violation almost always means a constraint problem, not a hard path.
"Not enough space" — utilization is too high; redo the floorplan at 0.6.
ANNOTATED OUTPUToptDesign -preCTS summary (Encounter)illustrative — your exact numbers and names will differ
Path groups as in the STA theory: all paths, then by type.
WNS = worst negative slack. Positive means even the worst path meets timing.
TNS = sum of all negative slacks. 0 means no violations at all.
DRVs (design-rule violations): electrical limits on capacitance, transition and fanout from the Liberty file. All must be 0.
Placement density ≈ the utilization you chose in Step 4.5.
Estimated routing overflow from the congestion model — 0 % means routing will be easy.
CheckpointAll standard cells are legal, congestion is acceptable, and pre-CTS timing has no unexplained unconstrained paths.
4.12
Synthesize the clock tree
Why this stepReplaces the ideal clock with a real buffered tree; from here hold timing becomes meaningful.
ACreate the clock-tree specification file
Until now the clock was ideal (it arrived everywhere at once). CTS builds a real buffer tree. It reads a specification file (.ctstch) listing which buffers it may use and the skew/latency targets. The course supplies Clock.ctstch; generate yours from your own library at the encounter> prompt:
Inside you will find an AutoCTSRootPin clk section with targets such as MaxSkew, MaxDelay, SinkMaxTran, BufMaxTran and the Buffer list. The generated values are reasonable defaults; leave them for this lab.
BRun CTS from the GUI
Choose Clock → Synthesize Clock Tree. In the dialog click … beside the specification field, select constraints/Clock.ctstch, and click OK.
Afterwards view the tree with Clock → Display → Display Clock Tree. Then fix any timing that CTS disturbed with Optimize → Optimize Design, Design Stage Post-CTS, type Setup — and again with Hold.
Before CTS the 0.2 ns uncertainty in the SDC covered future skew plus jitter. Now that the real tree exists, its skew is computed exactly, and keeping the full 0.2 ns counts skew twice (Chapter 4 theory, D6b). Production flows lower the uncertainty to the jitter budget only:
For this lab either choice is fine — the counter has huge slack. Write down which you used, because it changes the WNS numbers you report.
Read the CTS report
reports/clock/ holds the CTS summary. Look for Nr. of Sinks: 8 (the eight flops), the number of buffers inserted, and Max Skew well below the 0.2 ns uncertainty you budgeted in the SDC.
Physical effect
CTS inserts and sizes clock buffers so insertion delay and skew are controlled. This adds cells, power, routing demand and new hold-time behavior — which is why hold is optimized only from this point on.
ANNOTATED OUTPUTCTS summary (reports/clock)illustrative — your exact numbers and names will differ
CTS summary (reports/clock)*** Clock Tree Synthesis summary ***
Clock tree root : clk [1]
Nr. of Subtrees : 1
Nr. of Sinks : 8 [2]
Nr. of Buffer : 2 [3]
Nr. of Level (including gates) : 2
Max trig. edge delay at sink(R): count_reg[3]/CK 214.6(ps) [4]
Min trig. edge delay at sink(R): count_reg[6]/CK 207.9(ps)
(Actual) (Required)
Rise Phase Delay : 207.9~214.6(ps) 0~10000(ps)
Max. Skew : 6.7(ps) 300(ps) [5]
Max. Slew (Sink) : 48.2(ps) 400(ps) [6]
Where the tree starts: the clk port.
Sinks = clock pins of flops. It must equal your flop count (8).
Buffers CTS inserted (from the -bufferList you gave).
Latency to the slowest and fastest flop.
Skew = 214.6 − 207.9 = 6.7 ps, far below the target — and below the 200 ps uncertainty budgeted in the SDC.
Clock transition at the flops; slow clock edges increase and short-circuit power.
Troubleshooting — clock tree synthesis
“No clock root found” — the SDC’s create_clock did not reach Encounter; check report_clocks and the MMMC constraint mode.
A buffer name in -bufferList is unknown — use only names from logs/cell_names.txt; the list in lib_paths.tcl (CLKBUFX2 … X12, CLKINVX1 … X8) was checked against your library.
Skew is large — check that all flops are on the same clock net and that no flop was left unplaced.
4.13
Trial-route, NanoRoute and optimize
Why this stepCreates the real wires; timing is now computed from extracted R and C.
Route → Trial Route → OK. A fast, rough routing used only to expose congestion. Open View → Congestion (or the "density" layer toggles) — red hot-spots would mean the floorplan is too tight.
Route → NanoRoute → Route. Leave Global Route and Detail Route ticked, tick Timing Driven and SI Driven, click OK. This produces the real, DRC-correct wires.
Optimize → Optimize Design, choose Design Stage: Post-Route and Optimization Type: Setup and Hold, click OK. Timing is now calculated on extracted wires instead of estimates — Encounter extracts R and C with its native engine using $PDK45_TECH/capTable from the RC corner.
The final routed layout (as in the screenshot) shows signal wires in several metal colours over the placed cells. Toggle layers on the right-hand Layer Control panel to see each metal separately.
How to read the timeDesign summary
Setup mode: WNS ≥ 0.000 and "Violating Paths: 0" for reg2reg, in2reg, reg2out.
Hold mode: same, using the fast corner (VIEW_HOLD).
DRVs: max_cap, max_tran, max_fanout all 0.
NanoRoute log: Total number of DRC violations = 0.
Troubleshooting — routing and post-route timing
DRC violations after NanoRoute — run routeDesign -globalDetail again (it repairs incrementally). Persistent violations near the ring usually mean the ring offset is too small.
Hold violations remain — hold needs the hold view to be active (check set_analysis_view in mmmc.tcl) and delay cells/buffers in the library — gsclib045 has DLY1X1 … DLY4X4 and BUFX2 … BUFX20.
setExtractRCMode rejects -effortLevel — drop the option; the default post-route engine uses the same cap table.
Unrouted nets — verifyConnectivity lists them; most often a pin is blocked by a power stripe. Delete the stripes over the core and rerun from Step 4.8 with a larger pitch.
ANNOTATED OUTPUTtimeDesign -postRoute -hold summaryillustrative — your exact numbers and names will differ
Hold uses the minimum-delay paths ( in the STA recurrences).
Small positive hold slack is normal: hold only needs to be ≥ 0, extra margin buys nothing.
Must be the fast corner view — if it says VIEW_SETUP, hold is being checked at the wrong corner.
Density grew slightly because CTS buffers and hold-fix cells were added.
CheckpointNo signal net is unrouted; setup and hold are checked against extracted post-route parasitics and both show WNS ≥ 0.
4.14
Add fillers, verify and save the database
Why this stepFillers make the layout manufacturable; verification and saving make the result reproducible.
AInsert fillers
Choose Place → Physical Cell → Add Filler. The cell list is pre-filled from the Filler tab of Step 4.10; check it, set the prefix to FILL, and click OK. Fillers close row gaps and preserve well/power-rail continuity (an N-well with gaps can fail DRC).
Every empty spot in the rows is now occupied — compare with Step 4.13's screenshot.
BVerify
Run Verify → Verify Connectivity (OK) and Verify → Verify Geometry (OK). Results go to the terminal and to violation markers in the Tools → Violation Browser.
CSave
Choose File → Save Design, Data Type Encounter, File Name results/cnt_updown_postRoute.enc (the course names it updown_counter_postRoute.enc). Encounter writes cnt_updown_postRoute.enc plus a folder cnt_updown_postRoute.enc.dat/; keep both together.
Verification Complete : 0 Viols. for both checks (connectivity may list warnings for unconnected filler power pins if fillers were added after sroute — rerun sroute -connect corePin to clear them).
Use real library names. The filler list and the metal layers must be checked against the imported LEF. A missing filler name is PDK data—not a reason to invent a cell.
ANNOTATED OUTPUTEncounter console after addFiller, verifyConnectivity and verifyGeometryillustrative — your exact numbers and names will differ
Filler count — any non-zero number is fine; it depends on how many row gaps placement left. Zero means the filler cell names in $FILLERS are wrong.
Database units must say 2000 — the same value you will pass to streamOut -units in Step 7.5.
Connectivity: “no problems” means every net, including VDD/VSS rails to every cell, is one connected piece.
Geometry sub-checks: Cells = overlapping instances, SameNet = notches/spacing on one net, Wiring = spacing/width between different nets, Antenna = process-antenna ratios.
Both totals 0 → proceed. Any violation: open Tools → Violation Browser, click the entry and the layout zooms to it.
CheckpointFillers inserted, 0 connectivity and geometry violations, and results/cnt_updown_postRoute.enc(.dat) plus results/cnt_updown_postRoute.v exist.
Q1Doubling an unbuffered wire’s length multiplies its intrinsic delay by about…
Elmore delay rcL²/2 is quadratic in L — which is why long wires get repeaters.
Q2Why is hold timing only fixed after clock-tree synthesis?
Skew δ enters the hold inequality directly; with an ideal clock it is zero and the result would be wrong.
Q3Halving the power-stripe pitch reduces the worst rail IR drop by about…
Worst drop rjL²/8 with L = stripe pitch — quadratic.
⚠ Common mistakes in this chapter
Starting Encounter outside the project directory — relative paths break.
Using layer names from the course (AP, M6) — check the LEF.
Skipping Connect Global Nets — cells end up unpowered.
Fixing hold before CTS (meaningless with an ideal clock).
Adding fillers before routing, then wondering why routing has no space.
Forgetting setExtractRCMode -engine postRoute before post-route optimisation.
CHAPTER 5
Turn the GUI flow into reproducible Tcl
Use the GUI to learn; use Tcl to repeat and compare.
You start withThe GUI flow you completed in Chapter 4
You end withOne script that rebuilds the whole layout and exports SPEF/SDF/DEF/GDS
Toolsencounter (batch)
Time≈ 30 min
THEORYTcl in ten minutes — enough to read every script on this page≈ 10 min read
T1Why script at all
Clicking is how you learn; scripts are how you repeat. A script records every value, runs the same way tomorrow, can be diffed between versions, and runs without a display (-nowin). RC, Encounter and NCSim all speak Tcl.
T2The whole language in one table
SYNTAX
MEANING
EXAMPLE
set name value
Create / change a variable
set TOP cnt_updown
$name
Use a variable’s value
elaborate $TOP
[command]
Run a command, use its result
[get_ports clk]
"…"
Text; $ and [] inside are substituted
"top is $TOP"
{…}
Text taken literally — nothing substituted
{VDD VSS}
list a b c
Build a list (substitutes inside)
[list top $H_LAYER]
#
Comment — only at the start of a command (use ;# after code)
;# ps
\ at line end
Command continues on next line
long addRing
source file
Run another Tcl file here
source scripts/lib_paths.tcl
Tcl warm-up you can type at any tool prompt · Tclset period 10.0
set cells {FILL64 FILL32 FILL16}
puts "Clock period is $period ns" ;# variables expand inside "..."
puts {Clock period is $period ns} ;# but NOT inside {...}
puts "Half period = [expr {$period / 2}] ns" ;# [ ] runs a command
foreach c $cells { puts "filler: $c" }
if {[llength $cells] > 2} { puts "more than two fillers" }
proc banner {msg} { puts "==== $msg ====" }
banner "done"
Why the scripts use [list top $H_LAYER …] instead of {top $H_LAYER …}: braces would pass the literal text $H_LAYER to the tool. This is the #1 Tcl mistake.
T3Learning commands from the GUI
Encounter writes every GUI action as a Tcl command into encounter.cmd in the start directory. Click once, copy the command.
help addStripe (Encounter) or help define_dft (RC) prints every option your build supports.
RC stores the design as a virtual file system: ls /designs/cnt_updown, get_attribute on any object.
The practical way to learn Encounter commands. Do an action once in the GUI, then find the exact command it recorded in encounter.cmd. Paste it into your script, and rerun the whole flow in batch mode.
T4Debugging a script
Find the firstERROR in the log — later errors are usually consequences.
The tool stays at its prompt after a failure: fix, then paste the remaining lines block by block.
Check variables with puts $VAR; a wrong path in lib_paths.tcl causes most failures.
DEEP DIVE writing your own helpers
D1How Tcl evaluates a line (the one rule)
Tcl reads a command, performs exactly one round of substitution — $var, [cmd], backslashes — except inside {…}, splits it into words, and calls the first word with the rest as arguments. Nothing is re-substituted afterwards. Every “strange” Tcl behaviour follows from this rule. For example, in if {$x > 2} {…} the braces delay substitution so that if itself evaluates the condition each time.
The one Tcl evaluation rule applied to a real line. One round of substitution runs the bracketed expr (inside braces, $period is handed to expr untouched, and expr substitutes it itself). The result is split into words, and puts is called with a single argument.
D2A helper that extracts WNS from every run
Comparing experiments (different utilization, different clock) is easier with a small procedure. Paste into scripts/helpers.tcl and source it in Encounter:
scripts/helpers.tcl · Tcl# Print the worst setup and hold slack of the current design state
proc slack_summary {tag} {
set s [report_timing -late -max_paths 1 -collection]
set h [report_timing -early -max_paths 1 -collection]
set ws [get_property $s slack]
set wh [get_property $h slack]
puts [format "%-12s setup WNS = %8.3f ns hold WNS = %8.3f ns" $tag $ws $wh]
}
# Count lines that contain a pattern in a report file
proc count_in_file {file pattern} {
set fh [open $file r]; set n 0
while {[gets $fh line] >= 0} { if {[regexp -- $pattern $line]} { incr n } }
close $fh
return $n
}
Using it at the encounter> prompt · Tclsource scripts/helpers.tcl
slack_summary preCTS
puts "geometry violations: [count_in_file reports/geometry.rpt {Viol}]"
If -collection / get_property are not supported in your build (check with help report_timing), fall back to timeDesign and read reports/*/…summary files with count_in_file.
D3Sweeping a parameter
A loop turns one experiment into a table — e.g. how utilization affects timing:
Utilization sweep sketch (batch Encounter) · Tclforeach util {0.60 0.72 0.85} {
freeDesign
source scripts/init_only.tcl ;# import part of encounter.tcl
floorPlan -r 1.0 $util 100 100 100 100
# ... power grid + placeDesign + optDesign -preCTS as in encounter.tcl ...
slack_summary "util=$util"
}
Why this stepThe same MMMC file in GUI and batch runs guarantees both are timed identically.
You already wrote scripts/mmmc.tcl in Step 4.2. The scripted flow uses the identical file, so the GUI run and the batch run time the design the same way. Re-read it once more and make sure you can answer three questions: which Liberty is used for setup (slow), which for hold (fast), and which SDC (the one written by RC).
scripts/mmmc.tcl (summary of what it defines)# LIB_SLOW / LIB_FAST -> library sets
# RC_TYP -> interconnect model ($PDK45_TECH/capTable)
# DC_SLOW / DC_FAST -> delay corners
# FUNC -> constraint mode (results/cnt_updown_mapped.sdc)
# VIEW_SETUP / VIEW_HOLD -> analysis views used by optDesign / timeDesign
Why MMMC exists
One physical layout must work across operating modes and PVT corners. This teaching setup uses two corners; a production flow normally has several setup and hold corners and separate functional/test modes (e.g. a scan-shift mode with a slower clock).
5.2
Run the complete Encounter script
Why this stepA script turns two hours of clicking into a repeatable minutes-long run you can compare and archive.
This script is the whole of Chapter 4 in one file, in the same order, with the same values. Every line maps to a GUI step you already did, so you can debug it piece by piece. It ends by exporting everything signoff needs.
Create the script · shellgedit scripts/encounter.tcl &
Open the full Encounter 13.10 script (scripts/encounter.tcl, 111 lines)
scripts/encounter.tcl · Tcl# ================= Encounter 13.10 place-and-route: cnt_updown =================
# VARIANT func (default) implements results/cnt_updown_mapped.v (Chapters 4-5);
# VARIANT scan implements the scan netlist from Chapter 6 (set by encounter_scan.tcl).
if {![info exists VARIANT]} { set VARIANT func }
set TOP cnt_updown
source scripts/lib_paths.tcl
if {$VARIANT eq "scan"} {
set NETLIST results/${TOP}_scan.v
set SDC_FILE results/${TOP}_scan.sdc
set TAG ${TOP}_scan
set R reports/scan
} else {
set NETLIST results/${TOP}_mapped.v
set SDC_FILE results/${TOP}_mapped.sdc
set TAG ${TOP}
set R reports
}
file mkdir reports results $R
# ---- 4.2-4.4 Import ----
set init_top_cell $TOP
set init_verilog $NETLIST
set init_lef_file $LEF_FILES
set init_mmmc_file scripts/mmmc.tcl
set init_pwr_net VDD
set init_gnd_net VSS
init_design
if {$VARIANT eq "scan"} {
defIn results/${TOP}_scan.scandef ;# scan-chain description from RC (Step 6.3)
}
# ---- 4.5 Floorplan: square, 72 % utilisation, 100 um margins, gsclib045 site ----
floorPlan -site CoreSite -r 1.0 0.72 100 100 100 100
# ---- 4.6 Global power connections ----
globalNetConnect VDD -type pgpin -pin VDD -inst * -verbose
globalNetConnect VSS -type pgpin -pin VSS -inst * -verbose
globalNetConnect VDD -type tiehi -inst * -verbose
globalNetConnect VSS -type tielo -inst * -verbose
# ---- 4.7 Core ring: Metal9 (horizontal) top/bottom, Metal8 (vertical) left/right ----
addRing -nets {VDD VSS} -type core_rings -follow core \
-layer [list top $H_LAYER bottom $H_LAYER left $V_LAYER right $V_LAYER] \
-width {top 3 bottom 3 left 3 right 3} \
-spacing {top 4 bottom 4 left 4 right 4} \
-offset {top 3 bottom 3 left 3 right 3}
# ---- 4.8 Stripes sized for this ~15 um core ----
addStripe -nets {VDD VSS} -direction horizontal -layer $H_LAYER \
-width 1 -spacing 1 -set_to_set_distance 6 \
-start_from bottom -start_offset 2 -stop_offset 2
addStripe -nets {VDD VSS} -direction vertical -layer $V_LAYER \
-width 1 -spacing 1 -set_to_set_distance 6 \
-start_from left -start_offset 2 -stop_offset 2
# ---- 4.9 Special route (cell rails) ----
sroute -connect {blockPin padPin padRing corePin floatingStripe} -nets {VDD VSS}
# ---- 4.10-4.11 Placement ----
setPlaceMode -clkGateAware true
setTieHiLoMode -cell $TIE_CELLS -maxFanout 8
setFillerMode -core $FILLERS -corePrefix FILL
placeDesign
if {$VARIANT eq "scan"} { catch {scanReorder} }
addTieHiLo
checkPlace $R/checkPlace.rpt
optDesign -preCTS -outDir $R/preCTS
# ---- 4.12 Clock tree ----
createClockTreeSpec -bufferList $CTS_BUFS -file constraints/Clock.ctstch
clockDesign -specFile constraints/Clock.ctstch -outDir $R/clock
optDesign -postCTS -outDir $R/postCTS
optDesign -postCTS -hold -outDir $R/postCTS_hold
# ---- 4.13 Routing and post-route optimisation (cap-table extraction) ----
trialRoute
setNanoRouteMode -routeWithTimingDriven true -routeWithSiDriven true
routeDesign -globalDetail
if {[catch {setExtractRCMode -engine postRoute -effortLevel low}]} {
setExtractRCMode -engine postRoute
}
setAnalysisMode -analysisType onChipVariation
optDesign -postRoute -outDir $R/postRoute
optDesign -postRoute -hold -outDir $R/postRoute_hold
# ---- 4.14 Fillers, checks, save ----
addFiller -cell $FILLERS -prefix FILL
globalNetConnect VDD -type pgpin -pin VDD -inst * -verbose
globalNetConnect VSS -type pgpin -pin VSS -inst * -verbose
verifyConnectivity -type all -error 1000 -warning 50 -report $R/connectivity.rpt
verifyGeometry -report $R/geometry.rpt
timeDesign -postRoute -outDir $R/timing_final
timeDesign -postRoute -hold -outDir $R/timing_final
saveDesign results/${TAG}_postRoute.enc
saveNetlist results/${TAG}_postRoute.v
# ---- Exports for signoff (Chapter 7) ----
extractRC
rcOut -spef results/${TAG}.spef -rc_corner RC_TYP
write_sdf -view VIEW_SETUP results/${TAG}.sdf
if {[catch {write_sdc -view VIEW_SETUP results/${TAG}_postRoute.sdc}]} {
catch {writeTimingCon -sdc -view VIEW_SETUP results/${TAG}_postRoute.sdc}
}
defOut -floorplan -netlist -routing results/${TAG}.def
if {[catch {streamOut results/${TAG}.gds -mapFile $STREAM_MAP -libName DesignLib \
-structureName $TOP -units $DB_UNITS -mode ALL -outputMacros} msg]} {
puts "**NOTE: streamOut with -outputMacros failed ($msg) - retrying without it"
streamOut results/${TAG}.gds -mapFile $STREAM_MAP -libName DesignLib \
-structureName $TOP -units $DB_UNITS -mode ALL
}
puts "==== Encounter flow for $TAG finished ===="
Check the file · shellwc -l scripts/encounter.tcl # must print 111
Two things differ from a plain transcript of Chapter 4. (1) The script has a VARIANT switch: by default it implements results/cnt_updown_mapped.v; Step 6.5 sets VARIANT scan to run the identical flow on the scan netlist. (2) The GDS is written with -outputMacros and the map file from Step 7.5, because the kit has no cell GDS — create scripts/gds_view.map (Step 7.5 B1) before the first run, or the stream-out at the end prints a missing-file error (everything before it is still saved).
ARun it — first with the GUI, then in batch
Run · shellcd /home/buet/cds_work/asic_lab
source setup_cadence.sh
encounter -init scripts/encounter.tcl -log logs/encounter.log
# Once stable (no window, faster, ideal for reruns):
encounter -nowin -init scripts/encounter.tcl -log logs/encounter_batch.log
With the GUI you can watch each stage draw itself. If the script stops on an error, the encounter> prompt stays open: fix the cause, then copy-paste the remaining lines one block at a time.
BCompare runs
Quick health check of a run · shellgrep -E "\*\*ERROR" logs/encounter_batch.log | head
grep -A12 "timeDesign Summary" logs/encounter_batch.log | head -40
grep -i "Viols" reports/connectivity.rpt reports/geometry.rpt
ls -l results/
Troubleshooting — the script stops
invalid command name — a command name or option is not available in your exact build. Type help <command> at the prompt (e.g. help addStripe) to see the supported options, and adjust.
Layer not found — H_LAYER/V_LAYER in lib_paths.tcl must be Metal9/Metal8.
streamOut fails at the very end — scripts/gds_view.map does not exist yet (Step 7.5 B1). The database, netlist, SPEF, SDF and DEF were already written; create the map and run only the streamOut line at the encounter> prompt.
Cell not found in filler/tie/CTS lists — remove names that are missing from logs/cell_names.txt.
ANNOTATED OUTPUTWhat a clean batch run leaves in the log (grep summary)illustrative — your exact numbers and names will differ
Zero ERROR lines first — a batch run keeps going after some errors, so the log must be checked, not just the exit.
Positive WNS, zero TNS, zero violating paths after the post-route optimisation — compare with your GUI run from Chapter 4; the numbers should match closely because the steps are identical.
Two “Verification Complete” lines (connectivity and geometry), both 0 viols.
Every hand-off file exists — these are what Chapters 6 and 7 consume. If one is missing, search the log for the command that should have written it.
CheckpointA clean-shell rerun produces the same database and reports without manual clicks, and results/ contains cnt_updown_postRoute.enc(.dat), cnt_updown_postRoute.v, cnt_updown.spef, cnt_updown.sdf, cnt_updown.def and cnt_updown.gds.
✔ Chapter recap
Commands in order
Chapter commands, in order (condensed — every option is in the steps)gedit scripts/encounter.tcl &
encounter -init scripts/encounter.tcl -log logs/encounter.log
encounter -nowin -init scripts/encounter.tcl -log logs/encounter_batch.log
grep -A12 "timeDesign Summary" logs/encounter_batch.log
What you should now have
FILE
WHAT IT IS
scripts/encounter.tcl
The entire Chapter 4 as one script
results/*.spef, *.sdf, *.def, *.gds
Signoff hand-off files
⚠ Common mistakes in this chapter
Writing {top $H_LAYER} — braces stop the variable from expanding; use [list top $H_LAYER].
Putting a # comment after a command without ;.
Debugging the last error in a log instead of the first one.
CHAPTER 6
Insert scan with RTL Compiler DFT
This is an added chapter. The VT tutorial does not cover DFT.
You start withThe functional RTL and constraints
You end withA scan-inserted netlist with one 8-flop chain, a scandef, and a passing shift test
THEORYWhy chips need built-in test hardware≈ 12 min read
T1Verification vs test
VERIFICATION (Ch 1–2)
MANUFACTURING TEST (this chapter)
Question
Is the design correct?
Was this particular chip built correctly?
Done
Once, in simulation
On every chip, on a tester, in seconds
Finds
Logic bugs
Shorts, opens, bad vias, particles
Verification and test answer different questions at different times. Verification (simulation, STA, equivalence checking) asks once, before tape-out, whether the design is right. Manufacturing test asks of every single die, after fabrication, whether this one was built right.
T2The stuck-at fault model
Real defects are messy, so test tools model them simply: a net is stuck at 0 or stuck at 1. Detecting a fault needs two things:
Activate — drive the net to the opposite value (to find stuck-at-0, try to make it 1).
Propagate — make the difference visible at something the tester can read.
One test pattern, two possible answers: matching = good chip, different = defect.
T3Why flops make testing hard
A tester can only touch the chip’s pins. To set a flop deep inside to a particular value you may need many clock cycles of carefully chosen inputs (poor controllability); to see a flop’s value you must wait until it influences an output (poor observability). For millions of flops that is hopeless.
Controllability and observability. Without scan, setting a flop deep inside the logic to a chosen value (or reading it) may take many cycles through other logic. With scan, all flops form one shift register, so any state can be shifted in and any captured result shifted out directly.
Scan solves both at once: in test mode every flop becomes part of a shift register, so the tester can write and read every flop directly.
T4The scan flip-flop
A normal flop with a 2:1 mux in front. SE chooses between the functional input D and the previous flop’s output SI.
T5How one scan test runs
Shift in a state, capture once in functional mode, shift the result out while the next pattern shifts in.
test cycles ≈ (L + 1) · N + L
L = longest chain length, N = number of patterns
This lab: L = 8, say N = 20 → 9 × 20 + 8 = 188 cycles. A million-flop chip with one chain would need ~10⁶ cycles per pattern — so real chips use hundreds of parallel chains plus compression.
T6Scan design rules — and the reason behind each
RULE
WHY
Clocks controllable from a pin
The tester must pulse the clock exactly when it wants.
Async set/reset inactive in test
A reset pulse during shifting would wipe the chain.
No latches / combinational loops
Their values cannot be predicted by ATPG.
No X sources (undriven nets, black boxes)
An unknown reaching a scan flop corrupts the compare.
Two typical scan design-rule fixes. Gated clocks are bypassed by a test-mode multiplexer, so the tester controls every flop’s clock. Asynchronous resets are forced inactive in test mode, so no reset can corrupt the chain while it shifts.
T7Coverage and ATPG
ATPG (Automatic Test Pattern Generation) computes the patterns. Quality is measured as fault coverage = detected faults ÷ total faults; production targets are typically above 95–99 %. Scan insertion (this chapter) makes high coverage possible; ATPG (a separate tool) achieves it.
Fault coverage against pattern count (illustrative). The first few hundred ATPG patterns catch most faults. After that each pattern adds little, and the curve flattens below 100 %. The remaining faults are redundant (undetectable by any pattern) or random-resistant and need targeted patterns or test points.
DEEP DIVE the mathematics of test
D1When does a pattern detect a fault? Activation, propagation and the Boolean difference
Think of the faulty chip as a second copy of the circuit in which one wire is permanently stuck at a value . A test pattern detects the fault if the good and faulty copies give different outputs for it. Two things must happen:
Activation and propagation for one stuck-at-0 fault. Setting a = b = 1 makes the good value at ℓ equal 1, the opposite of the stuck value. Setting c = 0 (non-controlling for OR) lets the difference reach the output, where the good circuit gives 1 and the faulty one 0. The Boolean difference says the same thing.
Activate: the pattern must drive to the opposite of the stuck value in the good circuit, so the two copies differ at the fault site. To find stuck-at-0, set .
Propagate: that difference must reach an output the tester can observe. Every gate on the way must let it through — its other inputs must be at their non-controlling values (1 for AND/NAND, 0 for OR/NOR).
The Boolean difference captures the propagation condition exactly. Evaluate the output once with forced to 0 and once with forced to 1, and XOR the results:
It equals 1 precisely for the input patterns where the output depends on . Detection of “ stuck-at-” therefore needs
Example 1 — a single AND gate : . To see A, B must be 1. So A stuck-at-0 needs ; A stuck-at-1 needs .
Example 2 — two levels , fault on the internal wire , stuck-at-0.
Propagate: → we need (the OR gate’s other input must not already force the output to 1).
Activate: → .
Test pattern: . Good circuit outputs 1, faulty circuit outputs 0. ✓
ATPG tools solve exactly this — activate and propagate — for every fault in the list, using the D-algorithm of D7 or a SAT solver. With full scan, is always a combinational cloud between flops, which keeps the problem tractable.
D2Counting faults
Every line can be stuck-at-0 or stuck-at-1, so a circuit with lines has single stuck-at faults. Many are equivalent (no pattern can tell them apart): for an AND gate, any input stuck-at-0 behaves exactly like the output stuck-at-0. Collapsing reduces a 2-input AND from faults to . ATPG works on the collapsed list.
Fault collapsing on an AND gate. A/0, B/0 and Y/0 all force Y to 0, so a single pattern detects any of them, and they collapse into one class. The stuck-at-1 faults stay distinct. Six faults reduce to four targets, and on real netlists collapsing removes 40–60 % of the fault list.
D3Why 95 % coverage is not enough: yield and defect level
Three numbers decide how many bad chips reach customers:
Defect level (bad chips that pass test) against fault coverage, for 80 % yield. Even 95 % coverage lets about 11 000 defective parts per million escape. Customers expect tens to hundreds of ppm, which requires coverage of 99.9 % and beyond.
Yield — the fraction of manufactured dies that are actually good.
Fault coverage FC — the fraction of modelled faults the test can detect.
Defect level DL — the fraction of chips that pass the test but are bad. Customers measure it in defective parts per million (ppm).
Yield. If defects land randomly with density per cm², the number on a die of area follows a Poisson distribution with mean . A die is good only if it has zero defects:
(For , e.g. 0.5 cm² at 0.45 defects/cm², .)
Defect level. Williams and Brown showed that if the test detects a fraction FC of faults, the escaping bad chips are approximately
Check the edge cases: FC = 1 gives DL = 0 (perfect test); FC = 0 gives DL = (no test, every bad chip ships).
Example with : FC = 0.95 → DL = 11 100 ppm — about one bad chip in 90 shipped. FC = 0.99 → 2 200 ppm. FC = 0.999 → 220 ppm. Automotive customers ask for single-digit ppm, which is why scan, high coverage and at-speed tests are mandatory there.
D4Test time with many chains
With scan flops split into balanced chains, chain length . For patterns at shift frequency :
Test time against number of scan chains for flops, 2000 patterns and a 50 MHz shift clock (log scale). One chain takes 40 s per chip; 200 chains take 0.2 s. Test time scales with chain length, so splitting flops into many short chains is the main lever, limited by the pins available.
Example: , → . With , : . With a single chain it would be ≈ 40 s per chip — 200× more tester cost.
D5Try it: drive the scan chain yourself
The 8 counter flops, chained scan_in → count[0] → … → count[7] → scan_out. Load a value with SE = 1, capture one functional clock with SE = 0 (the counter adds 1), then unload. If the unloaded value is the loaded value + 1, the incrementer logic has been tested.
D6Built-in self-test: LFSRs
Instead of storing patterns on an expensive tester, a chip can generate pseudo-random patterns itself with a linear feedback shift register. For the characteristic polynomial the register obeys the recurrence over GF(2):
A 4-bit LFSR: Q1 ← Q3 ⊕ Q4, every other flop shifts.
If the polynomial is primitive, the register cycles through all non-zero states. Starting from Q1Q2Q3Q4 = 1000:
15 distinct states, then it repeats. A second LFSR with parallel inputs (a MISR) compresses the circuit’s responses into one signature. The probability that a faulty response produces the correct signature by chance (aliasing) is about
— about for a 32-bit MISR. Logic BIST and memory BIST let chips test themselves at power-up and in the field.
D7The D-algorithm: five-valued logic
ATPG reasons about the good and faulty circuit at once using the values , where means “1 in the good circuit, 0 in the faulty one” and the opposite. Gates are evaluated component-wise:
The D-algorithm on a two-gate path. Activating the stuck-at-0 puts D (good 1 / faulty 0) on g1’s output. Setting the NAND’s side input d = 1 (non-controlling) propagates it, inverted, as D̄ to the output, where good and faulty circuits give different values.
AND
0
1
X
D
D
0
0
0
0
0
0
1
0
1
X
D
D
X
0
X
X
X
X
D
0
D
X
D
0
D
0
D
X
0
D
The algorithm has three phases: activate (place a or at the fault site), propagate (drive the through gates on the D-frontier by setting their side inputs to non-controlling values — 1 for AND, 0 for OR) and justify (find primary-input values producing all required internal values, backtracking on conflicts). Note : two fault effects can cancel. PODEM and FAN refine the search; with full scan every flop is a pseudo-primary input and output, so ATPG only ever solves combinational problems.
D8At-speed test: transition faults
Stuck-at tests are applied slowly; they miss defects that only make a path too slow. The transition-fault model (slow-to-rise, slow-to-fall at each node) needs two patterns: initialises the node, launches the transition, and the response is captured exactly one functional period later:
Launch-on-capture at-speed test. Patterns are shifted in slowly with scan-enable high. SE then drops, and two functional-speed clock pulses follow: the first launches a transition, the second captures the result one functional period T later. The response is then shifted out slowly. A slow-to-rise or slow-to-fall defect makes the capture miss.
Two schemes: launch-on-shift (last shift pulse launches; needs a fast scan-enable) and launch-on-capture (two functional pulses; easier timing, lower coverage). The fast launch–capture pair comes from an on-chip PLL, so at-speed test also verifies the timing you signed off in Chapter 7.
D9How many random patterns are enough?
If a fault is detected by a random pattern with probability , the chance of missing it after independent patterns is . For confidence :
Detecting a random-pattern-resistant fault (the output stuck-at-0 of a 16-input AND, ). The detection probability stays near zero for tens of thousands of random patterns and only reaches 99 % at about . That is why BIST adds test points and ATPG targets such faults directly.
Random-pattern-resistant fault: the output stuck-at-0 of a 16-input AND is detected only by the all-ones input, . For 99 % confidence: patterns — for one fault. LBIST therefore adds test points (extra control/observe flops) to raise such probabilities, and deterministic ATPG targets the remaining faults directly.
Remember
Test checks manufacturing, not design.
Scan = mux + flop, chained; SE switches shift/functional.
Chain length sets test time.
6.1
Understand the test mode
Why this stepKnowing the three test modes makes every DFT command and report understandable.
After manufacturing, every chip must be tested for defects (a wire shorted to ground, a broken via). Testing a sequential circuit through its normal inputs alone is nearly impossible: you cannot directly set or read the internal flops. Scan fixes that by giving every flop a second input and chaining them into one long shift register.
scan_inscan flopscan flopscan flopscan_out
With scan_enable=0, each flop captures functional logic. With it asserted, the flops form shift registers. ATPG (Automatic Test Pattern Generation) loads a state by shifting it in, pulses one functional (capture) clock, then shifts the response out and compares it with the expected values.
MODE
scan_enable
WHAT THE FLOPS DO
Functional
0
Normal counter behavior.
Shift (load/unload)
1
Each flop takes its neighbour's value; data moves one position per clock.
Capture
0 for one clock
Flops capture the combinational logic's response to the loaded state.
Scan is not ATPG
Scan creates controllability and observability. A separate ATPG product generates patterns and measures fault coverage. On your VM the scan insertion commands come with RTL Compiler 12.10; there is no Encounter Test/Modus (no ATPG tool appears in the environment report), so pattern generation and fault coverage are explained in the theory card but not run.
6.2
Expose and constrain test signals
Why this stepScan needs dedicated ports, and the design must obey rules that make every flop controllable.
Scan needs three new ports. Create a separate RTL file so the functional flow of Chapters 1–5 is untouched. The original enable and up_down ports stay; the logic is identical — RC adds the scan muxes, you only add the ports.
Create the scan-ready RTL · shellgedit rtl/cnt_updown_scan.v &
rtl/cnt_updown_scan.v · Verilog`timescale 1ns/1ps
module cnt_updown (
input wire clk,
input wire reset, // asynchronous, active high (held 0 during test)
input wire enable,
input wire up_down,
input wire scan_enable, // 1 = shift, 0 = functional/capture
input wire scan_in, // serial data into the chain
output wire scan_out, // serial data out of the chain (driven by RC)
output reg [7:0] count
);
// Functional logic is unchanged. RC replaces the 8 flops with scan flops
// and connects scan_in -> flop -> ... -> flop -> scan_out.
always @(posedge clk or posedge reset) begin
if (reset)
count <= 8'h00;
else if (enable) begin
if (up_down) count <= count + 8'h01;
else count <= count - 8'h01;
end
end
endmodule
Before mapping, a design must obey the scan design rules. Check each one for your RTL:
Every clock must be controllable from a primary input — clk is a port: ✓. (A clock generated by internal logic would need a test-mode bypass mux.)
Asynchronous resets must be held inactive during shift — reset is a port that the tester can hold at 0; you declare that in Step 6.3: ✓.
Clock gating must be bypassed in test mode — no clock gating here: ✓.
No latches, tri-states, black boxes, combinational feedback or X-sources — none: ✓ (Step 2.3 already checked latches and loops).
What you should see
rtl/cnt_updown_scan.v saved; the port list now has eight entries (the original five plus scan_enable, scan_in, scan_out).
The functional always block is unchanged — scan muxes are added by RC, not by you.
6.3
Run legacy RC scan insertion
Why this stepRC replaces flops with scan flops and stitches the chain — the hardware that makes manufacturing test possible.
One thing differs from the functional run in Chapter 2: RC reads libs/slow_scan.lib (Step 0.5 C) instead of slow.lib. The timing is identical, but only the patched file tells RC, through its test_cell groups, that SDFFRHQX1 is the scan equivalent of DFFRHQX1 (and SDFFRX1 of DFFRX1, and so on). With the original slow.lib — which has 0 test_cell groups — RC would leave every flop unscanned and the chain would be empty.
Confirm the scan library exists · shellcd /home/buet/cds_work/asic_lab
source setup_cadence.sh
ls -l libs/slow_scan.lib
grep -c "test_cell" libs/slow_scan.lib # about 40
Create the script · shellgedit scripts/rtl_rc_scan.tcl &
scripts/rtl_rc_scan.tcl · Tcl# ================= RTL Compiler 12.10 synthesis + muxed scan insertion =================
set TOP cnt_updown
set ROOT [file normalize .]
source scripts/lib_paths.tcl
file mkdir reports results
# The scan-aware copy of slow.lib (Step 0.5) - same timing, plus test_cell groups
if {![file exists $LIB_SLOW_SCAN]} {
puts "**ERROR: $LIB_SLOW_SCAN not found - run Step 0.5 (gpdk045_libtool.py scan) first"
return
}
set_attribute information_level 7 /
set_attribute hdl_search_path [list $ROOT/rtl] /
set_attribute library [list $LIB_SLOW_SCAN] /
read_hdl -v2001 [list rtl/cnt_updown_scan.v]
elaborate $TOP
read_sdc constraints/cnt_updown.sdc
# ---- 1. Declare the scan style and test signals (before mapping) ----
set_attribute dft_scan_style muxed_scan /
define_dft shift_enable -name SE -active high [find / -port scan_enable]
define_dft test_mode -name TM_RST -active low [find / -port reset]
define_dft test_clock -name scan_clk -period 100000 [find / -port clk] ;# ps = 100 ns
# ---- 2. Check the DFT rules on the generic design ----
check_dft_rules > reports/dft_rules_pre_map.rpt
report dft_registers > reports/dft_registers_pre_map.rpt
# ---- 3. Map: flops that passed the rules become scan flops (SDFF... cells) ----
synthesize -to_generic
synthesize -to_mapped
# ---- 4. Build and connect the chain ----
define_dft scan_chain -name chain0 \
-sdi [find / -port scan_in] -sdo [find / -port scan_out] -shift_enable SE
connect_scan_chains -chains chain0
synthesize -incremental
# ---- 5. Reports and outputs ----
check_dft_rules > reports/dft_rules_post.rpt
report dft_setup > reports/dft_setup.rpt
report dft_chains > reports/scan_chains.rpt
report dft_registers > reports/dft_registers.rpt
report gates > reports/gates_scan.rpt
report timing > reports/timing_scan.rpt
write_hdl > results/cnt_updown_scan.v
write_sdc > results/cnt_updown_scan.sdc
write_scandef > results/cnt_updown_scan.scandef
write_do_lec -revised_design results/cnt_updown_scan.v > results/cnt_updown_scan_lec.do
puts "==== Scan insertion finished ===="
Check the file · shellwc -l scripts/rtl_rc_scan.tcl # must print 52
COMMAND
PURPOSE
library $LIB_SLOW_SCAN
The scan-aware copy of slow.lib; without it there is nothing to map flops to.
dft_scan_style muxed_scan
Each scan flop = normal flop + 2:1 mux on D (the common style) — exactly gsclib045’s SDFF… cells (pins D SI SE CK).
define_dft shift_enable
Which port switches between shift and functional mode.
define_dft test_mode … -active low reset
"During test, the tester holds reset at 0", so the async reset cannot corrupt shifting.
define_dft test_clock
The clock used during shift; period is in picoseconds in RC (100000 ps = 100 ns, a typical slow shift clock).
check_dft_rules
Lists flops that violate scan rules and therefore will not be scanned.
define_dft scan_chain + connect_scan_chains
Create the chain from scan_in to scan_out and stitch all scan flops into it.
write_scandef
Chain description so Encounter can reorder it after placement.
Run · shellrc -files scripts/rtl_rc_scan.tcl -logfile logs/rc_dft.log
# (type exit at the rc:/> prompt)
cat reports/dft_rules_post.rpt
cat reports/scan_chains.rpt
grep -oE "^ *SDFF[A-Z0-9]+" results/cnt_updown_scan.v | sort | uniq -c
grep -E "input|output" results/cnt_updown_scan.v | head
The course runs rc -dft. On your VM plain rc is used: the DFT commands are part of RTL Compiler 12.10 and the -dft option is not needed.
scan_chains.rpt: one chain chain0, length 8, starting at scan_in, ending at scan_out, listing the 8 count_reg flops in order.
The uniq -c line counts 8 scan flops, typically 8 SDFFRHQX1 (or SDFFRX1 — the resettable scan flops of gsclib045; RC picks by timing and area).
The netlist ports now include scan_enable, scan_in and scan_out.
Troubleshooting — scan insertion
"invalid command" for a define_dft variant — check the exact syntax in your build with help define_dft at the rc:/> prompt; option names differ slightly between RC releases.
The script stops with …slow_scan.lib not found — Step 0.5 C was skipped. Run python scripts/gpdk045_libtool.py scan $PDK45/timing/slow.lib libs/slow_scan.lib and rerun.
Chain length 0 / “no scan equivalent” messages / flops stay DFFR… — RC read a library without test_cell groups. Check the log: grep -i "library" logs/rc_dft.log | head must show libs/slow_scan.lib, and grep -c test_cell libs/slow_scan.lib must be about 40.
Registers fail the rules because of the reset — the test_mode line did not match the port; confirm with report dft_setup.
scan_out stays unconnected — if RC refuses to use the existing output port, replace the two [find / -port …] arguments of define_dft scan_chain by -create_ports and remove scan_in/scan_out from the RTL port list; RC then creates both ports itself.
License error at define_dft — scan insertion is not licensed on this VM. Record that in the README; the rest of the flow (Chapters 1–5, 7) is unaffected.
One genuine blocker remains possible. The missing Liberty scan data — the blocker the course warned about — is solved by Step 0.5. What can still stop this chapter is a missing RC DFT license. Do not hide it by inventing cells or substituting modern Modus commands; report it honestly.
ANNOTATED OUTPUTreports/scan_chains.rpt (report dft_chains)illustrative — your exact numbers and names will differ
Length 8 = all flops scanned. Fewer means some flops failed the DFT rules.
Physical order of the chain: this is the order the scan testbench and the widget in the theory card assume.
Reading the scan report quickly Three numbers matter: the number of chains (1 here), the chain length (= number of scan flops, 8), and the count of flops not on a chain (must be 0 — anything else is a DFT rule violation listed earlier in the log). Then check that scan_in and scan_out appear as new ports of cnt_updown in the netlist.
6.4
Verify functional, shift and capture modes
Why this stepProves the inserted chain really shifts and that functional behaviour is unchanged.
The testbench below checks both modes on the scanned netlist: first a short functional count with scan_enable=0, then a shift test that pushes a random 16-bit pattern through the 8-flop chain and compares scan_out against a shift-register model.
tb/tb_cnt_updown_scan.v · Verilog`timescale 1ns/1ps
module tb_cnt_updown_scan;
localparam L = 8; // chain length from reports/scan_chains.rpt
reg clk = 0, reset = 1, enable = 0, up_down = 1, scan_enable = 0, scan_in = 0;
wire scan_out;
wire [7:0] count;
integer errors = 0, i;
cnt_updown dut (.clk(clk), .reset(reset), .enable(enable), .up_down(up_down),
.scan_enable(scan_enable), .scan_in(scan_in),
.scan_out(scan_out), .count(count));
always #50 clk = ~clk; // 100 ns test clock
// Reference model of the chain: shifts only when scan_enable = 1
reg [L-1:0] model;
always @(posedge clk or posedge reset)
if (reset) model <= {L{1'b0}};
else if (scan_enable) model <= {model[L-2:0], scan_in};
initial begin
$dumpfile("./scan_test.dump"); $dumpvars(0, tb_cnt_updown_scan);
#120 reset = 0;
// ---- Functional mode: count up 5 times ----
@(negedge clk); enable = 1; up_down = 1;
repeat (5) @(negedge clk);
enable = 0;
if (count !== 8'd5) begin errors = errors + 1; $display("ERROR functional count=%0d (expected 5)", count); end
else $display("Functional mode OK: count = %0d", count);
// ---- Shift mode: reset chain, then shift 2L random bits ----
reset = 1; #10 reset = 0;
scan_enable = 1;
for (i = 0; i < 2*L; i = i + 1) begin
scan_in = $random;
@(negedge clk);
if (scan_out !== model[L-1]) begin
errors = errors + 1;
$display("ERROR shift %0d: scan_out=%b expected=%b", i, scan_out, model[L-1]);
end
end
scan_enable = 0;
if (errors == 0) $display("PASS: functional and %0d-bit shift test", 2*L);
else $display("FAIL: %0d errors", errors);
$finish;
end
endmodule
Functional — scan enable low, counter behaves normally (checked above; you can also rerun the full Chapter 1 testbench after adding .scan_enable(1'b0), .scan_in(1'b0), .scan_out() to its instance).
Shift — the pattern appears at scan_out exactly L clocks later. If every bit is inverted, RC used an inverting scan path (QN); flip the comparison and note it.
Capture — load a state, drop scan_enable for one clock with enable=1, raise it again and unload: the unloaded value should be the loaded value +1. (A full capture test is what ATPG automates.)
Conformal LEC is not installed on your VM, so keep results/cnt_updown_scan_lec.do for reference; the functional and shift simulations are your equivalence evidence.
After routing (Step 6.5), repeat this scan smoke test on the post-route scan netlist.
Physical consequence
Scan adds area (a mux per flop), extra fanout on scan_enable, and an arbitrary chain can zig-zag across the floorplan. In Encounter, load results/cnt_updown_scan.scandef with defIn before placement and run scanReorder after placement; then hand the final physical chain order back to ATPG. Step 6.5 does exactly that.
What you should see
Functional mode OK: count = 5
PASS: functional and 16-bit shift test (this testbench was run against a scan netlist built from the generated models before publishing and passes).
No ERROR shift lines.
Troubleshooting — the shift test fails
scan_out is X from the very first shift — the reset pulse before shifting did not clear the scan flops, so the chain holds unknowns while the model holds zeros. Check that reset reaches every SDFFR… instance in the scanned netlist (and that the DFT rules did not tie it off).
Every bit comes out one cycle late or early — the chain length L in the testbench differs from reports/scan_chains.rpt (lock-up latches or an extra flop change it). Copy the length from the report.
The pattern comes out inverted — some flops are connected through their QN output; the report marks them. Invert the model for those positions or compare against the report’s polarity column.
The functional test now fails — scan_enable was left floating (X) in functional mode. Drive it to 0 explicitly.
CheckpointChain length 8, 0 DFT violations, and the scan testbench prints PASS.
6.5
Place and route the scan netlist
Why this stepA scan chain only works on silicon once it is placed, reordered for short wires, clocked and routed; this runs the Chapter 5 flow on the scanned design and re-checks the chain.
The scripted flow from Chapter 5 already knows how to do this: the wrapper below sets VARIANT scan, which makes scripts/encounter.tcl read results/cnt_updown_scan.v and …_scan.sdc, load the scan DEF from RC right after import, reorder the chain after placement, and write every result with a cnt_updown_scan prefix (reports go to reports/scan/). The functional results from Chapter 5 are not touched.
scripts/encounter_scan.tcl · Tcl# Place and route the SCAN netlist from Chapter 6 with the same flow as Chapter 5
set VARIANT scan
source scripts/encounter.tcl
Run the scan implementation · shellls results/cnt_updown_scan.v results/cnt_updown_scan.sdc results/cnt_updown_scan.scandef
encounter -nowin -init scripts/encounter_scan.tcl -log logs/encounter_scan.log
grep -E "\*\*ERROR" logs/encounter_scan.log | head
grep -iE "scandef|scan.*reorder|Reorder" logs/encounter_scan.log | head
grep -i "Viols" reports/scan/connectivity.rpt reports/scan/geometry.rpt
ls results/cnt_updown_scan*
What you should see
No **ERROR lines; the log shows the scan DEF being read after init_design and scan-reorder messages after placement.
Verification Complete : 0 Viols. in both reports under reports/scan/.
results/ now also holds cnt_updown_scan_postRoute.enc(.dat), cnt_updown_scan_postRoute.v, cnt_updown_scan.spef, .sdf, .def and .gds.
Timing in reports/scan/timing_final meets setup and hold. The scan SDC times both mux inputs of every scan flop, which is slightly pessimistic for functional mode — fine for this design.
Scan reordering changes the order of the flops in the chain but not its length, and the testbench’s chain model only depends on the length (8), so the same PASS line must appear. If CTS or hold fixing inserted buffers on the chain, they are transparent to the test.
Troubleshooting — scan place and route
defIn reports errors in the scan DEF — open results/cnt_updown_scan.scandef; it must contain a SCANCHAINS 1 ; section naming chain0. If Encounter still rejects it, comment out the defIn line in scripts/encounter.tcl: the design is then placed and routed without reordering — the chain is still correct, just longer in wire.
scanReorder is reported as unknown or finds no chains — the script wraps it in catch, so the run continues; placement in Encounter 13 reorders loaded scan chains by default anyway.
The post-route shift test fails but the pre-route one passed — check grep -c SDFF results/cnt_updown_scan_postRoute.v (must be 8) and that scan_out is still a port of the post-route netlist.
Checkpointresults/cnt_updown_scan_postRoute.v exists, both scan verify reports show 0 violations, and the post-route scan simulation prints PASS: functional and 16-bit shift test.
✔ Chapter recap
Commands in order
Chapter commands, in order (condensed — every option is in the steps)gedit rtl/cnt_updown_scan.v scripts/rtl_rc_scan.tcl tb/tb_cnt_updown_scan.v &
rc -files scripts/rtl_rc_scan.tcl -logfile logs/rc_dft.log # reads libs/slow_scan.lib; then: exit
cat reports/dft_rules_post.rpt reports/scan_chains.rpt
irun -nospecify -notimingchecks -timescale 1ns/1ps -logfile logs/irun_scan.log \
libs/gsclib045_cells.v results/cnt_updown_scan.v tb/tb_cnt_updown_scan.v
encounter -nowin -init scripts/encounter_scan.tcl -log logs/encounter_scan.log # Step 6.5
irun ... libs/gsclib045_cells.v results/cnt_updown_scan_postRoute.v tb/tb_cnt_updown_scan.v
What you should now have
FILE
WHAT IT IS
results/cnt_updown_scan.v
Scan-inserted netlist
results/cnt_updown_scan.scandef
Chain description for Encounter
results/cnt_updown_scan_lec.do
Equivalence-check script
logs/irun_scan.log
Shift-test PASS
results/cnt_updown_scan_postRoute.*
Placed, reordered and routed scan design
? Check yourself
Q1To detect input A stuck-at-0 on a 2-input AND gate, apply…
Activate (A=1) and propagate (∂f/∂A = B must be 1).
Q2With fault coverage 0.95 and yield 0.8, the defect level is roughly…
DL = 1 − 0.80.05 ≈ 0.011.
Q3Splitting one scan chain into 10 balanced chains cuts shift time by about…
Test cycles ≈ (L+1)N + L, and L drops by 10×.
⚠ Common mistakes in this chapter
Declaring the DFT test signals after mapping instead of before.
Using an RC test-clock period in ns — RC expects picoseconds.
Leaving reset unconstrained in test mode, so flops fail the scan rules.
Assuming the chain order; read it from report dft_chains.
Synthesizing the scan design with slow.lib instead of libs/slow_scan.lib — RC then finds no scan equivalents.
CHAPTER 7
Signoff: extraction, timing, power, rail and GDS
Goal: verify the routed implementation, not the idealized netlist.
You start withThe saved post-route database
You end withSPEF, SDF, timing/power/IR evidence, a GDS file and DRC/LVS status
Toolsencounter, irun, virtuoso + Assura
Time≈ 1–2 h
THEORYSignoff — proving the layout will work and can be built≈ 12 min read
T1The signoff checklist
CATEGORY
QUESTION
STEP
Timing
Do setup and hold pass with real wires at every corner?
7.1, 7.2
Function
Does the routed netlist still behave the same, with real delays?
7.2
Power integrity
Is total power acceptable, and does every cell get enough voltage?
7.3–7.5
Physical verification
Is the geometry manufacturable (DRC) and the same circuit (LVS)?
7.1, 7.6
The four pillars of signoff: timing (setup and hold at the right corners with extracted parasitics), function (gate-level simulation with SDF, equivalence), power integrity (total power, IR drop, electromigration) and physical correctness (DRC, LVS, antenna, density). Tape-out needs all four.
T2PVT corners — testing the extremes
Delay depends on Process (how fast the transistors came out), Voltage and Temperature. A chip must work at the worst combination for each check:
The PVT corner space as a cube. Setup is worst at the slow corner (slow process, low voltage, high temperature), where gates are slowest. Hold is worst at the fast corner (fast process, high voltage, low temperature). Typical conditions are used for power estimates. MMMC analyses the corners that matter for each check.
CORNER
TRANSISTORS · VOLTAGE · TEMP
WORST FOR
Slow (SS)
slow · low V · hot (or very cold at advanced nodes)
Setup
Fast (FF)
fast · high V · cold
Hold
Typical (TT)
nominal
Power estimates
That is exactly the MMMC setup in scripts/mmmc.tcl: VIEW_SETUP = slow, VIEW_HOLD = fast. On-chip variation (OCV) adds a small pessimism because two flops on the same die are never perfectly identical.
T3What SPEF and SDF contain
SPEF excerpt — extracted parasitics of one net (illustrative)*D_NET count[0] 0.0042 // total capacitance (pF)
*CONN
*I count_reg_0_:Q O
*P count[0] O
*CAP
1 count_reg_0_:Q 0.0011
2 count[0]:1 0.0031
*RES
1 count_reg_0_:Q count[0]:1 12.4 // ohms
*END
SDF excerpt — final delays per cell arc (illustrative)(CELL (CELLTYPE "DFFRHQX1") (INSTANCE count_reg_0_)
(DELAY (ABSOLUTE
(IOPATH CK Q (0.182:0.182:0.182) (0.201:0.201:0.201)))))
SPEF = raw R and C of every net (input to timing tools). SDF = computed delays of every cell and wire (input to the simulator for the timing-annotated run in Step 7.2).
From routed layout to the files signoff reads. Extraction turns geometry into per-net R and C (SPEF). Delay calculation combines SPEF with the Liberty tables to produce per-arc delays (SDF). STA uses the parasitics; gate-level simulation back-annotates the SDF.
T4IR drop and electromigration
Every metal segment drops I·R volts; cells farthest from the supply see the least voltage — and become slower.
Static IR drop uses average current (what this lab runs). Dynamic IR drop uses peak current at clock edges — decaps help there.
Electromigration (EM): high current density slowly pushes metal atoms along a wire until it opens, years later. Rules cap current per wire width.
Typical limit: total drop within ~5 % of VDD — the thresholds you enter in Step 7.4.
T5Physical verification
Three of the hundreds of rules in a DRC deck.
CHECK
WHAT IT PROVES
DRC
Every shape obeys width, spacing, enclosure, density… rules of the foundry
LVS
Transistors and connections extracted from the polygons match the netlist
Antenna
Long wires connected only to a gate during manufacturing do not collect enough charge to damage it
Density
Each layer has enough (and not too much) metal for even chemical-mechanical polishing
T6What GDSII is
A binary file of hierarchical cells, each a list of polygons on numbered (layer, datatype) pairs — e.g. Metal1 might be (31, 0). The tool database uses names (“Metal1”); the stream map file translates names to numbers. Since Encounter only knows cell abstracts, real cell layouts are merged in from the library GDS during stream-out.
Inside a GDSII file. The top cell references the standard cells it uses (merged in from the library GDS at stream-out). Each cell is a list of polygons, each tagged with a (layer; datatype) pair. The stream map file translates Encounter’s layer names into these numbers. The numbers shown are examples.
DEEP DIVE variation, voltage and reliability, quantified
D1How much does IR drop slow a gate? The alpha-power law
Saturation current in short-channel transistors follows with . Delay is charge over current:
Example: , , . A 5 % drop to 0.855 V gives — a 6 % slower gate for a 5 % drop. That is why the rail-analysis threshold and timing margins are linked.
D2On-chip variation and CPPR, with numbers
Two identical buffers on the same die are never exactly identical (local doping, temperature and voltage differ slightly). STA covers this pessimistically with derates: for each check, the paths that make it worse are slowed by a factor , and the paths that help are sped up by . For setup the launch clock and data are made late and the capture clock early:
Common-path pessimism removal with the text’s numbers. Derating makes the launch clock late (525 ps) and the capture clock early (475 ps), 50 ps of pessimism. But the shared 400 ps cannot be late and early at once, so CPPR credits back ps.
The problem. The launch and capture clocks usually share most of the clock tree — the common part from the root to where the branches split. A physical buffer in that common part cannot be slow for the launch edge and fast for the capture edge at the same time, yet the derates assume exactly that. The extra pessimism is removed by Common Path Pessimism Removal (CPPR):
Numbers: common clock path 400 ps, then 100 ps on each branch, .
Derated launch clock: ps. Derated capture clock: ps. Pessimism: 50 ps.
Of that, the shared 400 ps contributes ps, which is physically impossible → CPPR gives it back. The remaining 10 ps (from the separate 100 ps branches) is real and stays.
That is what the -analysisType onChipVariation setting in Step 4.13 switches on; Encounter applies CPPR automatically in that mode.
D3Electromigration: Black’s equation
The median time to failure of a wire carrying current density (width × thickness) at temperature :
Black’s equation on log–log axes. With the current-density exponent n = 2, mean time to failure falls with the square of current density. Doubling J cuts electromigration lifetime to a quarter. That is why power-wire width is set by EM limits, not just IR drop.
With , doubling the current density cuts lifetime by 4×; widening the wire 2× restores it. Power rings and stripes are wide for both reasons — IR drop and EM.
D4Corner arithmetic
With 3 process corners × 3 voltages × 3 temperatures × 2 RC corners there are possible delay corners, multiplied by every mode (functional, scan shift, …). MMMC lets you pick the few dominant ones — here just two (slow for setup, fast for hold) — because a check that passes at the worst corner for that check passes at the others.
Corner arithmetic made visible. Two RC corners × three process × three voltage × three temperature corners give 54 delay corners. This lab signs off just two: slow/low-V/hot with Cmax for setup, and fast/high-V/cold with Cmin for hold. A check passing at its own worst corner passes at the rest.
D5GDS coordinates are integers
With DATABASE MICRONS 2000 one database unit is . Every vertex is an integer multiple of that grid, which is why streamOut -units 2000 must match the LEF: a mismatch scales the whole layout by a power of ten.
GDS coordinates are integers. Every polygon vertex sits on the database grid: 1 dbu = 1/2000 µm with DATABASE MICRONS 2000. If -units in streamOut does not match the LEF, the whole layout is scaled by the ratio.
D6Sizing decoupling capacitance for dynamic IR drop
At a clock edge many gates switch together and draw a burst of charge faster than the power grid’s inductance and resistance can deliver. On-chip decap supplies it locally. If a region needs current for a time and the allowed droop is :
Dynamic IR drop at a clock edge (illustrative). The burst of current makes the local supply droop. Without decap the droop crosses the 5 % limit. Nearby decoupling capacitance supplies the charge locally and keeps the dip shallow, which is the sizing rule at work.
Example: 10 mA for 50 ps with 45 mV (5 % of 0.9 V) allowed: . Every non-switching gate also contributes some decap through its own capacitances, which is why filler-with-decap cells are placed in empty space.
D7Temperature inversion
Heat lowers carrier mobility (slower) but also lowers (faster). In older nodes mobility wins and hot = slow. In advanced low-voltage nodes, where is small, the effect can win so cold becomes the slow corner. That is why modern signoff checks setup at both temperature extremes — a direct consequence of the alpha-power law in D1.
Temperature inversion (illustrative model). Heat lowers carrier mobility (slower) but also lowers (faster). At nominal supply the mobility loss wins, so hot is slow. At low supply the drop wins, so cold is slow. Low-voltage designs must therefore check both temperature extremes for setup.
D8Statistical variation: Pelgrom’s law and path averaging
Random dopant fluctuations make two identically drawn transistors differ. The standard deviation of their threshold mismatch follows Pelgrom’s law:
Example with a typical and : → mV — about 7 % of . Smaller devices vary more; bigger ones average out.
A path of gates with independent random delays (mean , deviation ) has
Deep paths are relatively less variable — the basis of depth-dependent derating (AOCV) and statistical STA, which replace the single OCV factor of D2 with numbers that shrink with path depth.
A path whose required time sits at fails on a fraction of chips.
The probability a single path meets timing is , where is the standard normal CDF. Try the margin calculator:
D9Crosstalk noise: when a quiet wire glitches
If a victim net is held only weakly and its neighbour (aggressor) switches by , charge sharing through the coupling capacitance gives a peak noise of about
Crosstalk noise with the text’s numbers. When the aggressor rises by 0.9 V, charge sharing through bumps the quiet victim to about 0.36 V before its driver pulls it back. The peak exceeds the 0.28 V noise margin, so the receiving gate could switch falsely.
Example: fF, fF, V → V. That exceeds the 0.28 V noise margin from the primer (F2): the receiving gate may switch falsely. A strong victim driver holding the line reduces the peak (the noise decays with the victim’s RC time constant), which is how SI fixing works: upsize the victim driver, space the wires, or shield with a grounded track.
D10The antenna effect
During manufacturing each metal layer is etched by plasma before the layers above exist. A long wire connected only to a transistor gate collects charge, and the thin gate oxide can be damaged. The rule limits the ratio
The antenna effect. While a long metal wire is being plasma-etched, it is connected only to a transistor gate and collects charge in proportion to its area. That charge can tunnel through and damage the thin gate oxide. The fixes give the charge another path: break the wire with a jump to a higher layer, or add a reverse-biased diode.
with typically a few hundred. Fixes: break the wire with a jump to a higher layer (so the long piece is not connected to the gate until later), or add a reverse-biased antenna diode that drains the charge. NanoRoute repairs antenna violations automatically when the LEF has antenna data; verifyGeometry reports the remainder.
Remember
Setup at slow, hold at fast, power at typical.
SPEF = R/C; SDF = delays.
Only a matching-PDK DRC/LVS run proves manufacturability.
7.1
Restore, extract and run implementation checks
Why this stepExports the parasitics and delays used by every signoff check and runs the implementation-level geometry checks.
AReopen the saved design
You can run this step either by typing the commands below at the encounter> prompt, or all at once with encounter -nowin -init scripts/signoff.tcl -log logs/signoff.log (the file is at the end of this step). If Encounter is closed, start it from the project directory (Step 4.0) and restore the database. The arguments are the .dat folder and the top-cell name. (The course's version is restoreDesign updown_counter_postRoute.enc.dat updown_counter; the names below match this lab.)
Verify → Verify Connectivity → OK. Opens, unconnected pins, antennas of dangling wires. Must be 0.
Verify → Verify Geometry → OK. Spacing/width/overlap rules known to Encounter.
Verify → Verify Process Antenna → OK. Checks the antenna ratios defined in gsclib045.lef (e.g. ANTENNAAREARATIO 475 on the metals); must be 0.
Verify → Verify Metal Density → OK. Each window of each metal must contain a minimum and maximum percentage of metal. gsclib045.lef asks for 20–65 % in every 120 × 120 µm window; your ≈14 µm core sits in a ≈214 µm die, so minimum density fails on most layers (the course notes the same, caused by widely spaced pads). The production fix is metal fill (addMetalFill) — run it, then re-verify; on a die this empty some windows may still fail, which you record and explain.
Verify → Verify Cut Density → OK. The same idea for vias.
Timing → Report Timing: Design Stage Post-Route, Analysis Type Setup, OK; repeat with Hold.
Same checks in TclverifyConnectivity -type all -report reports/signoff_connectivity.rpt
verifyGeometry -report reports/signoff_geometry.rpt
verifyProcessAntenna -reportfile reports/signoff_antenna.rpt
verifyMetalDensity -report reports/signoff_metal_density.rpt
verifyCutDensity -report reports/signoff_cut_density.rpt
timeDesign -postRoute -outDir reports/signoff_timing
timeDesign -postRoute -hold -outDir reports/signoff_timing
The same step as one script (scripts/signoff.tcl, 28 lines)
Run it in batch · shellencounter -nowin -init scripts/signoff.tcl -log logs/signoff.log
grep -i "Viols" reports/signoff_*.rpt
A density violation is a manufacturing-rule failure even when timing is clean. Record each result (pass, or the violation count and your explanation) in your lab README.
ANNOTATED OUTPUTverifyConnectivity / verifyGeometry outputillustrative — your exact numbers and names will differ
verifyConnectivity / verifyGeometry output******** Start: VERIFY CONNECTIVITY ********
Start Time: ...
Design Name: cnt_updown
Database Units: 2000 [1]
Design Boundary: (0.0000, 0.0000) (213.6000, 213.6800)
Error Limit = 1000; Warning Limit = 50
Check all nets
Begin Summary
Found no problems or warnings. [2]
End Summary
******** End: VERIFY CONNECTIVITY ********
...
VERIFY GEOMETRY ...... SubArea : 1 of 1
VG: elapsed time: 0.00
Begin Summary ...
Cells : 0
SameNet : 0
Wiring : 0
Antenna : 0 [3]
Short : 0
Overlap : 0
End Summary
Verification Complete : 0 Viols. 0 Wrngs. [4]
1 µm = 2000 database units — must match the -units of stream-out.
No opens, no dangling wires, no unconnected pins.
Each category is a different class of geometric rule (spacing, shorts, antenna…).
The line to record in your report.
ANNOTATED OUTPUTEncounter report_timing (post-route, setup)illustrative — your exact numbers and names will differ
Encounter report_timing (post-route, setup)Path 1: MET Setup Check with Pin count_reg_7_/CK [1]
Endpoint: count_reg_7_/D (^) checked with leading edge of 'core_clk'
Beginpoint: count_reg_0_/Q (v) triggered by leading edge of 'core_clk'
Path Groups: {reg2reg}
Analysis View: VIEW_SETUP [2]
Other End Arrival Time 0.212 [3]
- Setup 0.098
+ Phase Shift 10.000
- Uncertainty 0.200
= Required Time 9.914
- Arrival Time 0.861
= Slack Time 9.053 [4]
Clock Rise Edge 0.000
+ Clock Network Latency (Prop) 0.209 [5]
= Beginpoint Arrival Time 0.209
+----------------------------------------------------------------+
| Instance | Arc | Cell | Delay | Arrival | Required |
|---------------+--------+----------+-------+---------+----------|
| count_reg_0_ | CK ^ | | | 0.209 | 9.262 |
| count_reg_0_ | CK ^ -> Q v | DFFRHQX1 | 0.288 | 0.497 | 9.550 | [6]
| g214 | B v -> Y ^ | NAND2X1 | 0.091 | 0.588 | 9.641 |
| g209 | A ^ -> Y v | NOR2X1 | 0.083 | 0.671 | 9.724 |
| g201 | A v -> Y ^ | XNOR2X1 | 0.190 | 0.861 | 9.914 |
| count_reg_7_ | D ^ | DFFRHQX1 | 0.000 | 0.861 | 9.914 | [7]
+----------------------------------------------------------------+
One path, its type (setup) and the endpoint/beginpoint flops; ^ = rising, v = falling transition.
Must be the setup view (slow corner).
Other End Arrival Time = latency of the real clock tree to the capturing flop (ℓC) — no longer ideal after CTS.
Required = 0.212 − 0.098 + 10 − 0.2 = 9.914; slack = 9.914 − 0.861 = 9.053 ns. This is the setup inequality with skew, term by term (Chapter 2, D4).
Launch clock latency ℓL = 0.209 ns. Skew δ = 0.212 − 0.209 = 3 ps.
Each row is one cell arc; Delay comes from an NLDM lookup with the extracted wire load (Chapter 2, D6).
The Required column is the backward-pass RT at every pin; Required − Arrival is the same slack on every row of the critical path (Chapter 2, D3).
Troubleshooting — restore and signoff exports
restoreDesign: “cannot find … .dat” — pass the .enc.dat folder, not the .enc file, and give the top-cell name as the second argument.
rcOut: “RC corner RC_TYP not found” — the MMMC file was not reloaded. Restoring from the .dat folder normally brings it back; if you moved the project, re-run source scripts/lib_paths.tcl first because the MMMC file uses those variables.
Metal-density violations only — expected on this tiny design (see the note above). Run addMetalFill and re-verify; geometry and connectivity must still be 0.
Hold violations appear only after extraction — real wire caps changed the clock tree delays slightly. Run optDesign -postRoute -hold and re-export the SPEF/SDF.
7.2
Run extracted static timing and an SDF gate-level simulation
Why this stepChecks timing with real wires and re-proves function with real delays.
AThe course's PrimeTime sequence
The VT course signs off timing in Synopsys PrimeTime with this sequence. pt_setup.tcl sets the target/link libraries (compiled .db files). Positive slack in the max report means no setup violation; positive slack in the min report means no hold violation.
PrimeTime sequence from the mixed course · Tclsource pt_setup.tcl
read_verilog ./updown_counter_postRoute.enc.dat/updown_counter.v.gz
read_parasitics -format spef ./updown_counter_dve_typical.spef
read_sdc ./cnt_updown_syn_final.sdc
report_timing -nosplit -capacitance -path_type full_clock -significant_digits 4 -delay_type max
report_timing -nosplit -capacitance -path_type full_clock -significant_digits 4 -delay_type min
Your environment report confirms there is no PrimeTime or Tempus on the VM. Treat this as course coverage; use it only on a machine where the named signoff tool is installed. On your VM, the post-route timeDesign reports from Step 7.1 (which use the same extracted parasitics) are your timing evidence — state clearly in your report that they come from the implementation tool, not an independent signoff tool.
BRe-run the testbench with real routed delays
This is the strongest functional check available on your VM: the post-route netlist plus the SDF file (every cell and wire delay) plus the Chapter 1 testbench. The testbench already contains $sdf_annotate inside `ifdef SDF; +define+SDF switches it on.
model check done with no NO MODEL: line (clock buffers, tie and filler cells inserted by Encounter all have models).
PASS: 32 cycle checks matched, final count = 3.
The SDF statistics show the path delays annotated (a high percentage) and the timing checks at 0 %. That is expected: the generated models contain specify delay paths but no $setup/$hold checks, so NC reports warnings such as SDFNET/SDFNCAP for the TIMINGCHECK entries. Setup and hold are proven by Encounter’s static timing (Step 7.1), not by this simulation.
Because the testbench changes inputs half a cycle from the clock, real delays of a few hundred picoseconds do not upset it. In SimVision you can now see count change ≈0.3 ns after each rising clock edge (the routed clock-to-Q delay).
ANNOTATED OUTPUTlogs/sdf_annotate.log and the end of logs/irun_sdf.logillustrative — counts depend on your netlist; the 0 % timing-check line is expected with the generated models
logs/sdf_annotate.log and the end of logs/irun_sdf.logReading SDF file from location "results/cnt_updown.sdf" [1]
Annotating SDF timing data:
Compiled SDF file: cnt_updown.sdf.X
Log file: logs/sdf_annotate.log
Backannotation scope: tb_cnt_updown.dut
Configuration file:
MTM control: MAXIMUM [2]
Scale factors:
Scale type:
Annotation completed successfully...
SDF statistics: No. of Pathdelays = 151 Annotated = 9x.xx% [3]
No. of Tchecks = 40 Annotated = 0.00%
...
PASS: 32 cycle checks matched, final count = 3 [4]
The SDF written by Encounter in Step 7.1.
Which delay of each min:typ:max triplet is used — MAXIMUM for the setup-oriented view.
Path delays are annotated onto the generated models’ specify paths; a few conditional or edge-specific arcs may stay unmatched (warnings, not errors). Timing checks show 0 % because the generated models have none — signoff timing comes from Encounter, not from these models. “Instance not found” errors, on the other hand, would mean a netlist/SDF mismatch and must be fixed.
The same testbench passes with real routed delays: function is preserved end to end.
7.3
Create the PowerGrid library and run power
Why this stepPost-route power includes the clock tree and real wire capacitance; its current files feed rail analysis.
On your VM the supply of the slow corner is 1.08 V (nom_voltage of slow.lib); use it wherever a voltage is asked for. Post-route power and rail (IR-drop) analysis run inside Encounter's integrated power system (labelled Power & Rail in the course's version; in 13.10 these items live under the Power menu). They may require an extra license on your VM; if a menu item is greyed out, note that in your report.
ACharacterize the cells (PowerGrid library)
Rail analysis needs an electrical model of every cell's power pins. Choose Power & Rail → PowerGrid Library → Create PowerGrid Library and enter:
FIELD
VALUE
Cell List File
cell_list.list (a text file with one cell name per line — create it with cp logs/cell_names.txt cell_list.list)
Filler Cells
FILL*
Decap Cells
leave empty — gsclib045.lef has no decap cells (the report’s DECAP group is empty)
Results Directory
power_library
Click OK. Characterize the cells used by the design, including fillers and decaps.
Course values: the course’s PowerGrid library was written to power_library/fast_allcells.cl, which is the file selected later in Set Rail Analysis Mode, and the analysis view was typical_view at 25 °C. Use the .cl file your run actually produced (ls power_library).
BSet the power-analysis mode
Power & Rail → Set Power Analysis Mode: Analysis Mode Static, Analysis View VIEW_SETUP (the course's typical_view), Corner min as in the course (use max for a worst-case estimate). Tick Create Power Binary Database and Write Current Files — rail analysis needs those current files. Click OK. You may instead select dynamic vectorless or vector-based analysis; for vector-based, load the activity file from Chapter 3.
CRun the analysis
Power & Rail → Run Power Analysis: Results Directory report_power. Optionally load the VCD/TCF from the front-end simulation (only if the mode is dynamic vector-based). Click OK.
DView the results
Run the analysis and load power.db to inspect total and instance power: Power & Rail → Power & Rail Results; State Directory ./report_power → Load State; tick Power Database and select ./report_power/power.db; choose a Plot type (e.g. Total Instance Power) and tick Auto Apply so each selection redraws immediately.
If plots stay empty: as the course notes, try work as the state directory — the tool's default location for intermediate results.
Equivalent Tcl pattern (verify each option with help <command> in your build)
Static power analysis in Encounter 13 · Tclset_power_analysis_mode -reset
set_power_analysis_mode -method static -analysis_view VIEW_SETUP -corner max \
-create_binary_db true -write_static_currents true
set_power_output_dir -reset
set_power_output_dir report_power
set_default_switching_activity -reset
set_default_switching_activity -input_activity 0.2 -period 10.0
# optional: real activity from Chapter 3
# read_activity_file -format TCF -scope tb_cnt_updown.dut activity/dut.tcf
report_power -rail_analysis_format VS -outfile report_power/cnt_updown.rpt
Why post-route power differs
Clock-tree cells, extracted wire capacitance and actual slew now contribute. Vector-based activity is more realistic only when the workload is representative.
What you should see
power_library/ fills with one .cl file per corner (the course’s was fast_allcells.cl).
After Run Power Analysis, report_power/ contains power.db, a text report, and *.ptiavg current files.
The text report shows total power in the µW range for this design, with internal, switching and leakage columns.
Troubleshooting — power analysis
Menu items greyed out — the integrated power/rail engine may need a separate license on your VM — record that in the README.
“no activity” — set a default switching activity or load the TCF from Chapter 3.
Empty plots — load work as the state directory, as the course suggests.
7.4
Set up and run rail analysis
Why this stepVerifies every cell receives enough voltage under load.
ARail-analysis mode
Choose Power & Rail → Set Rail Analysis Mode. Load the PowerGrid library from power_library, the analysis view (VIEW_SETUP; the course uses its typical view) and temperature 125 °C — the temperature of slow.lib, which that view uses (the course used 25 °C with its typical corner). Use static analysis to match the power run.
BRun domain-based rail analysis
Choose Power & Rail → Run Rail Analysis. Define a domain containing VDD and VSS, and enter the supply voltages and the drop thresholds (the voltage below which a region is flagged):
NET
COURSE (65 nm)
YOUR VM
VDD voltage / threshold
0.88 V / 0.84 V
1.08 V (slow.lib nom_voltage) / 1.026 V (5 % drop)
VSS voltage / threshold
0 V / 0.04 V
0 V / 0.054 V (5 % of 1.08 V)
Provide the current files written in Step 7.3 (report_power/*.ptiavg) and the package connection (voltage source) locations — for a core-only design, use the ring as the source (tick the option to place sources on the ring/pins). Click OK.
CExactly how the course filled in this dialog
FIELD
COURSE VALUE
MEANING
Domain Based
ticked; Domain Name allDomains
analyse VDD and VSS together
Power Net(s) / Voltage / Threshold
VDD / 0.88 V / 0.84 V
flag any point below 0.84 V (≈ 5 % drop)
Ground Net(s) / Voltage / Threshold
VSS / 0 V / 0.04 V
flag ground bounce above 40 mV
Power Data
Current files, Scale 1
use the currents written by power analysis
Power/Current File(s)
./report_power/*.ptiavg (select all with Ctrl)
one average-current file per net
Voltage Source Files
VDD_wb.ppl → net VDD, VSS_wb.ppl → net VSS (Add each)
where the supply enters the grid
A .ppl file lists the supply connection points, one per line, as net x y layer. For a core-only design put a few points on the power ring. Print the real ring coordinates of your design at the encounter> prompt:
Print the ring wires · Tclforeach net {VDD VSS} {
foreach w [dbGet [dbGet -p top.nets.name $net].sWires] {
if {[dbGet $w.shape] eq "ring"} { puts "$net [dbGet $w.layer.name] [dbGet $w.box]" }
}
}
Each line is net layer {llx lly urx ury}. Take the middle of a ring segment: for a horizontal Metal9 segment use x anywhere between its ends and y = (lly + ury)/2; for a vertical Metal8 segment use y anywhere and x = (llx + urx)/2. With the floorplan of Step 4.5 the VDD ring (the inner one, listed first in addRing) runs about 4.5 µm outside the core — roughly x or y ≈ 95.5 on the left/bottom and ≈ 118 on the right/top. If the dbGet lines print nothing, click the ring in the GUI and press q instead.
VDD_wb.ppl (example for your floorplan — replace with the coordinates printed above)VDD 106.8 95.5 Metal9
VDD 106.8 118.1 Metal9
VDD 95.5 106.8 Metal8
VDD 118.1 106.8 Metal8
Write VSS_wb.ppl the same way on the VSS ring. Fewer or farther sources give larger IR drop — try moving them and watch the plot change.
Current through finite metal resistance creates voltage loss. A logically correct cell may slow down or fail if local supply voltage collapses during switching.
What you should see
The run log reports the worst IR drop for VDD and the worst ground bounce for VSS, and whether they exceed the thresholds.
rail_results/ (or the state directory) contains the result database loaded in Step 7.5.
7.5
Inspect IR drop and stream GDSII
Why this stepVisualises where voltage sags, then writes the GDSII the foundry would manufacture.
ALoad and plot the rail results
Open Power & Rail → Power & Rail Results, select the rail state directory, click Load State, and choose the IR-drop plot.
The layout is coloured by voltage drop: blue near the supply connections, warmer colours where current must travel farthest. Zoom into hot regions and use report_power -instance … on the cells there to relate current demand to voltage loss.
Pass criterion: the worst drop is below the threshold you set. If not: add stripes (smaller pitch), widen the ring, or add decap cells near the hot spot, then rerun Chapter 4 from the stripe step.
BStream out GDSII
GDSII is the polygon file a foundry manufactures from. In a production kit the real cell layouts are merged in from the library GDS during stream-out, and a map file from the PDK translates Encounter layer names to GDS layer numbers. The GPDK045 example kit on your VM has neither (Step 0.2), so you do the next-best complete thing:
Map file — write your own, scripts/gds_view.map, in the exact format of the Encounter map that ships with gpdk090 (gpdk090_v4.6/soce/soce_gds.map). The layer names Metal1–Metal9 and Via1–Via8 are identical in both kits, so the file reuses gpdk090’s GDS numbers (Metal1 = 7, Via1 = 8, Metal2 = 9 …). That makes the result viewable in Virtuoso with the gpdk090 technology in Step 7.6.
Cells — -outputMacros writes every standard cell as its LEF abstract (pins and obstructions on Metal1, Cont and Poly) instead of an empty reference, so the GDS is self-contained.
B1Create the map file (once)
Open the editor · shellgedit scripts/gds_view.map &
scripts/gds_view.map · Encounter stream map# Encounter streamOut layer map for gsclib045 (layer names Metal1..Metal9, Via1..Via8).
# GPDK045 ships no stream map, so the GDS numbers below are those of the gpdk090 kit
# (gpdk090_v4.6/stream/streamLayer.map) - this makes the GDS VIEWABLE in Virtuoso with
# the gpdk090 technology. It is a viewing map, not a foundry map.
#
# layer object types GDS-layer datatype
Metal1 NET, SPNET, VIA, PIN, LEFPIN, LEFOBS, FILL 7 0
Metal2 NET, SPNET, VIA, PIN, LEFPIN, LEFOBS, FILL 9 0
Metal3 NET, SPNET, VIA, PIN, LEFPIN, LEFOBS, FILL 11 0
Metal4 NET, SPNET, VIA, PIN, LEFPIN, LEFOBS, FILL 31 0
Metal5 NET, SPNET, VIA, PIN, LEFPIN, LEFOBS, FILL 33 0
Metal6 NET, SPNET, VIA, PIN, LEFPIN, LEFOBS, FILL 35 0
Metal7 NET, SPNET, VIA, PIN, LEFPIN, LEFOBS, FILL 38 0
Metal8 NET, SPNET, VIA, PIN, LEFPIN, LEFOBS, FILL 40 0
Metal9 NET, SPNET, VIA, PIN, LEFPIN, LEFOBS, FILL 42 0
Via1 ALL 8 0
Via2 ALL 10 0
Via3 ALL 30 0
Via4 ALL 32 0
Via5 ALL 34 0
Via6 ALL 37 0
Via7 ALL 39 0
Via8 ALL 41 0
Cont ALL 6 0
Poly ALL 3 0
NAME Metal1/PIN 7 3
NAME Metal2/PIN 9 3
NAME Metal3/PIN 11 3
NAME Metal4/PIN 31 3
NAME Metal5/PIN 33 3
NAME Metal6/PIN 35 3
NAME Metal7/PIN 38 3
NAME Metal8/PIN 40 3
NAME Metal9/PIN 42 3
Use File → Save → GDS/OASIS (Output file results/cnt_updown.gds, Map File scripts/gds_view.map, Library Name DesignLib, Units 2000, Mode ALL, and tick the option to output the LEF macros), or type:
Stream-out on your VM · Tclsource scripts/lib_paths.tcl
streamOut results/cnt_updown.gds \
-mapFile $STREAM_MAP \
-libName DesignLib -structureName cnt_updown \
-units $DB_UNITS -mode ALL \
-outputMacros
The course form is streamOut updown_counter.gds -mapFile ./libs/gds2.map -merge {standard_cell_library.gds io_pad_library.gds}. There is no -merge here because no cell GDS exists on your VM. -units must equal the LEF DATABASE MICRONS value: 2000.
Expected
The log ends with a summary of structures and layers written; ls -l results/cnt_updown.gds shows a file of some hundreds of kilobytes (the routed design plus abstracts of every gsclib045 cell). Warnings about layers that are not in the map (implant layers such as Nimp/Pimp inside cell abstracts, if any) are harmless for viewing.
ANNOTATED OUTPUTTail of the streamOut logillustrative — your exact numbers and names will differ
Tail of the streamOut logParse map file... [1]
Writing GDSII file ...
****** db unit per micron = 2000 ******
****** output gds2 file unit per micron = 2000 ****** [2]
****** unit scaling factor = 1 ******
Output for LEF macros [3]
Stream Out Information Processed for GDS version 5:
Units: 2000 DBU
Object Count
----------------------------------------
Instances 98 [4]
Ports/Pins 5
Nets ...
metal layer Metal1 ...
via layer Via1 ...
Done with stream out [5]
Parse map file reads scripts/gds_view.map. A line about an unknown object type would point to a typo in the map.
Unit scaling factor = 1 is the line to check: anything else means -units disagrees with the LEF.
Because of -outputMacros each used gsclib045 cell is written as a structure with its LEF pins and obstructions — no Merging with GDS libraries line, because there is nothing to merge.
Instances ≈ your cell count plus fillers; ports = the five top-level pins of cnt_updown (clk, reset, enable, up_down, count bus).
Done with stream out with no ERROR lines above it = a complete GDS. Next, view it in Virtuoso (Step 7.6).
Troubleshooting — stream-out
-outputMacros is not accepted — run the same command without it. The GDS then contains the routing and empty references to the cells; Virtuoso shows the cells as named boxes only.
“Layer … is not mapped” for Metal* or Via* — a line of scripts/gds_view.map was lost while pasting; compare with the block above (wc -l).
Map-file parse error on LEFPIN/LEFOBS — your build may not know these object types; delete , LEFPIN, LEFOBS from the nine Metal lines (that is exactly the format of $GPDK090/soce/soce_gds.map) and stream out again.
Virtuoso shows the layout 10× too small or too large — -units does not match the LEF DATABASE MICRONS (see the GDS-grid diagram in the signoff theory).
Final checkpointConnectivity, geometry and antenna checks are 0, density results are recorded, setup and hold pass, power and rail results (or the missing-license note) are recorded, and results/cnt_updown.gds was written with unit scaling factor 1.
7.6
View the final GDS in Virtuoso — and what DRC/LVS can prove on this VM
Why this stepSeeing the streamed layout closes the RTL→GDS loop; knowing what Assura can and cannot check here keeps your report honest.
AWhy Assura cannot sign off this layout here
Assura DRC compares polygons with a foundry rule deck, and LVS extracts transistors from the layout and compares them with a netlist. Your VM has Assura decks only for gpdk090 ($GPDK090/assura/drc.rul, extract.rul, compare.rul …), and the 45 nm GDS contains no transistors at all — only routing and LEF abstracts, because the kit has no cell GDS. A 90 nm deck run on 45 nm geometry would flag nearly every wire, and LVS would find nothing to extract. So, on this VM:
QUESTION
EVIDENCE YOU HAVE
WHERE
Are the wires legal (width, spacing, shorts, antennas)?
Encounter verifyGeometry, verifyProcessAntenna against the rules in gsclib045.lef
Step 7.1
Is everything connected, including power?
verifyConnectivity (0 opens, 0 unconnected pins)
Steps 4.14, 7.1
Does the layout netlist do what the RTL does?
Post-route netlist + SDF simulation with the same self-checking testbench (PASS)
Step 7.2
Is the scan chain intact after layout?
Post-route scan shift test (PASS)
Step 6.5
Does it meet timing with real wires?
Post-route timeDesign setup + hold with cap-table extraction
Steps 4.13, 7.1
Foundry DRC / LVS
Not available for GPDK045 on this VM — record exactly that
README (Step 7.7)
BStream the GDS into a viewing library
Work in a separate virtuoso/ folder so Virtuoso’s cds.lib does not clash with the NC cds.lib in the project root (Step 1.5). The new cds.lib simply includes your usual /home/buet/cds_work/cds.lib, which already defines gpdk090. strmin creates the library cnt_gds_view, attaches it to the gpdk090 technology, and uses gpdk090’s own layer map — the numbers your gds_view.map wrote.
The same through the GUI: in the CIW choose File → Import → Stream; Stream File = ../results/cnt_updown.gds, Library = cnt_gds_view, Top Cell = cnt_updown, Attach Technology Library = gpdk090; under Options → Layers load the layer map /home/buet/cadence/gpdk090_v4.6/libs.oa22/gpdk090/gpdk090.layermap; click Translate.
COpen and inspect the layout
In the CIW open Tools → Library Manager, select library cnt_gds_view, cell cnt_updown, view layout, and open it.
Press Shift+F to show all hierarchy levels and f to fit. Your ~/.cdsinit key bindings (scroll-wheel zoom) work here too.
Check what you see against Encounter: the VDD/VSS ring on Metal8/Metal9 around a ≈14 µm core, the two stripe pairs per direction, the Metal1 rails along the eight rows, signal routing on the lower metals, and each standard cell as a sub-cell named after its gsclib045 master, showing its pins.
Use the ruler (k) on the ring: 3 µm wide, 4 µm apart — the values you typed in Step 4.7. A correct scale proves that -units 2000 matched the LEF.
What you should see
strmin.log ends with a translation summary and no errors; unmapped-layer warnings should not appear for Metal/Via layers.
The layout opens and shows the routed counter in gpdk090’s layer colours. The cells show pins and obstructions, not transistors — expected, because the kit has no cell GDS.
Viewing only. The gpdk090 technology is attached purely so Virtuoso knows how to draw layers 7, 8, 9 …. Do not run Assura DRC/LVS from this view, and do not report any result from it — the geometry is 45 nm and the rules are 90 nm. If you want to practise Assura itself, run it on your own gpdk090 layouts (your mylib2/nand2 cell, for example) — that is the deck’s real purpose.
Troubleshooting — strmin and Virtuoso
strmin: command not found — the setup file was not sourced in this terminal (which strmin must print …/IC615/tools/dfII/bin/strmin).
“Library gpdk090 not found” — the cds.lib in virtuoso/ was not created, or /home/buet/cds_work/cds.lib moved. cat cds.lib must show the SOFTINCLUDE line; grep gpdk090 /home/buet/cds_work/cds.lib must show DEFINE gpdk090 /home/buet/cadence/gpdk090_v4.6/libs.oa22/gpdk090.
“Library cnt_gds_view already exists” on a second run — delete it first: rm -rf cnt_gds_view (inside virtuoso/), then rerun strmin.
The layout is empty — the top cell name must be cnt_updown (it is the -structureName of Step 7.5). strings ../results/cnt_updown.gds | grep -m3 cnt_updown shows it.
Checkpointcnt_gds_view/cnt_updown/layout opens in Virtuoso and shows the ring, stripes, rails and routed cells at the right scale; your README states that foundry DRC/LVS is not available for GPDK045 on this VM and lists the Encounter checks used instead.
7.7
Archive the evidence, not only the GDS
Why this stepA result is only credible if someone (including future you) can reproduce it from the archived inputs.
Keep the exact RTL, testbench, constraints, Tcl scripts, libraries by version, tool logs, reports, scan-chain report, final netlist, SDF/SPEF, DEF, GDS, stream map, DRC/LVS summaries and a short README containing the commands used. A GDS with no reproducible inputs is not a complete lab result.
Write a README and archive · shellcd /home/buet/cds_work/asic_lab
cat > README.txt <<'EOF'
cnt_updown ASIC lab - RTL to GDS on the BUET CentOS 6.5 VM
Tools : Incisive 10.20-s100, RTL Compiler v12.10-s012_1, Encounter v13.10-p003_1 (32bit),
Virtuoso 6.1.5 (viewing), Python 2.6 (library helper)
PDK : GPDK045 example kit (slow/fast.lib, gsclib045.lef, TECH/capTable) - see scripts/lib_paths.tcl
generated views: libs/gsclib045_cells.v, libs/slow_scan.lib (scripts/gpdk045_libtool.py)
Flow :
irun rtl/cnt_updown.v tb/tb_cnt_updown.v -> RTL sim PASS (350 ns)
rc -files scripts/rtl_rc.tcl -> results/cnt_updown_mapped.v
irun libs/gsclib045_cells.v + mapped netlist -> gate-level sim PASS
rc -files scripts/rc_power.tcl -> reports/power_tcf.rpt
encounter -nowin -init scripts/encounter.tcl -> results/*postRoute*, .spef, .sdf, .def, .gds
rc -files scripts/rtl_rc_scan.tcl -> results/cnt_updown_scan.v (chain length 8)
encounter -nowin -init scripts/encounter_scan.tcl -> results/cnt_updown_scan_postRoute.*
encounter -nowin -init scripts/signoff.tcl -> reports/signoff_*
strmin ... -attachTechFileOfLib gpdk090 -> virtuoso/cnt_gds_view (viewing only)
Results : (fill in WNS setup/hold, area, power, IR drop, density, antenna)
DRC/LVS : foundry DRC/LVS not available for GPDK045 on this VM (no 45 nm decks, no cell GDS);
Encounter verifyGeometry/Connectivity/ProcessAntenna + SDF gate-level sim used instead
EOF
tar -czf cnt_updown_asic_lab.tar.gz \
README.txt setup_cadence.sh dumptcf.tcl \
rtl tb constraints scripts libs activity reports results logs virtuoso/cds.lib
ls -lh cnt_updown_asic_lab.tar.gz
What you should see
README.txt filled in with your real numbers.
ls -lh cnt_updown_asic_lab.tar.gz shows an archive of a few megabytes; tar -tzf lists all folders.
You are finished only whenRTL and gate simulations pass; synthesis is constrained; placement, CTS and route are legal; setup and hold pass; power integrity is reviewed (or the missing license recorded); scan shift works before and after layout; the GDS opens in Virtuoso; and the DRC/LVS status — not available for GPDK045 on this VM, Encounter checks used instead — is written in the README.
✔ Chapter recap
Commands in order
Chapter commands, in order (condensed — every option is in the steps)restoreDesign results/cnt_updown_postRoute.enc.dat cnt_updown
extractRC; rcOut -spef results/cnt_updown.spef -rc_corner RC_TYP
write_sdf -view VIEW_SETUP results/cnt_updown.sdf
verifyConnectivity; verifyGeometry; verifyMetalDensity; verifyCutDensity
timeDesign -postRoute; timeDesign -postRoute -hold
irun ... +define+SDF results/cnt_updown_postRoute.v tb/tb_cnt_updown.v
streamOut results/cnt_updown.gds -mapFile $STREAM_MAP -libName DesignLib -structureName cnt_updown -units 2000 -mode ALL -outputMacros
cd virtuoso; strmin -library cnt_gds_view -strmFile ../results/cnt_updown.gds -topCell cnt_updown -attachTechFileOfLib gpdk090 -layerMap $GPDK090/libs.oa22/gpdk090/gpdk090.layermap
virtuoso & # view only - no Assura on the 45 nm layout
tar -czf cnt_updown_asic_lab.tar.gz README.txt rtl tb constraints scripts reports results logs
What you should now have
FILE
WHAT IT IS
results/cnt_updown.spef / .sdf
Parasitics and delays
report_power/, rail results
Power and IR-drop evidence
results/cnt_updown.gds
The layout to manufacture
reports/signoff_*.rpt · virtuoso/cnt_gds_view
Encounter physical checks · the GDS opened in Virtuoso
cnt_updown_asic_lab.tar.gz
Reproducible archive
? Check yourself
Q1Hold is checked at the fast corner because…
Hold fails when new data arrives too early — worst with the fastest transistors.
Q2A 5 % IR drop typically makes gates slower by about…
From the alpha-power law with Vt = 0.35, α = 1.3 the ratio is ≈ 1.06.
Q3Relative delay variation of a path of N independent gates scales as…
σ grows as √N while μ grows as N, so σ/μ ∝ 1/√N — deep paths average out.
⚠ Common mistakes in this chapter
Checking hold at the slow corner (it must be the fast corner).
Mixing PDKs for DRC/LVS and calling a run “clean”.
Streaming out GDS with -units different from the LEF database units.
Reporting Encounter verifyGeometry as a foundry DRC pass.
Running gpdk090 Assura DRC on the 45 nm GDS that was only streamed into gpdk090 for viewing.
CHAPTER 8 · COURSE APPENDIX
The original mixed Synopsys/Cadence flow
Included so every branch behind the VT “Digital Design Flow” link remains represented.
You start withNothing new — this is a reference chapter
You end withThe ability to follow the original VT Synopsys flow
ToolsSynopsys tools (not on your VM)
Timereading only
THEORYSame flow, other vendor — a translation table≈ 3 min read
T1Tool equivalents
TASK
CADENCE (your VM → today)
SYNOPSYS
Simulation
Incisive irun → Xcelium xrun
VCS
Waveforms
SimVision
DVE → Verdi
Synthesis
RTL Compiler → Genus
Design Compiler (Design Vision GUI)
Place & route
Encounter → Innovus
IC Compiler → Fusion Compiler
Signoff STA
Tempus
PrimeTime
Extraction
QRC → Quantus
StarRC
DRC / LVS
Assura → Pegasus
IC Validator
ATPG
Encounter Test → Modus
TetraMAX
T2File-format equivalents
PURPOSE
CADENCE FLOW
SYNOPSYS FLOW
Library
.lib read directly
.lib compiled to .db (lc_shell)
Activity
TCF
SAIF
Constraints
SDC — shared by both vendors
Netlist / parasitics / delays
Verilog / SPEF / SDF — shared
Because SDC, Verilog, SPEF, SDF, LEF/DEF and GDS are open standards, the course can synthesize with Synopsys and place-and-route with Cadence — the “mixed flow”.
8.1
Historical remote-access setup
Why this stepNeeded only if you ever run the tools on a remote server instead of the local VM.
The course documents Xming/PuTTY/WinSCP on Windows and XQuartz plus ssh -X on macOS, to display Linux GUI tools running on a remote server. Use your college’s current VPN and SSH guidance rather than installing the exact old versions blindly. On your VM you are already working locally, so this whole step is only needed if you ever run the tools on a remote server.
1Install and start an X server (Windows: Xming)
Install Xming with all default options, then the Xming-fonts package into the same folder (with Xming closed). Xming must be running before you connect. Check the taskbar for its icon:
…or open the Task Manager (Ctrl+Shift+Esc → Processes) and look for Xming.exe:
Today: Windows 10/11 users can instead use VcXsrv, MobaXterm (built-in X server), or WSLg.
2Connect with PuTTY and X11 forwarding
Run putty.exe. In the left tree go to Connection → SSH → X11 and tick Enable X11 forwarding.
Go back to Session, type the server's host name, enter a name under Saved Sessions and click Save.
Select the saved session and click Open; log in when prompted.
Test the forwarding by typing xclock & on the server — a clock window must appear on your PC. (Built-in alternative on modern Windows: ssh -X user@host in PowerShell with an X server running.)
3Map your server home folder as a network drive (optional)
In Windows File Explorer, right-click This PC → Map network drive:
Enter the file-server path given by your college (VT's was \\filebox.ece.vt.edu), choose a free drive letter, and give your credentials:
4Copy files with WinSCP
Install WinSCP, choose the saved PuTTY session (or type host, user, password), and click Login. Drag files between the two panes. Remember to save Verilog/Tcl files with their real extensions, not .txt.
macOS: install XQuartz, open Terminal, and run ssh -X your_user@server.
8.2
Compile libraries and simulate with VCS/DVE
Why this stepThe Synopsys counterpart of Chapter 1 — useful when reading the original course.
The Synopsys version of Chapter 1. These tools are not on your VM; this is the course's procedure for reference.
1Compile the Liberty libraries to .db
Synopsys tools read libraries in their binary .db format. In the project directory, start Library Compiler and convert each .lib (the course compiles a standard-cell and an I/O-pad library):
Course commands · shellvcs -full64 cnt_updown.v tb_cnt_updown.v
./simv
dve &
vcs compiles both files into an executable named simv (-full64 selects the 64-bit binaries):
Running ./simv executes the simulation and writes updown_counter.dump. Then start DVE (Discovery Visualization Environment):
3Open the dump in DVE
File → Open Database → select updown_counter.dump → Open:
The hierarchy appears once the database is loaded:
4Select signals and view waves
Click tb_cnt_updown in the hierarchy pane; its signals are listed in the variable pane:
Select them, then Signal → Add To Waves → New Wave View:
Finally View → Zoom → Zoom Full to see the whole run, and verify the same behavior table as Step 1.8:
8.3
Synthesize in Design Vision / dc_shell
Why this stepThe Synopsys counterpart of Chapter 2 — its outputs are what the course imports into Encounter.
The Synopsys version of Chapter 2. Start design_vision from the project directory (it reads .synopsys_dc.setup from there).
1Read the design
File → Read → select cnt_updown.v (set file type to All Files (*) if it is not listed) → Open.
2Look at the schematic
Select the design in the Logical Hierarchy window and click the Create Schematic button (second symbol on the toolbar):
A symbol for the block appears:
Double-click the symbol to see the generic logic inside it:
3Analyze, elaborate and link
File → Analyze… → Add cnt_updown.v → Work Library WORK → tick Create new library if it does not exist → OK.
File → Elaborate → Library WORK → OK.
File → Link Design → add your ./libs/ path to the search path, make sure the compiled .db files are in the link library list → OK.
4Constraints and uniquify
Select the design → Hierarchy → Uniquify → OK (gives every instance of a repeated module its own copy so each can be optimized separately):
Load the constraints with File → Execute Script → file type All files (*) → cnt_updown.sdc → OK (or type source cnt_updown.sdc in the console):
5Compile, propagate activity, report and write
Run Design → Compile Ultra, tick Retime and Exact Map, OK, then propagate switching activity, report power and write the mapped Verilog. The activity commands used in the course:
Batch form: the course's dc_shell.tcl contains all of the above as commands; run it with dc_shell -f dc_shell.tcl | tee dc.log. Its outputs (cnt_updown_dve.v and cnt_updown_syn.sdc) are what the course imports into Encounter in Step 4.2.
REFERENCE
Glossary
Every abbreviation used on this page, in one place. Type in the box to filter.
TERM
MEANING
Electrical effort h
Cout/Cin of a gate — its fan-out ratio.
Parasitic delay p
Delay of a gate charging its own output capacitance, independent of load.
Stage effort f
f = g·h, the load-dependent part of a gate’s delay.
Branching effort b, B
(Con-path + Coff-path)/Con-path at a node; B is the product along a path.
Path effort F
F = G·B·H, fixed for a path; minimum delay N·F1/N + P.
Arrival / required time
Latest time a signal can change at a pin / latest time it may arrive and still be captured.
Critical path
The path with the smallest slack — it limits the clock frequency.
NLDM
Non-linear delay model: Liberty tables of delay vs input slew and output load.
Elmore delay
Σ Rk·Cdownstream along a path in an RC tree.
Generate / propagate
g = a·b, p = a ⊕ b: the building blocks of fast adders.
Parallel prefix adder
Adder computing all carries with an associative (G,P) operator in log₂n levels (e.g. Kogge–Stone).
Domino logic
Dynamic precharge/evaluate gates followed by inverters.
Charge sharing
Loss of voltage on a dynamic node when it connects to discharged internal capacitance.
Time borrowing
Late data passing through a transparent latch, using time from the next stage.
Latch-up
Parasitic PNPN thyristor turning on and shorting VDD to VSS.
Well tap / end cap
Cells tying wells and substrate to the supplies / closing row ends.
Jitter
Variation in the timing of clock edges themselves.
CPPR
Common path pessimism removal — gives back OCV derating on the shared clock path.
Body effect
Threshold rises when the source is above the body: Vt = Vt0 + γ(√(2φF+VSB) − √(2φF)).
BDD
Binary decision diagram — a canonical graph form of a Boolean function for a fixed variable order.
D-algorithm
ATPG method using values {0,1,X,D,D̄} to activate and propagate a fault.
Dennard scaling
Constant-field scaling: dimensions and voltage shrink together, keeping power density constant.
EDP / PDP
Energy–delay product / power–delay product (energy per switching event).
Equivalence checking (LEC)
Formal proof that two netlists compute the same functions, via a miter f ⊕ g.
Prime implicant
A product term covering only 1s of a function that cannot be enlarged further.
Pelgrom’s law
σ(ΔVt) = AVt/√(WL): mismatch shrinks with device area.
AOCV
Advanced OCV — derates that depend on path depth and distance.
Lee algorithm
Breadth-first maze routing that always finds a shortest grid path.
Steiner tree
Minimum-length tree connecting pins, allowed extra branching points.
Retiming
Moving registers across logic without changing function.
Useful skew
Deliberately unequal clock arrival times chosen to improve timing.
Transition fault
At-speed fault model: a node is slow to rise or slow to fall.
Antenna effect
Plasma charging of gate oxide through long metal during fabrication.
Sheet resistance
R□ = ρ/t — resistance per square of a layer.
Transmission gate
Parallel NMOS + PMOS switch that passes both 0 and 1 fully.
CMOS
Complementary MOS — logic built from paired NMOS pull-down and PMOS pull-up networks.
Noise margin
How much noise a logic level tolerates: NML = VIL − VOL, NMH = VOH − VIH.
Logical effort
Ratio of a gate’s input capacitance to an inverter’s delivering the same current (g).
FO4
Delay of an inverter driving four copies of itself — a technology-independent delay unit.
Latch
Level-sensitive storage element; transparent while enabled.
Metastability
A flop output hanging between 0 and 1 after a setup/hold violation.
MTBF
Mean time between failures (here: of a synchroniser).
LFSR
Linear feedback shift register — generates pseudo-random patterns.