Excellent follow-up questions! This is exactly the kind of setup you'll see in the real world. Let's break down this standard library structure and how to use it.
First, let's decode your folder and file names. They are very descriptive!
- Folders (
SNPSLOPT25, SNPSHOPT25, etc.): These likely represent different library types optimized for different goals.
LOPT: Low Power Optimized
HOPT: High-performance Optimized
ROPT: Routability Optimized (or Regular VT)
SLOPT: Super Low Power Optimized
- Files (
..._ff0p715v125c.db): This is a specific Process, Voltage, and Temperature (PVT) corner.
ff: Fast-Fast process corner (fast NMOS, fast PMOS transistors).
0p715v: 0.715 Volts (Operating Voltage).
125c: 125 degrees Celsius (Operating Temperature).
- Other common corners are
ss (Slow-Slow) and tt (Typical-Typical).
1. How to set up the library (handling the folder with only .lib files)
The most important rule for modern Synopsys tools is: They need the .db format for speed and efficiency. The .lib (Liberty) format is a human-readable text file that is used to create the .db.
If one of your library folders (e.g., SNPSROPT25) only contains .lib files, it means they haven't been compiled into the binary .db format yet. You must do this as a one-time setup step.
How to Compile .lib to .db:
You can do this using a standalone tool called Library Compiler, but it's easier to just do it right inside Fusion Compiler.
- Start Fusion Compiler (
fusion_shell).
- Use the
read_lib command to read the text Liberty file and write out the binary .db file.
# Example for one PVT corner
# This reads the .lib and creates a .db in the same directory
read_lib /path/to/SNPSROPT25/liberty/nldm/base/snps25ropt_base_ss0p72v125c.lib -output /path/to/SNPSROPT25/liberty/nldm/base/snps25ropt_base_ss0p72v125c.db
# You would do this for every .lib file you intend to use.
# It's best to write a small script to loop through them all.
Once you have done this once, you will have .db files in all the library folders you need, and you won't have to do it again unless the foundry sends you new .lib files.
2. Link Library vs. Target Library vs. Reference Library
This is a critical concept.
-
Target Library (set_target_library):
- What it is: A list of libraries whose cells the tool is allowed to use for creating and optimizing logic.
- Analogy: This is the "menu" for the synthesis engine. When the tool needs to implement an adder, it will only pick cells from the libraries on this list.
- Example: You might set
target_library to only the LOPT (Low Power) cells because your primary goal is low power consumption.
-
Link Library (set_link_library):
- What it is: A list of all libraries the tool needs to understand the complete design. It must contain all libraries in the
target_library, plus any other libraries that are referenced by your design (e.g., I/O pad libraries, memory libraries, pre-compiled IP blocks).
- Analogy: This is the "encyclopedia." The tool uses it to look up information (timing, power, function, physical shape) for every single cell in the design, even if it's not allowed to use that cell for new logic.
- Rule of Thumb:
link_library is always a superset of or equal to target_library. A simple starting point is to set them to the same thing: set link_library [get_attribute [get_libs *] full_name]
-
Reference Library (Advanced):
- This is used less often, typically for hierarchical flows or when you have physical-only information. It provides a library's physical data (like the LEF information from the FRAM view) without making its logical/timing data available for linking. You generally don't need to worry about this when starting out.
3. setup_library vs. create_library
-
create_library: This is a fundamental, built-in Fusion Compiler command. It creates a new, empty library in the tool's memory. You would then populate this in-memory library by reading a .db file into it. This is a lower-level command.
-
setup_library: This is not a standard, built-in Fusion Compiler command. It is almost certainly a custom Tcl procedure (proc) defined in a setup script provided by your foundry or in a Synopsys Reference Methodology (RM) script. It's a high-level wrapper that likely calls create_library, set_attribute, and other commands under the hood to make setup easier. You would need to source the file that defines this procedure first.
Recommendation: Stick to the standard commands (set_target_library, set_link_library, set search_path) first. They are more fundamental and universally understood.
4. Is the library created once and for all?
This question has two parts:
-
The .db files on disk: Yes, the compilation from .lib to .db is a one-time setup task. You do this once and then reuse the generated .db files for all your runs. It's slow and wasteful to re-compile them every time.
-
The library in the tool's memory: No. Every time you start a new Fusion Compiler session (fusion_shell), its memory is empty. Your script must load the .db files from the disk into the tool's memory every single time. This is what set_target_library and set_link_library do. This loading process is very fast because the .db format is optimized for it.
If you really wanted to create it from .lib every time (NOT recommended): You would simply put the read_lib command from question #1 at the beginning of your main run script. But again, this is inefficient. The standard flow is: Compile once, load many times.
5. How to Get Area, Power, and Slack (The Ultimate Goal)
You cannot get meaningful reports until you have performed, at minimum, an initial synthesis and placement. The tool needs to build the logic and place it to estimate wire lengths, which are crucial for timing and power.
Here is a simplified Tcl script that outlines the flow from start to getting your first QoR (Quality of Results) report.
#################################################################
# Step 1: Library and Design Setup
#################################################################
# --- Point to the directories where your PRE-COMPILED .db files are ---
# Let's assume you want to use the Low Power library (LOPT) for a
# worst-case (slow) timing analysis.
set LOPT_DB_PATH "/path/to/SNPSLOPT25/liberty/nldm/base"
set search_path ". $LOPT_DB_PATH"
# --- Define which physical technology file to use ---
# This is the .tf file or the technology .lef file from the foundry
read_tech_file /path/to/foundry/files/tech.tf
# OR
# read_tech_lef /path/to/SNPSLOPT25/lef/snps25lopt.lef
# --- Define the libraries for linking and optimization ---
# We'll use the slow corner (ss, low voltage, high temp) for timing analysis
set MY_LIBS "snps25lopt_base_ss0p72v125c.db"
set_target_library $MY_LIBS
set_link_library "* $MY_LIBS" # The "*" includes the design itself
# --- Read in your Verilog design ---
read_verilog my_design.v
# --- Set the top-level module as the current design ---
current_design my_top_module
link_design
# --- Read in your timing constraints (clocks, I/O delays) ---
read_sdc my_design.sdc
#################################################################
# Step 2: Run Optimization
#################################################################
# This is the key step. You must run an optimization pass.
# place_opt is a great command that performs initial placement
# and logic optimization together.
place_opt
#################################################################
# Step 3: Reporting
#################################################################
# Now that the tool has done some work, the reports will be meaningful.
echo "========================================="
echo "====== TIMING REPORT ===================="
echo "========================================="
# Reports Worst Negative Slack (WNS) and Total Negative Slack (TNS)
report_qor
# For a more detailed timing breakdown:
report_timing -nworst 20 -digits 4
echo "========================================="
echo "====== AREA REPORT ======================"
echo "========================================="
# Reports cell area, net area, and total area.
report_area
echo "========================================="
echo "====== POWER REPORT ====================="
echo "========================================="
# This gives a power estimate based on switching activity from the SDC.
# For accurate power, you would need a .saif or .vcd file.
report_power -verbose
# To exit the tool
exit
By running a script like this, you will get the initial Area, Power, and Timing (TNS) numbers you're looking for. This forms the baseline for all your future optimization efforts.