register_proc - 2021.1 English

Vivado Design Suite Tcl Command Reference Guide (UG835)

Document ID
UG835
Release Date
2021-06-16
Version
2021.1 English

Register a Tcl proc with Vivado.

Syntax

register_proc [‑quiet] [‑verbose] <proc> [<tasknm>]

Returns

Nothing

Usage

Name Description
[-quiet] Ignore command errors
[-verbose] Suspend message limits during command execution
<proc> Name of proc to register. Proc must be known to Tcl
[<tasknm>] Name of Tcl task that wraps the proc. Default: Register the proc using the root name proc (no namespaces).

Categories

Tools

Description

Register a Tcl procedure (proc) with the Vivado Tcl command interpretor to register the command with the Vivado Design Suite help system.

The following is an example Tcl proc defined for use with the Vivado Design Suite:
proc findCommand {option} {
  # Summary:
  # Searches through all Vivado Tcl commands for commands implementing
  #   the specified argument.
  # Argument Usage:
  # option: Specifies the argument to search for.
  # Return Value:
  # Returns a list of Tcl commands that implement the option.
  # Categories: personal
  foreach cmd [lsort [info commands *]]
  {
       catch {
          if {[regexp "$option" [help -syntax $cmd]]}
  {
             puts $cmd
          }
       }
   }
  } ;
  # End
The commented lines beginning with '#' are used to define the help text for the registered command in the Vivado Design Suite help system.
  • # Summary: provides a brief description of the command.
  • # Argument Usage: provides a list and description of the various arguments for the proc.
  • # Return Value: provides a description of what is returned by the proc.
  • # Categories: provides an ability to define categories for registered procedures.
After registering the procedure as a Tcl command, the Vivado help system will return this text when queried with:
tasknm -help
-or-
help tasknm

This command returns the name of the registered proc.

Arguments

-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.

<proc> - (Required) The name of the Tcl procedure loaded into the current Vivado Design Suite session. The Tcl proc must be defined and loaded into the Vivado Design Suite prior to registration.

<tasknm> - (Optional) Specify the Tcl command name that wraps the proc, for use in the Vivado Design Suite. Default: Register the proc using the root name proc.

Example

The following example registers a Tcl proc called findCommand as a Tcl command named findCmd:
register_proc findCommand findCmd

See Also