UCSCommon Tcl
Reorganized API · Update
UniversalChip Studio

Small procedures. Clear contracts.

A stable common Tcl layer for formatting, collections, Error Browser data, and Synopsys GUI work—organized around two entrypoints and a compact public API.

Quick start

Choose one public entrypoint. New scripts do not source implementation files directly.

Tool independent

ucs_common.tcl

Numbers, text, time, paths, files, and explicit output.

Synopsys

ucs_snps_common.tcl

Loads the common layer, then adds tool, collection, Error Browser, and GUI procedures.

# Pure Tcl
source /path/to/common/tcl/ucs_common.tcl

# Synopsys collection, Error Browser, and GUI work
source /path/to/common/tcl/ucs_snps_common.tcl

Both entrypoints enforce the standard UCS license rule before registering protected public procedures. The encrypted customer release contains two independent self-contained files: ucs_common.tbc and ucs_snps_common.tbc.

Architecture

Public entrypoints are obvious; implementation modules have one responsibility each.

common/tcl/ ├── ucs_common.tcl ├── ucs_snps_common.tcl ├── pkgIndex.tcl ├── lib/ │ ├── base_utils.tcl │ ├── license_utils.tcl │ ├── output_utils.tcl │ ├── snps_tool_utils.tcl │ ├── snps_error_utils.tcl │ └── snps_gui_utils.tcl ├── tests/ └── docs/
Simple

Two entrypoints

Users choose plain Tcl or Synopsys. Internal file names are not part of normal usage.

Stable

Explicit contracts

Procedures return useful data and fail clearly when a tool or GUI command is unavailable.

Easy

Related actions merged

One selection procedure handles net, pin, and cell. One display procedure handles module and port.

General

No project policy

No technology, user, project path, floorplan rule, or TileBuilder traversal is embedded.

Procedure catalog

Search by name, purpose, category, or supported tool.

ProcedureLayerPurpose
ucs_sumBaseSum a list or multiple numeric arguments.
ucs_minBaseReturn the minimum numeric value.
ucs_maxBaseReturn the maximum numeric value.
ucs_splitBaseSplit text with a configurable regular expression.
ucs_format_fieldBaseBuild a fixed-width, aligned text field.
ucs_nowBaseReturn current time using a configurable format.
ucs_format_durationBaseConvert seconds into a readable duration.
ucs_list_uniqueBaseRemove duplicate list items while preserving order.
ucs_dict_get_defaultBaseRead a dictionary key with a default value.
ucs_find_upBaseSearch parent directories for a relative path.
ucs_unique_pathBaseCreate a non-conflicting output path.
ucs_read_textBaseRead a complete text file.
ucs_write_textBaseWrite a complete text file.
ucs_write_lineOutputWrite one line to explicit Tcl channels.
ucs_get_toolToolIdentify FC, ICC2, ICC, PT, DC, or FM.
ucs_require_toolToolRequire one of an explicit set of supported tools.
ucs_collection_namesCollectionReturn collection object names without printing.
ucs_print_collectionCollectionPrint Total once, then one object name per line.
ucs_error_markError BrowserValidate and mark polygon violations in the FC/ICC2 Error Browser.
ucs_winGUIShow the current FC, ICC2, or PT window.
ucs_zoom_selectedGUIZoom to the current selection.
ucs_clear_highlightsGUIClear highlights, selection, and annotations.
ucs_zoom_fitGUIFit the full design or a supplied collection.
ucs_layer_visibilityGUIShow only or toggle a supplied layer collection.
ucs_get_driversGUIResolve the driver of a pin, net, or selection.
ucs_selection_netsGUIResolve signal nets from selected objects.
ucs_highlightGUIAdd polygon annotations for FC or ICC2 objects.
ucs_selectGUISelect a net, pin, or cell through one interface.
ucs_show_itemGUIDisplay a collection as a colored FC/ICC2 VM bucket.
ucs_show_objectsGUIDisplay modules or ports through one interface.
ucs_colorGUIReturn a stable UCS display color.
ucs_reset_colorGUIReset the automatic color sequence.
ucs_set_viewGUIApply explicit Layout setting/value pairs.
ucs_clean_viewGUIApply the clean screenshot display profile.
ucs_capture_windowGUISave a window image without ImageMagick.
ucs_capture_designGUIClean, fit, and capture a design in one call.

Collections

Separate data access from presentation. Use names when another procedure needs the result; print only for an interactive review.

set names [ucs_collection_names [get_cells -hierarchical *]]

