↑

DIGITAL IC DESIGN · LAB NOTEBOOK

From RTL to Routed Silicon

Made by swr06

Incisive 10.20-s100RTL Compiler 12.10-s012_1Encounter 13.10-p003_1Virtuoso 6.1.5Assura 4.1GPDK045 example kitCentOS 6.5 · 32-bit
RTL + testbenchIncisive simRTL CompilerTCF powerEncounter P&RScan (DFT) + scan P&RSignoff checksGDSII + Virtuoso view
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 ROADMAP

PRIMER · OPTIONAL BACKGROUND

VLSI foundations — from transistor to flip-flop

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 VtV_t, the classic long-channel (“square-law”) model is:

ID={0VGS<Vt(cut-off)β[(VGS−Vt) VDS−VDS22]VDS<VGS−Vt(linear)β2 (VGS−Vt)2VDS≥VGS−Vt(saturation)β=μ Cox WLI_D = \begin{cases} 0 & V_{GS} \lt V_t \quad\text{(cut-off)}\\[4pt] \beta\left[(V_{GS}-V_t)\,V_{DS} - \dfrac{V_{DS}^2}{2}\right] & V_{DS} \lt V_{GS}-V_t \quad\text{(linear)}\\[8pt] \dfrac{\beta}{2}\,(V_{GS}-V_t)^2 & V_{DS} \ge V_{GS}-V_t \quad\text{(saturation)} \end{cases} \qquad \beta = \mu\,C_{ox}\,\frac{W}{L}
025507510000.20.40.60.8VGS = 0.9 VVGS = 0.8 VVGS = 0.7 VVGS = 0.6 Vdrain–source voltage VDS (V)drain current (% of max)linear (triode)saturation← dashed: VDS = VGS − Vt
Output characteristics from the equations above (Vt=0.35V_t = 0.35 V). Left of the dashed parabola the transistor acts like a resistor; right of it, like a current source.
  • Width WW is the designer’s knob. Doubling WW doubles β\beta 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: ID,sat∝(VGS−Vt)αI_{D,\text{sat}} \propto (V_{GS}-V_t)^{\alpha} with α≈1.3\alpha \approx 1.3. 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 VDDV_{DD} 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.

00.30.60.900.150.30.450.60.750.9Voutinput voltage Vin (V)output voltage Vout (V)VILVIHVOHVOLVM: Vin = Voutslope = −1slope = −1
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 Vin=Vout=VMV_{in} = V_{out} = V_M both transistors are saturated and carry the same current:

βn2(VM−Vtn)2=βp2(VDD−VM−∣Vtp∣)2    ⇒    VM=Vtn+r (VDD−∣Vtp∣)1+r,r=βp/βn\frac{\beta_n}{2}(V_M - V_{tn})^2 = \frac{\beta_p}{2}(V_{DD} - V_M - |V_{tp}|)^2 \;\;\Rightarrow\;\; V_M = \frac{V_{tn} + r\,(V_{DD} - |V_{tp}|)}{1 + r}, \qquad r = \sqrt{\beta_p/\beta_n}

With βp=βn\beta_p = \beta_n (PMOS made about 2× wider) and Vtn=∣Vtp∣V_{tn} = |V_{tp}|, VM=VDD/2V_M = V_{DD}/2: a symmetric inverter.

Noise margins. VILV_{IL} and VIHV_{IH} are the inputs where the slope is −1-1; VOHV_{OH}, VOLV_{OL} the corresponding outputs:

NML=VIL−VOL,NMH=VOH−VIHNM_L = V_{IL} - V_{OL}, \qquad NM_H = V_{OH} - V_{IH}
From the plot: VIL=0.326V_{IL} = 0.326, VOL=0.044V_{OL} = 0.044, VIH=0.574V_{IH} = 0.574, VOH=0.856V_{OH} = 0.856 V → NML=NMH=0.282NM_L = NM_H = 0.282 V, about 31 % of VDDV_{DD}. 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:

CONNECTIONCONDUCTS WHEN…BOOLEAN MEANING
Two transistors in seriesboth are onAND
Two transistors in paralleleither is onOR
NAND2: Y = ¬(A·B)VDDGNDPMOS APMOS BYNMOS ANMOS Bpull-up: parallel · pull-down: seriesNOR2: Y = ¬(A+B)VDDGNDPMOS APMOS BYNMOS ANMOS Bpull-up: series · pull-down: parallel
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 BNMOS A · NMOS BPDN (series)PMOS A · PMOS BPUN (parallel)Y
0 0off · offopenon · onconducts1
0 1off · onopenon · offconducts1
1 0on · offopenoff · onconducts1
1 1on · onconductsoff · offopen0

In every row exactly one network conducts — that is Y=A⋅B‾Y = \overline{A\cdot B}. The same recipe builds any gate of the form Y=f‾Y = \overline{f}:

  1. Write ff using AND and OR.
  2. Build the PDN so it conducts when f=1f = 1: AND → series, OR → parallel.
  3. Build the PUN as the dual: swap every series for parallel and vice versa. De Morgan’s law guarantees it conducts exactly when f=0f = 0.
Example — AOI21, Y=A⋅B+C‾Y = \overline{A\cdot B + C}: 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:

  1. A transistor’s on-resistance is inversely proportional to its width: a unit-width NMOS has resistance RR; width 2 has R/2R/2.
  2. A PMOS conducts about half as well (holes are slower than electrons), so it needs width 2 to reach resistance RR.
  3. 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 CC).
InverterNAND2NOR2P w=2N w=1YP w=2P w=2N w=2N w=2YP w=4P w=4YN w=1N w=1g = 3/3 = 1p = 3/3 = 1g = 4/3p = 6/3 = 2g = 5/3p = 6/3 = 2widths chosen so the worst pull-up and the worst pull-down each have resistance R (same as the inverter)
Every gate sized so that its worst-case pull-up and pull-down each have resistance RR, just like the reference inverter.

Now work out each gate in the figure:

  • Inverter. NMOS width 1 (resistance RR), PMOS width 2 (resistance RR). The input connects to both gates: input capacitance =1+2=3= 1 + 2 = 3 units.
  • NAND2. The two NMOS are in series, so their resistances add. To total RR, each must be R/2R/2 → 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 RR → width 2. Input A touches one NMOS (2) and one PMOS (2): input capacitance =4= 4 units.
  • NOR2. Now the PMOS are in series: each must be R/2R/2 → width 4. The NMOS are in parallel, worst case one on → width 1 each. Input capacitance =1+4=5= 1 + 4 = 5 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:

g  =  input capacitance of the gateinput capacitance of an inverter with the same output current⇒ginv=33=1,gNAND2=43,gNOR2=53g \;=\; \frac{\text{input capacitance of the gate}}{\text{input capacitance of an inverter with the same output current}} \qquad\Rightarrow\qquad g_{\text{inv}} = \tfrac33 = 1,\quad g_{\text{NAND2}} = \tfrac43,\quad g_{\text{NOR2}} = \tfrac53

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 pp: the capacitance a gate must charge on its own output (the drain areas of the transistors touching it), relative to an inverter. Inverter: 1+2=31 + 2 = 3 units → p=1p = 1. NAND2: PMOS 2+22 + 2 plus the top NMOS 22 = 6 units → p=6/3=2p = 6/3 = 2. NOR2: PMOS 44 plus NMOS 1+11 + 1 = 6 → p=2p = 2. Generalising to nn inputs:

GATELOGICAL EFFORT g (per input)PARASITIC DELAY pWHY
Inverter11the reference
NANDnn(n+2)/3(n+2)/3nnnn NMOS in series, each width nn
NORnn(2n+1)/3(2n+1)/3nnnn PMOS in series, each width 2n2n
2:1 multiplexer24transmission-gate structure
XOR2 / XNOR244needs both true and complemented inputs

Two lessons follow immediately: wide NOR gates are expensive (gNOR4=3g_{\text{NOR4}} = 3), and wide gates of any kind have large pp. Libraries stop at 3–4 inputs for exactly this reason.

F4bThe delay of one gate: d=g h+pd = g\,h + p

Measure time in units of τ\tau: the delay of an ideal inverter driving one identical inverter, ignoring its own parasitics. Since the inverter’s resistance RR drives 3 units of capacitance, τ=3RC\tau = 3RC — about 3–5 ps in a 45 nm process.

Deriving the formula. Take a gate whose input capacitance is CinC_{\text{in}}. An inverter with the same drive strength would have input capacitance Cin/gC_{\text{in}}/g, i.e. it would be Cin/(3g)C_{\text{in}}/(3g) times a unit inverter, so its resistance is

Rgate=RCin/(3g)=3gRCinR_{\text{gate}} = \frac{R}{C_{\text{in}}/(3g)} = \frac{3gR}{C_{\text{in}}}

This resistance charges the load CoutC_{\text{out}}, and also the gate’s own parasitic capacitance (which gives the pp term):

delay=Rgate Cout+p τ=3RC⋅g CoutCin+p τ⟹ d=g h+p ,h=CoutCin\text{delay} = R_{\text{gate}}\,C_{\text{out}} + p\,\tau = 3RC\cdot g\,\frac{C_{\text{out}}}{C_{\text{in}}} + p\,\tau \quad\Longrightarrow\quad \boxed{\,d = g\,h + p\,}, \qquad h = \frac{C_{\text{out}}}{C_{\text{in}}}

Each symbol has a physical meaning you can point at:

SYMBOLNAMEWHAT IT MEASURESWHO SETS IT
gglogical efforthow much harder this gate type is to drive than an inverterthe gate’s function and topology
hhelectrical effort (fan-out)how much bigger the load is than the gate’s own inputthe size you choose for the gate and what it drives
f=ghf = g hstage effortthe part of delay that depends on load — “how hard the gate is working”both
ppparasitic delaythe fixed delay of charging its own output, even with no loadthe gate type (not its size: bigger gates have proportionally bigger drain caps and lower resistance)
024681012140123456inverter d = h + 1NAND2 d = 4h/3 + 2NOR2 d = 5h/3 + 2electrical effort h = Cout / Cindelay d (units of τ)FO4 inverter: h = 4, d = 5p = intercept at h = 0slope = g
Delay is a straight line in hh: the slope is gg, the intercept is pp. 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 h=4h = 4:
d=43×4+2=7.33 τd = \tfrac43\times4 + 2 = 7.33\,\tau. Compare the FO4 inverter: d=1×4+1=5 τd = 1\times4 + 1 = 5\,\tau. The NAND2 is about 47 % slower at the same fan-out. With τ≈4\tau \approx 4 ps that is 29 ps vs 20 ps.

F4cFrom one gate to a whole path: GG, BB, HH, FF and DD

Real timing paths are chains of gates. Suppose the path has NN stages. Its delay is simply the sum of the stage delays:

D=∑i=1N(gi hi+pi)D = \sum_{i=1}^{N} \bigl(g_i\,h_i + p_i\bigr)

The gig_i and pip_i are fixed by which gates the logic needs. The hih_i 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 GG
G=∏i=1NgiG = \prod_{i=1}^{N} g_i

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 G=1G = 1). Inverters, NAND2, NOR2, inverter gives G=1⋅43⋅53⋅1=209≈2.2G = 1\cdot\tfrac43\cdot\tfrac53\cdot1 = \tfrac{20}{9} \approx 2.2.

2 · Path electrical effort HH
H=CloadCinH = \frac{C_{\text{load}}}{C_{\text{in}}}

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 HH.

3 · Branching effort BB

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:

stage idrives the nodenext stageon-path C_onside loadoff-pathside loadoff-pathb = (C_on + C_off) / C_onhere, three equal loads:b = 3C / C = 3stage i must deliver 3× thecurrent the path itself needs
One stage driving the on-path gate plus two equal side loads.
bi=Con-path+Coff-pathCon-path,B=∏i=1Nbib_i = \frac{C_{\text{on-path}} + C_{\text{off-path}}}{C_{\text{on-path}}}, \qquad B = \prod_{i=1}^{N} b_i

With no side loads b=1b = 1. With the two equal side loads in the figure b=3b = 3: the path must work three times harder at that node.

4 · Path effort FF — the key fact
F=G B HF = G\,B\,H

Here is why this product matters. The electrical effort of stage ii is hi=Cout,i/Cin,ih_i = C_{\text{out},i}/C_{\text{in},i}, and stage ii’s output load is the next stage’s input times its branching, Cout,i=bi Cin,i+1C_{\text{out},i} = b_i\,C_{\text{in},i+1}. Multiply all the hih_i together and watch the intermediate sizes cancel:

∏i=1Nhi=b1Cin,2Cin,1⋅b2Cin,3Cin,2⋯CloadCin,N=(∏bi)CloadCin,1=B H\prod_{i=1}^{N} h_i = \frac{b_1 C_{\text{in},2}}{C_{\text{in},1}}\cdot\frac{b_2 C_{\text{in},3}}{C_{\text{in},2}}\cdots\frac{C_{\text{load}}}{C_{\text{in},N}} = \Bigl(\prod b_i\Bigr)\frac{C_{\text{load}}}{C_{\text{in},1}} = B\,H

Every Cin,2,…,Cin,NC_{\text{in},2}, \dots, C_{\text{in},N} appears once on top and once underneath. Therefore

∏i=1Nfi=∏i=1Ngihi=G B H=F\prod_{i=1}^{N} f_i = \prod_{i=1}^{N} g_i h_i = G\,B\,H = F

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 f1+f2+⋯+fNf_1 + f_2 + \dots + f_N while their product is fixed at FF. The arithmetic–geometric mean inequality says that for positive numbers

f1+f2+⋯+fNN  ≥  (f1f2⋯fN)1/N=F1/N\frac{f_1 + f_2 + \dots + f_N}{N} \;\ge\; \bigl(f_1 f_2 \cdots f_N\bigr)^{1/N} = F^{1/N}

with equality only when all the fif_i are equal. So the smallest possible sum is NF1/NN F^{1/N}, reached when every stage carries the same effort

f^=F1/N,Dmin⁡=N F1/N+P,P=∑pi\hat f = F^{1/N}, \qquad D_{\min} = N\,F^{1/N} + P, \qquad P = \sum p_i

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 f^\hat f is known, every stage must have gihi=f^g_i h_i = \hat f, i.e. hi=f^/gih_i = \hat f / g_i. Start at the load and compute each gate’s input capacitance in turn:

Cin,i=gi Cout,if^C_{\text{in},i} = \frac{g_i \, C_{\text{out},i}}{\hat f}
Full worked example — INV → NAND2 → NOR2 → INV, first input 10 fF, final load 120 fF, no branching.
Step 1: G=20/9G = 20/9, B=1B = 1, H=120/10=12H = 120/10 = 12 → F=26.7F = 26.7.
Step 2: f^=26.71/4=2.27\hat f = 26.7^{1/4} = 2.27. P=1+2+2+1=6P = 1 + 2 + 2 + 1 = 6. Dmin⁡=4×2.27+6=15.1 τD_{\min} = 4\times2.27 + 6 = 15.1\,\tau.
Step 3 — sizes, backwards:
STAGEGATEgCout (fF)Cin = g·Cout/f̂ (fF)h = Cout/Cind = gh + p
4INV112052.92.273.27
3NOR25/352.938.81.364.27
2NAND24/338.822.81.704.27
1INV122.810.0 ✓2.273.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 h=1h = 1 and the last inverter has h=12h = 12: d=(1+1)+(43+2)+(53+2)+(12+1)=22.0 τd = (1+1) + (\tfrac43+2) + (\tfrac53+2) + (12+1) = 22.0\,\tau — 46 % slower, because the last stage is overworked while the first three idle.
7 · How many stages?

Adding inverters (or buffers) changes NN but not FF (an inverter has g=1g = 1). 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

N^≈log⁡4F\hat N \approx \log_4 F

For F=26.7F = 26.7, log⁡426.7=2.4\log_4 26.7 = 2.4: 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 (F=500F = 500), N^≈4.5\hat N \approx 4.5 — 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:

Latch 1 (master)transparent when clk = 0Latch 2 (slave)transparent when clk = 1DQmQclkinverted clockclk low: master follows D, slave holds. clk rises: master freezes, slave shows it.⇒ Q changes only at the rising edge. Setup = time for D to pass through the master before it closes.
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 tcqt_{cq} 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 VMV_M. The cross-coupled inverters then amplify the tiny difference ΔV0\Delta V_0 exponentially with time constant τ\tau:

ΔV(t)=ΔV0 et/τ\Delta V(t) = \Delta V_0\, e^{t/\tau}

Resolution therefore takes an unbounded but exponentially unlikely time. For a synchroniser with clock frequency fcf_c, data change rate fdf_d, and trt_r of resolution time allowed:

MTBF=e tr/τT0 fc fd\text{MTBF} = \frac{e^{\,t_r/\tau}}{T_0\, f_c\, f_d}
-5010203000.40.81.21.6log10 MTBFresolution time allowed t_r (ns)log10( MTBF / seconds )1 yearage of the universe
τ=20\tau = 20 ps, T0=20T_0 = 20 ps, fc=100f_c = 100 MHz, fd=10f_d = 10 MHz. Each extra 46 ps of waiting multiplies MTBF by 10.
Numbers: with tr=0.5t_r = 0.5 ns, MTBF ≈ 3.6×1063.6\times10^6 s ≈ 42 days — a guaranteed field failure. With tr=1t_r = 1 ns, MTBF ≈ 2.5×10172.5\times10^{17} 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

CONCEPTWHERE IT MATTERS IN THE LAB
β∝W/L\beta \propto W/L, drive strengthCell sizing in RC (Step 2.2) and optDesign (Ch 4)
Gate delay =gh+p= gh + pWhy fanout and load appear in every timing report
Setup, hold, tcqt_{cq}STA equations in Ch 2
CV2C V^2 switchingPower in Ch 3 and Ch 7
Alpha-power lawIR drop slowing gates (Ch 7)
MetastabilityWhy 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 toxt_{ox}, and the channel.

p-type substrate (body)n+ sourcen+ draingate (poly / metal)channelGSDB (body)CgsCgdCgb (gate–channel)CsbCdbgate capacitance:Cg ≈ Cox·W·Ldiffusion (junction)capacitance Csb, Cdb→ parasitic delay p
Where a MOSFET’s capacitances come from. The gate over its thin oxide forms the big gate capacitance Cg≈CoxWLC_g \approx C_{ox}WL: this is the input load that logical effort counts. The reverse-biased source/drain junctions add diffusion capacitance Csb,CdbC_{sb}, C_{db}, which the gate has to charge at its own output. That is the parasitic delay pp.
0.30.350.40.450.50.5500.30.60.9Vt = Vt0 + γ(√(2φF+VSB) − √(2φF))source–body voltage VSB (V)threshold Vt (V)upper NMOS of a stack sits here
The body effect. When the source sits above the body (VSB>0V_{SB} > 0), 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.
Cox=εoxtox,εox=3.9 ε0≈3.45×10−11 F/m,Cg≈Cox W LC_{ox} = \frac{\varepsilon_{ox}}{t_{ox}}, \qquad \varepsilon_{ox} = 3.9\,\varepsilon_0 \approx 3.45\times10^{-11}\,\text{F/m}, \qquad C_g \approx C_{ox}\,W\,L
Order of magnitude for an effective oxide of about 1.2 nm: Cox≈3.45×10−11/1.2×10−9≈0.029 F/m2=29 fF/μm2C_{ox} \approx 3.45\times10^{-11}/1.2\times10^{-9} \approx 0.029\,\text{F/m}^2 = 29\,\text{fF}/\mu\text{m}^2. A transistor with W=0.2 μmW = 0.2\,\mu\text{m}, L=0.045 μmL = 0.045\,\mu\text{m} has Cg≈29×0.009≈0.26 fFC_g \approx 29 \times 0.009 \approx 0.26\,\text{fF}. 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 CgC_g, every drain has a reverse-biased junction capacitance to the body. These drain capacitances form the gate’s parasitic (self-loading) capacitance — the pp term in logical effort.

Body effect. When the source sits above the body (VSB>0V_{SB} \gt 0), as for the upper NMOS in a NAND stack, the threshold rises:

Vt=Vt0+γ(2ϕF+VSB−2ϕF)V_t = V_{t0} + \gamma\left(\sqrt{2\phi_F + V_{SB}} - \sqrt{2\phi_F}\right)

with body-effect coefficient γ\gamma and Fermi potential ϕF\phi_F. 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:

00.510123456789VinVouttime (arbitrary units)V / VDD50 %t_pHLt_pLH
tpHLt_{pHL}: output falling; tpLHt_{pLH}: output rising. The average tp=(tpHL+tpLH)/2t_p = (t_{pHL} + t_{pLH})/2 is the number a library calls “delay”.

When the input rises, the NMOS discharges CLC_L from VDDV_{DD} to VDD/2V_{DD}/2. Its current is roughly constant at IDSATI_{DSAT} over that range, so it behaves like an equivalent resistance equal to the average of V/IV/I over the swing:

Req=1VDD/2∫VDD/2VDDVIDSAT dV=1VDD/2⋅1IDSAT⋅VDD2−VDD2/42=34 VDDIDSATR_{eq} = \frac{1}{V_{DD}/2}\int_{V_{DD}/2}^{V_{DD}} \frac{V}{I_{DSAT}}\,dV = \frac{1}{V_{DD}/2}\cdot\frac{1}{I_{DSAT}}\cdot\frac{V_{DD}^2 - V_{DD}^2/4}{2} = \frac34\,\frac{V_{DD}}{I_{DSAT}}

