Package: lctime
LibreCell - LibCharacterization kit for CMOS cells.
This Python package comes with a some stand-alone command-line tools:Most notablylctimeforrecognitionandcharacterizationof combinational and sequential cells.sp2bool: Recognition ('reverse engineering') of transistor networks. This is intended for analyzis and debugging.libertyviz: Visualization of NDLM tables.Getting started# Clone this repository.
git clone https://codeberg.org/librecell/lctime
cd lctime

# Install
./install_develop.sh

# Run tests
cd tests
./run_tests.shCharacterize a cellAn ready-to-run example can be found in theexamplesfolder.
The scriptrun_example.shshould characterize theINVX1inverter.The following example determines the input capacitances and timing delays of a combinational cell.It is assumed thatFreePDK45is installed in the users home directory.Required inputs are:--liberty: A template liberty file which defines how the cells should be characterized.--include: SPICE files or models to be included.--spice: A SPICE file which contains the transistor level circuit of the cell (best including extracted parasitic capacitances).--cell: Name of the cell to be characterized.--output: Output liberty file which will contain the characterization data.Characterize a single cell:lctime--liberty~/FreePDK45/osu_soc/lib/files/gscl45nm.lib\--include~/FreePDK45/osu_soc/lib/files/gpdk45nm.m\--output-loads"0.05, 0.1, 0.2, 0.4, 0.8, 1.6"\--slew-times"0.1, 0.2, 0.4, 0.8, 1.6, 3.2"\--spice~/FreePDK45/osu_soc/lib/source/netlists/AND2X1.pex.netlist\--cellAND2X1\--output/tmp/and2x1.libCharacterize multiple cells in the same run:lctime--liberty~/FreePDK45/osu_soc/lib/files/gscl45nm.lib\--include~/FreePDK45/osu_soc/lib/files/gpdk45nm.m\--output-loads"0.05, 0.1, 0.2, 0.4, 0.8, 1.6"\--slew-times"0.1, 0.2, 0.4, 0.8, 1.6, 3.2"\--spice~/FreePDK45/osu_soc/lib/source/netlists/*.pex.netlist\--cellINVX1AND2X1XOR2X1\--output/tmp/invx1_and2x1_xor2x1.libCell recognitionCell types can be recognized automatically such that only a minimal
liberty file needs to be supplied.cdexamples
lctime--libertytemplate.lib\--analize-cell-function\--includegpdk45nm.m\--spiceINVX1.pex.netlist\--cellINVX1\--output-loads"0.05, 0.1, 0.2, 0.4, 0.8, 1.6"\--slew-times"0.1, 0.2, 0.4, 0.8, 1.6, 3.2"\--outputinvx1.libSequential cellsCharacterization of sequential cells involves finding hold, setup, removal and recovery constraints.For an example seeexamples/run_example_flip-flop.sh.VisualizationVizualize the result:libertyviz-l/tmp/and2x1.lib--cellAND2X1--pinY--related-pinA--tablecell_riseCharacterize a cell with differential inputsDifferential inputs can be specified in the liberty template with thecomplementary_pinattribute.
Only the non-inverted pin should appear in the liberty file.Differential pairs can also be recognized based on their naming. For example if pairs are named with suffixes_pfor
the non-inverted pin and_nfor the inverted pin:lctime--diff%_p,%_n...Merging liberty fileslctimewill output a liberty file containing only one cell. Thelibertymergecommand allows to merge this kind of
output file back into the liberty template.The following example will takebase_liberty.libas a template and update itscellentries with the data found in
the liberty files in thecharacterizationdirectory.libertymerge-bbase_liberty.lib\-ooutput_liberty.lib\-ucharacterization/*.libThis approach allows to run characterization runs of multiple cells independently and in parallel (e.g usingmake).Recognize a celllctimecan recognize the boolean function of cells based on the transistor network. Besides combinational functions
also memory-loops can be found and abstracted into latches or flip-flops.
Thesp2boolcommand can be used to analyze cells and dump information about their behaviour. This can be useful for debugging and verification.Example:# Analyze a combinational cell.sp2bool--spice~/FreePDK45/osu_soc/lib/files/cells.sp--cellNAND2X1# Analyze a flip-flop with asynchronous set and reset signals.sp2bool--spice~/FreePDK45/osu_soc/lib/files/cells.sp--cellDFFSRFor cells withdifferentialinputs the--diffargument must be used to specify differential pairs.DebuggingEnable very verbose trace log: set theDEBUG_LCTIMEenvironment variable toyes