ucs_print_collection [get_cells -hierarchical *]
# Total 2
#    top/u_cpu
#    top/u_gpu

ucs_print_collection returns the collection size, accepts an output channel, and prints the Total line once before iteration.

Error Browser

Checking policy stays in product code. The common procedure validates supplied geometry and writes it through one FC/ICC2 interface.

set violations {
  {{0 0} {10 0} {10 5} {0 5}}
  {{20 20} {30 20} {30 30} {20 30}}
}

set result [ucs_error_mark \
  -cell UCS_FLOORPLAN \
  -name MACRO_OVERLAP \
  -info "Macro overlap" \
  -error_list $violations]

puts "Marked [dict get $result count] polygons"

# Reuse the same Error Browser data for another error type.
ucs_error_mark -cell UCS_FLOORPLAN -name CHANNEL \
  -error_list $channel_violations -incremental

-cell may include the .err suffix; it is added only when absent. An empty -error_list is a no-op. Invalid coordinates and unsupported tools fail before data is changed.

GUI operations

FC and ICC2 share one public interface where commands match. Unsupported tools fail before changing the display.

Select and inspect

ucs_select net  top/u_cpu/n_reset
ucs_select pin  top/u_cpu/U1/A
ucs_select cell top/u_cpu/U1

ucs_zoom_selected
ucs_win

Collection views

# Direct collection
ucs_show_item [get_cells {top/u_cpu/*}] CPU 1

# Related object groups
ucs_show_objects module {top/u_cpu top/u_gpu} 1
ucs_show_objects port   {DATA ADDR}

Window capture

ucs_clean_view
ucs_capture_window ./images/layout.png

# TileBuilder-inspired common operations
ucs_clear_highlights
ucs_zoom_fit [get_cells -physical_context u_cpu]
ucs_layer_visibility only [get_layers {M4 M5 M6}]
change_selection [ucs_get_drivers [get_selection]]
ucs_capture_design ./images/clean_layout.png

The capture procedure uses gui_write_window_image only. Captioning or image conversion is outside common and remains optional in a product layer.

Examples

Pure Tcl formatting

source /path/to/common/tcl/ucs_common.tcl

set runtime [ucs_format_duration 90061]
set title   [ucs_format_field 24 "Route Runtime" center "|" "|"]
ucs_write_line "$title $runtime"

Tool guard

source /path/to/common/tcl/ucs_snps_common.tcl

set tool [ucs_require_tool {fc icc2}]
ucs_write_line "Running in $tool"

Tool support

Support is attached to each action, not assumed for every Synopsys tool.

CapabilityFCICC2PTPlain Tcl
Base and outputYesYesYesYes
Collection helpersYesYesYesNo
Window show / zoomYesYesYesNo
Net / pin / cell selectionYesYesNoNo
VM bucket displayYesYesNoNo
Error Browser polygon marksYesYesNoNo
Window imageYesYesYesNo

Scope

Common stays small by defining an explicit boundary.

Included

  • Pure Tcl transformations
  • Explicit channel output
  • Tool identification
  • Collection presentation
  • Error Browser polygon output
  • Reusable GUI display primitives
  • Shared UCS license validation at package load

Not included

  • Floorplan checks or fixes
  • Placement, routing, or DRC policy
  • TileBuilder clock-tree traversal
  • Technology or project constants
  • Main-program debug and logging policy

Testing

Pure Tcl behavior and EDA-facing call contracts are tested separately.

tclsh update/common/tcl/tests/run_all.tcl
TestCoverage
test_common_utils.tclNumbers, text, formatting, paths, files, and stable errors.
test_snps_tool_utils.tclTool detection, collection names, count, and aligned output.
test_snps_entrypoint.tclSynopsys public entrypoint loading and native command-attribute registration.
test_snps_error_utils.tclSingle/multiple polygons, replacement/incremental behavior, empty input, validation, and tool guards.
test_snps_gui_utils.tclFC/ICC2 dispatch, merged selection/display APIs, settings, capture, and unsupported-tool errors.

Mock tests validate UCS logic and command construction. Real FC, ICC2, and PT smoke tests remain required before promotion to verified.

Migration

The reorganization intentionally removes ambiguous aliases.

Legacy actionsCurrent API
select_net / select_pin / select_instucs_select
show_module / show_portucs_show_objects
show_itemucs_show_item
ms_error_markucs_error_mark
win / zoom_selecteducs_win / ucs_zoom_selected
write_log / print_infoucs_write_line

UniversalChip Studio Support

Technical: tech@universalchipstudio.com
Business: support@universalchipstudio.com