Discharging CLC_L through ReqR_{eq} to the 50 % point (Chapter 0, deep dive D2) gives

tpHL=ln⁡2  Req,n CL≈0.69 Req,n CL,tpLH≈0.69 Req,p CLt_{pHL} = \ln 2\; R_{eq,n}\, C_L \approx 0.69\, R_{eq,n}\, C_L, \qquad t_{pLH} \approx 0.69\, R_{eq,p}\, C_L

Split CLC_L into the inverter’s own drain capacitance CintC_{int} and the external load CextC_{ext}. Making the inverter SS times larger divides ReqR_{eq} by SS and multiplies CintC_{int} by SS:

tp=0.69 ReqS(S Cint+Cext)=tp0(1+CextS Cint),tp0=0.69 ReqCintt_p = 0.69\,\frac{R_{eq}}{S}\bigl(S\,C_{int} + C_{ext}\bigr) = t_{p0}\left(1 + \frac{C_{ext}}{S\,C_{int}}\right), \qquad t_{p0} = 0.69\,R_{eq}C_{int}

Upsizing helps only until S Cint≫CextS\,C_{int} \gg C_{ext}; 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 CLC_L from a small CinC_{in}, use NN inverters, each ff times larger than the previous, with fN=F=CL/Cinf^N = F = C_L/C_{in}. With γ=Cint/Cg\gamma = C_{int}/C_g (≈ 1), each stage has delay tp0(1+f/γ)t_{p0}(1 + f/\gamma) and the total is

tp(N)=N tp0(1+F1/Nγ)t_p(N) = N\,t_{p0}\left(1 + \frac{F^{1/N}}{\gamma}\right)

Differentiate with respect to NN (using ddNF1/N=−F1/Nln⁡F/N2\tfrac{d}{dN}F^{1/N} = -F^{1/N}\ln F/N^2) and set to zero:

F1/Nγ(1−ln⁡FN)+1=0    ⇒    f=e 1+γ/f\frac{F^{1/N}}{\gamma}\left(1 - \frac{\ln F}{N}\right) + 1 = 0 \;\;\Rightarrow\;\; f = e^{\,1 + \gamma/f}

For γ=0\gamma = 0 (no self-loading) the solution is f=e≈2.72f = e \approx 2.72; for the realistic γ=1\gamma = 1 it is f≈3.6f \approx 3.6. 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 VDD−VtnV_{DD} - V_{tn}.

NMOS pass transistortransmission gateNMOSgate = VDDin = VDDNMOSPMOSen¬enin = VDDout = 0.55 VVDD − Vt: weak 1out = 0.90 Vfull 1 (PMOS helps)
Passing a logic 1. An NMOS alone stops conducting once its output reaches VDD−VtV_{DD} - V_t, so it delivers a degraded ‘weak 1’ (here 0.55 V). A transmission gate puts a PMOS in parallel, which keeps conducting near VDDV_{DD} and restores a full 0.9 V.
Vout,max⁡=VDD−Vtn(VSB)e.g. 0.9−0.35=0.55 V (worse with body effect)V_{out,\max} = V_{DD} - V_{tn}(V_{SB}) \qquad\text{e.g. } 0.9 - 0.35 = 0.55\,\text{V (worse with body effect)}

A degraded 1 of 0.55 V is barely above the next inverter’s VIHV_{IH} 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 κ>1\kappa \gt 1 (Dennard, 1974) every quantity changes predictably:

0.5×1×1.5×2×0.710.71gate delay0.511power per gate1.961.96gates per area11.96power densityDennard scaling (V shrinks)after 2005 (V fixed)change per technology generation (κ = 1.4): with fixed voltage, power density doubles every node — the power wall
One technology generation (linear shrink k=1/0.7k = 1/0.7), 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 VDDV_{DD} stopped scaling (after about 2005), density kept doubling but so did power per area. That is why clock rates plateaued.
QUANTITYSCALES ASREASON
W,L,toxW, L, t_{ox}, wire pitch1/κ1/\kappaLithography
VDD,VtV_{DD}, V_t1/κ1/\kappaKeep the electric field constant
Capacitance C∝WL/toxC \propto WL/t_{ox}1/κ1/\kappaκ−2/κ−1\kappa^{-2}/\kappa^{-1}
Current II1/κ1/\kappaβ(V−Vt)2\beta(V-V_t)^2, β\beta constant
Gate delay CV/ICV/I1/κ1/\kappaFaster
Power per gate CV2fCV^2 f1/κ21/\kappa^2κ−1⋅κ−2⋅κ\kappa^{-1}\cdot\kappa^{-2}\cdot\kappa
Gates per areaκ2\kappa^2Area per gate κ−2\kappa^{-2}
Power density1κ2⋅κ−2\kappa^2\cdot\kappa^{-2}

Around 2005 VtV_t could no longer fall (leakage grows as e−Vt/nvTe^{-V_t/n v_T}, Chapter 3, D4), so VDDV_{DD} stopped scaling too. With VV fixed, power density grows as κ2\kappa^2: 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:

00.511.522.530.50.60.70.80.91delayenergy ∝ V²EDPsupply voltage VDD (V)normalised to VDD = 0.9 VV_opt ≈ 0.62 V
Supply voltage trades delay against energy. Energy falls as V2V^2, but delay rises sharply as VDDV_{DD} approaches VtV_t. 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.
PDP=Pavg tp≈12CVDD2,EDP=PDP⋅tp\text{PDP} = P_{avg}\,t_p \approx \tfrac12 C V_{DD}^2, \qquad \text{EDP} = \text{PDP}\cdot t_p

Using E∝V2E \propto V^2 and the alpha-power delay tp∝V/(V−Vt)αt_p \propto V/(V - V_t)^{\alpha}:

EDP∝V3(V−Vt)α    ⇒    ddV[3ln⁡V−αln⁡(V−Vt)]=3V−αV−Vt=0    ⇒    Vopt=3 Vt3−α\text{EDP} \propto \frac{V^3}{(V - V_t)^{\alpha}} \;\;\Rightarrow\;\; \frac{d}{dV}\Bigl[3\ln V - \alpha\ln(V - V_t)\Bigr] = \frac{3}{V} - \frac{\alpha}{V - V_t} = 0 \;\;\Rightarrow\;\; V_{opt} = \frac{3\,V_t}{3 - \alpha}
Example: Vt=0.35V_t = 0.35 V, α=1.3\alpha = 1.3: Vopt=1.05/1.7≈0.62V_{opt} = 1.05/1.7 \approx 0.62 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:

VDDGNDP prechargeP keeper (weak)X (dynamic node)N AN BN footpull-downnetwork (A·B)clkclkABYfeedbackclk = 0 precharge:X charged to 1, Y = 0clk = 1 evaluate:X falls only if A·B = 1Y can only rise duringevaluation → safe inputfor the next domino gatekeeper tops X up againstleakage and charge sharing
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.
clkA·BXYprechargeevaluateprechargeevaluateprechargecharge-sharing dipkeeper restores XX discharges → Y rises
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.
  1. 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.
  2. 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 CxC_x were at 0 and connect to the output node CoutC_{\text{out}} during evaluation, the charge redistributes: Vout=VDD CoutCout+CxV_{\text{out}} = V_{DD}\,\frac{C_{\text{out}}}{C_{\text{out}} + C_x} With Cx=Cout/2C_x = C_{\text{out}}/2 the output drops to 0.67 VDD0.67\,V_{DD} — 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.

φ1φ2latch L2 transparent0510 nshalf-stage 1 logic: 6.0 nsborrowed 1.2 nshalf-stage 2: 3.4 nsarrives at 9.8 ns ✓L1 → L2L2 → L1
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 (ϕ1\phi_1 transparent in the first half-period, ϕ2\phi_2 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 t1t_1 and t2t_2 and a latch D-to-Q delay tdqt_{dq}, the requirement is only on their sum:

t1+t2+2 tdq  ≤  T(instead of each stage needing its own full cycle)t_1 + t_2 + 2\,t_{dq} \;\le\; T \qquad\text{(instead of each stage needing its own full cycle)}

How much one half-stage may borrow is limited by how long the next latch stays open:

tborrow  ≤  T2−tsut_{\text{borrow}} \;\le\; \frac{T}{2} - t_{su}
Example: T=10T = 10 ns, tdq=0.2t_{dq} = 0.2 ns. Half-stages of 6.0 and 3.4 ns: 6.0+3.4+0.4=9.8≤106.0 + 3.4 + 0.4 = 9.8 \le 10 ✓. The first half-stage overruns its 5 ns half-period by about 1.2 ns, well below the borrow limit of 5−tsu5 - t_{su}. 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).

WLBLBLBN accessN accessQQBtwo cross-coupled inverters hold the bit; WL connects it to the bit linesread: both BLs precharged, one is pulled down · write: drivers force 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 VDDV_{DD}, 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 ΔVBL\Delta V_{BL} between BL and BLB. Meanwhile the “0” node rises a little, to a value ΔV\Delta V set by the fight between the access transistor (pulling up) and the pull-down (pulling down). If ΔV\Delta V 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):

kax2 (VDD−ΔV−Vt)2  =  kpd[(VDD−Vt) ΔV−ΔV22]\frac{k_{ax}}{2}\,\bigl(V_{DD} - \Delta V - V_t\bigr)^2 \;=\; k_{pd}\Bigl[(V_{DD}-V_t)\,\Delta V - \frac{\Delta V^2}{2}\Bigr]

The ratio β=kpd/kax\beta = k_{pd}/k_{ax} is the cell ratio. A larger β makes the pull-down win more decisively and keeps ΔV\Delta V small. Designs use β≈1.5–2.5\beta \approx 1.5\text{–}2.5.

Example: VDD=0.9V_{DD} = 0.9 V, Vt=0.35V_t = 0.35 V, β=2\beta = 2. Solving the equation gives ΔV≈0.1\Delta V \approx 0.1 V, comfortably below an inverter threshold of about 0.45 V, so the read is safe. With β=1\beta = 1, ΔV\Delta V 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 kpu/kaxk_{pu}/k_{ax} must be small (weak PMOS). The sizing order that satisfies both reads and writes is pull-down>access>pull-up\text{pull-down} > \text{access} > \text{pull-up}.

How fast is a read?

The cell current IcellI_{cell} must discharge the whole bit-line capacitance CBLC_{BL} (hundreds of cells hang on it) by the sense-amplifier threshold:

tread≈CBL ΔVBLIcelle.g.100 fF×0.1 V20 μA=0.5 nst_{\text{read}} \approx \frac{C_{BL}\,\Delta V_{BL}}{I_{cell}} \qquad\text{e.g.}\quad \frac{100\,\text{fF} \times 0.1\,\text{V}}{20\,\mu\text{A}} = 0.5\,\text{ns}

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 NN 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.

N = 5 inverters (odd) — no stable state, so it oscillatesperiod = 2·N·t_p → f = 1 / (2·N·t_p)measuring f on silicon gives the real gate delay of the process corner
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, T=2NtpT = 2Nt_p.

A rising edge must pass all NN stages to return inverted, then another NN stages to return to its original value. The period is two trips around the ring:

Tosc=2 N tp⇒fosc=12 N tpT_{osc} = 2\,N\,t_p \qquad\Rightarrow\qquad f_{osc} = \frac{1}{2\,N\,t_p}
Example: with τ≈4\tau \approx 4 ps (Chapter 0) an inverter driving one identical inverter has d=p+h=1+1=2d = p + h = 1 + 1 = 2, so tp≈8t_p \approx 8 ps. An 11-stage ring then oscillates at f=1/(2⋅11⋅8 ps)≈5.7f = 1/(2 \cdot 11 \cdot 8\,\text{ps}) \approx 5.7 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 tpt_p directly comparable to the logical-effort unit used in F4.

Why even rings do not oscillate. With an even NN 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 (N=2N = 2) 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…

Q2Why are NOR gates usually avoided in favour of NAND?

Q3Allowing a synchroniser 46 ps more resolution time (τ = 20 ps) multiplies its MTBF by about…

Q4In the logical-effort model, the product of all stage efforts f₁·f₂·…·f_N…

Q5For minimum path delay, the stage efforts should be…

Q6A gate drives the next gate on the path plus two equal side loads. Its branching effort b is…

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.

RTLgate netlistplacedroutedGDSIIalways @(posedge clk) if (en) q <= q + 1;assign y = a & b;endmore detail at every step — and a new check at every step (simulation, STA, DRC/LVS)
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.
LEVELWHAT EXISTSWHAT YOU CHECKCHAPTER
RTLRegisters and the logic between them, written in VerilogFunction (does it count?)1
Gate netlistReal library cells connected by netsFunction again + timing estimate2–3
Placed designEvery cell has an (x, y) locationCongestion, timing with estimated wires4
Routed designEvery net is metal wires and viasTiming with real wires, power, IR drop4, 7
GDSIIPolygons on numbered layersDRC (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):

Incisiveirun · SimVisionRTL CompilerrcEncounterencounter · NanoRouteVirtuosoAssura DRC/LVSRTL ✓netlistGDSLiberty .lib (cell delay + power tables)LEF + QRC (shapes, wires)DRC/LVS rule deckRTL + testbenchSDC constraintswaveforms, PASS/FAILarea · timing · powerSPEF · SDF · DEF · GDSclean DRC / LVSblue = inputs from the PDK / you green = evidence each stage produces
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.
VDD railVSS railABYrow height(same forevery cell)width = N × site widthpins (blue): whereroutes may connectblockage (grey): metalinside the cellrails abut with theneighbouring cells
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:

VIEWCONTAINSUSED BY
Liberty .libFunction, delay tables, power tables, pin capacitanceRC, Encounter timing, power analysis
LEF .lefSize, pin shapes, blockages; tech LEF = metal layers and rulesEncounter
Verilog model .vLogic behavior (+ specify blocks for delays)Gate-level simulation
GDS .gdsThe real polygons of the layoutStream-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.

PDKone manufacturing processLiberty .libtiming + powerRC, Encounter, powerLEF (tech + cells)layers, rules, cell shapesEncounterQRC / cap tableswire R and C modelsextractionVerilog cell modelslogic + specifygate-level simGDS + layer mapreal polygonsstream-out, VirtuosoDRC / LVS decksfoundry rulesAssura
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.

1 ps10 ps100 ps1 ns10 ns100 nsτ ≈ 4 psFO4 ≈ 20 psflop t_cq ≈ 0.3 nscounter critical path ≈ 0.6 nsclock period 10 nsscan shift clock 100 nslog scale: each tick is 10× — a clock period holds hundreds of gate delays
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.
QUANTITYTYPICAL UNITSCALE IN THIS LAB
Timens, psclock period T=10 ns=10 000 psT = 10\,\text{ns} = 10\,000\,\text{ps}; a gate ≈ 20–80 ps
CapacitancepF, fFa 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
PowermW, µW, nWthis counter ≈ µW at 100 MHz

A useful identity: 1 kΩ×1 pF=1 ns1\,\text{k}\Omega \times 1\,\text{pF} = 1\,\text{ns}. 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 RonR_{\text{on}} charging the capacitance CC of whatever it drives. Charging a capacitor through a resistor from 0 to VDDV_{DD}:

00.250.50.630.751012345V(t) / VDD = 1 − e^(−t/RC)time t (in units of RC)V / VDD50 % at 0.69 RC63 % at 1 RC
Charging a capacitor through a resistor. The voltage follows 1−e−t/RC1 - e^{-t/RC}: it crosses 50 % at 0.69 RC0.69\,RC (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.
V(t)=VDD(1−e−t/RC)V(t) = V_{DD}\left(1 - e^{-t/RC}\right)

A logic gate “switches” when its output crosses the 50 % point:

12VDD=VDD(1−e−t50/RC)  ⇒  t50=RC ln⁡2≈0.69 RC\tfrac12 V_{DD} = V_{DD}\left(1 - e^{-t_{50}/RC}\right) \;\Rightarrow\; t_{50} = RC\,\ln 2 \approx 0.69\,RC
So: a bigger driver (smaller RR) is faster; a bigger load (more fanout, longer wire → larger CC) is slower. Synthesis sizing cells (X1 → X4) and placement shortening wires are both attacks on the same R⋅CR\cdot C product.

D3Why technology nodes matter

If every dimension shrinks by a factor ss (e.g. 65 nm → 45 nm gives s≈0.69s \approx 0.69), area per cell scales as s2s^2:

65 nm cellarea 145 nmarea (45/65)² ≈ 0.4845 nm cell45 nm cell≈ 2 cells fit in the old area
Moving from 65 nm to 45 nm shrinks each linear dimension by 45/65. Cell area therefore falls by about (45/65)2≈0.48(45/65)^2 \approx 0.48, so roughly two cells fit where one used to. This density gain is the economic engine behind every node.
A45A65≈(4565)2≈0.48\frac{A_{45}}{A_{65}} \approx \left(\frac{45}{65}\right)^2 \approx 0.48

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.

ITEMON THIS VM (from the report)WHAT IT MEANS FOR THE LAB
Operating systemCentOS 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 swapAll commands are written for these versions (no sort -V, no \s in grep, Python-2.6-safe scripts).
SimulationIncisive 10.20-s100 — irun ncvlog ncelab ncsim simvision in /home/buet/cadence/installs/INCISIV102/tools/binChapters 1, 2.4, 3, 6.4, 6.5, 7.2.
Synthesis + DFTRTL Compiler v12.10-s012_1 — rc in /home/buet/cadence/EDI/tools/binrc -version crashes with a segmentation fault on this VM; start RC normally instead (Step 0.1 D).
Place & routeEncounter v13.10-p003_1 (32bit), NanoRoute 13.10, IQRC/TQRC 12.1 — encounter, velocity in EDI/tools/binChapters 4, 5, 6.5, 7.
Custom ICVirtuoso 6.1.5 (IC615), Spectre 12.1 (MMSIM121), Assura 4.1 (ASSURA41), strmin/strmoutStep 7.6 (viewing the final GDS).
LicenseCDS_LIC_FILE=/home/buet/cadence/IC615/ic6151license.dat; LM_LICENSE_FILE emptyAlready correct — nothing to change.
Digital libraryGPDK045 example kit in EDI/share/FoundationFlows/EXAMPLES/EDI/DESIGN/GPDK: timing/slow.lib (library gpdk045bc, 1.08 V, 125 °C), typical.lib, fast.lib (gpdk045wc, 1.32 V, 0 °C) — 477 cells each; gsclib045.lef — 487 macros, Metal1–Metal9, site CoreSite 0.2 × 1.71 µm, 2000 DB units/µmThe only standard-cell library on the machine — the whole digital flow uses it.
Extraction dataGPDK/TECH/capTable, qrcTechFile (201 MB), mapFile, qrc.confThe cap table drives every Encounter extraction (Steps 4.2, 4.13, 7.1).
Missing from the kitcell Verilog models, test_cell scan data in the .lib, cell GDS, a 45 nm stream map, 45 nm DRC/LVS rule decks, I/O padsStep 0.5 generates models + scan .lib; core-only design (no pads); GDS with LEF abstracts (7.5); Encounter checks instead of Assura (7.6).
gpdk090_v4.6Transistor-level 90 nm PDK (nmos1v/pmos1v…, Assura & Diva decks, techfile, soce/ cap tables) — no standard cellsCannot implement a digital design. Used only to view the final GDS in Virtuoso, because its metal names match (Metal1–Metal9).
Your Virtuoso setup/home/buet/cds_work/cds.lib defines gpdk090 (+ mylib, mylib2 …); ~/.cdsinit holds your KiCad-style key bindingsStep 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)
Custom IC / viewingvirtuoso (IC 6.1.5), strmin, Assura 4.1 (gpdk090 decks only)

AOpen a terminal

  1. Start the VM and log in as the college user (buet on this machine).
  2. From the CentOS desktop choose Applications → System Tools → Terminal.
  3. 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
