oascript howto - si2 · 2 oascript news 6/10/13 openaccess api c++ programming interface eda...

29
1 oaScript HowTo Kevin Nesmith Lead Engineer, Si2 June 10, 2013

Upload: others

Post on 27-Mar-2020

75 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: oaScript HowTo - Si2 · 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

1

oaScript HowTo

Kevin Nesmith Lead Engineer, Si2

June 10, 2013

Page 2: oaScript HowTo - Si2 · 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

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

Page 3: oaScript HowTo - Si2 · 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

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…

Page 4: oaScript HowTo - Si2 · 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

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.

Page 5: oaScript HowTo - Si2 · 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

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

Page 6: oaScript HowTo - Si2 · 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

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

Page 7: oaScript HowTo - Si2 · 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

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

Page 8: oaScript HowTo - Si2 · 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

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.

Page 9: oaScript HowTo - Si2 · 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

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”.

Page 10: oaScript HowTo - Si2 · 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

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

Page 11: oaScript HowTo - Si2 · 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

11 6/10/13

oasPython Example Creating an example design script:

#!/usr/bin/env  python  

makeDesign.py

Execute  as  a  python  script.  

Page 12: oaScript HowTo - Si2 · 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

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.  

Page 13: oaScript HowTo - Si2 · 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

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  

Page 14: oaScript HowTo - Si2 · 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

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.  

Page 15: oaScript HowTo - Si2 · 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

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.  

Page 16: oaScript HowTo - Si2 · 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

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.  

Page 17: oaScript HowTo - Si2 · 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

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.  

Page 18: oaScript HowTo - Si2 · 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

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”.  

Page 19: oaScript HowTo - Si2 · 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

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”.  

Page 20: oaScript HowTo - Si2 · 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

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.  

Page 21: oaScript HowTo - Si2 · 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

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.  

Page 22: oaScript HowTo - Si2 · 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

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.  

Page 23: oaScript HowTo - Si2 · 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

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.  

Page 24: oaScript HowTo - Si2 · 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

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

Page 25: oaScript HowTo - Si2 · 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

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.  

Page 26: oaScript HowTo - Si2 · 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

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

Page 27: oaScript HowTo - Si2 · 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

27

oaScript 2.0 NOW AVAILABLE TO ALL SI2

MEMBERS!

UNDER THE ESG LICENSE v2.0.

6/10/13

Page 28: oaScript HowTo - Si2 · 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

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

Page 29: oaScript HowTo - Si2 · 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

29

THANK YOU!

6/10/13