Pulling out All the Stops ------------------------- - Implementation of a High Performance Tcl Extension in the Calibre IC Design Verification tool by Phil Brooks - software engineer, Mentor Graphics Corporation ABSTRACT -------- The Calibre IC Design Verification environment has used Tcl for a number of years in a traditional scripted GUI architecture where Tcl drives underlying high performance C++ application code. An existing high performance limited functionality scripting mini language provides users with custom calculation capabilities in some performance critical areas. When users needed greater flexibility and extensibility for some low level scripted calculations, I turned to Tcl to provide them. The catch was that these calculations are at the heart of one of Calibre's performance sensitive, multi-threaded C++ analysis modules. User provided Tcl procs will be called millions of times from within threaded C++ application code in a performance critical area. The existing mini-language will provide the underlying application framework for Tcl user procs. I examine the architecture of this system providing maximum user provided Tcl proc call performance from inside a C++ application. SUMMARY ------- Application Architecture ------------------------ The Calibre Verification tool does geometric analysis on integrated circuit designs. The geometric data manipulations is programmed by the user in a specialized geometric manipulation language called Standard Verification Rule Format (SVRF). Using SVRF, users can perform various functions that help them to discover geometric properties of the design that can in turn be used in verification analysis. This paper concerns use of Calibre for analysis of devices (i.e. transistors, resistors, etc) and calculation of properties related to those devices. Existing Application Scripting Engine ------------------------------------- Calibre provides a very simple device scripting language that users often employ to perform simple device calculations based on geometric measurements made by Calibre. This scripting language is extremely fast, but also has very limited capabilities (no looping constructs, no function calls, only numeric and string data types, etc). As integrated circuit technology advances, some customers are require the ability to produce and manipulate more complex data types while analyzing properties of a device. Rather than making piecemeal additions to the existing scripting engine, these requirements can be handled by calling user provided Tcl code from within the existing scripting engine. Making Tcl viable in this part of the application will require a level of efficiency that not substantially slower than the stripped down light weight scripting language already in place. With Tcl's constant creation and destruction of objects, can high performance levels to a user supplied Tcl proc be achieved? Calling Tcl Efficiently ----------------------- One of the properties that makes the Calibre scripting language perform so well is the fact that it doesn't require (or allow) any dynamic allocation during the individual device calculation. Rather, each device is evaluated by a byte compiled program that has all potential variables and results pre allocated at the device call time. What is the difference in performance for various Tcl interfaces? I look at Tcl_Eval, Tcl_EvalObjEx, and Tcl_EvalObjv as alternate calling mechanisms in our quest for ultimate call performance to the user proc. Getting data to Tcl Efficiently ------------------------------- Successful use of Tcl in this environment required efficient transfer of per-device call information to the user's Tcl proc. Careful avoidance of per call Tcl_Obj creation for arguments helps to achieve high efficiency calls from C++ to Tcl. Getting data back to C++ Efficiently ------------------------------------ Getting data back into C++ efficiently for storage as a device property is also an important consideration in the overall performance of this system. Again, through careful avoidance of per call Tcl_Obj creation for result objects helps to achieve a high efficiency round trip from C++ to Tcl and back. Conclusions ----------- Performance comparisons are made between various Tcl call implementations and the previous simple scripting language by itself. Also provided is performance profiling analysis of the various systems showing where the bottlenecks in each implementation are.