Expected output on your VM/home/buet/cadence/installs/INCISIV102/tools/bin/irun          [1]
/home/buet/cadence/installs/INCISIV102/tools/bin/ncvlog
/home/buet/cadence/installs/INCISIV102/tools/bin/ncelab
/home/buet/cadence/installs/INCISIV102/tools/bin/ncsim
/home/buet/cadence/installs/INCISIV102/tools/bin/simvision
/home/buet/cadence/EDI/tools/bin/rc
/home/buet/cadence/EDI/tools/bin/encounter
/home/buet/cadence/IC615/tools/dfII/bin/virtuoso
/home/buet/cadence/MMSIM121/tools/bin/spectre
/home/buet/cadence/ASSURA41/tools/bin/assura
/home/buet/cadence/IC615/tools/dfII/bin/strmin
TOOL:   irun    10.20-s100                                        [2]
@(#)CDS: Encounter v13.10-p003_1 (32bit) 04/17/2013 15:43 (Linux 2.6)
@(#)$CDS: virtuoso version 6.1.5 12/17/2012 14:39 (cic2009lnx) $
/home/buet/cadence/EDI/share/FoundationFlows/EXAMPLES/EDI/DESIGN/GPDK/LIBS/GPDK045
/home/buet/cadence/EDI/share/FoundationFlows/EXAMPLES/EDI/DESIGN/GPDK/LIBS/GPDK045:
gsclib045.lef  timing                                             [3]

/home/buet/cadence/EDI/share/FoundationFlows/EXAMPLES/EDI/DESIGN/GPDK/TECH:
capTable  mapFile  qrc.conf  qrcTechFile                          [4]
  1. Every tool resolves to the installation listed in Step 0.0 — Incisive under installs/INCISIV102, RC and Encounter under EDI, Virtuoso/strmin under IC615.
  2. The exact versions on your VM: Incisive 10.20-s100, Encounter 13.10-p003_1 (32-bit build), Virtuoso 6.1.5.
  3. The library folder holds just one LEF and a timing/ folder — no qrc, gds or Verilog folders. That is normal for this example kit.
  4. 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:

FOLDERWHAT 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).
activity/Switching-activity files (TCF) from simulation.
logs/ · reports/ · results/Tool logs · human-readable reports · machine outputs (netlists, SDC, SDF, SPEF, DEF, GDS).
Project setup · shellcd /home/buet/cds_work/asic_lab
mkdir -p rtl tb constraints scripts activity logs reports results
ls

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]
  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. No cell Verilog models — Step 0.5 generates them from slow.lib.
  6. 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.

Cell and layer discovery · shellLIB=$PDK45/timing/slow.lib
LEF=$PDK45/gsclib045.lef
mkdir -p logs

grep -o "cell *( *[A-Za-z0-9_]* *)" $LIB | sed 's/cell *( *//; s/ *)//' | sort -u > logs/cell_names.txt
grep "^MACRO" $LEF | awk '{print $2}' | sort -u > logs/lef_macros.txt
wc -l logs/cell_names.txt logs/lef_macros.txt
comm -13 logs/cell_names.txt logs/lef_macros.txt | tr '\n' ' '; echo     # physical-only cells
grep -E "^(TIE|CLKBUF|CLKINV|SDFFR|DFFR)" logs/cell_names.txt | tr '\n' ' '; echo
grep "^FILL" logs/lef_macros.txt | tr '\n' ' '; echo

grep -m3 -E "nom_voltage|nom_temperature|time_unit" $LIB
awk '/^MACRO/{exit} /^LAYER/{l=$2} /TYPE ROUTING/{r[l]=1} /^ *DIRECTION/{if(r[l])print l, $2}' $LEF
grep -A2 "^UNITS" $LEF
grep -A3 "^SITE" $LEF
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 ….
  • time_unit : "1ns", nom_voltage : 1.08, nom_temperature : 125.
  • 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:

  1. From the CentOS desktop choose Applications → System Tools → Terminal. This opens a shell window.
  2. Type bash if the prompt is not already Bash (a Bash prompt usually ends in $; csh ends in % or >).
  3. Move to the project directory and source the environment file created above.
  4. 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…USECHAPTER
Check that the RTL behaves correctlyirun + SimVision1
Turn RTL into standard cells under timing constraintsrc2, 3, 6
Build the layout (floorplan → route)encounter4, 5, 7
Look at the final GDSvirtuoso (gpdk090 technology, viewing only)7
Generate cell models and the scan .libpython scripts/gpdk045_libtool.py0
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 VIEWWHO NEEDS ITWHAT THE SCRIPT BUILDS
Cell Verilog models (*.v)Every gate-level simulation: Steps 2.4, 6.4, 6.5, 7.2libs/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 .libRTL Compiler scan insertion (Step 6.3) — without them RC cannot tell that SDFFRHQX1 is the scan version of DFFRHQX1; the report counted 0 test_cell groupslibs/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))
Verify the file arrived complete · shellwc -l scripts/gpdk045_libtool.py          # must print 838
tail -2 scripts/gpdk045_libtool.py        # if __name__ == ... / sys.exit(main(sys.argv))
python -c "import py_compile; py_compile.compile('scripts/gpdk045_libtool.py', doraise=True)" && echo SYNTAX_OK

BGenerate the cell models

libs/gsclib045_cells.v · shellpython scripts/gpdk045_libtool.py verilog $PDK45/timing/slow.lib libs/gsclib045_cells.v $PDK45/gsclib045.lef | tee logs/libtool_verilog.log
grep -c "^module" libs/gsclib045_cells.v
grep -A12 "^module DFFRHQX1" libs/gsclib045_cells.v
What you should see
  • 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".
  • slow_scan.lib is a few kB larger than slow.lib.

DCompile the models once

Compile check · shellirun -compile libs/gsclib045_cells.v -logfile logs/irun_cells.log
grep -c "\*E," logs/irun_cells.log          # must print 0

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
FILEWHAT IT IS
setup_cadence.shEnvironment for every terminal
scripts/lib_paths.tclAll library paths, layers and cell names
logs/cell_names.txt · logs/lef_macros.txtThe 477 .lib cells · the 487 LEF macros
libs/gsclib045_cells.vGenerated cell simulation models
libs/slow_scan.libslow.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.
tb_cnt_updown (testbench — never synthesized)Stimulusdrives inputs on negedgeClock generatoralways #5 clk=~clkDUT: cnt_updownthe design under testReference modelwhat count SHOULD beCheckercompare every cyclecountexpected→ PASS / 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).

RTL + TB filesncvlogworklib/ncelabsnapshotncsimdump + logirun runs all three for yousyntax errors“undefined module”wrong values = design bugappear hereappears hereappear here
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:

blocking = (wrong for flops)non-blocking <= (correct)before edgea = 1b = 0a = b runsa = 0b = 0b = a runsa = 0b = 0 ✗before edgea = 1b = 0evaluate botha ← 0b ← 1update togethera = 0b = 1 ✓
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.
  1. Active region — run triggered blocks; blocking = assignments update immediately; for non-blocking <= only the right-hand side is evaluated and remembered.
  2. NBA region — all remembered <= updates happen together.
  3. 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

VALUEMEANINGTYPICAL CAUSE
0 / 1Logic low / high—
xUnknownUninitialized flop, two drivers fighting, missing reset
zHigh impedance (undriven)Unconnected input, tri-state off
a & b01xz00000101xxx0xxxz0xxx0 dominates AND: 0 & x = 01 & x = x (cannot decide)a floating input (z) is read as xx == 1 → x, and if(x) is false:use === / !== in checkers
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

clkresetenableup_downcount012343210hold (enable = 0)count downcount up← released between edges← inputs change on falling edges
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).

$timescale 1ps $end$var wire 1 ! clk $end$var reg 8 " count $end#00!b0 "#50001!#150001! b1 "clkcount01#time lines + value changes → waveform
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 cn∈{0,…,255}c_n \in \{0,\dots,255\} be the count after the nn-th rising edge, ene_n the enable and unu_n the direction sampled at that edge. The RTL implements exactly

2502512522532542550123456 … 249256 statesup: +1 mod 256down: −1 mod 256255 → 0 (count up) and0 → 255 (count down) are therollover cases tested in Phase 3enable = 0: every state loopsto itself (hold)
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.
cn+1={0if resetcnif en=0(cn+1) mod 256if en=1, un=1(cn−1) mod 256if en=1, un=0c_{n+1} = \begin{cases} 0 & \text{if reset} \\ c_n & \text{if } e_n = 0 \\ (c_n + 1) \bmod 256 & \text{if } e_n = 1,\ u_n = 1 \\ (c_n - 1) \bmod 256 & \text{if } e_n = 1,\ u_n = 0 \end{cases}

Compactly, with dn=2un−1∈{−1,+1}d_n = 2u_n - 1 \in \{-1, +1\}:

cn+1=(cn+en dn) mod 28c_{n+1} = \bigl(c_n + e_n\, d_n\bigr) \bmod 2^8

The testbench’s reference model is this equation written in Verilog. The “rollover” you check in Phase 3 is just the  mod 28\bmod 2^8: (0−1) mod 256=255(0 - 1) \bmod 256 = 255.

D2The design is a finite-state machine

The counter has 28=2562^8 = 256 states and 23=82^3 = 8 input combinations, so the full transition table has 256×8=2048256 \times 8 = 2048 entries. Exhaustively checking every transition is cheap here; it becomes impossible for real designs (a 32-bit register alone has 4.3×1094.3\times10^9 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.

s − 1ss + 1e=1, u=1e=1, u=0e=0 (any u): stayevery state has 8 input combinations (reset, e, u) → 256 × 8 = 2048 transitions in total
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 14\tfrac14 per edge of being “enabled up”, the chance of 255 in a row is (1/4)255(1/4)^{255} — 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 t0<t1<…t_0 \lt t_1 \lt \dots. Inside one slot the scheduler repeatedly drains regions until nothing is left:

Activerun triggered blocks;evaluate RHS of <=Inactive#0 eventsNBAapply all <= updatestogetherMonitor$dumpvars / $monitorsee final valuesnew events? → another delta cycle (zero time)→ next time slot
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.
Active⏟evaluate  →  Inactive⏟#0  →  NBA⏟update ≤  →  Monitor⏟$dump\underbrace{\text{Active}}_{\text{evaluate}} \;\rightarrow\; \underbrace{\text{Inactive}}_{\#0} \;\rightarrow\; \underbrace{\text{NBA}}_{\text{update } \le} \;\rightarrow\; \underbrace{\text{Monitor}}_{\text{\$dump}}

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 α\alpha 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:

line / statement100 % · every branch of the if executestoggle100 % · rollover toggles all 8 bitsFSM state7 % · only 0–10, 254, 255 visited
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”.
METRICDEFINITIONTHIS TESTBENCH
Line / statement#RTL lines executed#lines\dfrac{\#\text{RTL lines executed}}{\#\text{lines}}100 % — every branch of the if runs
Toggle#bits seen going 0→1 and 1→0#bits\dfrac{\#\text{bits seen going } 0\to1 \text{ and } 1\to0}{\#\text{bits}}100 % — the rollover to 255 toggles every count bit
FSM state#states visited28\dfrac{\#\text{states visited}}{2^8}≈ 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:

inputtransportinertialδ0.4-wide glitchpassed throughswallowed (w < δ)
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.
MODELRULEUSED FOR
TransportEvery input change appears at the output after δ\delta, however shortWires
InertialA pulse of width w<δw \lt \delta is swallowedGates (Verilog default for assign #δ and gate primitives)

Formally, an inertial element with delay δ\delta outputs

y(t)={x(t−δ)if x was constant on [ t−δ,  t ]y(t−)otherwisey(t) = \begin{cases} x(t-\delta) & \text{if } x \text{ was constant on } [\,t-\delta,\; t\,] \\ y(t^-) & \text{otherwise} \end{cases}

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.
PHASEINPUTSEXPECTED COUNT AT THE END
Reset (0–22 ns)reset=10
1 · up ×10enable=1 up_down=110
2 · hold ×3enable=010 (unchanged)
3 · down ×12enable=1 up_down=0254 (passes 0 → 255: rollover)
4 · hold ×2enable=0254
5 · async reset2 ns pulse between edges0 immediately, no clock needed
6 · up ×3enable=1 up_down=13
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):.)

Unified run · shellcd /home/buet/cds_work/asic_lab
irun -access +rwc \
  -logfile logs/irun.log \
  rtl/cnt_updown.v tb/tb_cnt_updown.v
OPTIONMEANING
(no language option)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 +rwcGive read/write/connectivity access to every signal so SimVision and Tcl can see them. Slower, but essential while debugging.
-logfile logs/irun.logCopy everything printed on screen into a file you can search later.
\ at line endShell 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
  1. Analysis of each file: look for errors: 0 on every module.
  2. Elaboration: the snapshot name printed here is what you pass to ncsim later.
  3. Simulation starts; irun issues run for you in batch mode.
  4. The checker’s verdict — the single most important line.
  5. 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.

Expected generated files · shellls -la
ls -la INCA_libs
tail -n 40 logs/irun.log
grep -iE "error|warning" logs/irun.log

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.

cds.lib and hdl.var · shellcd /home/buet/cds_work/asic_lab
mkdir -p worklib
echo "DEFINE worklib ./worklib" > cds.lib
echo "DEFINE WORK worklib"      > hdl.var
cat cds.lib hdl.var

BAnalyze, elaborate, simulate

ncvlog → ncelab → ncsim · shellncvlog -messages -linedebug rtl/cnt_updown.v tb/tb_cnt_updown.v
ncelab -messages -access +rwc worklib.tb_cnt_updown
ncsim  -messages worklib.tb_cnt_updown

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.

Saved snapshot (your VM) · shellncsim -messages worklib.tb_cnt_updown:module

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

  1. Return to the terminal and type simvision &. The Console and Design Browser windows open.
  2. Choose File → Open Database.
  3. 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.
  4. 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.

  1. In the Design Browser (left pane), expand the scope tree and click tb_cnt_updown. Its signals appear in the right pane.
  2. Select the signals: click clk, then hold Ctrl and click reset, enable, up_down, count and expected.
  3. 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

  1. Right-click count → Radix/Mnemonic → Unsigned Decimal so values read 0, 1, 2 … instead of hex.
  2. 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.
  3. Check each item in the list below at the matching time.
WHAT TO VERIFYWHERE TO LOOKCORRECT BEHAVIOR
Reset priority0–22 nscount = 0 even though clk toggles.
Enabled up-count~35–125 ns+1 at each rising edge, never at falling edges.
Disabled hold~135–155 nsValue stays 10 for three edges.
Down-count & rollover~165–275 ns…, 1, 0, 255, 254.
Asynchronous reset~302–304 nsDrops to 0 the instant reset rises — between clock edges.
No unknownsEverywhere after resetNo 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

  1. Left-click in the trace area: the primary cursor (a vertical line) jumps there and the value column shows every signal at that instant.
  2. Add a second reference with the Create marker toolbar button (or Edit → Create → Marker) and drag it to another edge.
  3. 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).
  4. 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
FILEWHAT IT IS
rtl/cnt_updown.vThe design
tb/tb_cnt_updown.vSelf-checking testbench
updown_counter.dumpWaveforms (VCD)
worklib/ snapshotReused by Chapter 3
? Check yourself

Q1Which assignment should a clocked always block use?

Q2Why does the checker use !== instead of !=?

Q3The counter is at 0 and counts down one step. The new value is…

⚠ 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

RTLcount <= count + 1Elaborategeneric adder,mux, 8 flopsGeneric opt.BooleansimplificationMapADDHX1, MXI2XL,DFFRHQX1 …Optimizesize cells tomeet the SDCread_hdl → elaborate → synthesize -to_generic → -to_mapped → -incremental
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 WRITEYOU GET
always @(posedge clk)One flip-flop per assigned bit
… or posedge resetFlops with an asynchronous reset pin
if / else, ? :Multiplexers
+, -Adder / subtractor (half/full-adder cells)
Combinational always @* missing an elseA latch — the value must be “remembered” in that branch
A signal assigned in two always blocksMultiple drivers — an error
8 × DFFRDQ+1 incrementer−1 decrementerMUXMUX10next value1D[7:0]up_downenablereset (async)0feedback: count[7:0] goes back to both arithmetic blocks and to the hold inputcount[7:0]
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:

Sscan muxDFFD flip-flopRreset pinHhigh-speedQQ output onlyX1drive ×1NAND2X1 = 2-input NAND, drive 1 · CLKBUFX4 = clock buffer, drive 4 · TIEHI = constant 1
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.
NAMEREADS AS
NAND2X1NAND, 2 inputs, drive strength ×1
INVX4Inverter, ×4 drive (bigger, faster on heavy loads, more leakage)
DFFRHQX1D flip-flop, Reset, High-speed, Q output only, ×1
SDFFRHQX1The same flop with a Scan mux (Chapter 6)
CLKBUFX4Clock 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.

INlogicFF1logicFF2logicOUTclkin2regreg2regreg2outlogicin2out (pure combinational — none in this counter)
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 tsetup before the capturing clock edge. Too slow → the flop captures garbage.
  • Hold: data must stay stable some time thold after the edge. Too fast → the new value races through and corrupts the capture.
CLK @ FF1D @ FF2CLK @ FF2old valueNEWnexttsetuptholdtcqtcomb (max path)SETUP SLACKHOLD SLACKclock period T (10 ns)
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:

reg2reglogic windowin2reglogic window 8.7reg2outlogic window 7.50 ns2 ns4 ns6 ns8 ns10 nsorange = t_cq, t_su, input/output delay (used outside the logic) · green = what synthesis may spend · blue = uncertainty u
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.
PATHTIME LEFT FOR LOGIC INSIDE THIS BLOCK
reg2reg10 − 0.2 = 9.8 ns (minus tcq, tsetup)
in2reg10 − 1 − 0.2 = 8.8 ns
reg2out10 − 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.

010203005101520wire-load-model estimate (fF)extracted after routing (fF)dashed: perfect estimateillustrative: each dot is one net
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 c7…c0c_7 \dots c_0. Adding 1 to a binary number flips bit ii exactly when all lower bits are 1 (the carry reaches it). Subtracting 1 flips bit ii when all lower bits are 0 (the borrow reaches it). So the toggle condition of bit ii is

c0DQXORc0eT0 = ec1DQXORc1XNORANDc0uT1T0c2DQXORc2XNORANDc1uT2T1T_i = e · Π xnor(c_j, u) over all lower bits · c_i⁺ = c_i ⊕ T_i (Q outputs feed back as the blue c inputs)
The gate-level structure behind the counter’s next-state equations. Bit ii 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 TiT_i, and each flop’s D input is ci⊕Tic_i \oplus T_i.
Ti=e⋅∏j=0i−1xnor⁡(cj, u)andci+=ci⊕TiT_i = e \cdot \prod_{j=0}^{i-1} \operatorname{xnor}(c_j,\, u) \qquad\text{and}\qquad c_i^{+} = c_i \oplus T_i

Here xnor⁡(cj,u)=¬(cj⊕u)\operatorname{xnor}(c_j,u) = \lnot(c_j \oplus u) is 1 when cj=uc_j = u: all-ones for counting up (u=1u=1), all-zeros for counting down (u=0u=0). The empty product for i=0i = 0 is 1, so c0c_0 toggles on every enabled edge.

Check with numbers: c=0000 01112=7c = 0000\,0111_2 = 7, counting up. T0=T1=T2=T3=1T_0 = T_1 = T_2 = T_3 = 1 (bits 0–2 are all 1), T4=0T_4 = 0 (bit 3 is 0). Flipping bits 0–3 gives 0000 10002=80000\,1000_2 = 8. ✓

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, T7T_7 needs the AND of seven terms through a chain (“ripple”), so the logic depth is O(n)\mathcal{O}(n) for an nn-bit counter:

ripple chain: depth 7balanced tree: depth 3ANDANDANDANDANDANDANDANDANDANDANDANDANDAND8 inputs: ripple needs 7 gate delays, a tree needs log₂8 = 3 — at the cost of more wiring
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 log⁡28=3\log_2 8 = 3 deep. Synthesis restructures chains into trees when timing demands it, trading a little wiring for logarithmic depth.
tcombripple≈n⋅tAND2t_{\text{comb}}^{\text{ripple}} \approx n \cdot t_{\text{AND2}}

A balanced tree of 2-input ANDs computes the same product in ⌈log⁡2n⌉\lceil \log_2 n \rceil levels:

tcombtree≈⌈log⁡2n⌉⋅tAND2t_{\text{comb}}^{\text{tree}} \approx \lceil \log_2 n \rceil \cdot t_{\text{AND2}}

For n=8n = 8: 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).

A = FF1/QAT 0.3 RT 8.5slack 8.2B = inputAT 1.0 RT 8.5slack 7.5C = FF3/QAT 0.3 RT 8.8slack 8.5g1 NAND2AT 1.5 RT 9.0slack 7.5g2 INVAT 0.5 RT 9.0slack 8.5g3 NOR2AT 2.1 RT 9.6slack 7.5D = FF2/DAT 2.2 RT 9.7slack 7.50.50.50.20.60.60.1numbers on arrows = delays (ns) · gold boxes + orange arrows = critical path (smallest slack)
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: tcq=0.3t_{cq} = 0.3 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

AT(v)=max⁡u→v[AT(u)+d(u,v)]\text{AT}(v) = \max_{u \to v}\bigl[\text{AT}(u) + d(u,v)\bigr]

We take the maximum because a gate’s output is not final until its last input has arrived.

VERTEXINPUTS (AT + delay)AT
g1 (NAND2)A: 0.3 + 0.5 = 0.8 · B: 1.0 + 0.5 = 1.51.5 (B is later)
g2 (INV)C: 0.3 + 0.2 = 0.50.5
g3 (NOR2)g1: 1.5 + 0.6 = 2.1 · g2: 0.5 + 0.6 = 1.12.1
D (end point)g3: 2.1 + 0.12.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: RT(D)=T−u−tsu=10−0.2−0.1=9.7\text{RT}(D) = T - u - t_{su} = 10 - 0.2 - 0.1 = 9.7 ns. Then walk the graph in reverse topological order:

RT(v)=min⁡v→w[RT(w)−d(v,w)]\text{RT}(v) = \min_{v \to w}\bigl[\text{RT}(w) - d(v,w)\bigr]

We take the minimum because a pin that feeds several paths must satisfy the most demanding one.

