Using EDA Databases: Milkyway & OpenAccess Enabling and Using Scripting Languages with Milkyway and OpenAccess Don Amundson Khosro Khakzadi 2006 LSI Logic Corporation 1
Outline History Choice Of Scripting Language When To Use Scripting Language When Not To Use Scripting Language Python For OpenAccess & Milkyway Summary Something Completely Different Backup Slides 2
History Internal CAD Commercial CAD 2006 LSI Logic Corporation 3
History Flexstream LSI Internal CAD LSI Proprietary CAD system Data base API written in C Data base functions return error code that must be checked after each function call Global variables, Memory management LSI Internal Common API Written in C++ Use C++ exception rather that check return code Abstraction layer to hide the data base Main objective was to substantially reduce porting cost of internal tools when data base changes Python wrappers written for the common API To provide rapid prototyping capability Ease of use for Engineers LSI Proprietary CAD system flavor of this API developed Python wrappers are basically free Implementation is a number of #include s 4
History Third party CAD Synopsys (Avant!) Same characteristics as LSI Proprietary CAD system Data base API (Milkyway) written in C Data base functions return error code Applications must manage memory allocated by API At the time certain operations not available in C (scheme only) Milkyway Flavor of LSI Common API Same motivation as LSI Internal Common API - Written in C++ - Object oriented - Use C++ exception rather that check return code - Abstraction layer to hide the data base - Substantially reduce porting cost of internal tools Python wrappers are basically free - Implementation is a number of #include s Other Flavors Of LSI Common API Minor porting cost This allowed existing programs written for LSI Proprietary CAD system to port by simply including new header files and recompiling. Minor changes to the program startup and run time environment specific code. 5
History Third party CAD API Based Applications API Layer (App side) API Layer (DB side) GUI Forms API API OpenAccess V1 3 rd Party Database LSI Database Utilities Tcl/Tk 6
History Third party CAD API Based Applications OpenAccess 2.0 GUI Forms Decided to Natively Adopt OA 2.x As Common API Utilities Tcl/Tk 7
Choice of Scripting Language PYTHON TCL JAVA 2006 LSI Logic Corporation 8
PYTHON 9
Choice of Scripting Language PYTHON Python Reasons LSI chose Python More proficient in python than Tcl. Python is an object oriented language, this results in a easy and clean mapping to class based languages such as C++ Easy to learn thus ideal to use by engineers who may not be interested in hard core programming Python provides you with a good environment for quickly developing an initial prototype http://www.amk.ca/python/howto/advocacy http://www.python.org/workshops/2000-01/proceedings/papers/elkner/pyyhs.html 10
Choice of Scripting Language TCL TCL Reasons LSI chose Python Like Python, Tcl is usable as an application extension language, as well as a stand-alone programming language. However, Tcl, which traditionally stores all data as strings, is weak on data structures http://python.fyxm.net/doc/essays/comparisons.html Better suited for pure script programming and good choice for command interpreters. Tcl scripts can be useful and efficient if they grow to no larger than a few pages, and if they manage a relatively small amount of data. http://www.networkcomputing.com/unixworld/tutorial/005/005.html#others 11
Choice of Scripting Language JAVA Java Reasons LSI chose Python Java was in its infancy. (Circa 1996) Java will be the choice for LSI in the future. Java's design is friendlier to glue languages than C. Both Java's type safety and the existence of a reflection API make it reasonably easy to automatically generate wrappers that allow Python programmers to access Java packages. http://www.python.org/workshops/1997-10/proceedings/hugunin.html With availability of open source development tools such as Eclipse we believe JAVA will become the scripting language of choice at LSI. Eclipse http://www.eclipse.org/ - Eclipse is an open source community whose projects are focused on providing an extensible development platform and application frameworks for building software. 12
When To Use Scripting Language Data Base Conversion Data Base Browser Prototype Software Small Tasks 2006 LSI Logic Corporation 13
When To Use Scripting Language Milkyway To OpenAccess MW to OA Python App 5:50 min OA to MW Python App 16 sec In Memory Interpretive Translators Python Interface Milkyway Python Interface OpenAccess File Based Compiled Translators DEF Interface DEF Interface DEF DEF Interface DEF Interface File 5:15 min 75k gates + 3 rams DEF DEF File File 3:02 min + HAND edits 14
Milkyway CHIP CELL OpenAccess 15
When to use scripting language Browse Milkyway 16
17
When to use scripting language Browse OpenAccess 18
When Not To Use Scripting Language Complex Data Structures Complex Algorithm Maintenance 2006 LSI Logic Corporation 19
When not to use scripting language Cycle intensive programs such as DRC, Placement or Routing. These may be prototyped in a language like python but will not be useful in production Example Flexstream to Milkyway Not the same problem as Milkyway to OA Different connectivity model requires converting edge connected shapes to center line connected shapes DRC algorithm FlexStream 1.0 Avant! 20
When not to use scripting language Flexstream to Milkyway Insert WIRE 21
Python For OpenAccess & Milkyway 2006 LSI Logic Corporation 22
Python For Milkyway Milkyway Flavor of LSI Internal Common AP Difficult to write Python wrappers for Milkyway API Common API makes writing python wrappers relatively easy string AvantNet :: Name() const { if (!ObjectId() ) return string(); // Return empty String char * name = NULL; // Milkyway MWXDb_Get_name() will allocate memory // for the net name, so this method is responsible for the memory int32 rc = MWXDb_Get_Net_name ( CellId(), ObjectId(), &name ); if (!AvantApiMWXError(rc,"Find Net Name") ) // throw exception or issue error message return string(); // if in message mode string result = name; free(name); // Further, certain names (i.e. layer names) may not be freed. return result ; } Python wrappers ( for the Common API ) Usable for any data base static PyObject* PySdbNet_get_name(PySdbNetObject *ob,pyobject* args) { if (!PySdbLibraryObjectValidate(ob->v.Container().Library())) return NULL; return PyString_FromCString(ob->v.Name()); } 23
Python For Milkyway Python Wrapper (Milkyway Flavor of API) #define PDPY_AVANTI_API #include "so_sdb_avant.h #include "pdpy_net_c.h (#define SdbNet AvantNet) 24
Python for OpenAccess Code is auto-generated directly from header files We considered SWIG and BOOST PYTHON Reduce maintenance with code updates Each OA type maps to a real Python type Python API matches C++ API as much as possible API Header Files Code Generator Hint Information Extension Code 25
SUMMARY 2006 LSI Logic Corporation 26
SUMMARY PYTHON & TCL Are used extensively at LSI Both provide an interpreted high-level programming environment. Widely available and well supported. Free Python has been historically used as the primary scripting language for programs performing complex operations on large data bases Familiarity. Easy to manage large programs. Rapid prototyping Component gluing Flexibility, Interactivity, Debugging, Testing, etc. TCL has been historically used as embedded command processor for applications. Works well when program is small, the amount of data being managed is small & the data structures map well to strings. Not particularly easy to code programs that need to perform complex operations on large data bases, using complex data structures. 27
SUMMARY JAVA LSI Common API was developed when JAVA was in its infancy JAVA is very well supported and its feature set is growing at a much faster rate than Tcl or Python. Productivity gains achieved through Eclipse are such that we may not have a choice but to move to JAVA. LSI is considering developing JAVA wrappers for OpenAccess 2.2.x. 28
THANK YOU 2006 LSI Logic Corporation 29
And Now For Something Completely Different Can you guess the following language? Hint :! English class HELLO_WORLD create make feature make is do io.put_string ("Hello, world!%n") end end 30