oascript howto - si2 · 2 oascript news 6/10/13 openaccess api c++ programming interface eda...
TRANSCRIPT
1
oaScript HowTo
Kevin Nesmith Lead Engineer, Si2
June 10, 2013
2
oaScript News
6/10/13
OpenAccess API C++ Programming Interface
EDA Programmer Centric
• Version 2.0 available under the new ESG approved license – Allows for custom C++ extensions. – 64 bit binaries for each language.
• Windows version in development under the Silicon Photonics TAB • 10 OA labs ported from C++ to support all 4 scripting languages
– Provides training to design engineers who operate at the scripting interface
Perl API
Type Mapping
Ruby API
Type Mapping
Tcl API
Type Mapping
Python API
Type Mapping Common Wrapper Architecture Interface
Language-Specific Bindings
Common SWIG Framework
Chip Designer Centric
3 6/10/13
oaScript Support
OpenAccess Streams • oa22.04 – gcc-4.2.2 64bit • oa22.41 – gcc-4.4.3 64bit • oa22.43 – gcc-4.4.3 64bit Linux • RHEL 4.8 • RHEL 5 • SLES 10 • SLES 11 Perl 5.8.1 – 5.10.1 Python 2.5.1 – 2.7.3 Ruby 1.8 – 1.9 Tcl 8.4 – 8.6
oaScript is currently supported on…
4 6/10/13
oasPython Example This simple scripting language demo will show how to use oasPython to open a library and create a simple design with two nets.
5 6/10/13
oasPython Example Shell environment variables need by oaScript
perl: linux> export =/opt/oaScript/perl5
ruby: linux> export =/opt/oaScript/ruby
tcl: linux> export =/opt/oaScript/tcl
python: linux> export =/opt/oaScript/python2
LD_LIBRARY_PATH specifies the path to the OA libraries: linux> export =/opt/oa22.43p004/lib/linux_rhel50_gxx44_64/opt
6 6/10/13
oasPython Example Unsupported Platforms
Often times the need arises to run OA/oaScript on an unsupported platform such as Fedora 17.
Fedora 17: The user will still need to specify the path to the OA libraries:
linux> export =/opt/oa22.43p004/lib/linux_rhel50_gcc44x_64/opt
Important The user will need to tell OA which platform to substitute:
linux> export =linux_rhel50_gcc44x
7 6/10/13
oasPython Example Using the python interpreter to create a library:
linux> export PYTHONPATH=/opt/oaScript/python2 linux> export LD_LIBRARY_PATH=/opt/oa22.43p004/…/opt linux> export OA_UNSUPPORTED_PLAT=linux_rhel50_gcc44x
linux> python ���Python 2.7.3 (default, Jul 24 2012, 10:05:38) >>> import oa >>> oa.oaLib.create("designLib", "./designLibOnDisk") <Swig Object of type 'OpenAccess_4::oaLib *' at 0x7feace8141f0> >>> quit()
linux> ls -ld designLibOnDisk drwxrwxr-x. 2 me user 4096 May 28 12:12 designLibOnDisk
8 6/10/13
oasPython Example Create a lib.defs (library definition) file:
The lib.defs file associates logical library names used by tools with physical locations on disks.
DEFINE designLib ./designLibOnDisk lib.defs
The lib.defs file is a text file. It can be created and managed by OpenAccess functions, OR it can be created and edited in your favorite text editor. For our simple example, it is made in the editor.
9 6/10/13
oasPython Example The “DEFINE” statement specifies the mapping between a logical
library name and its physical location on disk.
DEFINE lib.defs
The library’s logical name is “designLib”. The library’s physical location is “./designLibOnDisk”.
10 6/10/13
oasPython Example The OpenAccess API looks for a lib.defs file in 1. The current directory 2. The home directory 3. <oaInstallDir>/data/libraries directory
DEFINE designLib ./designLibOnDisk lib.defs
11 6/10/13
oasPython Example Creating an example design script:
#!/usr/bin/env python
makeDesign.py
Execute as a python script.
12 6/10/13
oasPython Example Creating an example design script:
#!/usr/bin/env python
import sys import oa
makeDesign.py
Import the system uAlity and oa modules.
13 6/10/13
oasPython Example Creating an example design script:
#!/usr/bin/env python
import sys import oa
oa.oaDesignInit()
makeDesign.py
“import oa” calls oaDesignInit()
automaAcally, so this isn’t needed
14 6/10/13
oasPython Example Creating an example design script:
#!/usr/bin/env python
import sys import oa
oa.oaLibDefList.openLibs()
makeDesign.py
Read the lib.defs file, which maps logical names to physical locaAons.
15 6/10/13
oasPython Example Creating an example design script:
#!/usr/bin/env python
import sys import oa
oa.oaLibDefList.openLibs() vt=oa.oaViewType.get(“netlist”)
makeDesign.py
viewType must be specified to
create a design.
16 6/10/13
oasPython Example Creating an example design script:
import sys import oa
oa.oaLibDefList.openLibs() vt=oa.oaViewType.get(“netlist”)
des=oa.oaDesign.open(“designLib”, “myCell”, “myView”, vt, ‘w’)
makeDesign.py Open a design with logical, cell, and view names, viewType, and write mode.
17 6/10/13
oasPython Example Creating an example design script:
oa.oaLibDefList.openLibs() vt=oa.oaViewType.get(“netlist”)
des=oa.oaDesign.open(“designLib”, “myCell”, “myView”, vt, ‘w’)
block=oa.oaBlock.create(des)
makeDesign.py
The block holds a physical
descripAon of the design.
18 6/10/13
oasPython Example Creating an example design script:
des=oa.oaDesign.open(“designLib”, “myCell”, “myView”, vt, ‘w’)
block=oa.oaBlock.create(des)
oa.oaScalarNet.create(block, “net1”)
makeDesign.py
This creates the 1st net, “net1”.
19 6/10/13
oasPython Example Creating an example design script:
block=oa.oaBlock.create(des)
oa.oaScalarNet.create(block, “net1”)
oa.oaScalarNet.create(block, “net2”)
makeDesign.py
This creates the 2nd net, “net2”.
20 6/10/13
oasPython Example Creating an example design script:
block=oa.oaBlock.create(des)
oa.oaScalarNet.create(block, “net1”)
oa.oaScalarNet.create(block, “net2”)
for net in (block.getNets()): print “net in block: %s” % (net.getName())
makeDesign.py
This iterates over the collecAon of nets in the block.
21 6/10/13
oasPython Example Creating an example design script:
block=oa.oaBlock.create(des)
oa.oaScalarNet.create(block, “net1”)
oa.oaScalarNet.create(block, “net2”)
for net in (block.getNets()): print “net in block: %s” % (net.getName())
makeDesign.py
This prints each net’s name in the
collecAon.
22 6/10/13
oasPython Example Creating an example design script:
oa.oaScalarNet.create(block, “net1”)
oa.oaScalarNet.create(block, “net2”)
for net in (block.getNets()): print “net in block: %s” % (net.getName())
des.save()
makeDesign.py
This saves the design to the disk.
23 6/10/13
oasPython Example Creating an example design script:
oa.oaScalarNet.create(block, “net2”)
for net in (block.getNets()): print “net in block: %s” % (net.getName())
des.save()
des.close()
makeDesign.py
This closes the design.
24 6/10/13
oasPython Example Running the makeDesign.py script:
Don’t forget your environment variables…
linux> export PYTHONPATH=/opt/oaScript/python2 linux> export LD_LIBRARY_PATH=/opt/oa22.43p004/…/opt linux> export OA_UNSUPPORTED_PLAT=linux_rhel50_gcc44x
Make sure you have the script, library, and lib.defs file in the current directory.
linux> ls lib.defs makeDesign.py designLibOnDisk
You may need to make your file executable… linux> chmod +x makeDesign.py
25 6/10/13
oasPython Example Running the makeDesign.py script:
Execute the script…
linux> ./makeDesign.py net in block: net1 net in block: net2
NoAce: this is our expected output.
26
OpenAccess News
6/10/13
The new ESG v2.0 License has been approved! • Sign Once / Use Many model.
String/Name Table Capacity Increase • Due in 2013.
END of LIFE coming January 1, 2014: • oa22.04 Stream • oa22.42 Stream
27
oaScript 2.0 NOW AVAILABLE TO ALL SI2
MEMBERS!
UNDER THE ESG LICENSE v2.0.
6/10/13
28
For More Information
6/10/13
oaScript Users Wiki http://www.oascript.org
README notes for the oaScript releases https://www.si2.org/openeda.si2.org/project/shownotes.php?release_id=563
OpenAccess Documentation and Training Si2 OpenAccess Online Course https://www.si2.org/?page=414
Si2 OpenAccess Tutorial and Labs https://www.si2.org/openeda.si2.org/projects/si2oatools
OpenAccess Online Docs https://www.si2.org/openeda.si2.org/si2_online/oa_online_info.php
29
THANK YOU!
6/10/13