VERTEXOUTPUTS (RT − delay)RT
g39.7 − 0.19.6
g1, g29.6 − 0.69.0
A, B9.0 − 0.58.5
C9.0 − 0.28.8
Step 4 · Slack and the critical path
slack(v)=RT(v)−AT(v)\text{slack}(v) = \text{RT}(v) - \text{AT}(v)

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 O(∣V∣+∣E∣)\mathcal{O}(|V| + |E|) — 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 min⁡\min and max⁡\max 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:

clk at Ldata at Cclk at Coldnewδt_cq + t_combt_susetup slack (gains δ)
Setup timing with skew δ. The data launched by the clock at L must arrive at least tsut_{su} 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 δ.
SYMBOLMEANING
ℓL, ℓC\ell_L,\ \ell_Cclock latency: time for the clock edge to reach the launching flop L and the capturing flop C
δ=ℓC−ℓL\delta = \ell_C - \ell_Lskew between the pair (positive = capture clock arrives later)
tcqt_{cq}clock-to-Q delay of L
tcombmax⁡, tcombmin⁡t_{\text{comb}}^{\max},\ t_{\text{comb}}^{\min}longest and shortest logic delay from L to C
tsu, tht_{su},\ t_hsetup and hold time of C
uuuncertainty (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 ℓL\ell_L; edge 1 reaches C at T+ℓCT + \ell_C:

ℓL+tcq+tcombmax⁡⏟data arrives+tsu  ≤  T+ℓC⏟next edge at C−u⟺tcq+tcombmax⁡+tsu  ≤  T+δ−u\underbrace{\ell_L + t_{cq} + t_{\text{comb}}^{\max}}_{\text{data arrives}} + t_{su} \;\le\; \underbrace{T + \ell_C}_{\text{next edge at C}} - u \quad\Longleftrightarrow\quad t_{cq} + t_{\text{comb}}^{\max} + t_{su} \;\le\; T + \delta - u

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, tht_h after that edge:

ℓL+tcq+tcombmin⁡⏟new data arrives  ≥  ℓC+th⏟capture finished+u⟺tcq+tcombmin⁡  ≥  th+δ+u\underbrace{\ell_L + t_{cq} + t_{\text{comb}}^{\min}}_{\text{new data arrives}} \;\ge\; \underbrace{\ell_C + t_h}_{\text{capture finished}} + u \quad\Longleftrightarrow\quad t_{cq} + t_{\text{comb}}^{\min} \;\ge\; t_h + \delta + u

Solving the setup inequality for TT gives the fastest safe clock:

fmax⁡=1 tcq+tcombmax⁡+tsu−δ+u f_{\max} = \frac{1}{\,t_{cq} + t_{\text{comb}}^{\max} + t_{su} - \delta + u\,}

Read the two inequalities side by side and three facts jump out:

  1. TT appears only in setup. A slower clock cures setup violations and does nothing for hold.
  2. Skew moves slack from one check to the other. δ\delta 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.
  3. Hold is about the shortest path. Two flops connected by a bare wire (tcombmin⁡≈0t_{\text{comb}}^{\min} \approx 0) 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 ss) and how much capacitance it drives (CC). 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:

output load C (pF) →input slew s (ns) →0.0010.0100.0500.050.200.800.0310.0580.1620.0440.0710.1760.090.1210.231query (s = 0.35, C = 0.020)→ d = 0.110 nsweights: 0.75·0.75 on the nearest grid point,0.25·0.25 on the farthest one
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 (s,C)(s, C) falls between grid points, the tool interpolates bilinearly: first along one axis, then along the other. With (s1,s2)(s_1, s_2) and (C1,C2)(C_1, C_2) the surrounding grid values:

w1(s)=s2−ss2−s1,w2(s)=1−w1(s),d(s,C)=∑i,j∈{1,2}wi(s) wj(C)  d(si,Cj)w_1(s) = \frac{s_2 - s}{s_2 - s_1},\quad w_2(s) = 1 - w_1(s),\qquad d(s,C) = \sum_{i,j \in\{1,2\}} w_i(s)\,w_j(C)\;d(s_i, C_j)
Worked lookup: s=0.35s = 0.35 ns, C=0.020C = 0.020 pF.
Neighbours: s∈[0.20,0.80]s \in [0.20, 0.80] → w1(s)=(0.80−0.35)/0.60=0.75w_1(s) = (0.80-0.35)/0.60 = 0.75, w2=0.25w_2 = 0.25. C∈[0.010,0.050]C \in [0.010, 0.050] → w1(C)=(0.050−0.020)/0.040=0.75w_1(C) = (0.050-0.020)/0.040 = 0.75, w2=0.25w_2 = 0.25.
d=0.75⋅0.75⋅0.071+0.75⋅0.25⋅0.176+0.25⋅0.75⋅0.121+0.25⋅0.25⋅0.231d = 0.75\cdot0.75\cdot0.071 + 0.75\cdot0.25\cdot0.176 + 0.25\cdot0.75\cdot0.121 + 0.25\cdot0.25\cdot0.231
    =0.0399+0.0330+0.0227+0.0144=0.110\;\;= 0.0399 + 0.0330 + 0.0227 + 0.0144 = 0.110 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 kk is given an estimated length and capacitance from a lookup table, roughly linear:

3.5 fFfanout 15 fFfanout 26.5 fFfanout 38 fFfanout 49.5 fFfanout 511 fFfanout 6C_wire(k) ≈ C₀ + k·ΔC (here C₀ = 2 fF, ΔC = 1.5 fF; real values come from the library’s wire-load table)
A wire-load model is a lookup from fanout to estimated wire capacitance, roughly linear: Cwire(k)≈C0+k ΔCC_{wire}(k) \approx C_0 + k\,\Delta C. Every net with the same fanout gets the same estimate, whatever its real length. Encounter replaces these guesses with extracted values.
Cwire(k)≈C0+k ΔC,Cnet=Cwire(k)+∑p∈sinksCpin(p)C_{\text{wire}}(k) \approx C_0 + k\,\Delta C, \qquad C_{\text{net}} = C_{\text{wire}}(k) + \sum_{p \in \text{sinks}} C_{\text{pin}}(p)

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):

subject graphcover Acover B ✓NAND2INVNAND2INVNAND2 (2) + INV (1) = cost 3NAND2INVone AND2 cell = cost 2.5
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.
cost(v)=min⁡m∈matches(v)[ area(m)+∑u∈inputs(m)cost(u)]\text{cost}(v) = \min_{m \in \text{matches}(v)} \Bigl[\, \text{area}(m) + \sum_{u \in \text{inputs}(m)} \text{cost}(u) \Bigr]

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.

FF1DQFF2DQVDD (1)rst_sync_n → all flopsrst_n (async)clkassertion: both flops clear at once (asynchronous)release: passes through two flops — synchronous and metastability-safe
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.

ab \ cd00011110001001010110110110101001m0m1m3m2m4m5m7m6m12m13m15m14m8m9m11m10blue group (centre):b = 1, d = 1 → b·dorange group (4 corners,wraps around the edges):b = 0, d = 0 → ¬b·¬df = ¬b·¬d + b·d = ¬(b ⊕ d)8 minterms → 2 terms, a and c vanish
f(a,b,c,d)=∑m(0,2,5,7,8,10,13,15)f(a,b,c,d) = \sum m(0,2,5,7,8,10,13,15). Two groups of four cover all eight 1s; each group of 2k2^k cells eliminates kk variables.

The algebra behind a group is the adjacency theorem xy+xyˉ=xxy + x\bar{y} = x:

aˉ b cˉ d+aˉ b c d+a b cˉ d+a b c d=b d (aˉcˉ+aˉc+acˉ+ac)=b d\bar a\, b\, \bar c\, d + \bar a\, b\, c\, d + a\, b\, \bar c\, d + a\, b\, c\, d = b\,d\,(\bar a\bar c + \bar a c + a\bar c + a c) = b\,d

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 f=x(y+z)f = x(y + z)) because two-level forms blow up for functions like parity: nn-input XOR needs 2n−12^{n-1} product terms but only n−1n-1 XOR gates.

D11Shannon expansion and binary decision diagrams

Every Boolean function splits on any variable xx (Shannon’s expansion):

f=x⋅f∣x=1  +  xˉ⋅f∣x=0f = x \cdot f\big|_{x=1} \;+\; \bar x \cdot f\big|_{x=0}

Applying it recursively in a fixed variable order and merging identical sub-graphs gives a reduced ordered BDD:

abc01solid edge = variable is 1dashed edge = variable is 0f = a·b + cevery path root → terminalis one evaluation of freduced + ordered ⇒ canonical:two equal functions give theidentical graph (used by LEC)
ROBDD of f=ab+cf = ab + c with order a<b<ca \lt b \lt c. Note the shared node cc: both the a=0a{=}0 branch and the b=0b{=}0 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 f=(a1=b1)∧⋯∧(an=bn)f = (a_1{=}b_1)\wedge\dots\wedge(a_n{=}b_n) the order a1b1a2b2…a_1 b_1 a_2 b_2\dots gives 3n+23n+2 nodes, while a1…anb1…bna_1\dots a_n b_1\dots b_n needs about 3⋅2n3\cdot 2^n.

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:

xgolden fRTLrevised gnetlist⊕SAT / BDDcan M = 1 ?no → equivalentyes → counter-exampleM(x) = f(x) ⊕ g(x) is the “miter”
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.
  1. Map key points. Pair every flop and primary output in the RTL with its counterpart in the netlist (by name, then by structure).
  2. Build a miter for every pair of next-state functions ff (golden) and gg (revised): M(x)=f(x)⊕g(x)M(\mathbf{x}) = f(\mathbf{x}) \oplus g(\mathbf{x}).
  3. Prove unsatisfiability. f≡g  ⟺  ∄ x:M(x)=1f \equiv g \iff \nexists\,\mathbf{x}: M(\mathbf{x}) = 1, decided with BDDs or a SAT solver.

A satisfying x\mathbf{x} 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 tlogict_{\text{logic}} into NN balanced stages separated by registers with overhead tov=tcq+tsut_{ov} = t_{cq} + t_{su} (plus skew/uncertainty):

TN=tlogicN+tov,throughput=1TN,latency=N TN=tlogic+N tovT_N = \frac{t_{\text{logic}}}{N} + t_{ov}, \qquad \text{throughput} = \frac{1}{T_N}, \qquad \text{latency} = N\,T_N = t_{\text{logic}} + N\,t_{ov}
unpipelinedcombinational logic t_logic = 9 nsT ≥ 9 + 0.5 = 9.5 ns3-stage pipeline3 ns3 ns3 nsT ≥ 3 + 0.5 = 3.5 nsthroughput ×2.7, latency 3 × 3.5 = 10.5 ns (+1 ns): registers are not freegold bars = registers, each adding t_cq + t_setup ≈ 0.5 ns
9 ns of logic, 0.5 ns register overhead.

The speed-up saturates:

S(N)=T1TN=tlogic+tovtlogic/N+tov  →  N→∞    tlogic+tovtovS(N) = \frac{T_1}{T_N} = \frac{t_{\text{logic}} + t_{ov}}{t_{\text{logic}}/N + t_{ov}} \;\xrightarrow{\;N\to\infty\;}\; \frac{t_{\text{logic}} + t_{ov}}{t_{ov}}

For the example the ceiling is 9.5/0.5=19×9.5/0.5 = 19\times, but N=3N = 3 already gives 9.5/3.5=2.7×9.5/3.5 = 2.7\times 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 r(v)r(v); edge register counts become wr(e)=w(e)+r(v)−r(u)≥0w_r(e) = w(e) + r(v) - r(u) \ge 0. 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 nn-bit numbers aa, bb, define per bit:

gi=ai bi    (generate),pi=ai⊕bi    (propagate),ci+1=gi+pi ci,si=pi⊕cig_i = a_i\,b_i \;\;\text{(generate)},\qquad p_i = a_i \oplus b_i \;\;\text{(propagate)},\qquad c_{i+1} = g_i + p_i\,c_i,\qquad s_i = p_i \oplus c_i

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 ci+1=gi+picic_{i+1} = g_i + p_i c_i bit after bit lets the carry ripple through all nn positions: delay O(n)\mathcal{O}(n), area O(n)\mathcal{O}(n). For 64 bits that is 64 gate delays.

Carry look-ahead: unroll the recurrence
c2=g1+p1g0+p1p0c0,c3=g2+p2g1+p2p1g0+p2p1p0c0c_2 = g_1 + p_1 g_0 + p_1 p_0 c_0, \qquad c_3 = g_2 + p_2 g_1 + p_2 p_1 g_0 + p_2 p_1 p_0 c_0

Every carry can be computed directly from the ggs and pps 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 (G,P)(G, P) and define a combining operator for two adjacent groups (left = more significant):

(G,P)∘(G′,P′)=(G+P G′,    P P′)(G, P) \circ (G', P') = \bigl(G + P\,G',\;\; P\,P'\bigr)

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 nn bits can be combined in a balanced tree of depth ⌈log⁡2n⌉\lceil\log_2 n\rceil instead of a chain:

bit 0g,pbit 1g,pbit 2g,pbit 3g,pbit 4g,pbit 5g,pbit 6g,pbit 7g,plevel 1span 1level 2span 2level 3span 4each ● computes (G,P) ∘ (G′,P′) = (G + P·G′, P·P′) — after log₂8 = 3 levels every bit has its carry
Kogge–Stone network for 8 bits. Level kk combines each bit with the bit 2k−12^{k-1} positions to its right.
ARCHITECTURELOGIC DEPTHPREFIX CELLSTRADE-OFF
Ripple carrynnnnsmallest, slowest
Brent–Kung2log⁡2n−12\log_2 n - 1≈2n\approx 2nfew cells, low fan-out
Kogge–Stonelog⁡2n\log_2 nnlog⁡2n−n+1n\log_2 n - n + 1fastest, many wires

Back to the counter. Adding 1 means b=0b = 0 and c0=1c_0 = 1, so gi=0g_i = 0, pi=cip_i = c_i (the counter bit), and the carry into bit ii is ∏j<icj\prod_{j \lt i} c_j — 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.

  1. Open Applications → System Tools → Terminal.
  2. Type bash if the prompt is not already Bash.
  3. Go to the lab directory and source the college setup file. You must source it once in every new terminal.
  4. 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]
COMMANDWHAT IT TELLS THE TOOLUNITS
create_clockA periodic clock exists on port clk. Every flop clocked by it is checked against this period.ns (from the .lib)
set_clock_uncertaintySubtract 0.2 ns from each cycle for skew/jitter you do not model yet.ns
set_input_delayLogic outside this block already used 1 ns of the cycle, so inside paths get 10 − 1 − 0.2 = 8.8 ns.ns
set_output_delayLogic outside needs 1 ns after this block's output, so internal-to-output paths also get 8.8 ns.ns
set_input_transition / set_loadRealistic slew on inputs and capacitive load on outputs, so boundary cells are sized properly.ns / pF
set_false_pathDo 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
COMMANDWHAT HAPPENS
set_attribute libraryLoads the Liberty file: the menu of legal cells, their delays and power.
read_hdlParses the Verilog (syntax only).
elaborateBuilds the design hierarchy, infers flops, adders and muxes. After this the design is at /designs/cnt_updown.
check_designReports unresolved modules, undriven/multiply-driven nets, unloaded ports.
synthesize -to_genericTechnology-independent optimization (Boolean simplification).
synthesize -to_mappedMaps to real gsclib045 cells and optimizes for your SDC.
synthesize -incrementalExtra clean-up pass: fixes remaining violations, recovers area.
write_hdl / write_sdcGate-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
  1. Half-adder cells: RC recognised count + 1 and built an incrementer chain (Chapter 2, D1–D2).
  2. Exactly 8 resettable flip-flops — one per bit. Check this number first.
  3. 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 AcellsA_{\text{cells}} that, divided by utilization, sets the core size in Step 4.5.
  4. 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 CATEGORYWHAT IT MEANSHOW TO FIX IT
Sequential clock pins without clock waveformFlip-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 delaysA 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 delaysAn 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 effectA set_false_path or similar matched nothing.The object name is wrong; check spelling against the RTL.
Multiple clocks on a pin / generated clocksNot 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:

rc:/> prompt · Tclls /libraries
report gates -summary
ANNOTATED OUTPUTreports/timing.rpt (RTL Compiler format)illustrative — your exact numbers and names will differ
reports/timing.rpt (RTL Compiler format)============================================================
  Generated by:           Encounter(R) RTL Compiler RC12.10
  Module:                 cnt_updown
  Technology library:     gpdk045bc                             [1]
  Operating conditions:   slow (balanced_tree)
  Wireload mode:          enclosed                              [2]
============================================================
     Pin            Type      Fanout Load Slew Delay Arrival     [3]
                                     (fF) (ps)  (ps)   (ps)
-----------------------------------------------------------------
(clock core_clk)    launch                              0 R     [4]
count_reg[0]/CK                           100           0 R
count_reg[0]/Q      DFFRHQX1       4  5.2  52   281   281 F     [5]
g214/Y              NAND2X1        2  3.1  61    84   365 R
g209/Y              NOR2X1         1  1.9  58    77   442 F
g201/Y              XNOR2X1        1  1.6  49   131   573 R
count_reg[7]/D <<<  DFFRHQX1                    0   573 R     [6]
count_reg[7]/CK     setup             100   112   685 R     [7]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(clock core_clk)    capture                         10000 R     [8]
                    uncertainty                -200  9800 R
-----------------------------------------------------------------
Timing slack :    9115ps                                        [9]
Start-point  : count_reg[0]/CK
End-point    : count_reg[7]/D
  1. 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.
  2. Wires are estimated by a wire-load model (Chapter 2 theory, D7).
  3. Columns: Fanout and Load are what the cell drives; Slew its output transition; Delay this stage; Arrival the running total.
  4. The launching clock edge at time 0 — the start of the path (an Rising edge).
  5. Clock-to-Q of the launching flop: tcqt_{cq} = 281 ps. Each following line adds one gate of tcombt_{\text{comb}}.
  6. The endpoint (<<<): data arrives at 573 ps = tcq+tcombt_{cq} + t_{\text{comb}}.
  7. The setup requirement of the capturing flop: 112 ps.
  8. The capturing edge one period later (10 000 ps) minus 200 ps uncertainty → 9 800 ps.
  9. 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"
Zero-delay functional gate simulation · shellirun -access +rwc -nospecify -notimingchecks \
  -timescale 1ns/1ps \
  -logfile logs/irun_gate.log \
  $CELL_VLOG results/cnt_updown_mapped.v tb/tb_cnt_updown.v

grep -E "PASS|FAIL|ERROR" logs/irun_gate.log
  • -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
FILEWHAT IT IS
results/cnt_updown_mapped.vGate-level netlist
results/cnt_updown_mapped.sdcConstraints for Encounter
reports/timing*.rpt, area.rpt, gates.rptSynthesis evidence
logs/irun_gate.logGate-level PASS
? Check yourself

Q1Slowing the clock (larger T) can fix…

Q2A port name in the SDC is misspelt. The most likely effect is…

Q3STA runs in time linear in the design size because…

Q4In the STA forward pass, a gate’s arrival time is the…

⚠ 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

COMPONENTCAUSEDEPENDS ON
SwitchingCharging and discharging wire + pin capacitanceActivity, C, V², f
Internal (short-circuit)Inside a cell during a transition both transistor stacks conduct briefly; internal nodes switchActivity, input slew
LeakageTransistors never fully turn offCell type, temperature, V — not activity
internal · flops 980 nWinternal · logic260 nWswitching280 nWleakage 1.8 nW (a sliver)total ≈ 1.52 µW at the slow corner, 100 MHz (values from the annotated power report in Step 3.3)internal power of the flops dominates because every clock pin toggles every cycle
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

VDDGNDPMOSon when in = 0NMOSon when in = 1outC (load)inchargedischarge0 → 1: supply delivers C·V²½ C·V² stored on C½ C·V² burnt in PMOS1 → 0: stored ½ C·V²burnt in NMOSper full cycle ⇒ C·V²
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.

[0]1[1]0.5[2]0.25[3]0.125[4]0.0625[5]0.03125[6]0.015625[7]0.0078125a flat “default” guessαcount bit (transitions per clock while counting)
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

FORMATCONTENTTYPICAL USE
VCDEvery change with its time (big)Waveforms, time-based (dynamic) power
TCFPer net: toggle count + probability (small)Cadence average power (this lab)
SAIFSame idea as TCFSynopsys tools (Chapter 8)
VCDevery change + its timegrows with run length (MB–GB)countTCF / SAIFper net: toggles + P(1)fixed size (kB)power tools only need how often each net switches, not when
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

LEVEREFFECT
Lower VDDQuadratic saving, but cells get slower
Clock gatingStops α on idle registers (the “Clock Gating Awareness” option in Chapter 4)
Smaller cells / shorter wiresLower C
High-Vt cellsLess leakage, slower — used on non-critical paths
00.40.81.21.60.60.70.80.911.1P / P(0.9 V) = (V / 0.9)²supply voltage (V)relative switching power0.8 V: −21 %0.9 V
Switching power scales with V2V^2. 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 VDDV_{DD}, the supply delivers current i(t)=C dVdti(t) = C\,\frac{dV}{dt} at constant voltage VDDV_{DD}:

