Use Tcl/Tk to Add Gui to Your Automation Flow

Make it to the Right and Larger Audience


Use Tcl/Tk to Add Gui to Your Automation Flow

I was investigating design for 100M/1G Ethernet MAC and found a good reference project from, ethernet mac authored by Jon Gao. This blog is actually not about the Ethernet but about the Tcl GUI interface used in this project.


In my previous projects, I use Perl and Shell scripts quite a bit but not much for Tcl/Tk. If I need user to select an option, I will output all the options and prompt user to enter a digit to select which option to use. This is not too bad but a more user friendly way is to let user click on option directly. It becomes awkward when it comes to I give user option to modify many parameters since user has to go through prompts one by one.


When I studied Gao’s project, I realized he was using tcl/tk to implement a very convenient gui tool. How it is done is actually very straightforward and requires very minimum coding. You can easily follow this way to add gui to your project.

Project url at opencores is:,ethernet_tri_mode

Once you download and unzip it, you can go to ethernet_tri_mode/sim/rtl_sim/ncsim_sim/script folder and run “wish run.tcl”. (Note here as many fpga designers I work on Windows PC and not Linux machine so I run “wish run.tcl” in a Cygwin terminal.) You can get below dialog box popped up:


run.tcl is as below.


As seen above, the way to create this pop-up is very straightforward.


Another example is you can run “wish start.tcl” at ethernet_tri_mode/ and below window pops up:


click on “Next” and you get:


click on Verify and you get verification window again:


start.tcl is as below.


the code corresponding to invoking verify window is:


run_proc.tcl in sim/rtl/ncsim_sim/script/ is as below:


As can be seen, it is very similar to run.tcl and the difference is due to run_proc.tcl is an procedure and called by others while run.tcl is a top and standalone module.

In summary, using tcl/tk to make an interactive gui tool is very convenient and can be very productive in asic/fpga design.

Senior Engineer
Author brief is empty



Contact Us

Thanks for helping us better serve the community. You can make a suggestion, report a bug, a misconduct, or any other issue. We'll get back to you using your private message ASAP.



Forgot your details?