Welcome to the reference page for QisMExplCounter, an extended API of QisMLib, Artwork Conversion's CAD processing framework.
QisMExplCounter measures how much data is in a layout and where it is concentrated. Chip designs are built from cells that are reused many times over, so the number of shapes you would see if every reuse were expanded, known as the exploded count, can be far larger than the number of shapes actually stored. Knowing that count, and knowing which parts of the design are dense and which are sparse, helps a program plan how much work lies ahead and split it evenly across processors. The extension has two jobs:
Count the exploded polygons and vertices for a chosen cell and set of layers, either by brute force over a region of interest, by a much faster hierarchical method for designs with lots of cell reuse, or down to a chosen nesting depth.
Map density by breaking a region into tiles so that no tile holds more than a chosen number of vertices. One method divides by the vertices contained in each tile; another uses a quad-tree scheme based on the vertices crossing each tile. The resulting tile lists can be drawn to a file for inspection, trimmed to a percentage, shuffled, or sorted by area.
This page is the complete reference for the extension. Here is what you will find, in the order it appears:
C++ programming interface. The counting functions, from the basic brute-force and hierarchical counts through nesting-level control, and the successive density-map functions that break regions into tiles, first by contained vertices, then by crossing vertices, and finally with an open-ended options string for threads, region of interest, and tile limits.
Script commands. The equivalent commands for users who prefer to run the same counts and density maps within the framework without writing code, including a command to release the tile lists they create.
If you just want a quick count or density map of a file, the script commands are the quickest route. If you are using the API into your own software, start with the C++ programming interface.
QisMExplCounter QisMExplCounter C++ API (qismexplcounter.h)QisMExplCounterVersion ControlGet_last_error_msgGet_counts_fullGet_counts_hierarchicalQisMExplCounterV2Get_counts_nlQisMExplCounterV3Break_window_by_vertnumRelease_window_listQisMExplCounterV4Break_window_by_vertcrossQisMExplCounterV5Break_window_by_vertcross_advQisMExplCounter commandsexplcounter.countexplcounter.break_window_by_crossingexplcounter.break_window_by_vertnumexplcounter.delete_windows
API to compute exploded polygon and vertex counts for a given cell and set of layers
class QisMExplCounter: public NsQisMLib::QisMExtensionAPI { ... };Cast to a pointer of another version in the class hierarchy (base/derived)
Get the latest version number. Version numbers start at 1 and are reflected in the class name using the suffix V<number>. E.g <baseclass>V<version>
The topmost base class is version 1 (V1 implied)
The cast returns NULL if a version number is not recognized/implemented
xxxxxxxxxxvirtual void* QisMExplCounter_cast(const int version) = 0;virtual const void* QisMExplCounter_cast(const int version) const = 0;virtual int QisMExplCounter_latest_version() const = 0;Get more information about the last error condition
xxxxxxxxxxvirtual const char* Get_last_error_msg() const = 0;virtual int Get_last_error_code() const = 0;Get exploded vertex count (estimated) over a region of interest using multi-threaded brute-force technique
Suitable for view with little or no cell hierarchy
filedb: Handle to a valid QisMFile object obtained from QisMLib::Load_file
counts: Buffer to get the exploded vertex counts
cell: Name of the cell to explode. If NULL, default top cell is used
layers: Comma-sepatated list of layer[:datatype] of interest. Counts will be obtained only for the specified layers
win: Extents of the region of interest to explode. If NULL, the ROI is same as the view cell's extents
thrnum: Number of threads to use. By default (0), thrnum == No. system processors
numPolygons: Address of a buffer to get the number of polygons
Success: true. counts contains the exploded number of vertices (approx)
Failure: false. Use Get_last_error_msg() for more information
xxxxxxxxxxvirtual bool Get_counts_full( NsQisMLib::QisMFile* filedb, long long& counts, const char* cell = 0, const char* layers = 0, const NsQisMLib::QisMWindow* win = 0, const int thrnum = 0, long long* numPolygons = 0 ) = 0;Get exploded vertex count (exact) for a given cell using a hierarchical technique
Much faster than Get_counts_full(...) for cells with lots of hierarchy, many repeating cell references including arrays
Reverts to Get_counts_full(...) for flat cells (with no references to other cells)
filedb: Handle to a valid QisMFile object obtained from QisMLib::Load_file
counts: Buffer to get the exploded vertex counts
cell: Name of the cell to explode. If NULL, default top cell is used
layers: Comma-sepatated list of layer[:datatype] of interest. Counts will be obtained only for the specified layers
numPolygons: Address of a buffer to get the number of polygons
Success: true. counts contains the exploded number of vertices (approx)
Failure: false. Use Get_last_error_msg() for more information
xxxxxxxxxxvirtual bool Get_counts_hierarchical( NsQisMLib::QisMFile* filedb, long long& counts, const char* cell = 0, const char* layers = 0, long long* numPolygons = 0 ) = 0;xxxxxxxxxxclass QisMExplCounterV2: public QisMExplCounter { ... };Works exactly the same as Get_counts_full() except for the additional nesting level control.
nesting_level < 1implies ALL nesting levels
xxxxxxxxxxvirtual bool Get_counts_nl( NsQisMLib::QisMFile* filedb, long long& counts, const char* cell = 0, const char* layers = 0, const NsQisMLib::QisMWindow* win = 0, const int nesting_level = 0, const int thrnum = 0, long long* numPolygons = 0 ) = 0;xxxxxxxxxxclass QisMExplCounterV3: public QisMExplCounterV2 { ... };Break one or more ROIs (tiles) into smaller tiles based on the no. vertices contained within.
This method can be used to generate a density map of the design to that the subsequent multi-threaded queue ops can have better load sharing
list will point to a list of computed windows when this methods returns successfully
filedb is a handle to the file database
max_vertnum is the max. no. vertices inside any window. larger windows will be broken into smaller ones until qualified
min_vertnum is the min. no. vertices inside any window. Windows with lesser vertices will be dropped
cellname is the name of the view cell. If empty/null, default top cell is used
layers is a comma-separated list of layer(s) or layer:datatype(s) to be treated as a single set. If empty/null, all loaded layers are used
tiles if not null is a list of pre-computed tiles (sets of 4 values -- minx,miny,maxx,maxy per tile). ntiles is the no. tiles in the list. Use pre-computed tiles to:
Perform computation only for specified ROIs
Control aspect ratio of the output tiles
thrnum is the number of threads to be used. 0 implies auto i.e no. of cpus
If thrnum > 1, the input may be broken up before running computation for efficient thread allocations
The output window list MUST BE RELEASED using Release_window_list to avoid memory leak
RETURN is the no. windows in list. If <= 0, call Get_last_error_msg to determine the error details
xxxxxxxxxxvirtual int Break_window_by_vertnum( NsQisMLib::QisMWindow*& list, NsQisMLib::QisMFile* filedb, const int max_vertnum, const int min_vertnum = 1, const char* cellname = 0, const char* layers = 0, const double* tiles = 0, const int ntiles = 0, const int thrnum = 0 ) = 0;virtual void Release_window_list(NsQisMLib::QisMWindow* list) const = 0;xxxxxxxxxxclass QISMLIB_LNX_DECLSPEC QisMExplCounterV4: public QisMExplCounterV3 { ... };Break a view of the database into smaller tiles based on the no. vertices crossing
This method can be used to generate a density map of the design to that the subsequent multi-threaded queue ops can have better load sharing
list will point to a list of computed windows when this methods returns successfully
filedb is a handle to the file database
max_vertnum is the max. no. vertices inside any window. larger windows will be broken into smaller ones until qualified
max_depth is the max. depth of the division scheme
cellname is the name of the view cell. If empty/null, default top cell is used
layers is a comma-separated list of layer(s) or layer:datatype(s) to be treated as a single set. If empty/null, all loaded layers are used
roi if not NULL represents the region-of-interest to compare
limit_list_pct if specified limits the no. tiles to the specified percentage of the original using random selection
The output window list MUST BE RELEASED using Release_window_list to avoid memory leak
RETURN is the no. windows in list. If <= 0, call Get_last_error_msg to determine the error details
xxxxxxxxxxvirtual int Break_window_by_vertcross( NsQisMLib::QisMWindow*& list, NsQisMLib::QisMFile* filedb, const int max_vertnum, const int max_depth = 8, const char* cellname = 0, const char* layers = 0, const NsQisMLib::QisMWindow* roi = 0, const int limit_list_pct = 100 ) = 0;xxxxxxxxxxclass QisMExplCounterV5: public QisMExplCounterV4 { ... };Same as
Break_window_by_vertcrosswith extensible options
opts is a string of optional parameters separated by <space>. Parameters with spaces in them MUST be enclosed in double-quotes
xxxxxxxxxx//Specify max-depth (as an int, default 8)static const char* Key_MAXDEPTH() { return "maxdepth="; } //maxdepth=%d//Specify view cell (as a string)static const char* Key_CELL() { return "cell="; } //cell=%s//Specify layers of interest (as a string)static const char* Key_LAYERS() { return "layers="; } //layers=%s//Specify region-of-interest (as 4 doubles separared by comma)static const char* Key_ROI() { return "roi="; } //roi=%lf,%lf,%lf,%lf//Specify a percentage from 1-100 and receive a limited no. tiles selected randomly from the full set (as an int, default 100)static const char* Key_LIMITPCT() { return "limitpct="; } //roi=%d//Specify a min. vertex count for a tile to be included (as an int, default 1)static const char* Key_MINVERT() { return "minvert="; } //minvert=%d//Specify no. threads to use (as an int, default 0 - no. logical cpus in the system)static const char* Key_THRNUM() { return "thrnum="; } //thrnum=%dvirtual int Break_window_by_vertcross_adv( NsQisMLib::QisMWindow*& list, NsQisMLib::QisMFile* filedb, const int max_vertnum, const char* opts = 0 ) = 0;See qismexplcounter.h for the relevant C++ API
xxxxxxxxxxexplcounter.count $filedb={filedb_id} [cell={cellname}] [layers={layer_list}] Get polygon and vertex counts for a design
{filedb_id} is name of a variable associated with the file database to be used
{cellname} if specified is the view cell to be used. Default : default top cell
{layer_list} is a comma-separated list of layer or layer:datatype numbers to be treated as a single group. Default: ALL available layers
xxxxxxxxxxexplcounter.break_window_by_crossing $filedb={filedb_id} [gds={output_gds_path}] [cell={cellname}] [layers={layer_list}] [window={minx},{miny},{maxx},{maxy}] [maxd={max_quad_depth}] [maxv={max_vertices_per_quad}] [limitpct={percentage}] [lout={output_layer}] [&var={set_id}] [minv={0 | 1}] [thrnum={n}] [expand={uu}] [shuffle] [sortby{+|-}area]Break a region of interest into tiles based on the no. vertices crossing a region of the ROI
Uses a quad-tree based algorithm to compute density map. Suitable for cases where the no. intersections between polygons outweigh the no. vertices
{filedb_id} is name of a variable associated with the file database to be used
{cellname} if specified is the view cell to be used. Default : default top cell
{layer_list} is a comma-separated list of layer or layer:datatype numbers to be treated as a single group. Default: ALL available layers
window if specified represents the region of interest (default: extents of the view cell)
{output_gds_path} if specified, generates a (GDSII) file at the specified path illustrating the newly computed windows
{max_quad_depth} if specified controls the resolution of the density map by setting the max. depth of the quad-tree. Increasing the depth increases the resolution of the density map (default: 8)
{max_vertices_per_quad} if specified controls the breaking up of quads based on the max. no. vertices per leaf quad (default: 1024). Increasing the max. no. vertices reduces the resolution of the density map
{percentage} if specified limits the no. output tiles to the specified percentage of the original no. computed tiles (default: 100)
{output_layer} if specified writes the tiles to {output_layer}:0 in the output file
{set_id} if specified, is name of a variable associated with a newly created list of tiles. It MUST be eventually destroyed using explcounter.delete_windows
{min_vert} is the minimum no. vertices to keep the quad. Use 1 or 0
{thrnum} is the num. threads to be used (default: no. cpus)
expand={uu} if specified, expands (enlarges or shrinks) each tile by the specified amount in user-units on each side
If shuffle is specified, all the tiles will be randomly shuffled
If sortby{+|-}area is specified, the windows are sorted by area. sortby+area lists the largest windows first while sortby-area lists the smallest first
xxxxxxxxxxexplcounter.break_window_by_vertnum $filedb={filedb_id} maxvert={max_vert_per_window} [cell={cellname}] [layers={layer_list}] [$tiles={window_set_id}] [thrnum={n_threads}] [gds={output_gds_path}] [minvert={min_vert_per_window}] [&var={new_set_id}] [expand={uu}] [shuffle] [sortby{+|-}area]Break a region of interest into tiles based on the no. vertices contained within (a.k.a density map of the ROI)
Equivalent to QisMExplCounterV3::Break_window_by_vertnum in qismexplcounter.h
{filedb_id} is name of a variable associated with the file database to be used
{max_vert_per_window} is the max. no. vertices contained in any of the computed tiles. Larger windows will be broken up into smaller ones until this criteria is satisfied
{cellname} if specified is the view cell to be used. Default : default top cell
{layer_list} is a comma-separated list of layer or layer:datatype numbers to be treated as a single group. Default: ALL available layers
{window_set_id} if specified is name of a variable associated with a list of windows that represents a pre-computed tiles over which this computation will be performed. Use this to:
Perform computation only over select areas of the view
Control the aspect ratio of the computed tiles
Save time by breaking up the ROI into smaller tiles
{n_threads} if specified is the no. threads to be used to perform this operation. Default: 0 i.e no. cpus in the system. If {n_threads} > 1, the input ROI(s) may be further split into smaller tiles for better multi-threaded load sharing
{output_gds_path} if specified generates a .sf (GDSII) file at the specified path illustrating the newly computed windows
{min_vert_per_window} is the min. no. vertices per window. Windows smaller than this count will be dropped from the output
{set_id} if specified, is name of a variable associated with a newly created list of tiles. It MUST be eventually destroyed using explcounter.delete_windows
expand={uu} if specified, expands (enlarges or shrinks) each tile by the specified amount in user-units on each side
If shuffle is specified, all the tiles will be randomly shuffled
If sortby{+|-}area is specified, the windows are sorted by area. sortby+area lists the largest windows first while sortby-area lists the smallest first
xxxxxxxxxxexplcounter.delete_windows $windows={set_id}
Destroy a set of windows allocated by the explcounter commands
{set_id} is name of a variable associated with the list of windows to be destroyed
Last Updated -- Wed Sep 30 00:57:27 UTC 2026