VQQ = C·Vstored: ½CV²lost in PMOS: ½CV²VDDC·VDDsupply delivers charge CVat constant VDD: area = CV²capacitor stores thetriangle: ∫V dQ = ½CV²
Energy in one charge–discharge cycle, as areas on a charge–voltage plot. The supply delivers charge CVCV at constant voltage VV: energy CV2CV^2 (the rectangle). The capacitor stores only the triangle, 12CV2\tfrac12 CV^2; the other half is dissipated in the PMOS while charging. The stored half is burnt in the NMOS on discharge.
Esupply=∫0∞VDD i(t) dt=VDD∫0VDDC dV=C VDD2E_{\text{supply}} = \int_0^{\infty} V_{DD}\, i(t)\,dt = V_{DD}\int_0^{V_{DD}} C\,dV = C\,V_{DD}^2

The energy that ends up stored on the capacitor is

Estored=∫0VDDC V dV=12 C VDD2E_{\text{stored}} = \int_0^{V_{DD}} C\,V\,dV = \tfrac12\,C\,V_{DD}^2

The other 12CVDD2\tfrac12 C V_{DD}^2 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 CVDD2C V_{DD}^2.

D2From energy to average power

If the node makes a 0→1 transition in a fraction α0→1\alpha_{0\to1} of the ff clock cycles per second:

clknode8 cycles, 2 rising (0→1) transitions → α₀→₁ = 2/8 = 0.25; toggle rate τ = 4/8 = 0.5
Counting activity on one node over eight cycles. Two rising transitions give α0→1=2/8=0.25\alpha_{0\to1} = 2/8 = 0.25, the factor in P=αCV2fP = \alpha C V^2 f. 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.
Psw=α0→1 C VDD2 fP_{\text{sw}} = \alpha_{0\to1}\, C\, V_{DD}^2\, f

Watch the convention. Tools often count toggles (both 0→1 and 1→0). With toggle rate τ\tau (toggles per cycle), α0→1=τ/2\alpha_{0\to1} = \tau/2, so Psw=12 τ C VDD2 fP_{\text{sw}} = \tfrac12\,\tau\,C\,V_{DD}^2\,f. Many textbooks write 12αCV2f\tfrac12 \alpha C V^2 f for this reason — both are the same physics.

D3The counter’s total activity — a neat result

While counting continuously, bit ii toggles once every 2i2^i cycles, so τi=2−i\tau_i = 2^{-i}. Summing over all nn bits:

limit = 21n=11.5n=21.75n=31.88n=41.94n=51.97n=61.98n=71.99n=8total toggles per clock of an n-bit counter = 2(1 − 2⁻ⁿ)
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 1+12+14+…1 + \tfrac12 + \tfrac14 + \dots approaches 2, so even a wide counter flips only about two bits per clock on average.
∑i=0n−1τi=∑i=0n−12−i=2(1−2−n)  →  n→∞    2\sum_{i=0}^{n-1} \tau_i = \sum_{i=0}^{n-1} 2^{-i} = 2\left(1 - 2^{-n}\right) \;\xrightarrow{\;n\to\infty\;}\; 2

An nn-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, τ=0.2\tau = 0.2 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:

-12-10-8-6-400.20.40.60.8Vt = 0.35 VVt = 0.26 V (low-Vt)gate voltage VGS (V)log10( I_D / A )↑ 10× more leakage at VGS = 0slope: one decade per n·vT·ln10 ≈ 90 mV
Subthreshold current on a log scale. Below VtV_t the current falls by one decade for every ~90 mV of gate voltage. A low-VtV_t transistor (shifted by 90 mV) is faster but leaks about 10× more at VGS=0V_{GS} = 0. Hence the multi-VtV_t libraries that tools mix per path.
Isub=I0 eVGS−Vthn vT(1−e−VDS/vT),vT=kTq≈26 mV at 300 KI_{\text{sub}} = I_0\, e^{\frac{V_{GS} - V_{th}}{n\,v_T}}\left(1 - e^{-V_{DS}/v_T}\right), \qquad v_T = \frac{kT}{q} \approx 26\,\text{mV at } 300\,\text{K}

With n≈1.5n \approx 1.5, lowering VthV_{th} by just n vTln⁡10≈90 mVn\,v_T \ln 10 \approx 90\,\text{mV} increases leakage 10×. Temperature raises vTv_T and lowers VthV_{th}, so leakage climbs steeply when the chip is hot. This is why libraries offer high-VthV_{th} cells (slower, far less leaky) and why leakage reports must state the corner.

D5Try it: dynamic power calculator

Notice the V2V^2: 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 VtV_t and VDD−VtV_{DD} - V_t, both transistors conduct and current flows straight from supply to ground. For a symmetric inverter with input rise/fall time trt_r (Veendrick’s result):

00.450.90246810input (slow ramp)timevoltage (V)VtVDD − VtI_scboth transistors on
Short-circuit current. While a slow input ramp sits between VtV_t and VDD−VtV_{DD} - V_t, 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.
Psc=β12 (VDD−2Vt)3 trT  =  β12 (VDD−2Vt)3 tr fP_{sc} = \frac{\beta}{12}\,(V_{DD} - 2V_t)^3\,\frac{t_r}{T} \;=\; \frac{\beta}{12}\,(V_{DD} - 2V_t)^3\, t_r\, f

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 VDD<2VtV_{DD} \lt 2V_t the term vanishes, as both devices can never be on together.

D7Clock power and clock gating

The clock toggles every cycle (τ=2\tau = 2, α0→1=1\alpha_{0\to1} = 1), so the clock network is often 30–50 % of dynamic power:

latchopen when clk = 0enclkANDgclkreg0DQreg1DQreg2DQintegrated clock-gating cell (ICG)clkengclkpulses removed while en = 0, no glitches
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.
Pclk=(Ctree+Nff Cck pin) VDD2 fP_{\text{clk}} = \bigl(C_{\text{tree}} + N_{\text{ff}}\,C_{\text{ck pin}}\bigr)\,V_{DD}^2\,f

If a group of registers is idle a fraction gg of the time, an integrated clock-gating cell stops their clock in those cycles, saving roughly gg 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 Δ\Delta apart, the output goes 0 → 1 → 0: two extra transitions, real CV2CV^2 energy, no logical effect. The effective activity is

ABA ⊕ BΔglitch: 2 extra transitions, CV² wasted,final value unchanged
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 CV2CV^2. Balanced path delays reduce glitch power.
αeff=αfunctional+αglitch\alpha_{\text{eff}} = \alpha_{\text{functional}} + \alpha_{\text{glitch}}

A glitch survives only if Δ\Delta 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:

one OFF transistorN offfull V_DStwo OFF transistors in seriesN offVx ≈ 50–100 mVN offupper: V_GS = −Vx < 0smaller V_DS too→ leaks far lessboth effects enter the exponent of the leakage equation: stacks typically leak 5–10× less
The stack effect. A single OFF transistor sees the full VDSV_{DS}. In a series stack of two OFF transistors the middle node floats up to tens of millivolts. The upper device then has a negative VGSV_{GS} and a smaller VDSV_{DS}, both of which enter the exponent of the leakage equation, so stacks leak 5–10× less.
Eop=Pfop=∑nets kαk Ck VDD2  +  PleakfopE_{\text{op}} = \frac{P}{f_{\text{op}}} = \sum_{\text{nets } k} \alpha_k\,C_k\,V_{DD}^2 \;+\; \frac{P_{\text{leak}}}{f_{\text{op}}}

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 VGSV_{GS} of the upper device negative and reducing its VDSV_{DS} — 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
  1. Total for the block. Dynamic power dwarfs leakage at the slow corner and 100 MHz.
  2. All nets got their activity from the TCF — if this is low, revisit the -instance option.
  3. 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
FILEWHAT IT IS
activity/dut.tcfSwitching activity of the DUT
reports/power_tcf.rptActivity-annotated power
? Check yourself

Q1Halving the supply voltage changes switching power by a factor of…

Q2On average, how many bits of a long binary counter flip per clock?

Q3Which power component is independent of switching activity?

⚠ 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

DIEmarginPower ring (VDD orange, VSS blue)Stripes crossing the coreCore: rows of std cellsFollow-pin rails on each row edgeI/O pins on the die edge
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

VDDVSSVDDVSSNAND2INVDFFRFILLXOR2TIEMUX2FILLADDHR0 (normal)NAND2INVDFFRFILLXOR2TIEMUX2FILLADDHMX (flipped)NAND2INVDFFRFILLXOR2TIEMUX2FILLADDHR0 (normal)every other row is mirrored so neighbouring rows share one rail
Alternate rows are mirrored so two rows share one VDD or VSS rail. Gaps become filler cells.
CELLWHY IT EXISTS
FillerKeeps the N-well, implant layers and power rails continuous across gaps (a broken well is a DRC error).
Tie-high / tie-lowGives a logic constant through a transistor instead of wiring a gate input straight to VDD/VSS (ESD and reliability).
DecapA 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

silicon + transistors (front end of line)Metal1 — horizontalMetal2 | verticalMetal3 — horizontalMetal4 | verticalMetal5 — horizontalMetal6 | verticalMetal7 — horizontalMetal8 | verticalMetal9 — horizontalMetal10 | verticalthin, dense, high R:local cell wiringmedium:block-level signalsthick, low R:power grid + clock
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.

T4The power grid → Steps 4.6–4.9

pad / pinring (top metal)stripes (top metal)vias downfollow-pin rails (Metal1)cell VDD/VSS pins

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.

padringringstripe + viafollow-pin rail (Metal1)IIIIevery arrow is cell currentevery zig-zag is metalresistance → I·R drop
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

  1. 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.
  2. Legalization — snaps every cell onto a row and site with no overlaps.
  3. 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).

random placementafter placement00112233445566778899total wire length ≈ 1620 unitstotal wire length ≈ 710 units
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.

clock root (clk port)FFFFFFFFFFFFFFFFevery flop sees the same number of buffers and the same wire length → skew ≈ 0
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

  1. Global routing divides the chip into tiles (gcells) and decides which tiles each net passes through, balancing demand against available tracks.
  2. Track assignment picks actual tracks.
  3. Detailed routing draws exact wires and vias that obey every spacing/width rule.
2/103/105/104/102/101/101/102/103/106/108/109/105/103/102/101/102/105/109/1011/107/104/102/101/101/103/106/107/105/103/101/101/101/101/102/103/102/102/101/100/10each cell = a gcell; number = wires wanted / tracks availableplenty of tracksbusyoverflow → detour
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

driverRCRCRCreceiverneighbouring wire (aggressor)Cc (coupling)delay grows with R·C; neighbours switching through Cc cause crosstalk
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

STAGECLOCKWIRESMAINLY FIXES
pre-CTSIdealEstimated (from placement)Setup, max transition/cap/fanout
post-CTSReal treeEstimatedSetup and now hold
post-RouteReal treeExtracted R/CFinal setup/hold, SI
pre-CTSclock: idealwires: estimatedfixes: setup, DRVpost-CTSclock: real treewires: estimatedfixes: setup + holdpost-routeclock: real treewires: extracted R/Cfixes: final setup/hold, SIeach optDesign run sees more reality — numbers usually get worse, then are fixed
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 AcellsA_{\text{cells}}, utilization UU, aspect ratio 1 and margin mm on each side:

die 210 µm × 210 µm (to scale)core 10 µm × 10 µm (zoomed 14×)core = √(72 µm² / 0.72) = 10 µmmargin 100 µm per side→ core is 0.2 % of the die
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.
acore=AcellsU,adie=acore+2ma_{\text{core}} = \sqrt{\frac{A_{\text{cells}}}{U}}, \qquad a_{\text{die}} = a_{\text{core}} + 2m
This lab: Acells≈72 μm2A_{\text{cells}} \approx 72\,\mu\text{m}^2, U=0.72U = 0.72 → acore=10 μma_{\text{core}} = 10\,\mu\text{m}. With m=100 μmm = 100\,\mu\text{m}: adie=210 μma_{\text{die}} = 210\,\mu\text{m}. The core is only (10/210)2≈0.2 %(10/210)^2 \approx 0.2\,\% 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 ee is the half-perimeter of its bounding box:

fixed pin x = 0fixed pin x = 10weight 1weight 3 (critical net)cell settles at x = 7.5force balance: 1·(x − 0) + 3·(x − 10) = 0 → x = 7.5 (the weighted average)
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(e)=(max⁡p∈exp−min⁡p∈exp)+(max⁡p∈eyp−min⁡p∈eyp),W=∑eHPWL(e)\text{HPWL}(e) = \Bigl(\max_{p\in e} x_p - \min_{p\in e} x_p\Bigr) + \Bigl(\max_{p\in e} y_p - \min_{p\in e} y_p\Bigr), \qquad W = \sum_{e} \text{HPWL}(e)

HPWL has kinks (max/min), so analytical placers first minimise a smooth quadratic substitute where every two-pin connection i ⁣− ⁣ji\!-\!j acts like a spring of stiffness wijw_{ij}:

Φ(x)=12∑(i,j)wij (xi−xj)2⇒∂Φ∂xi=∑jwij(xi−xj)=0\Phi(\mathbf{x}) = \tfrac12 \sum_{(i,j)} w_{ij}\,(x_i - x_j)^2 \qquad\Rightarrow\qquad \frac{\partial \Phi}{\partial x_i} = \sum_j w_{ij}(x_i - x_j) = 0

Solving gives each movable cell at the weighted average of its neighbours; for all cells at once it is a sparse linear system Qx=bQ\mathbf{x} = \mathbf{b} (same for yy).

1-D example: a cell wired to a fixed pin at x=0x=0 (weight 1) and to one at x=10x=10 (weight 3, e.g. a critical net):
1⋅(x−0)+3⋅(x−10)=0⇒x=7.51\cdot(x-0) + 3\cdot(x-10) = 0 \Rightarrow x = 7.5. 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.

τi=∑k ∈ path(i)Rk  Cdown(k)\tau_i = \sum_{k \,\in\, \text{path}(i)} R_k \; C_{\text{down}}(k)

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, τi\tau_i 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 RCRC exactly.

driverR1 = 100 Ωn1C1 = 10 fFR2 = 200 ΩC2 = 20 fFsink AR3 = 150 ΩC3 = 15 fFsink Bτ_A = R1·(C1+C2+C3) + R2·C2 = 4.5 ps + 4.0 ps = 8.5 psτ_B = R1·(C1+C2+C3) + R3·C3 = 4.5 ps + 2.25 ps = 6.75 ps
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: R1(C1+C2+C3)=100 Ω×45 fF=4.5R_1(C_1+C_2+C_3) = 100\,\Omega \times 45\,\text{fF} = 4.5 ps.
To sink A we also cross R2, which only charges C2: 200 Ω×20 fF=4.0200\,\Omega\times20\,\text{fF} = 4.0 ps → τA=8.5\tau_A = 8.5 ps.
To sink B we cross R3, which only charges C3: 150 Ω×15 fF=2.25150\,\Omega\times15\,\text{fF} = 2.25 ps → τB=6.75\tau_B = 6.75 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 LL with rr ohms and cc farads per unit length. Cut it into tiny slices of length dxdx. The slice at position xx has resistance r dxr\,dx, and everything beyond it — length L−xL - x — is downstream, capacitance c (L−x)c\,(L-x). Summing (integrating) the products:

τwire=∫0Lr c (L−x) dx=r c[Lx−x22]0L=r c L22\tau_{\text{wire}} = \int_0^L r\,c\,(L - x)\,dx = r\,c\left[Lx - \frac{x^2}{2}\right]_0^L = \frac{r\,c\,L^2}{2}

Adding a driver of resistance RdR_d (which charges the whole wire and the receiving pin CLC_L) and the wire’s own charging of CLC_L:

τ=Rd (cL+CL)⏟driver+rcL22⏟wire itself+rL CL⏟wire charging the pin\tau = \underbrace{R_d\,(cL + C_L)}_{\text{driver}} + \underbrace{\frac{rcL^2}{2}}_{\text{wire itself}} + \underbrace{rL\,C_L}_{\text{wire charging the pin}}

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 rcL2/2rcL^2/2 by about 0.76, giving 0.38 rcL20.38\,rcL^2.)

D4Why tools insert buffers on long wires

The L2L^2 term means long wires get disproportionately slow. The cure is to cut the wire into kk equal pieces and put a buffer (repeater) in front of each piece. Each buffer costs a fixed delay tbt_b, but each piece is now only L/kL/k long, so its own delay is rc(L/k)2/2rc(L/k)^2/2:

t(k)=k tb⏟buffers+k⋅rc2(Lk)2⏟k short wires=k tb+rcL22kt(k) = \underbrace{k\,t_b}_{\text{buffers}} + \underbrace{k\cdot\frac{r c}{2}\left(\frac{L}{k}\right)^2}_{k\ \text{short wires}} = k\,t_b + \frac{r c L^2}{2k}

More buffers make the first term grow and the second shrink. The best kk is where the curve bottoms out — set the derivative to zero:

dtdk=tb−rcL22k2=0    ⇒    k∗=Lrc2 tb\frac{dt}{dk} = t_b - \frac{r c L^2}{2k^2} = 0 \;\;\Rightarrow\;\; k^\ast = L\sqrt{\frac{r c}{2\,t_b}}

Substituting back, both terms become equal (a sign the balance is optimal) and

t(k∗)=2 k∗tb=L2 rc tbt(k^\ast) = 2\,k^\ast t_b = L\sqrt{2\,r c\,t_b}

With optimal buffering, delay grows linearly with length instead of quadratically.

010203040500246810unbuffered L²/2optimally buffered 2Lwire length L (normalised)delay (normalised)crossover L = 4
Normalised delay vs wire length (rc=1rc = 1, tb=2t_b = 2): unbuffered L2/2L^2/2 against optimally buffered 2L2L. Beyond L=4L = 4 buffering wins, and the gap grows fast.

Rule of thumb: the critical length beyond which buffering pays is where rcL2/2≈2tbrcL^2/2 \approx 2t_b. 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 LL (resistance rr per unit length) drawing uniform current jj per unit length, fed with VDDV_{DD} at both ends. Current conservation and Ohm’s law give

d2Vdropdx2=− r j,Vdrop(0)=Vdrop(L)=0    ⇒    Vdrop(x)=r j2 x (L−x)\frac{d^2 V_{\text{drop}}}{dx^2} = -\,r\,j, \quad V_{\text{drop}}(0) = V_{\text{drop}}(L) = 0 \;\;\Rightarrow\;\; V_{\text{drop}}(x) = \frac{r\,j}{2}\,x\,(L - x)

The worst point is the middle: Vdropmax⁡=r j L2/8V_{\text{drop}}^{\max} = r\,j\,L^2/8. Fed from one end only, the worst drop is r j L2/2r\,j\,L^2/2 — four times worse.

08162432400246810fed both ends rjx(L−x)/2fed one endposition along rail x (L = 10)voltage drop (normalised)max rjL²/8 at the centre4× worse
Drop along a rail fed from both ends (parabola) vs one end. Stripes every PP µm replace LL by PP: halving the stripe pitch cuts the worst drop by 4×.

D6Clock skew, formally → Step 4.12

With ℓi\ell_i the clock latency to flop ii:

clock rootFF0ℓ = 207.9 psFF1ℓ = 210.2 psFF2ℓ = 214.6 psFF3ℓ = 211.0 psskew = max ℓ − min ℓ = 214.6 − 207.9 = 6.7 ps (the CTS report number)
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.
skew=max⁡iℓi−min⁡iℓi,local skew(L ⁣→ ⁣C)=ℓC−ℓL=δ\text{skew} = \max_i \ell_i - \min_i \ell_i, \qquad \text{local skew}(L\!\to\!C) = \ell_C - \ell_L = \delta

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 ℓi\ell_i 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.

idealrealwhere edge 4 actually lands (σ_jit)shortest possible cycle T − t_jitis what setup must survive
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 uu in the SDC is reserved for jitter.
MEASUREDEFINITIONMATTERS FOR
Period jitterTn−TnominalT_n - T_{\text{nominal}}: how much one cycle differs from idealsetup (a short cycle steals time)
Cycle-to-cycle jitterTn+1−TnT_{n+1} - T_nPLL quality specification
Long-term jitterdrift of edge nn from its ideal timeI/O interfaces

For a single-cycle setup check, the danger is the shortest possible cycle, so the effective period is T−tjitT - t_{\text{jit}}. Hold is checked on one edge, and jitter largely cancels (the same edge launches and captures). Independent random jitter sources add in quadrature:

σjit,total=σPLL2+σbuffers2+⋯,tjit≈k σjit,total    (k≈6–7)\sigma_{\text{jit,total}} = \sqrt{\sigma_{\text{PLL}}^2 + \sigma_{\text{buffers}}^2 + \cdots}, \qquad t_{\text{jit}} \approx k\,\sigma_{\text{jit,total}}\;\;(k \approx 6\text{–}7)

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 gg has a capacity cap(g)\text{cap}(g) = number of routing tracks crossing it (tile width ÷ track pitch, summed over the layers in that direction) and a demand dem(g)\text{dem}(g) = nets the global router wants through it. The router minimises

