Allegro System Capture AppNote - DRC
Allegro System Capture AppNote - DRC
Capture
Introduction
Allegro System Capture provides a set of Tcl APIs for writing custom design rule checks (DRC).
After a custom rules file is placed, create a tclIndex file for the custom rules using the auto_mkIndex Tcl
command from a Tcl shell. A standalone Tcl shell is supplied with Cadence SPB installation at: <CADENCE
SPB INSTALL>/tcltk/bin/tclsh.
Allegro System Capture Tcl Graphics API
RETURN
# Name ARG1 ARG2 TYPE Description
Converts number in user units to
1 dbConvertToDBUnits number number database units
Converts number in database units
2 dbConvertToUserUnits number number to user units
3 dbGetActivePage dbId returns the dbId of the active page
returns the bounding box of the
4 dbGetBBox dbId of item dbBox item
returns the SPATH of a loaded
5 dbGetBlockSPath block name string design
returns a list of dbIds of all children
6 dbGetChildren dbId of item list of dbIds of an item
dbId of pin returns a list of dbIds of all route
7 dbGetConnectedItems item list of dbIds items connected to a pin
dbId of pin
8 dbGetHotSpot item dbPoint returns the hotspot of the pin
returns a list of dbIds of items
9 dbGetItemsInBBox dbBox list of dbIds within a bounding box
returns a list of dbIds of linked
10 dbGetLinkedItems dbId of item list of dbIds items
dbId of page
11 dbGetPage schematic name dbId returns dbId of a page
returns a list of dbIds of all items on
12 dbGetPageItems dbId of page list of dbIds a page
13 dbGetParent dbId of item dbId returns the dbId of the parent item
return position of the item on the
14 dbGetPos dbId of item dbPoint page in DB units
returns a list of properties defined
15 dbGetProperties dbId of item list of props on the item
spath list property
dbId of of name and returns the property name and
16 dbGetPropNameVal property design value value as a two-element list
returns the visibility values for the
property as follows:
0 – name and value invisible
1 – only name is visible
dbId of 2 – only value is visible
17 dbGetPropVisibility property short 3 – both name and value visible
returns the segments associated
with a route. A segment is denoted
dbId of route list of pair of by a pair of points. Example: {{{0 0}
18 dbGetSegments item points {0 100}} {{0 100} {100 100}}}
returns a list of dbIds of items
19 dbGetSelectedItems list of dbIds selected on a page
returns the SPATH of the selected
20 dbGetSPath dbId of item string item, if available
21 dbGetSPathForActiveTab string returns the SPATH of the active tab
22 dbGetType dbId of item dbType return the type number
23 dbIsByPassItem dbId of item dbBool checks if item is Bypass
24 dbIsValid dbId of item dbBool checks for valid dbId
25 dbName2Type type name numeric returns the type number
26 dbType2Name type number string returns the type name
DRC Sample to Determine Component Pin Overlaps
# **************************************************************
# Rule: To check if any component pin overlaps and if there is a pin-to-pin connection
# between any two components.
# 1. Function gets the component pins from the canvas and creates a list of component pins.
# 2. Gets all the zero length segments from the canvas and creates a list containing the segments.
# 3. Iterates over all the component pins and for each pin calculates bounding box.
# **************************************************************
proc asda_pins_overlap {designName msgType} {
set compPinInsts [asda_get_all_comppins]
set zerolengthSegments [asda_get_zerolength_segments]
set overlapped_insts {}
set count 0
foreach item $compPinInsts {
set item_bbox [sch::dbGetBBox $item]
set count [incr count]
set insts_to_visit [lrange $compPinInsts $count end]
foreach item1 $insts_to_visit {
set item1_bbox [sch::dbGetBBox $item1]
if {[asda_checkbbox_intersection $item_bbox $item1_bbox]} {
foreach segment $zerolengthSegments {
if { [asda_segment_pt_in_bbox $segment $item_bbox ]} {
lappend overlapped_insts $item
}
}
}
}
}
set msgInfo [asda_get_drc_msg_info [lindex [info level [info level]] 0]]
set msgId [ lindex $msgInfo 0 ]
set message [ lindex $msgInfo 1 ]
asda_report_drc $designName $msgType $msgId $message $overlapped_insts
return [llength $overlapped_insts]
}