Cloud native EDA tools & pre-optimized hardware platforms
Electronic design automation tools (EDA) are highly complex, developed for use on some of the most demanding engineering projects on the planet. Synopsys and other EDA vendors work hard to make their solutions applicable to a wide range of chip designs, but new challenges and opportunities arise every day. Further, chip developers often have strong preferences for how they use design tools. For these reasons, EDA solutions must offer user customization (often through coding).
Read on to discover how Synopsys has made solutions such as PrimeTime customizable through the popular programming language Python.
Scripting languages have proven the most effective way for users to personalize graphical interfaces, define shortcuts, and perform other customization tasks. Tcl and Python are two of the best-known and well-supported languages. For years, Tcl dominated EDA flows. It is an effective interactive command line interface (CLI), but it is far from a true programming language and has limitations even for scripting. Further, the size of the developer community supporting it has shrunk, limiting Tcl’s ability to adopt to today’s innovation requirements.
Python, in contrast, has rapidly emerged as the customization language of choice for EDA solutions. It is a full-fledged programming language that is widely taught in engineering schools and used within the semiconductor industry. In fact, the TIOBE Programming Community index on language popularity consistently ranks Python at the very top, whereas Tcl has fallen off the list. Python has an active developer community with many readily available packages targeting machine learning, data analysis, and visualization.
Recognizing that Python is revolutionizing the EDA industry, Synopsys has aggressively supported it as a customization language. At the same time, we have ensured a seamless coexistence with the countless Tcl scripts still in use by maintaining consistency between Python and Tcl in terms of application interface, user experience, and documentation. Further, the Tcl shell and setup files do not change; this makes the transition to Python easy for existing Tcl user flows. For those already familiar with Python, we have ensured that usage feels natural and supports common Python idioms.
The Synopsys PrimeTime® static timing analysis tool is an excellent example of a solution where Python support has proven valuable and has been enthusiastically embraced. Users can execute Python code from within a Tcl shell with a new command:
Usage: py_eval # Evaluate python code
-file <path> (Evaluate python code in file)
[-verbose] (Echo commands and display results during evaluation)
code (Evaluate python statements)
All Python features are provided in the snps module, which can be accessed via the import command during PrimeTime startup. Users can also import their own existing Python files, which will scope any classes and functions within the module namespace.
A Python console is provided in the interactive shell and the graphical user interface (GUI) main window. Users can enable this console by using the set_app_var sh_language python command or selecting the Python language from the drop-down menu within the GUI.
As you would expect, PrimeTime fully supports writing or modifying Python code within its script editor:
In Python, users can access commands via methods on the snps.cmd object. Most commands accept one or more arguments, either positional (in specific order) or keyword (in any order). Examples of commands include:
cmd.get_cells('*mem*', hierarchical=True, filter='is_soft_macro')
cmd.get_defined_attributes(_class='cell') # underscore for reserved word
cmd.get_timing_paths(through=B, **cmd.arg('through',C)) # repeated keyword
Python commands return one of the following object types.
Users can return values from Python commands to Tcl, query or set Tcl variables within Python code, and execute Tcl scripts or arbitrary code from within Python. All Python stdout/stderr messages show up in the PrimeTime log file. Users can also redirect this output to a custom file or variable. Tcl equivalents to the Python commands are logged in trace_log, and all error messages apply to both Python and Tcl bindings. Again, the goal is to ensure a seamless transition from Tcl to Python while preserving access to user’s legacy code.
As noted earlier, one of the biggest advantages of using Python is the public availability of many powerful packages. PrimeTime supports nearly 600 built-in Python packages, and this list is ever-growing due to the active developer community.
For example, NumPy is a library supporting large multi-dimensional arrays and matrices, along with functions that operate on them. Similarly, Pandas is a Python library for data structures such as tables and time series, plus the operations that manipulate them. Once users have their data in the form you want, you can generate custom graphical views using Matplotlib, a data visualization library that generates plots, graphs, charts, histograms, and more.
Synopsys provides guidance to help users achieve optimized performance when customizing PrimeTime with Python, especially on tasks such as data processing and analysis. Python is 10-15 times faster for our users than Tcl in common design query loops.
We are currently adding Python support to many additional Synopsys tools and solutions so that even more users can benefit from full compatibility with Tcl interfaces and leverage the vast public Python library. With Synopsys, “You can do it in Python.”
Additional information on Python usage in PrimeTime is available on SolvNet.