Glade

cdlflatten

cdlflatten reads a hierarchical SPICE/CDL netlist and writes a flat netlist of one cell, with every device given its full hierarchical name. It is used to prepare a hierarchical schematic netlist for transistor-level LVS, and can also be run on its own.

Glade has a built-in copy of this flattener, which it runs when Hierarchical netlist? is checked in Verify->LVS->Run; the dialog's Top Cell Name and Delimiter character fields correspond to the -topcell and -delim options below. The flat netlist can then be compared with an extracted layout by Gemini.

Gemini can itself read a one-level hierarchical CDL netlist, comparing the subcircuit instances as black boxes (see Gemini input netlists). Use cdlflatten when the comparison must be made down to the transistors.

Command line

cdlflatten -topcell cell [-delim c] [-v] -infile in.cdl -outfile out.cdl
cdlflatten -topcell cell [-delim c] [-v] in.cdl out.cdl
OptionDefaultMeaning
-topcell cellThe .subckt to flatten. Required.
-infile fileThe hierarchical CDL netlist to read. Required.
-outfile fileThe flat netlist to write. Required; an existing file is overwritten.
-delim c/Delimiter between the levels of hierarchical device and net names.
-vPrint the build date and, after reading, the pins, nets and elements of the top cell.
-hPrint a summary of the options and exit.

Each option can also be written with two dashes (--topcell, --infile and so on), and the options can be given in any order. Instead of -infile and -outfile, the files can be given as bare names: the first is the input file and the second the output file. cdlflatten exits with status 0 on success. It stops with an error, naming the option, if the top cell or either file is not given, and also if the input file cannot be read or the top cell is not in it.

Input netlist

The input is a CDL file of .subckt ... .ends definitions, read as follows:

A cell that is instantiated but not defined in the file is reported (Can't find master) and its instances are left out of the output.

Flat netlist

The output is a single .subckt for the top cell, with its pins, *.PININFO, *.SCALE and .GLOBAL lines, followed by every device in the hierarchy:

For example, this hierarchical netlist:

.GLOBAL VDD VSS
.SUBCKT inv A Y
MP1 Y A VDD VDD pch W=wp L=0.1u
MN1 Y A VSS VSS nch W=1u L=0.1u
.ENDS
.SUBCKT buf IN OUT
XI1 IN mid / inv wp=2u
XI2 mid OUT / inv wp=3u
.ENDS
.SUBCKT top a z
XB1 a z / buf
.ENDS

flattened with cdlflatten -topcell top -infile h.cdl -outfile flat.cdl, gives these devices:

MN1/XB1/XI2  z /XB1/mid VSS VSS nch  W=1u L=0.1u
MP1/XB1/XI2  z /XB1/mid VDD VDD pch  W=3u L=0.1u
MN1/XB1/XI1  /XB1/mid a VSS VSS nch  W=1u L=0.1u
MP1/XB1/XI1  /XB1/mid a VDD VDD pch  W=2u L=0.1u