create_drc_check - 2023.1 English

Vivado Design Suite Tcl Command Reference Guide (UG835)

Document ID
UG835
Release Date
2023-05-16
Version
2023.1 English

Create a user defined DRC rule

Syntax

create_drc_check [‑hiername <arg>] ‑name <arg> [‑desc <arg>] [‑msg <arg>]
    ‑rule_body <arg> [‑severity <arg>] [‑quiet] [‑verbose]

Usage

Name Description
[-hiername] Specify the hiername for this rule. When the DRC UI panel is created, this is used to place the new rule in the menu hierarchy. Use a dot (.) to separate layers in the menu hierarchy. It is optional and will default to User Defined. Default: User Defined
-name Specify the name for this rule. This must be of the form PREFIX-id where XXXX is a 4-6 letter abbreviation and id is an integer identifying a particular rule. Similar checks should have the same abbreviation and each a unique id.
[-desc] Specify the short description for this rule. It is optional and will default to <User rule - default description>. Default: User rule - default description
[-msg] Specify the full description for this rule. Including the substitutions. Values are: %MSG_STRING %NETLIST_ELEMENT %SITE_GROUP %CLOCK_REGION %BANK %BEL_GROUP.
-rule_body The string representing the body of the rule. This can be a tcl proc name or any string of tcl code to be evaluated.
[-severity] Specify severity level for a DRC rule. Default: Warning. Values: Error, Critical Warning, Warning, Advisory.
[-quiet] Ignore command errors
[-verbose] Suspend message limits during command execution

Categories

DRC, Object

Description

Create a new user-defined DRC rule check, drc_check, for use by the tool when running report_drc.

This command allows you to define a unique name or abbreviation for the user-defined rule check, optionally group the rule into a special hierarchy and provide a description of the rule, define a general placeholder message for the check when violations are encountered, and refer to the Tcl code associated with the design rule check to be run during the report_drc command.

The general placeholder message defined in this command is populated with specific information related to the design objects and violations found by the Tcl checker procedure, and by the create_drc_violation command.

The process in brief is:

  • Write a Tcl checker procedure to define the method applied when checking the user-defined rule, and the objects to check against the rule. The Tcl checker procedure is defined in a separate Tcl script that must be loaded by the source command prior to running report_drc.
  • Use create_drc_violation in the Tcl checker to identify and flag violations found when checking the rule against a design.
  • Define a user-defined DRC rule check using the create_drc_check command that calls the Tcl checker proc from the -rule_body.
  • Create a rule deck using the create_drc_ruledeck command, and add the user-defined rule check to the rule deck using the add_drc_checks command.
  • Run report_drc, and specify either the rule deck, or the user-defined rule check to check for violations.

If a drc_check of the specified name is already defined in the tool, an error is returned. In this case, to overwrite or redefine and existing drc_check, you must first delete the check using the delete_drc_check command.

The DRC rule check object features the is_enabled property that can be set to TRUE or FALSE using the set_property command. When a new rule check is created, the is_enabled property is set to TRUE as a default. Set the is_enabled property to FALSE to disable the rule check from being used when report_drc is run. This lets you create new DRC checks, add them to rule decks using add_drc_checks, and then enable them or disable them as needed without having to remove them from the rule deck.

Each user defined DRC rule check has the 'USER_DEFINED' property, which lets you quickly identify and select user-defined rule checks.

Arguments

-hiername <arg> - (Optional) Defines a rule grouping for the new rule. The default is "User Defined". This is used as the first level of hierarchy in the GUI when listing DRC rules. All newly created DRC checks are also added to the "all" hierarchy used by default by the report_drc command.

-name <arg> - (Required) The unique name for the design rule. This should match the name used by the create_drc_violation commands in the Tcl checker procedure specified in -rule_body. The name will appear in the DRC report with any associated violations. The name should consist of a short 4 to 6 letter abbreviation for the rule group, and an ID to differentiate it from other checks in the same group, for instance ABCD-1 or ABCD-23.

