The basic application of Tcl in Vivado

Xilinx's next-generation design suite, Vivado, has significantly improved in terms of speed, algorithm optimization and functional integration compared to the previous generation ISE. But for beginners, the introduction of the new constraint language XDC and the scripting language Tcl has become the biggest obstacle to quickly mastering the skills of Vivado. So many years later, there are still many users who lack the confidence to upgrade to Vivado.

This article introduces the basic application of Tcl in Vivado, and hopes to play a role in inspiring the user, guiding users to quickly master relevant skills in a short period of time, and better play the advantages of Vivado in FPGA design.

Tcl background introduction and basic grammar

Tcl (pronounced TIckle) was born in the 1980s at the University of California at Berkeley. As a simple and efficient scripting language, Tcl has been widely used in almost all EDA tools. The biggest feature of Tcl is that its grammar format is extremely simple and even rigid. It adopts the pure [command option parameter] form, which is a veritable "tool command language" (that is, the full name of Tcl Tool Command Language).

In fact, the functionality of Tcl can be very powerful, and the programs written in it can be very complicated, but to use it in Vivado or most other EDA tools, you only need to master the most basic parts.

Note: In the following example, % represents the command prompt of Tcl. After performing carriage return, Tcl will output the command execution result on the next line. // After the comment by the author, it is not part of the example.

Setting variables

The basic application of Tcl in Vivado

Printing is mainly performed by the puts statement, and the final output is directly determined by the special symbol.

File I/O

The basic application of Tcl in Vivado

You can see that Tcl's operation on the file is also done by setting variables, changing properties, and printing commands. In the above example of writing a file, two lines of text are written in the my_file.txt file by the puts command, which are the values ​​of the "Hello World!" and myVar variables, and then the contents of the same file are read line by line in the read file operation.

Control flow and loop commands

The commands used to control processes and loops in the Tcl language are similar to C and other high-level languages, including if, while, for, and foreach.

For specific use, please refer to the following example:

The basic application of Tcl in Vivado

Subroutine/process

Subroutines in Tcl are also called Procedures. Tcl is the ability to enhance its built-in commands by creating new procedures, providing greater scalability. Specific to the use of Vivado, users can often extend or personalize the use of Vivado by creating subroutines/processes.

The basic application of Tcl in Vivado

Some special symbols

The basic application of Tcl in Vivado

The basic syntax of the Tcl language is relatively simple, but it requires constant practice on a daily basis. There are a lot of relevant information on the Xilinx website. Here are two Tcl-related documents UG835 and UG894. I hope to help you learn Vivado and Tcl.

Using Tcl to target in Vivado

The most basic scenario for using Tcl in Vivado is to traverse, find, and locate the targets on the netlist, which is the basis for constraining the targets on the netlist. To master these, you first need to understand Vivado's classification of goals.

Target definition and positioning

The basic application of Tcl in Vivado

As shown in the figure above, the top-level I/O is called ports, and the rest of the underlying modules or component ports on the gate-level netlist are called pins. The modules at all levels, including the top layer, blackbox and gate-level components, are called cells. The connection is called nets, plus the clocks defined in XDC. In Vivado, the targets in the netlist file are defined as five categories. To select these five types of targets, you need to use the corresponding get_* command, such as get_pins and so on.
Get_ports

Ports only refer to top-level ports, so the use of get_ports is relatively simple and can be used with the wildcard "*" and the commands that handle lists in the Tcl language. As follows,

The basic application of Tcl in Vivado

Get_cells/get_nets

Unlike ports, which only refer to top-level ports, it is relatively complicated to locate cells and nets. First, you need to face the level of problems. There is a big background to be clear: in Vivado, Tcl/XDC searches the target in the netlist hierarchically, that is, only searches for a specified level of current_instance at a time, and the default is the top level.

Electric Scooter Battery

ZTTEK Electric Scooter Batteries. Any size batteriesb can be customized! Suitable for most electric vechile modles, like electric e-bike, golf cart,forklift,beach electric motorcycle.

Electric Motorcycle Battery,Li-Ion Battery Pack For Electric Bike,Lithium Battery Charger For Electric Bike,Lithium Battery Pack For E-Bike

Jiangsu Zhitai New Energy Technology Co.,Ltd , https://www.zhitainewenergy.com