Intel® Quartus® Prime Standard Edition User Guide: Scripting
Visible to Intel only — GUID: mwh1410471030568
Ixiasoft
Visible to Intel only — GUID: mwh1410471030568
Ixiasoft
2.13.8. Procedures
Simple Procedure
proc multiply { x y } {
set product [expr { $x * $y }]
return $product
}
The following example shows how to use the multiply procedure in your code. You must define a procedure before your script calls it.
Using a Procedure
proc multiply { x y } {
set product [expr { $x * $y }]
return $product
}
set a 1
set b 2
puts [multiply $a $b]
Define procedures near the beginning of a script. If you want to access global variables in a procedure, use the global command in each procedure that uses a global variable.
Accessing Global Variables
proc print_global_list_element { i } {
global my_data
puts "The list element at index $i is [lindex $my_data $i]"
}
set my_data { 1 2 3}
print_global_list_element 0