6/89/85/87/810/88/84/86/83/85/87/89/84/86/811/88/82/8each label: demand / capacityof one gcell edge (tracks)orange edges overflowoverflow = (9−8) + (9−8) + (10−8) + (11−8) = 7→ detours or DRC errors in detailed routing
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=∑gmax⁡(0, dem(g)−cap(g))\text{overflow} = \sum_{g} \max\bigl(0,\ \text{dem}(g) - \text{cap}(g)\bigr)

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 CgC_g and coupling CcC_c to a neighbour behaves as if its capacitance were

same directionvictimaggressork = 0C_eff = C_gaggressor quietvictimaggressork = 1C_eff = C_g + C_copposite directionvictimaggressork = 2C_eff = C_g + 2C_cthe coupling capacitor sees a voltage swing of 0, 1 or 2 × VDD → delay is a window, not a number
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.
Ceff=Cg+k Cc,k={0neighbour switches the same way1neighbour quiet2neighbour switches the opposite way (Miller effect)C_{\text{eff}} = C_g + k\,C_c, \qquad k = \begin{cases} 0 & \text{neighbour switches the same way} \\ 1 & \text{neighbour quiet} \\ 2 & \text{neighbour switches the opposite way (Miller effect)} \end{cases}

So one net’s delay is not a single number but a window. SI-aware timing (the -routeWithSiDriven option) accounts for the worst kk on critical nets and spaces them apart.

D9Rent’s rule: how wiring demand scales

Empirically, a block of GG gates has a number of external connections

0123450123456p = 0.5p = 0.65p = 0.75log10 G (gates in the block)log10 T (external pins)T = t·G^p, t = 4: a straight line of slope p
Rent’s rule on log–log axes. The number of external pins of a block grows as a power of its gate count, T=tGpT = tG^p, which appears as a straight line of slope pp. Higher pp (more irregular logic) means more wiring demand per gate as blocks grow.
T=t G p,0.5≲p≲0.75T = t\,G^{\,p}, \qquad 0.5 \lesssim p \lesssim 0.75

where tt is the average pins per gate and pp the Rent exponent. Donath showed that for p>0.5p \gt 0.5 the average wire length in a good placement grows as G p−0.5G^{\,p-0.5} (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 nn cells with kk pins each and the available tracks per unit area is fixed, raising utilization from U1U_1 to U2U_2 raises the local pin density by U2/U1U_2/U_1 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.

01020300.50.60.70.80.91routing overflow (%)core utilizationoverflow (illustrative)usual range 60–80 %this lab: 0.72
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 aa in part A, let E(a)E(a) = edges to the other part, I(a)I(a) = edges inside its own part, and D(a)=E(a)−I(a)D(a) = E(a) - I(a). Swapping a∈Aa \in A with b∈Bb \in B reduces the cut by

part Apart Bapqrbstuorange = cut nets (4). D(a) = 3 − 1 = 2, D(b) = 2 − 0 = 2, c(a,b) = 1swap gain g = D(a) + D(b) − 2·c(a,b) = 2 → after swapping a and b only 2 nets are cut
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.
g(a,b)=D(a)+D(b)−2 c(a,b)g(a,b) = D(a) + D(b) - 2\,c(a,b)

(the c(a,b)c(a,b) 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 aa has 3 nets to part B and 1 inside A → D(a)=2D(a) = 2. Cell bb has 2 nets to A and 0 inside B → D(b)=2D(b) = 2. They share one net: g=2+2−2=2g = 2 + 2 - 2 = 2. 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 ΔC\Delta C with probability

00.250.50.751012345T = 4 (hot: explores)T = 1T = 0.25cost increase ΔC of a moveprobability of accepting it
Simulated annealing’s acceptance rule e−ΔC/Te^{-\Delta C/T}. 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.
P(accept)=min⁡ ⁣(1,  e−ΔC/Tk),Tk+1=λ Tk(0.8<λ<0.99)P(\text{accept}) = \min\!\left(1,\; e^{-\Delta C / T_k}\right), \qquad T_{k+1} = \lambda\,T_k \quad (0.8 \lt \lambda \lt 0.99)

High “temperature” early on lets the placement escape local minima; as T→0T\to 0 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 O(MN)\mathcal{O}(MN) for an M×NM\times N 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  ≤  RSMT  ≤  RMST  ≤  32 RSMT\text{HPWL} \;\le\; \text{RSMT} \;\le\; \text{RMST} \;\le\; \tfrac32\,\text{RSMT}

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 i→ji \to j with path delays dijmax⁡,dijmin⁡d^{\max}_{ij}, d^{\min}_{ij} (including tcqt_{cq}), the setup and hold conditions of Chapter 2 become constraints on the clock arrival times ℓ\ell:

ℓ1ℓ2ℓ3ℓ4+3.1−0.4+2.0−0.2+1.5+0.8edge u → v with weight c means ℓv − ℓu ≤ c (setup edges grey, hold edges blue)a solution exists ⇔ no cycle has negative total weight (Bellman–Ford checks this)
Useful-skew scheduling as a constraint graph. Every setup or hold inequality ℓv−ℓu≤c\ell_v - \ell_u \le c 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.
ℓi−ℓj  ≤  T−dijmax⁡−tsu,ℓj−ℓi  ≤  dijmin⁡−th\ell_i - \ell_j \;\le\; T - d^{\max}_{ij} - t_{su}, \qquad \ell_j - \ell_i \;\le\; d^{\min}_{ij} - t_h

Every inequality has the form xv−xu≤cuvx_v - x_u \le c_{uv} — a difference constraint. Draw an edge u→vu \to v of weight cuvc_{uv} 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 O(∣V∣∣E∣)\mathcal{O}(|V||E|). Binary-searching on TT 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 ρ\rho, thickness tt, width WW and length LL:

R□R□R□R□L = 4W → 4 squares → R = 4·R□R□R□same length, double width → 2 squares → R = 2·R□R = R□ · (L / W): a 1 µm × 1 µm square and a 100 µm × 100 µm square have the same resistance
Counting squares. A wire’s resistance is R□⋅L/WR_\square \cdot L/W: 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.
R=ρ LW t=R□ LW,R□=ρt    [Ω/□]R = \frac{\rho\,L}{W\,t} = R_\square\,\frac{L}{W}, \qquad R_\square = \frac{\rho}{t}\;\;[\Omega/\square]

Resistance depends only on the number of “squares” L/WL/W. Thick top metals have small R□R_\square, which is why power stripes live there.

Example: 100 µm of a 0.07 µm-wide Metal1 at R□=0.2 Ω/□R_\square = 0.2\,\Omega/\square: 100/0.07≈1430100/0.07 \approx 1430 squares → 286 Ω. With about 0.2 fF/µm the wire has 20 fF, so its own Elmore delay is 12⋅286⋅20 fF≈2.9\tfrac12\cdot286\cdot20\,\text{fF} \approx 2.9 ps — negligible here, but it grows with L2L^2: 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):

PNP (in the n-well)emitter = PMOS source (p+)NPN (in the p-substrate)emitter = NMOS source (n+)PNP collector → NPN baseNPN collector → PNP baseR_well (to VDD tap)R_sub (to VSS tap)positive feedback if β_npn·β_pnp ≥ 1 — a short from VDD to VSS that does not stop on its own
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:

Iinj⋅Rwell≳0.7 Vandβnpn βpnp≥1    ⇒    latch-upI_{\text{inj}} \cdot R_{\text{well}} \gtrsim 0.7\,\text{V} \quad\text{and}\quad \beta_{\text{npn}}\,\beta_{\text{pnp}} \ge 1 \;\;\Rightarrow\;\; \text{latch-up}

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 RwellR_{\text{well}} and RsubR_{\text{sub}} 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:

Rwell∝dtap⇒dtap≤dmax⁡    (typically 15–60 μm)R_{\text{well}} \propto d_{\text{tap}} \quad\Rightarrow\quad d_{\text{tap}} \le d_{\max}\;\;(\text{typically } 15\text{–}60\,\mu\text{m})

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.
ImportFloorplanGlobal netsRingStripesSpecial routePlaceCTSRouteOptimizeFillersSave
4.0

Open Encounter from the project directory

Why this stepLaunching from the project root makes every relative path in the scripts resolve correctly.

  1. Open a new terminal.
  2. Enter Bash, return to the project, and load the same Cadence environment.
  3. Confirm that the mapped netlist, SDC and physical libraries exist.
  4. 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 / CONTROLWHAT IT DOES
fFit the whole design in the window
z / ZZoom in / zoom out (or right-drag a box to zoom into it)
Arrow keysPan
qShow the attributes of the selected object (net name, layer, cell, coordinates)
k / KDraw 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 barCursor 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.

ACheck whether your VM has a pad library

Look for I/O pad cells · shellfind $PDK45 $PDK45_TECH -iname "*pad*" -o -iname "*io*.lef" -o -iname "*io*.lib"
find /home/buet/cadence/EDI/share/FoundationFlows/EXAMPLES -iname "pdkIO*"
  • 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:

FIELDVALUENOTES
Verilog Netlist → Filesresults/cnt_updown_mapped.vThe course used its pad netlist cnt_updown_dve.v.
Top CellBy User: cnt_updownOr "Auto Assign" — explicit is safer.
Technology/Physical Libraries → LEF Files/home/buet/cadence/EDI/share/FoundationFlows/EXAMPLES/EDI/DESIGN/GPDK/LIBS/GPDK045/gsclib045.lefThe only LEF: it holds the technology section and all 487 cell macros, so there is no ordering to get wrong. Use the … button or paste the path.
Analysis Configuration → MMMC View Definition Filescripts/mmmc.tclReplaces 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.

  1. 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.
  2. Click OK. Watch the terminal: Encounter reads the LEF, the netlist, the MMMC file and the SDC.
  3. 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.
  1. LEF read first: technology layers, then cell abstracts. Antenna warnings on filler cells are harmless.
  2. The top cell you named — a wrong name here means nothing else will match.
  3. Every netlist instance was matched to a timing cell. Any “unresolved” count must be zero.
  4. The SDC from RC is read per constraint mode; errors here mean names in the SDC do not exist in the netlist.
  5. 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:

FIELDVALUEMEANING
Specify BySize → Core Size by: Aspect RatioLet utilization decide the size.
Ratio (H/W)1.0Square core.
Core Utilization0.7272 % of row area filled by cells; 28 % left for buffers, CTS and routing detours.
Core Margins byCore to IO Boundary—
Core to Left / Right / Top / Bottom100 eachMicrons of empty space around the core for the power ring and pins.
Everything elsedefault—
Equivalent Encounter TclfloorPlan -site CoreSite -r 1.0 0.72 100 100 100 100

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:

  1. Rule 1: select Pins; Pin Name(s) = VDD; Instance Basename = *; To Global Net = VDD. Click Add to List.
  2. Rule 2: Pin Name(s) = VSS; Instance Basename = *; To Global Net = VSS. Click Add to List.
  3. (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.
  4. 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.

Equivalent Encounter TclglobalNetConnect 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
What "Check" prints

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.

FIELDCOURSE VALUE (65 nm)VALUE ON YOUR VM (GPDK045)
Net(s)VDD VSS (click … and pick both)
Ring TypeCore ring(s) contouring → Around core boundary
Layer Top / Bottom (horizontal)APMetal9 (= $H_LAYER; the top layer, HORIZONTAL)
Layer Left / Right (vertical)M6Metal8 (= $V_LAYER; the highest VERTICAL layer)
Width (all sides)3 µm
Spacing (all sides)4 µm
Offset → Specify3 µ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

FIELDCOURSE (65 nm)YOUR VM (GPDK045)
Net(s)VDD VSSVDD VSS
Layer / DirectionAP, HorizontalMetal9 (= $H_LAYER), Horizontal
Width / Spacing3 / 51 / 1
Set Pattern → Set-to-set distance206
Stripe BoundaryCore ringCore ring
First/Last Stripe → Start from bottom, relative offset52 (start and stop offset)

Click Apply (not OK — you will reuse the dialog).

BVertical stripes

FIELDCOURSE (65 nm)YOUR VM (GPDK045)
Layer / DirectionM6, VerticalMetal8 (= $V_LAYER), Vertical
Width / Spacing3 / 51 / 1
Set-to-set distance156
Start from left, relative offset3.52 (start and stop offset)

Click OK.

Equivalent Encounter TcladdStripe -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

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.

  1. Net(s): VDD VSS.
  2. In SRoute, tick Block pins, Pad pins, Pad rings, Follow pins (the standard-cell rails — the most important one) and Floating stripes.
  3. Leave the other tabs at default and click OK.
Equivalent Encounter Tclsroute -connect {blockPin padPin padRing corePin floatingStripe} \
  -nets {VDD VSS}

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.

Equivalent Encounter Tcl (placement modes)setPlaceMode -clkGateAware true
setTieHiLoMode -cell $TIE_CELLS -maxFanout 8
setFillerMode -core $FILLERS -corePrefix FILL
Why tie cells exist

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

  1. Click OK to apply and close Mode Setup.
  2. Back in the Place dialog, leave Include Pre-Place Optimization on and click OK.
  3. 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.
Core placement · TclplaceDesign
addTieHiLo
checkPlace reports/checkPlace.rpt
optDesign -preCTS -outDir reports/preCTS
What you should see
  • 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
optDesign -preCTS summary (Encounter)------------------------------------------------------------
     optDesign Final Summary
------------------------------------------------------------
+--------------------+---------+---------+---------+---------+
|     Setup mode     |   all   | reg2reg | in2reg  | reg2out |  [1]
+--------------------+---------+---------+---------+---------+
|           WNS (ns):|  7.442  |  9.010  |  7.890  |  7.442  |  [2]
|           TNS (ns):|  0.000  |  0.000  |  0.000  |  0.000  |  [3]
|    Violating Paths:|    0    |    0    |    0    |    0    |
|          All Paths:|   24    |    8    |   16    |    8    |
+--------------------+---------+---------+---------+---------+
+----------------+-------------------------------+------------------+
|                |              Real             |       Total      |
|    DRVs        +------------------+------------+------------------|
|                |  Nr nets(terms)  | Worst Vio  |  Nr nets(terms)  |  [4]
+----------------+------------------+------------+------------------+
|   max_cap      |      0 (0)       |   0.000    |      0 (0)       |
|   max_tran     |      0 (0)       |   0.000    |      0 (0)       |
|   max_fanout   |      0 (0)       |     0      |      0 (0)       |
+----------------+------------------+------------+------------------+
Density: 72.381%                                                    [5]
Routing Overflow: 0.00% H and 0.00% V                               [6]
  1. Path groups as in the STA theory: all paths, then by type.
  2. WNS = worst negative slack. Positive means even the worst path meets timing.
  3. TNS = sum of all negative slacks. 0 means no violations at all.
  4. DRVs (design-rule violations): electrical limits on capacitance, transition and fanout from the Liberty file. All must be 0.
  5. Placement density ≈ the utilization you chose in Step 4.5.
  6. 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:

Generate constraints/Clock.ctstch · Tclsource scripts/lib_paths.tcl
createClockTreeSpec -bufferList $CTS_BUFS -file constraints/Clock.ctstch
Inspect it · shellless constraints/Clock.ctstch

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.

Equivalent TclclockDesign -specFile constraints/Clock.ctstch -outDir reports/clock
optDesign -postCTS       -outDir reports/postCTS
optDesign -postCTS -hold -outDir reports/postCTS_hold

COptional — reduce clock uncertainty after CTS

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:

Post-CTS uncertainty (MMMC-aware) · Tclset_interactive_constraint_modes [all_constraint_modes -active]
set_clock_uncertainty -setup 0.05 [all_clocks]
set_clock_uncertainty -hold  0.02 [all_clocks]
set_interactive_constraint_modes {}
report_clocks

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]
  1. Where the tree starts: the clk port.
  2. Sinks = clock pins of flops. It must equal your flop count (8).
  3. Buffers CTS inserted (from the -bufferList you gave).
  4. Latency to the slowest and fastest flop.
  5. Skew = 214.6 − 207.9 = 6.7 ps, far below the target — and below the 200 ps uncertainty budgeted in the SDC.
  6. Clock transition at the flops; slow clock edges increase tcqt_{cq} 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.

  1. 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.
  2. 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.
  3. 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.
Equivalent TcltrialRoute
setNanoRouteMode -routeWithTimingDriven true -routeWithSiDriven true
routeDesign -globalDetail
setExtractRCMode -engine postRoute -effortLevel low   ;# native extractor + GPDK045 capTable
setAnalysisMode -analysisType onChipVariation
optDesign -postRoute       -outDir reports/postRoute
optDesign -postRoute -hold -outDir reports/postRoute_hold
timeDesign -postRoute       -outDir reports/timing_final
timeDesign -postRoute -hold -outDir reports/timing_final

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
timeDesign -postRoute -hold summary+--------------------+---------+---------+---------+---------+
|     Hold mode      |   all   | reg2reg | in2reg  | reg2out |  [1]
+--------------------+---------+---------+---------+---------+
|           WNS (ns):|  0.071  |  0.071  |  0.188  |   N/A   |  [2]
|           TNS (ns):|  0.000  |  0.000  |  0.000  |   N/A   |
|    Violating Paths:|    0    |    0    |    0    |   N/A   |
+--------------------+---------+---------+---------+---------+
Analysis View: VIEW_HOLD                                           [3]
Density: 74.103%                                                   [4]
  1. Hold uses the minimum-delay paths (min⁡\min in the STA recurrences).
  2. Small positive hold slack is normal: hold only needs to be ≥ 0, extra margin buys nothing.
  3. Must be the fast corner view — if it says VIEW_SETUP, hold is being checked at the wrong corner.
  4. 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.

Fill, verify and save · TcladdFiller -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 reports/connectivity.rpt
verifyGeometry -report reports/geometry.rpt
saveDesign  results/cnt_updown_postRoute.enc
saveNetlist results/cnt_updown_postRoute.v
What clean results look like

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
Encounter console after addFiller, verifyConnectivity and verifyGeometry*INFO:   Added 41 filler instances (FILL*)[1]
*INFO:   Total 41 filler insts added - prefix FILL (CPU: 0:00:00.0)
VERIFY_CONNECTIVITY use new engine.
******** Start: VERIFY CONNECTIVITY ********
Start Time: ...
Design Name: cnt_updown
Database Units: 2000                                                [2]
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.                                    [3]
End Summary
******** End: VERIFY CONNECTIVITY ********
  Verification Complete : 0 Viols.  0 Wrngs.
 *** Starting Verify Geometry (MEM: 512.4) ***
  VERIFY GEOMETRY ...... Starting Verification
  VERIFY GEOMETRY ...... SubArea : 1 of 1
  VERIFY GEOMETRY ...... Cells          :  0 Viols.
  VERIFY GEOMETRY ...... SameNet        :  0 Viols.
  VERIFY GEOMETRY ...... Wiring         :  0 Viols.                 [4]
  VERIFY GEOMETRY ...... Antenna        :  0 Viols.
  VERIFY GEOMETRY ...... Sub-Area : 1 complete 0 viols. 0 wrngs.
Verification Complete : 0 Viols. 0 Wrngs.                           [5]
Writing Encounter database to results/cnt_updown_postRoute.enc.dat
  1. 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.
  2. Database units must say 2000 — the same value you will pass to streamOut -units in Step 7.5.
  3. Connectivity: “no problems” means every net, including VDD/VSS rails to every cell, is one connected piece.
  4. Geometry sub-checks: Cells = overlapping instances, SameNet = notches/spacing on one net, Wiring = spacing/width between different nets, Antenna = process-antenna ratios.
  5. 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.
✔ Chapter recap
Commands in order
Chapter commands, in order (condensed — every option is in the steps)encounter -log logs/encounter_gui.log
# GUI: Import Design (netlist, LEF, scripts/mmmc.tcl, VDD/VSS) -> save default.conf
floorPlan -site CoreSite -r 1.0 0.72 100 100 100 100
globalNetConnect VDD -type pgpin -pin VDD -inst *;  globalNetConnect VSS -type pgpin -pin VSS -inst *
addRing ...     # Metal9 top/bottom, Metal8 left/right; width 3, spacing 4, offset 3
addStripe ...   # twice: Metal9 horizontal + Metal8 vertical; width 1, spacing 1, set-to-set 6
sroute -connect {blockPin padPin padRing corePin floatingStripe} -nets {VDD VSS}
placeDesign; addTieHiLo; optDesign -preCTS
createClockTreeSpec -bufferList $CTS_BUFS -file constraints/Clock.ctstch
clockDesign -specFile constraints/Clock.ctstch; optDesign -postCTS; optDesign -postCTS -hold
routeDesign -globalDetail; setExtractRCMode -engine postRoute -effortLevel low
optDesign -postRoute; optDesign -postRoute -hold
addFiller -cell $FILLERS -prefix FILL; verifyConnectivity; verifyGeometry
saveDesign results/cnt_updown_postRoute.enc
What you should now have
FILEWHAT IT IS
scripts/mmmc.tclTiming views
constraints/Clock.ctstchCTS specification
results/cnt_updown_postRoute.enc(.dat)Saved layout database
results/cnt_updown_postRoute.vPost-route netlist
reports/preCTS, postCTS, postRoute, …Timing evidence at every stage
? Check yourself

Q1Doubling an unbuffered wire’s length multiplies its intrinsic delay by about…

Q2Why is hold timing only fixed after clock-tree synthesis?

Q3Halving the power-stripe pitch reduces the worst rail IR drop by about…

⚠ 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

SYNTAXMEANINGEXAMPLE
set name valueCreate / change a variableset TOP cnt_updown
$nameUse a variable’s valueelaborate $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 cBuild a list (substitutes inside)[list top $H_LAYER]
#Comment — only at the start of a command (use ;# after code);# ps
\ at line endCommand continues on next linelong addRing
source fileRun another Tcl file heresource 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.
click oncein the GUIencounter.cmdrecords the commandcopy intoscripts/encounter.tclencounter -nowin-init … (batch)learn by clicking once, then never click again
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

  1. Find the first ERROR in the log — later errors are usually consequences.
  2. The tool stays at its prompt after a failure: fix, then paste the remaining lines block by block.
  3. 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.

puts "Half = [expr {$period / 2}] ns"one round of substitution: [ … ] runs expr → 5.0 ($period inside { } is passed to expr untouched)words: { puts } { Half = 5.0 ns } → call puts with one argument
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"
}
Remember
  • $ = value, [ ] = run, " " substitutes, { } does not.
  • encounter.cmd turns your clicks into a script.
5.1

Reuse the MMMC view

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
What a clean batch run leaves in the log (grep summary)$ grep -E "ERROR|\*\*ERROR" encounter.log | wc -l
0                                                                    [1]
$ grep -E "WNS|TNS|Violating" reports/postRoute/*.summary | head
reports/postRoute/cnt_updown_postRoute.summary:| WNS (ns):|  8.912 |    [2]
reports/postRoute/cnt_updown_postRoute.summary:| TNS (ns):|  0.000 |
reports/postRoute/cnt_updown_postRoute.summary:| Violating Paths:|  0 |
$ grep "Verification Complete" encounter.log
  Verification Complete : 0 Viols.  0 Wrngs.                         [3]
Verification Complete : 0 Viols. 0 Wrngs.
$ ls results/
cnt_updown.gds  cnt_updown.sdf  cnt_updown.spef  cnt_updown_postRoute.enc  [4]
cnt_updown_postRoute.enc.dat  cnt_updown_postRoute.v ...
  1. Zero ERROR lines first — a batch run keeps going after some errors, so the log must be checked, not just the exit.
  2. 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.
  3. Two “Verification Complete” lines (connectivity and geometry), both 0 viols.
  4. 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
FILEWHAT IT IS
scripts/encounter.tclThe entire Chapter 4 as one script
results/*.spef, *.sdf, *.def, *.gdsSignoff 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
Toolspython (Step 0.5 output), rc, irun, encounter
Time≈ 45 min
THEORYWhy chips need built-in test hardware≈ 12 min read

T1Verification vs test

VERIFICATION (Ch 1–2)MANUFACTURING TEST (this chapter)
QuestionIs the design correct?Was this particular chip built correctly?
DoneOnce, in simulationOn every chip, on a tester, in seconds
FindsLogic bugsShorts, opens, bad vias, particles
designverifysim · STA · LECtape-outfabricationtest everychip (ATE)ship thegood onesverification: is the design right? (once)test: was this chip built right? (every chip)
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:

  1. Activate — drive the net to the opposite value (to find stuck-at-0, try to make it 1).
  2. Propagate — make the difference visible at something the tester can read.
A = 1B = 1ANDstuck-at-0good chip: Y = 1faulty chip: Y = 0the pattern A=1,B=1 detects the fault: the outputs differ
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.

without scanwith scanlogiclogiclogiclogicFFpins → many cycles of logic → FF (poor control/observation)FFFFFFFFFFscan_inscan_outshift any value into / out of every FF directly
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

MUXD (functional)SI (scan in)SE (scan enable): 0 → D, 1 → SID QflopclkQ → logicand → SI of next flopscan flop (e.g. SDFFRHQX1)
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

SECLKscan_inscan_outpattern bits 1…Lnext patternresponse bits 1…LLOAD (shift in)CAPTUREUNLOAD + load next
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

RULEWHY
Clocks controllable from a pinThe tester must pulse the clock exactly when it wants.
Async set/reset inactive in testA reset pulse during shifting would wipe the chain.
No latches / combinational loopsTheir values cannot be predicted by ATPG.
No X sources (undriven nets, black boxes)An unknown reaching a scan flop corrupts the compare.
clock gating: bypass in testasync reset: held off in testICGclkMUXtest_modeto flopsORrsttest_modereset pins(active low)in test mode the tester owns the clock, and no reset can corrupt the chain during shifting
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.

5060708090100050010001500200025003000fault coverage (%)number of test patternscoverage (%)plateau: leftovers are redundant or random-resistant
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 ℓ\ell is permanently stuck at a value vv. A test pattern detects the fault if the good and faulty copies give different outputs for it. Two things must happen:

a = 1b = 1c = 0ANDℓ stuck-at-0good 1 / faulty 0ORf: good 1 / faulty 0→ fault detectedactivate: a = b = 1 makes ℓ = 1 · propagate: c = 0 (non-controlling for OR) · ∂f/∂ℓ = ¬c = 1
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 ∂f/∂ℓ=¬c\partial f/\partial \ell = \lnot c says the same thing.
  1. Activate: the pattern must drive ℓ\ell 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 ℓ=1\ell = 1.
  2. 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 ℓ\ell forced to 0 and once with ℓ\ell forced to 1, and XOR the results:

∂f∂ℓ=f∣ℓ=0⊕f∣ℓ=1\frac{\partial f}{\partial \ell} = f\big|_{\ell=0} \oplus f\big|_{\ell=1}

It equals 1 precisely for the input patterns where the output depends on ℓ\ell. Detection of “ℓ\ell stuck-at-vv” therefore needs

ℓ(x)=¬v(activate)and∂f∂ℓ(x)=1(propagate)\ell(\mathbf{x}) = \lnot v \quad\text{(activate)} \qquad\text{and}\qquad \frac{\partial f}{\partial \ell}(\mathbf{x}) = 1 \quad\text{(propagate)}
Example 1 — a single AND gate f=A⋅Bf = A\cdot B: ∂f/∂A=(0⋅B)⊕(1⋅B)=B\partial f/\partial A = (0\cdot B)\oplus(1\cdot B) = B. To see A, B must be 1. So A stuck-at-0 needs A=1,B=1A = 1, B = 1; A stuck-at-1 needs A=0,B=1A = 0, B = 1.
Example 2 — two levels f=(a⋅b)+cf = (a\cdot b) + c, fault on the internal wire ℓ=a⋅b\ell = a\cdot b, stuck-at-0.
Propagate: ∂f/∂ℓ=(0+c)⊕(1+c)=c⊕1=¬c\partial f/\partial \ell = (0 + c) \oplus (1 + c) = c \oplus 1 = \lnot c → we need c=0c = 0 (the OR gate’s other input must not already force the output to 1).
Activate: ℓ=1\ell = 1 → a=1,b=1a = 1, b = 1.
Test pattern: a=1,b=1,c=0a = 1, b = 1, c = 0. 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, ff 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 NN lines has 2N2N 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 66 faults to 44. ATPG works on the collapsed list.

ANDABY{ A/0, B/0, Y/0 } — one class: any of them forces Y = 0A/1 B/1 Y/1 — distinct6 single stuck-at faults collapse to 4 that need separate patterns
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.
FC=#detected faults#total faults\text{FC} = \frac{\#\text{detected faults}}{\#\text{total faults}}

D3Why 95 % coverage is not enough: yield and defect level

Three numbers decide how many bad chips reach customers:

123459092949698100defect level (Y = 0.8)fault coverage FC (%)log10( defective ppm )11 100 ppm2 200 ppm220 ppm
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 YY — 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 D0D_0 per cm², the number on a die of area AA follows a Poisson distribution with mean AD0A D_0. A die is good only if it has zero defects:

Y=P(0 defects)=e−A D0Y = P(\text{0 defects}) = e^{-A\,D_0}

(For AD0=0.22A D_0 = 0.22, e.g. 0.5 cm² at 0.45 defects/cm², Y=0.80Y = 0.80.)

Defect level. Williams and Brown showed that if the test detects a fraction FC of faults, the escaping bad chips are approximately

DL=1−Y 1−FC\text{DL} = 1 - Y^{\,1-\text{FC}}

Check the edge cases: FC = 1 gives DL = 0 (perfect test); FC = 0 gives DL = 1−Y1 - Y (no test, every bad chip ships).

Example with Y=0.8Y = 0.8:
FC = 0.95 → DL =1−0.80.05≈0.0111= 1 - 0.8^{0.05} \approx 0.0111 = 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 FF scan flops split into kk balanced chains, chain length L=⌈F/k⌉L = \lceil F/k \rceil. For NN patterns at shift frequency fsf_s:

0.1 s1 s10 s40 s1 chain4 s10 chains0.4 s100 chains0.2 s200 chains10⁶ flops, 2000 patterns, 50 MHz shift: test time ∝ chain length L = F / k (log scale)
Test time against number of scan chains for 10610^6 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.
ttest=(L+1) N+Lfst_{\text{test}} = \frac{(L + 1)\,N + L}{f_s}
Example: F=106F = 10^6, k=200k = 200 → L=5000L = 5000. With N=2000N = 2000, fs=50 MHzf_s = 50\,\text{MHz}: (5001⋅2000+5000)/5×107≈0.2 s\bigl(5001\cdot2000 + 5000\bigr)/5\times10^{7} \approx 0.2\,\text{s}. 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 x4+x3+1x^4 + x^3 + 1 the register obeys the recurrence over GF(2):

sn+4=sn+3⊕sns_{n+4} = s_{n+3} \oplus s_{n}
Q1D flopQ2D flopQ3D flopQ4D flop⊕tap Q3tap Q4feedback taps from Q3 and Q4 ⇔ characteristic polynomial x⁴ + x³ + 1primitive polynomial ⇒ visits all 2⁴ − 1 = 15 non-zero states before repeatingout
A 4-bit LFSR: Q1 ← Q3 ⊕ Q4, every other flop shifts.

If the polynomial is primitive, the register cycles through all 2n−12^n - 1 non-zero states. Starting from Q1Q2Q3Q4 = 1000:

1000010000101001110001101011010110101101111011110111001100011000 …

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

Palias≈2−nP_{\text{alias}} \approx 2^{-n}

— about 2.3×10−102.3\times10^{-10} 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 {0,1,X,D,Dˉ}\{0, 1, X, D, \bar D\}, where DD means “1 in the good circuit, 0 in the faulty one” and Dˉ\bar D the opposite. Gates are evaluated component-wise:

a = 1b = 1d = 1AND g1s-a-0 → DNAND g2out = D̄(good 0 / faulty 1)activate: g1 output = D · propagate: side input d = 1 (non-controlling for NAND) inverts D to D̄
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.
AND01XDD
000000
101XDD
X0XXXX
D0DXD0
D0DX0D

The algorithm has three phases: activate (place a DD or Dˉ\bar D at the fault site), propagate (drive the DD 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 D⋅Dˉ=0D \cdot \bar D = 0: 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: V1V_1 initialises the node, V2V_2 launches the transition, and the response is captured exactly one functional period TT later:

SECLKT (functional period)launchcaptureslow shift (load V1/V2)slow unload
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.
tcapture−tlaunch=T⇒detects any extra delay Δ with dpath+Δ>T−tsut_{\text{capture}} - t_{\text{launch}} = T \quad\Rightarrow\quad \text{detects any extra delay } \Delta \text{ with } d_{\text{path}} + \Delta \gt T - t_{su}

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 pp, the chance of missing it after NN independent patterns is (1−p)N(1-p)^N. For confidence cc:

00.250.50.75101234567P(detected) = 1 − (1 − 2⁻¹⁶)^Nlog10 N (random patterns applied)probability≈ 3×10⁵ for 99 %
Detecting a random-pattern-resistant fault (the output stuck-at-0 of a 16-input AND, p=2−16p = 2^{-16}). The detection probability stays near zero for tens of thousands of random patterns and only reaches 99 % at about 3×1053\times10^5. That is why BIST adds test points and ATPG targets such faults directly.
(1−p)N≤1−c    ⇒    N≥ln⁡(1−c)ln⁡(1−p)≈−ln⁡(1−c)p(1-p)^N \le 1 - c \;\;\Rightarrow\;\; N \ge \frac{\ln(1-c)}{\ln(1-p)} \approx \frac{-\ln(1-c)}{p}
Random-pattern-resistant fault: the output stuck-at-0 of a 16-input AND is detected only by the all-ones input, p=2−16≈1.5×10−5p = 2^{-16} \approx 1.5\times10^{-5}. For 99 % confidence: N≥4.6/1.5×10−5≈3×105N \ge 4.6/1.5\times10^{-5} \approx 3\times10^{5} 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.

MODEscan_enableWHAT THE FLOPS DO
Functional0Normal counter behavior.
Shift (load/unload)1Each flop takes its neighbour's value; data moves one position per clock.
Capture0 for one clockFlops 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
COMMANDPURPOSE
library $LIB_SLOW_SCANThe scan-aware copy of slow.lib; without it there is nothing to map flops to.
dft_scan_style muxed_scanEach 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_enableWhich 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_clockThe clock used during shift; period is in picoseconds in RC (100000 ps = 100 ns, a typical slow shift clock).
check_dft_rulesLists flops that violate scan rules and therefore will not be scanned.
define_dft scan_chain + connect_scan_chainsCreate the chain from scan_in to scan_out and stitch all scan flops into it.
write_scandefChain 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.

What success looks like
  • dft_rules_post.rpt: 0 DFT violations; 8 registers pass.
  • 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
reports/scan_chains.rpt (report dft_chains)Reporting 1 scan chain (connect_scan_chains done)
Chain 1: chain0                                                    [1]
  scan_in:      scan_in                                            [2]
  scan_out:     scan_out
  shift_enable: SE (scan_enable) (active high)                    [3]
  clock_domain: scan_clk (edge: rise)
  length: 8                                                        [4]
     START segment abstract_0 (type: ...)
     bit 1   count_reg[0]  <clk (rise)>                            [5]
     bit 2   count_reg[1]  <clk (rise)>
     ...
     bit 8   count_reg[7]  <clk (rise)>
  1. One chain, as defined in the script.
  2. Its serial input and output ports.
  3. The shift-enable signal and its polarity.
  4. Length 8 = all flops scanned. Fewer means some flops failed the DFT rules.
  5. 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
Simulate the scanned netlist · shellCELL_VLOG=libs/gsclib045_cells.v                   # generated in Step 0.5
irun -access +rwc -nospecify -notimingchecks -timescale 1ns/1ps \
  -logfile logs/irun_scan.log \
  $CELL_VLOG results/cnt_updown_scan.v tb/tb_cnt_updown_scan.v
grep -E "PASS|FAIL|ERROR|OK" logs/irun_scan.log
  1. 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).
  2. 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.
  3. 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.)
  4. 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.
  5. 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.

Create the wrapper · shellcd /home/buet/cds_work/asic_lab
source setup_cadence.sh
gedit scripts/encounter_scan.tcl &
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.

ARe-run the shift test on the routed scan netlist

Post-route scan simulation · shellirun -access +rwc -nospecify -notimingchecks -timescale 1ns/1ps \
  -logfile logs/irun_scan_postroute.log \
  libs/gsclib045_cells.v results/cnt_updown_scan_postRoute.v tb/tb_cnt_updown_scan.v
grep -E "PASS|FAIL|ERROR|OK" logs/irun_scan_postroute.log

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
FILEWHAT IT IS
results/cnt_updown_scan.vScan-inserted netlist
results/cnt_updown_scan.scandefChain description for Encounter
results/cnt_updown_scan_lec.doEquivalence-check script
logs/irun_scan.logShift-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…

Q2With fault coverage 0.95 and yield 0.8, the defect level is roughly…

Q3Splitting one scan chain into 10 balanced chains cuts shift time by about…

⚠ 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

CATEGORYQUESTIONSTEP
TimingDo setup and hold pass with real wires at every corner?7.1, 7.2
FunctionDoes the routed netlist still behave the same, with real delays?7.2
Power integrityIs total power acceptable, and does every cell get enough voltage?7.3–7.5
Physical verificationIs the geometry manufacturable (DRC) and the same circuit (LVS)?7.1, 7.6
Timingsetup @ slowhold @ fastSPEF-basedFunctiongate-level simwith SDFLECPower integritytotal powerIR dropEMPhysicalDRCLVSantenna, densitya chip is signed off only when all four pillars pass
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:

SS · low V · hot → worst setupFF · high V · cold → worst holdTT · nominal → powerprocess: slow → fastvoltage ↑temperature: cold → hot
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.
CORNERTRANSISTORS · VOLTAGE · TEMPWORST FOR
Slow (SS)slow · low V · hot (or very cold at advanced nodes)Setup
Fast (FF)fast · high V · coldHold
Typical (TT)nominalPower 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).

routedlayoutextraction(QRC)SPEF:R, C per netdelay calc+ LibertySDF:delay per arcSTA / SDFsimulationSPEF describes the wires; SDF is the computed result that the simulator reads
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

pad0.900 Vcells0.889 Vcells0.881 Vcells0.877 Veach segment of rail resistance drops I·R — the far end sees the lowest voltage
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

min widthmin spacingenclosurevia
Three of the hundreds of rules in a DRC deck.
CHECKWHAT IT PROVES
DRCEvery shape obeys width, spacing, enclosure, density… rules of the foundry
LVSTransistors and connections extracted from the polygons match the netlist
AntennaLong wires connected only to a gate during manufacturing do not collect enough charge to damage it
DensityEach 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.

cnt_updown (top cell)DFFRHQX1 ×8ADDHX1 ×6XNOR2X1 ×5NAND2XL ×4FILL… ×nMetal1 (31;0)Via1 (32;0)Poly (13;0)N-diff (2;0)a cell = polygons on (layer; datatype) pairs — these numbers are examples; the stream map has the real ones
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 Ion∝(VDD−Vth)αI_{\text{on}} \propto (V_{DD} - V_{th})^{\alpha} with α≈1.2–1.5\alpha \approx 1.2\text{–}1.5. Delay is charge over current:

td  ∝  C VDDIon  ∝  VDD(VDD−Vth)αt_d \;\propto\; \frac{C\,V_{DD}}{I_{\text{on}}} \;\propto\; \frac{V_{DD}}{(V_{DD} - V_{th})^{\alpha}}
Example: VDD=0.9 VV_{DD} = 0.9\,\text{V}, Vth=0.35 VV_{th} = 0.35\,\text{V}, α=1.3\alpha = 1.3. A 5 % drop to 0.855 V gives
td(0.855)td(0.9)=0.855/0.5051.30.9/0.5501.3≈2.0781.958≈1.061\dfrac{t_d(0.855)}{t_d(0.9)} = \dfrac{0.855/0.505^{1.3}}{0.9/0.550^{1.3}} \approx \dfrac{2.078}{1.958} \approx 1.061 — 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 1+ε1+\varepsilon, and the paths that help are sped up by 1−ε1-\varepsilon. For setup the launch clock and data are made late and the capture clock early:

rootcommon path 400 pslaunch branch 100 pscapture branch 100 psFF_LFF_Clate: 1.05 × 500 = 525early: 0.95 × 500 = 475the shared 400 ps cannot be both late and early → CPPR returns 2 × 0.05 × 400 = 40 ps of the 50 ps pessimism
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 2×0.05×400=402 \times 0.05 \times 400 = 40 ps.
(1+ε)(ℓL+tcq+tcombmax⁡)+tsu  ≤  T+(1−ε) ℓC−u(1+\varepsilon)\bigl(\ell_L + t_{cq} + t_{\text{comb}}^{\max}\bigr) + t_{su} \;\le\; T + (1-\varepsilon)\,\ell_C - u

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):

CPPR credit=(1+ε) ℓcom−(1−ε) ℓcom=2 ε ℓcom\text{CPPR credit} = (1+\varepsilon)\,\ell_{\text{com}} - (1-\varepsilon)\,\ell_{\text{com}} = 2\,\varepsilon\,\ell_{\text{com}}
Numbers: common clock path 400 ps, then 100 ps on each branch, ε=5 %\varepsilon = 5\,\%.
Derated launch clock: 1.05×500=5251.05 \times 500 = 525 ps. Derated capture clock: 0.95×500=4750.95 \times 500 = 475 ps. Pessimism: 50 ps.
Of that, the shared 400 ps contributes 2×0.05×400=402\times0.05\times400 = 40 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 J=I/(w t)J = I/(w\,t) (width × thickness) at temperature TT:

-2.5-2-1.5-1-0.5000.30.60.91.2MTTF ∝ J⁻² (slope −2)log10( J / J₀ )log10( MTTF / MTTF₀ )2× current density → ¼ lifetime
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.
MTTF=A J−n exp⁡ ⁣(Eak T),n≈2\text{MTTF} = A\,J^{-n}\,\exp\!\left(\frac{E_a}{k\,T}\right), \qquad n \approx 2

With n=2n = 2, 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 3⋅3⋅3⋅2=543\cdot3\cdot3\cdot2 = 54 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.

RC corner CmaxSSTTFFRC corner CminSSTTFFin each group: rows = voltage (top high), columns = temperature (cold → hot)3 process × 3 voltage × 3 temperature × 2 RC = 54 corners; this lab signs off the two highlighted ones
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 1/2000 μm=0.5 nm1/2000\,\mu\text{m} = 0.5\,\text{nm}. 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.

every vertex sits on thedatabase grid1 dbu = 1/2000 µm = 0.5 nm
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 IpeakI_{\text{peak}} for a time Δt\Delta t and the allowed droop is ΔV\Delta V:

0.750.80.8550.90.9502468local VDD without decapwith decaptime (clock edge at t ≈ 3)local supply (V)5 % limit
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 C≥I Δt/ΔVC \ge I\,\Delta t/\Delta V at work.
Cdecap  ≥  ΔQΔV=Ipeak ΔtΔVC_{\text{decap}} \;\ge\; \frac{\Delta Q}{\Delta V} = \frac{I_{\text{peak}}\,\Delta t}{\Delta V}
Example: 10 mA for 50 ps with 45 mV (5 % of 0.9 V) allowed: C≥0.01×50×10−12/0.045≈11 pFC \ge 0.01 \times 50\times10^{-12} / 0.045 \approx 11\,\text{pF}. 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 VtV_t (faster). In older nodes mobility wins and hot = slow. In advanced low-voltage nodes, where VDD−VtV_{DD} - V_t is small, the VtV_t 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.

0.80.911.11.21.31.4-400255085125VDD = 1.0 V: hot is slowVDD = 0.55 V: cold is slowtemperature (°C)delay / delay at 25 °C
Temperature inversion (illustrative model). Heat lowers carrier mobility (slower) but also lowers VtV_t (faster). At nominal supply the mobility loss wins, so hot is slow. At low supply the VtV_t 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:

σ(ΔVt)=AVtW L\sigma(\Delta V_t) = \frac{A_{V_t}}{\sqrt{W\,L}}
Example with a typical AVt≈2.5 mV⋅μmA_{V_t} \approx 2.5\,\text{mV}\cdot\mu\text{m} and WL=0.2×0.045 μm2W L = 0.2 \times 0.045\,\mu\text{m}^2: 0.009≈0.095\sqrt{0.009} \approx 0.095 → σ≈26\sigma \approx 26 mV — about 7 % of VtV_t. Smaller devices vary more; bigger ones average out.

A path of NN gates with independent random delays (mean μg\mu_g, deviation σg\sigma_g) has

μpath=Nμg,σpath=N σg    ⇒    σpathμpath=1N σgμg\mu_{\text{path}} = N\mu_g, \qquad \sigma_{\text{path}} = \sqrt{N}\,\sigma_g \;\;\Rightarrow\;\; \frac{\sigma_{\text{path}}}{\mu_{\text{path}}} = \frac{1}{\sqrt N}\,\frac{\sigma_g}{\mu_g}

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.

00.510.80.911.11.21.3path delay distributionpath delay (normalised to nominal)relative probabilityμμ+σμ+2σμ+3σrequired timefails: 0.13 %
A path whose required time sits at μ+3σ\mu + 3\sigma fails on a fraction 1−Φ(3)≈0.135 %1 - \Phi(3) \approx 0.135\,\% of chips.

The probability a single path meets timing is Φ((treq−μ)/σ)\Phi\bigl((t_{\text{req}} - \mu)/\sigma\bigr), where Φ\Phi 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 VDDV_{DD}, charge sharing through the coupling capacitance gives a peak noise of about

00.280.360.60.90123456aggressorvictim (should stay at 0)time (arbitrary)voltage (V)noise margin 0.28 Vpeak 0.36 V ✗
Crosstalk noise with the text’s numbers. When the aggressor rises by 0.9 V, charge sharing through CcC_c 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.
Vnoise≈VDD CcCc+CgV_{\text{noise}} \approx V_{DD}\,\frac{C_c}{C_c + C_g}
Example: Cc=2C_c = 2 fF, Cg=3C_g = 3 fF, VDD=0.9V_{DD} = 0.9 V → Vnoise≈0.36V_{\text{noise}} \approx 0.36 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

← thin gate oxidelong Metal1 wire — connected only to the gate while it is etched+++++++++plasma charge collected ∝ metal areafixes: jump to a higher metal layer to break the wire, or add a reverse-biased antenna diode
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.
antenna ratio=Ametal connected to the gate (this layer)Agate oxide  ≤  Rmax⁡\text{antenna ratio} = \frac{A_{\text{metal connected to the gate (this layer)}}}{A_{\text{gate oxide}}} \;\le\; R_{\max}

with Rmax⁡R_{\max} 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.)

Encounter signoff exports · TclrestoreDesign results/cnt_updown_postRoute.enc.dat cnt_updown
source scripts/lib_paths.tcl
setExtractRCMode -engine postRoute -effortLevel low
extractRC
rcOut -spef results/cnt_updown.spef -rc_corner RC_TYP
writeTimingCon -sdc -view VIEW_SETUP results/cnt_updown_syn_final.sdc
write_sdf -view VIEW_SETUP results/cnt_updown.sdf

BRun the implementation checks (Verify menu)

  1. Verify → Verify Connectivity → OK. Opens, unconnected pins, antennas of dangling wires. Must be 0.
  2. Verify → Verify Geometry → OK. Spacing/width/overlap rules known to Encounter.
  3. Verify → Verify Process Antenna → OK. Checks the antenna ratios defined in gsclib045.lef (e.g. ANTENNAAREARATIO 475 on the metals); must be 0.
  4. 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.
  5. Verify → Verify Cut Density → OK. The same idea for vias.
  6. 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)
scripts/signoff.tcl · Tcl# ================= Chapter 7 signoff checks and exports (Encounter 13.10) =================
restoreDesign results/cnt_updown_postRoute.enc.dat cnt_updown
source scripts/lib_paths.tcl
file mkdir reports

# ---- Extraction with the GPDK045 cap table, then hand-off files ----
if {[catch {setExtractRCMode -engine postRoute -effortLevel low}]} {
  setExtractRCMode -engine postRoute
}
extractRC
rcOut -spef results/cnt_updown.spef -rc_corner RC_TYP
write_sdf -view VIEW_SETUP results/cnt_updown.sdf
if {[catch {write_sdc -view VIEW_SETUP results/cnt_updown_syn_final.sdc}]} {
  catch {writeTimingCon -sdc -view VIEW_SETUP results/cnt_updown_syn_final.sdc}
}

# ---- Implementation checks (Verify menu) ----
verifyConnectivity -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

# ---- Post-route timing with extracted parasitics ----
timeDesign -postRoute       -outDir reports/signoff_timing
timeDesign -postRoute -hold -outDir reports/signoff_timing
report_timing -max_paths 5 > reports/signoff_setup_paths.rpt
puts "==== signoff.tcl finished - read reports/signoff_* ===="
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. 1 µm = 2000 database units — must match the -units of stream-out.
  2. No opens, no dangling wires, no unconnected pins.
  3. Each category is a different class of geometric rule (spacing, shorts, antenna…).
  4. 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]
     +----------------------------------------------------------------+
  1. One path, its type (setup) and the endpoint/beginpoint flops; ^ = rising, v = falling transition.
  2. Must be the setup view (slow corner).
  3. Other End Arrival Time = latency of the real clock tree to the capturing flop (ℓC) — no longer ideal after CTS.
  4. 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).
  5. Launch clock latency ℓL = 0.209 ns. Skew δ = 0.212 − 0.209 = 3 ps.
  6. Each row is one cell arc; Delay comes from an NLDM lookup with the extracted wire load (Chapter 2, D6).
  7. 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.

Timing-annotated gate simulation · shellCELL_VLOG=libs/gsclib045_cells.v
for c in $(grep -oE "^ *[A-Z][A-Z0-9]+ " results/cnt_updown_postRoute.v | sort -u); do
  grep -qE "^module $c[ (;]" $CELL_VLOG || echo "NO MODEL: $c"
done; echo "model check done"
irun -access +rwc -timescale 1ns/1ps +define+SDF \
  -logfile logs/irun_sdf.log \
  $CELL_VLOG results/cnt_updown_postRoute.v tb/tb_cnt_updown.v
grep -iE "PASS|FAIL|ERROR|violation" logs/irun_sdf.log
grep -iE "Pathdelays|Tchecks" logs/irun_sdf.log logs/sdf_annotate.log
Expected
  • 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]
  1. The SDF written by Encounter in Step 7.1.
  2. Which delay of each min:typ:max triplet is used — MAXIMUM for the setup-oriented view.
  3. 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.
  4. 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:

FIELDVALUE
Cell List Filecell_list.list (a text file with one cell name per line — create it with cp logs/cell_names.txt cell_list.list)
Filler CellsFILL*
Decap Cellsleave empty — gsclib045.lef has no decap cells (the report’s DECAP group is empty)
Results Directorypower_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):

NETCOURSE (65 nm)YOUR VM
VDD voltage / threshold0.88 V / 0.84 V1.08 V (slow.lib nom_voltage) / 1.026 V (5 % drop)
VSS voltage / threshold0 V / 0.04 V0 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

FIELDCOURSE VALUEMEANING
Domain Basedticked; Domain Name allDomainsanalyse VDD and VSS together
Power Net(s) / Voltage / ThresholdVDD / 0.88 V / 0.84 Vflag any point below 0.84 V (≈ 5 % drop)
Ground Net(s) / Voltage / ThresholdVSS / 0 V / 0.04 Vflag ground bounce above 40 mV
Power DataCurrent files, Scale 1use 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 FilesVDD_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.

Equivalent Tcl pattern (verify with help)
Static rail analysis · Tclset_rail_analysis_mode -method static -accuracy xd -analysis_view VIEW_SETUP \
  -power_grid_library [glob power_library/*.cl] -temperature 125
set_pg_nets -net VDD -voltage 1.08 -threshold 1.026
set_pg_nets -net VSS -voltage 0.0  -threshold 0.054
set_rail_analysis_domain -name CORE -pwrnets VDD -gndnets VSS
set_power_data -reset
set_power_data -format current -scale 1 [glob report_power/*.ptiavg]
analyze_rail -type domain -results_directory rail_results CORE
Physical effect

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
Check it · shellwc -l scripts/gds_view.map         # must print 34
diff <(awk '$1~/^(Metal|Via)/{print $1,$(NF-1)}' $GPDK090/soce/soce_gds.map | sort -u) \
     <(awk '$1~/^(Metal|Via)/{print $1,$(NF-1)}' scripts/gds_view.map | sort -u) && echo "layer numbers match gpdk090"

B2Write the GDS

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]
  1. Parse map file reads scripts/gds_view.map. A line about an unknown object type would point to a typo in the map.
  2. Unit scaling factor = 1 is the line to check: anything else means -units disagrees with the LEF.
  3. 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.
  4. Instances ≈ your cell count plus fillers; ports = the five top-level pins of cnt_updown (clk, reset, enable, up_down, count bus).
  5. 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:

QUESTIONEVIDENCE YOU HAVEWHERE
Are the wires legal (width, spacing, shorts, antennas)?Encounter verifyGeometry, verifyProcessAntenna against the rules in gsclib045.lefStep 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 extractionSteps 4.13, 7.1
Foundry DRC / LVSNot available for GPDK045 on this VM — record exactly thatREADME (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.

Stream in for viewing · shellcd /home/buet/cds_work/asic_lab
source setup_cadence.sh
mkdir -p virtuoso && cd virtuoso
echo "SOFTINCLUDE /home/buet/cds_work/cds.lib" > cds.lib
strmin -library cnt_gds_view -strmFile ../results/cnt_updown.gds -topCell cnt_updown \
  -view layout -attachTechFileOfLib gpdk090 \
  -layerMap $GPDK090/libs.oa22/gpdk090/gpdk090.layermap \
  -logFile ../logs/strmin.log
tail -15 ../logs/strmin.log
grep cnt_gds_view cds.lib || echo "DEFINE cnt_gds_view ./cnt_gds_view" >> cds.lib
virtuoso &

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

  1. In the CIW open Tools → Library Manager, select library cnt_gds_view, cell cnt_updown, view layout, and open it.
  2. Press Shift+F to show all hierarchy levels and f to fit. Your ~/.cdsinit key bindings (scroll-wheel zoom) work here too.
  3. 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.
  4. 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
FILEWHAT IT IS
results/cnt_updown.spef / .sdfParasitics and delays
report_power/, rail resultsPower and IR-drop evidence
results/cnt_updown.gdsThe layout to manufacture
reports/signoff_*.rpt · virtuoso/cnt_gds_viewEncounter physical checks · the GDS opened in Virtuoso
cnt_updown_asic_lab.tar.gzReproducible archive
? Check yourself

Q1Hold is checked at the fast corner because…

Q2A 5 % IR drop typically makes gates slower by about…

Q3Relative delay variation of a path of N independent gates scales as…

⚠ 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

TASKCADENCE (your VM → today)SYNOPSYS
SimulationIncisive irun → Xcelium xrunVCS
WaveformsSimVisionDVE → Verdi
SynthesisRTL Compiler → GenusDesign Compiler (Design Vision GUI)
Place & routeEncounter → InnovusIC Compiler → Fusion Compiler
Signoff STATempusPrimeTime
ExtractionQRC → QuantusStarRC
DRC / LVSAssura → PegasusIC Validator
ATPGEncounter Test → ModusTetraMAX

T2File-format equivalents

PURPOSECADENCE FLOWSYNOPSYS FLOW
Library.lib read directly.lib compiled to .db (lc_shell)
ActivityTCFSAIF
ConstraintsSDC — shared by both vendors
Netlist / parasitics / delaysVerilog / 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

  1. Run putty.exe. In the left tree go to Connection → SSH → X11 and tick Enable X11 forwarding.
  2. Go back to Session, type the server's host name, enter a name under Saved Sessions and click Save.
  3. 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):

Library Compiler (lc_shell) · shelllc_shell
#   read_lib ./libs/tcbn65gplusbc0d88.lib
#   write_lib tcbn65gplusbc0d88 -format db -output ./libs/tcbn65gplusbc0d88.db
#   read_lib ./libs/tpdn65gpgv2od3_sdbc.lib
#   write_lib tpdn65gpgv2od3_sdbc -format db -output ./libs/tpdn65gpgv2od3_sdbc.db
#   quit

2Compile and run with VCS

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

  1. File → Analyze… → Add cnt_updown.v → Work Library WORK → tick Create new library if it does not exist → OK.
  2. File → Elaborate → Library WORK → OK.
  3. 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:

Activity and automation · Tclwrite_saif -output ./cnt_updown_dv_prop.saif -propagated
read_saif -input ./cnt_updown_dv_prop.saif -instance updown_counter
report_power
write -format verilog -hierarchy -output cnt_updown_dve.v
write_sdc cnt_updown_syn.sdc
source dc_shell.tcl

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.
TERMMEANING
Electrical effort hCout/Cin of a gate — its fan-out ratio.
Parasitic delay pDelay of a gate charging its own output capacitance, independent of load.
Stage effort ff = 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 FF = G·B·H, fixed for a path; minimum delay N·F1/N + P.
Arrival / required timeLatest time a signal can change at a pin / latest time it may arrive and still be captured.
Critical pathThe path with the smallest slack — it limits the clock frequency.
NLDMNon-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 / propagateg = a·b, p = a ⊕ b: the building blocks of fast adders.
Parallel prefix adderAdder computing all carries with an associative (G,P) operator in log₂n levels (e.g. Kogge–Stone).
Domino logicDynamic precharge/evaluate gates followed by inverters.
Charge sharingLoss of voltage on a dynamic node when it connects to discharged internal capacitance.
Time borrowingLate data passing through a transparent latch, using time from the next stage.
Latch-upParasitic PNPN thyristor turning on and shorting VDD to VSS.
Well tap / end capCells tying wells and substrate to the supplies / closing row ends.
JitterVariation in the timing of clock edges themselves.
CPPRCommon path pessimism removal — gives back OCV derating on the shared clock path.
Body effectThreshold rises when the source is above the body: Vt = Vt0 + γ(√(2φF+VSB) − √(2φF)).
BDDBinary decision diagram — a canonical graph form of a Boolean function for a fixed variable order.
D-algorithmATPG method using values {0,1,X,D,D̄} to activate and propagate a fault.
Dennard scalingConstant-field scaling: dimensions and voltage shrink together, keeping power density constant.
EDP / PDPEnergy–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 implicantA product term covering only 1s of a function that cannot be enlarged further.
Pelgrom’s lawσ(ΔVt) = AVt/√(WL): mismatch shrinks with device area.
AOCVAdvanced OCV — derates that depend on path depth and distance.
Lee algorithmBreadth-first maze routing that always finds a shortest grid path.
Steiner treeMinimum-length tree connecting pins, allowed extra branching points.
RetimingMoving registers across logic without changing function.
Useful skewDeliberately unequal clock arrival times chosen to improve timing.
Transition faultAt-speed fault model: a node is slow to rise or slow to fall.
Antenna effectPlasma charging of gate oxide through long metal during fabrication.
Sheet resistanceR□ = ρ/t — resistance per square of a layer.
Transmission gateParallel NMOS + PMOS switch that passes both 0 and 1 fully.
CMOSComplementary MOS — logic built from paired NMOS pull-down and PMOS pull-up networks.
Noise marginHow much noise a logic level tolerates: NML = VIL − VOL, NMH = VOH − VIH.
Logical effortRatio of a gate’s input capacitance to an inverter’s delivering the same current (g).
FO4Delay of an inverter driving four copies of itself — a technology-independent delay unit.
LatchLevel-sensitive storage element; transparent while enabled.
MetastabilityA flop output hanging between 0 and 1 after a setup/hold violation.
MTBFMean time between failures (here: of a synchroniser).
LFSRLinear feedback shift register — generates pseudo-random patterns.
MISR / BISTMultiple-input signature register / built-in self-test.
Rent’s ruleT = t·Gp: pins of a block grow as a power of its gate count.
DecapOn-chip capacitor between VDD and VSS that supplies charge locally.
Threshold voltage VtGate voltage at which a MOSFET channel starts to conduct.
Velocity saturationShort-channel effect making ID ∝ (VGS − Vt)α with α ≈ 1.3.
Recovery / removalSetup/hold-like timing checks on asynchronous reset pins.
ASICApplication-Specific Integrated Circuit — a chip designed for one purpose.
ATPGAutomatic Test Pattern Generation — computes scan test patterns (Ch 6).
CTSClock Tree Synthesis — builds the buffered clock network (Step 4.12).
DEFDesign Exchange Format — the placed/routed layout in text form.
DFTDesign For Test — hardware added so chips can be tested after manufacture.
DRCDesign Rule Check — geometry obeys the foundry rules.
DRVDesign Rule Violation (electrical) — max transition, max capacitance, max fanout.
DUTDevice Under Test — the design instantiated inside a testbench.
ElaborationBuilding the full design hierarchy from analysed modules.
EMElectromigration — wire wear-out from high current density.
Filler cellEmpty cell that keeps wells and rails continuous between real cells.
Follow pinsThe VDD/VSS rails along each standard-cell row (Metal1).
GDSIIBinary polygon format sent to the foundry.
GcellA tile of the global-routing grid.
Hold timeHow long data must stay stable after the clock edge.
HPWLHalf-perimeter wire length — the placer’s wire-length estimate.
IR dropSupply voltage lost across power-grid resistance.
LatencyClock delay from the clock source to a flop.
LEFLibrary Exchange Format — cell outlines/pins and metal-layer rules.
Liberty (.lib)Cell timing, power and function tables.
LVSLayout Versus Schematic — layout extracts to the same circuit as the netlist.
MMMCMulti-Mode Multi-Corner — set of analysis views (modes × corners).
NetlistList of cell instances and the nets connecting them.
OCVOn-Chip Variation — pessimism for differences across one die.
PDKProcess Design Kit — all foundry data for one technology.
PVTProcess, Voltage, Temperature — the axes of timing corners.
QRCCadence parasitic extraction technology (tech file used by Encounter).
RTLRegister-Transfer Level — Verilog describing registers and logic between them.
Scan chainFlops linked into a shift register in test mode.
SDCSynopsys Design Constraints — clocks, I/O delays, exceptions.
SDFStandard Delay Format — computed delays for timing simulation.
SE / SI / SOScan enable / scan in / scan out.
Setup timeHow long data must be stable before the clock edge.
SISignal integrity — crosstalk effects between neighbouring wires (also “scan in” in Ch 6).
SkewDifference in clock arrival between two flops.
SlackRequired time − arrival time. Negative means a violation.
SnapshotAn elaborated, ready-to-run simulation image (NC tools).
SPEFStandard Parasitic Exchange Format — extracted R and C per net.
STAStatic Timing Analysis — exhaustive path-based timing check.
StripeWide power wire crossing the core, connected to the ring.
TCFToggle Count Format — per-net switching activity.
Tie cellCell that outputs a constant 1 or 0 safely.
UtilizationCell area ÷ core area.
VCDValue Change Dump — text waveform file.
WNS / TNSWorst / Total Negative Slack — summary of all violations.

REFERENCE

Original course pages

Use these links to compare wording, download inputs, or inspect the source page.