Liberty Syntax Highlighting
Syntax highlighting for Liberty (.lib) timing library files used in EDA/VLSI design.
Features
This extension provides comprehensive syntax highlighting for the Liberty format:
- Comments: Block (
/* */) and line (//) comments
- Strings: Double-quoted strings with escape character support
- Numbers: Integer and floating-point numbers (including scientific notation)
- Groups: All major Liberty groups with dedicated scoping:
library, cell, pin, pg_pin, timing
lu_table_template, power_lut_template
operating_conditions, wire_load, wire_load_selection
ff, latch, statetable
cell_rise, cell_fall, rise_transition, fall_transition
intrinsic_power, leakage_power, internal_power
- And many more...
- Complex Attributes: Table data (
values, index_1–index_7)
- Simple Attributes: 160+ Liberty attributes (technology, delay_model, direction, capacitance, timing_type, etc.)
- Define Blocks:
define (name) { ... } macro definitions
- Punctuation: Braces, parentheses, semicolons, colons, commas
Supported File Types
.lib files (Liberty timing library format)
Installation
From VSIX
- Package the extension:
npx @vscode/vsce package
- In VS Code: Extensions → ... → Install from VSIX... → select
liberty-syntax-1.0.1.vsix
From Source
- Clone this repository
- Open in VS Code
- Press
F5 to launch the Extension Development Host
- Open any
.lib file to see syntax highlighting
Liberty files describe timing, power, and physical characteristics of standard cells in VLSI design. The format is hierarchical:
Simple Attributes
attribute_name : value ;
Values can be numbers, strings, or identifiers:
technology : cmos ;
area : 10.5 ;
function : "A & B" ;
Complex Attributes
Table data uses parenthesized lists:
values ("0.1, 0.5, 1.0, 2.0, 5.0") ;
index_1 ("0.01, 0.05, 0.1, 0.5, 1.0") ;
Groups
Groups have optional parameters and a body in braces:
library (my_lib) {
cell (AND2) {
pin (A) {
direction : input ;
capacitance : 0.002 ;
}
}
}
Define Blocks
Macro definitions for repeated structures:
define (ff_timing) {
timing () {
related_pin : "CK" ;
timing_type : rising_edge ;
}
}
Test File
A comprehensive sample .lib file is available at test/sample.lib that exercises all syntax highlighting features.
License
MIT