The Tool Command Language (Tcl) is the scripting language that goes hand in hand with VHDL. That’s because most FPGA software tools use this language. For example, Vivado, Quartus, Questa, and ModelSim.
You can create powerful scripts for any of these tools when you know Tcl. But Tcl isn’t like other programming languages. A major point of confusion for new learners is that everything is a string in Tcl, and I will explain what that means in the first lessons.
If you already know Tcl, there are still many things you can take away from this course. For example, the details of how namespaces, variable scopes, and classes work.
Finally, we will use Tcl to create a GUI widget for Questa/ModelSim. And you will see how we can interact with VHDL simulations and visualize the state of the DUT using Tcl as a front-end.
View the video above to see a preview of some of the lessons!
This course is also available in the VHDLwhiz Membership.
The difference is that when you purchase this product, you get permanent access to the course, while the membership charges a monthly fee to access the content.
Software used in the course
I’m using the built-in Tcl shell of the Questa VHDL simulator in the course. The required software is available for free for Windows and Linux:
- Questa – Intel FPGA Edition(includes Starter Edition)
(Any version of ModelSim or QuestaSim will work)
- Microsoft Visual Studio Code
(Any editor will do)
The overview below shows the lessons you can access after purchasing this course.
1 - Why Tcl?
What's Tcl, and what can you gain from learning it?
2 - Tcl shells and documentation
Here's how to start coding Tcl with the FPGA tools you already have installed.
3 - Everything is a string
In Tcl, every object's name and value is a string.
4 - Variables
This is how variable substitution works in Tcl.
5 - Namespaces
Use namespaces and the variable keyword to avoid overwriting global variables.
6 - Lists
The Tcl list is a versatile data structure for storing objects.
7 - Arrays
Arrays in Tcl are hash maps that store key/value pairs.
8 - Loops
Let's look at the different loops that Tcl has to offer.
9 - Conditional expressions
Learn about Boolean values, If-Then-Elseif-Else, and the Switch statement.
10 - Procedures
Learn about Tcl's subprograms and how they relate to global and namespace variables.
11 - Classes
It's time to explore Tcl's object-oriented features.
12 - GUI: Tcl/Tk in Questa/ModelSim
We'll create a GUI to control and visualize a VHDL testbench.
13 - GUI: Layout of the widget
The geometry manager controls the sub-widget positions and appearances.
14 - GUI: Interacting with the simulation
You can read VHDL signals and control the simulation using Tcl in Questa.
15 - GUI: Tcl callbacks using "when"
Questa's when command can run your Tcl code based on VHDL signal events.
16 - GUI: Start and Quit buttons
The buttons will trigger procedure calls when clicked.
17 - GUI: Compile and Open Waveform buttons
We can control the ModelSim GUI with Tcl commands and from our widget.
18 - GUI: The Run buttons
See how to start and stop the simulation at predefined DUT states.