-desc <arg> - (Optional) A brief description of the rule. The default is "User Rule". This is displayed when listing DRC rules in the GUI. The description is also used in the DRC report and summary.

-msg< arg> - (Optional) This is the message displayed when a violation of the rule is found. The message can include placeholders for dynamic substitution with design elements found in violation of the rule. The design data is substituted into the message at the time report_drc is run. Each substitution key has a long form, and a short form as shown below. Valid substitutions keys are:

  • %MSG_STRING (%STR) - This is the message string defined by the -msg option in the create_drc_violation command for the specific violation.
    Note: %STR is the default message for the create_drc_check command if the -msg option is not specified. In this case, any message defined by create_drc_violation in the -rule_body is simply passed through to the DRC report.
  • %NETLIST_ELEMENT (%ELG) - Netlist elements including cells, pins, ports, and nets.
  • %SITE_GROUP (%SIG) - Device site.
  • %CLOCK_REGION (%CRG) - Clock region.
  • %BANK (%PBG) - Package IO bank.

-rule_body <arg> - (Required) This is the name of the Tcl procedure which defines the rule checking functionality. The Tcl procedure can be embedded here, into the -rule_body option, or can be separately defined in a Tcl script that must be loaded with the source command when the tool is launched, or prior to running the report_drc command.

The Tcl checker procedure can create DRC violation objects, using the create_drc_violation command, containing the design elements that are associated with a design rule violation. The tool populates the substitution keys in the message defined by -msg with the design elements from the violation object.

-severity <arg> - (Optional) Specifies the severity of the rule being created. The default value is Warning. The possible values are:

  • ERROR
  • "CRITICAL WARNING"
  • WARNING
  • ADVISORY
-quiet - (Optional) Execute the command quietly, returning no messages from the command. The command also returns TCL_OK regardless of any errors encountered during execution.
Note: Any errors encountered on the command-line, while launching the command, will be returned. Only errors occurring inside the command will be trapped.
-verbose - (Optional) Temporarily override any message limits and return all messages from this command.
Note: Message limits can be defined with the set_msg_config command.

Examples

The following example defines a new design rule check named RAMW-1, with the hierarchy name and description defined, using the default severity of Warning, and calling the dataWidthCheck procedure when the check is run:

create_drc_check -name {RAMW-1} -hiername {RAMB} \
  -desc {Data Width Check} -rule_body dataWidthCheck -severity Advisory

The following Tcl script defines the dataWidthCheck procedure which is called by the -rule_body argument of the RAMW-1 check. This Tcl script file must be loaded into the tool using the source command, prior to running the report_drc command.

# This is a simplistic check -- report BRAM cells with WRITE_WIDTH_B
# wider than 36.
proc dataWidthCheck {} {
  # list to hold violations
  set vios {}
  # iterate through the objects to be checked
  foreach bram [get_cells -hier -filter {PRIMITIVE_SUBGROUP == bram}] {
    set bwidth [get_property WRITE_WIDTH_B $bram]
    if { $bwidth > 36} {
      # define the message to report when violations are found
      set msg "On cell %ELG, WRITE_WIDTH_B is $bwidth"
      set vio [ create_drc_violation -name {RAMW-1} -msg $msg $bram ]
      lappend vios $vio
    }
  }
  if {[llength $vios] > 0} {
    return -code error $vios
  } else {
    return {}
  }
}
create_drc_check -name {RAMW-1} -hiername {RAMB Checks} \
   -desc {Data Width Check} -rule_body dataWidthCheck \
   -severity Advisory
Note: The script file can contain both the Tcl checker procedure, and the create_drc_check command that defines it for use by report_drc command. In this case, when the Tcl script file is sourced, both the dataWidthCheck proc and the RAMW-1 design rule check are loaded into the tool.