Updated documentation Python/Tutorial to catch up with API improvements.

This commit is contained in:
Jean-Paul Chaput 2022-08-15 13:49:35 +02:00
parent 440547a1c5
commit 16428ffaa9
35 changed files with 1778 additions and 1570 deletions

View File

@ -34,81 +34,4 @@ go through all the components of a trans-hierarchical net.
For a starter, how to get all the leaf cells... For a starter, how to get all the leaf cells...
9.5 Dynamically decorating data-base objects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When writing algorithms directly in Python, it may come in handy to be
able to add attributes over the Hurricane data-base objects. As C++
objects exposed to the Python realm cannot natively do so (it would
means to be able to modify a C++ aobject attributes *at runtime*),
we add a special Property tasked with handling the extra Python
attributes. The syntax has been made as simple as possible.
.. code-block:: python
from Hurricane import PythonAttributes
class MyAttribute ( object ):
count = 0
def __init__ ( self ):
self.value = MyAttribute.count
print( '{} has been created'.format(self) )
MyAttribute.count += 1
def __del__ ( self ):
print( '{} has been deleted'.format(self) )
def __str__ ( self ):
return '<MyAttribute {}>'.format(self.value)
def demoAttributes ( cell ):
PythonAttributes.enable( cell )
cell.myAttribute0 = MyAttribute()
cell.myAttribute1 = MyAttribute()
print( 'cell.myAttribute0 =', cell.myAttribute0 )
del cell.myAttribute0
PythonAttributes.disable( cell )
Detailing the life cycle of Python attributes on a DBo_:
1. Enabling the addition of Python attribute on a DBo_:
.. code-block:: python
PythonAttributes.enable( cell )
2. Adding/removing properties on the DBo_:
.. code-block:: python
cell.myAttribute0 = MyAttribute()
cell.myAttribute1 = MyAttribute()
print( 'cell.myAttribute0 =', cell.myAttribute0 )
del cell.myAttribute0
3. And finally disabling the use of Python attributes on the DBo.
Any still attached Python attributes will be released.
.. code-block:: python
PythonAttributes.disable( cell )
.. note::
When the attributes of a DBo_ are released it does not automatically
imply that they are removed. Their reference count is decreased, and
if they are only referenced here, they will be deleted. But if other
variables still holds reference onto them, they will stay allocateds.
4. There is no need to keep track of all the DBo_ that have Python
attributes to disable them. One can directly call:
.. code-block:: python
PythonAttributes.disableAll()

View File

@ -51,15 +51,12 @@ environment is provided by the |CRL| module.
from Hurricane import * from Hurricane import *
from CRL import * from CRL import *
from helpers.overlay import UpdateSession
af = AllianceFramework.get() af = AllianceFramework.get()
UpdateSession.open() with UpdateSession():
cell = af.createCell( 'my_inv' )
cell = af.createCell( 'my_inv' ) # Build then save the Cell.
# Build then save the Cell.
UpdateSession.close()
This is the simplest call to ``createCell()``, and in that case, the newly This is the simplest call to ``createCell()``, and in that case, the newly
@ -89,6 +86,24 @@ two conversion functions are provided:
In the weakly typed |Python| world, :cb:`lbd` is *float* while :cb:`unit` In the weakly typed |Python| world, :cb:`lbd` is *float* while :cb:`unit`
is *integer*. is *integer*.
In order to reduce the number of characters one has to code, the :cb:`helpers`
module provides three very short function to perform conversion *towards*
DbU_ :
.. code-block:: Python
def l ( value ):
"""Convert a lambda into a DbU."""
return DbU.fromLambda( value )
def u ( value ):
"""Convert a length in micrometer into a DbU."""
return DbU.fromPhysical( value, Hurricane.DbU.UnitPowerMicro )
def n ( value ):
"""Convert a length in nanometer into a DbU."""
return DbU.fromPhysical( value, Hurricane.DbU.UnitPowerNano )
3.5 Setting up the Abutment Box 3.5 Setting up the Abutment Box
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -99,20 +114,17 @@ corner ``(x2,y2)``.
.. code-block:: Python .. code-block:: Python
b = Box( DbU.fromLambda( 0.0) # x1 b = Box( l( 0.0) # x1
, DbU.fromLambda( 0.0) # y1 , l( 0.0) # y1
, DbU.fromLambda(15.0) # x2 , l(15.0) # x2
, DbU.fromLambda(50.0) ) # y2 , l(50.0) ) # y2
cell.setAbutmentBox( b ) cell.setAbutmentBox( b )
Or more simply: Or more simply:
.. code-block:: Python .. code-block:: Python
cell.setAbutmentBox( Box( DbU.fromLambda( 0.0) cell.setAbutmentBox( Box( l( 0.0), l( 0.0), l(15.0), l(50.0) ) )
, DbU.fromLambda( 0.0)
, DbU.fromLambda(15.0)
, DbU.fromLambda(50.0) ) )
3.6 Adding Nets and Components 3.6 Adding Nets and Components
@ -180,12 +192,12 @@ of ``METAL1``.
.. code-block:: Python .. code-block:: Python
segment = Vertical.create( i # The owner Net. segment = Vertical.create( i # The owner Net.
, layer # The layer. , layer # The layer.
, DbU.fromLambda( 5.0 ) # The X coordinate. , l( 5.0 ) # The X coordinate.
, DbU.fromLambda( 2.0 ) # The width. , l( 2.0 ) # The width.
, DbU.fromLambda( 10.0 ) # The Y source coordinate. , l( 10.0 ) # The Y source coordinate.
, DbU.fromLambda( 40.0 ) ) # The Y target coordinate. , l( 40.0 ) ) # The Y target coordinate.
With this overload of the ``Vertical.create()`` function the segment is created at an With this overload of the ``Vertical.create()`` function the segment is created at an
absolute position. There is a second overload for creating a relatively placed absolute position. There is a second overload for creating a relatively placed
@ -236,101 +248,99 @@ explanation of that part of the code, refer to `5. Make a script runnable throug
#!/usr/bin/python #!/usr/bin/python
import sys import sys
from Hurricane import * from Hurricane import DataBase, NetExternalComponents, Net, \
from CRL import * DbU, Point, Box, Horizontal, Vertical, Contact, RoutingPad, \
Breakpoint
from CRL import AllianceFramework, Catalog
def toDbU ( l ): return DbU.fromLambda(l) from helpers import l
from helpers.overlay import UpdateSession
def doBreak ( level, message ): def doBreak ( level, message ):
UpdateSession.close() """Put a breakpoint into the script."""
Breakpoint.stop( level, message ) Breakpoint.stop( level, message )
UpdateSession.open()
def buildInvertor ( editor ): def buildInvertor ( editor ):
UpdateSession.open() """Build step by step an invertor standard cell."""
with UpdateSession():
cell = AllianceFramework.get().createCell( 'invertor' ) cell = AllianceFramework.get().createCell( 'invertor' )
cell.setTerminal( True ) cell.setTerminalNetlist( True )
cell.setAbutmentBox( Box( l(0.0), l(0.0), l(15.0), l(50.0) ) )
cell.setAbutmentBox( Box( toDbU(0.0), toDbU(0.0), toDbU(15.0), toDbU(50.0) ) )
if editor: if editor:
UpdateSession.close()
editor.setCell( cell ) editor.setCell( cell )
editor.fit() editor.fit()
UpdateSession.open()
technology = DataBase.getDB().getTechnology() with UpdateSession():
metal1 = technology.getLayer( "METAL1" ) technology = DataBase.getDB().getTechnology()
poly = technology.getLayer( "POLY" ) metal1 = technology.getLayer( "METAL1" )
ptrans = technology.getLayer( "PTRANS" ) poly = technology.getLayer( "POLY" )
ntrans = technology.getLayer( "NTRANS" ) ptrans = technology.getLayer( "PTRANS" )
pdif = technology.getLayer( "PDIF" ) ntrans = technology.getLayer( "NTRANS" )
ndif = technology.getLayer( "NDIF" ) pdif = technology.getLayer( "PDIF" )
contdifn = technology.getLayer( "CONT_DIF_N" ) ndif = technology.getLayer( "NDIF" )
contdifp = technology.getLayer( "CONT_DIF_P" ) contdifn = technology.getLayer( "CONT_DIF_N" )
nwell = technology.getLayer( "NWELL" ) contdifp = technology.getLayer( "CONT_DIF_P" )
contpoly = technology.getLayer( "CONT_POLY" ) nwell = technology.getLayer( "NWELL" )
ntie = technology.getLayer( "NTIE" ) contpoly = technology.getLayer( "CONT_POLY" )
ntie = technology.getLayer( "NTIE" )
net = Net.create( cell, "nwell" ) net = Net.create( cell, "nwell" )
Vertical.create( net, nwell, toDbU(7.5), toDbU(15.0), toDbU(27.0), toDbU(51.0) ) Vertical.create( net, nwell, l(7.5), l(15.0), l(27.0), l(51.0) )
vdd = Net.create( cell, "vdd" ) vdd = Net.create( cell, "vdd" )
vdd.setExternal( True ) vdd.setExternal( True )
vdd.setGlobal ( True ) vdd.setGlobal ( True )
h = Horizontal.create(vdd, metal1, toDbU(47.0), toDbU(6.0), toDbU(0.0), toDbU(15.0) ) h = Horizontal.create(vdd, metal1, l(47.0), l(6.0), l(0.0), l(15.0) )
NetExternalComponents.setExternal( h ) NetExternalComponents.setExternal( h )
Contact.create ( vdd, contdifn, toDbU(10.0), toDbU(47.0), toDbU( 1.0), toDbU( 1.0) ) Contact.create ( vdd, contdifn, l(10.0), l(47.0), l( 1.0), l( 1.0) )
Contact.create ( vdd, contdifp, toDbU( 4.0), toDbU(45.0), toDbU( 1.0), toDbU( 1.0) ) Contact.create ( vdd, contdifp, l( 4.0), l(45.0), l( 1.0), l( 1.0) )
Vertical.create( vdd, pdif , toDbU( 3.5), toDbU( 4.0), toDbU(28.0), toDbU(46.0) ) Vertical.create( vdd, pdif , l( 3.5), l( 4.0), l(28.0), l(46.0) )
Vertical.create( vdd, ntie , toDbU(10.0), toDbU( 3.0), toDbU(43.0), toDbU(48.0) ) Vertical.create( vdd, ntie , l(10.0), l( 3.0), l(43.0), l(48.0) )
doBreak( 1, 'Done building vdd.' ) doBreak( 1, 'Done building vdd.' )
vss = Net.create( cell, "vss" ) with UpdateSession():
vss.setExternal( True ) vss = Net.create( cell, "vss" )
vss.setGlobal ( True ) vss.setExternal( True )
h = Horizontal.create(vss, metal1, toDbU(3.0), toDbU(6.0), toDbU(0.0), toDbU(15.0)) vss.setGlobal ( True )
NetExternalComponents.setExternal( h ) h = Horizontal.create(vss, metal1, l(3.0), l(6.0), l(0.0), l(15.0))
Vertical.create( vss, ndif , toDbU(3.5), toDbU(4.0), toDbU(4.0), toDbU(12.0) ) NetExternalComponents.setExternal( h )
Contact.create ( vss, contdifn, toDbU(4.0), toDbU(5.0), toDbU(1.0), toDbU( 1.0) ) Vertical.create( vss, ndif , l(3.5), l(4.0), l(4.0), l(12.0) )
Contact.create ( vss, contdifn, l(4.0), l(5.0), l(1.0), l( 1.0) )
doBreak( 1, 'Done building vss.' ) doBreak( 1, 'Done building vss.' )
i = Net.create( cell, "i" ) with UpdateSession():
i.setExternal( True ) i = Net.create( cell, "i" )
v = Vertical.create ( i, metal1, toDbU(5.0), toDbU(2.0), toDbU(10.0), toDbU(40.0) ) i.setExternal( True )
NetExternalComponents.setExternal( v ) v = Vertical.create ( i, metal1, l(5.0), l(2.0), l(10.0), l(40.0) )
Vertical.create ( i, ptrans , toDbU( 7.0), toDbU( 1.0), toDbU(26.0), toDbU(39.0) ) NetExternalComponents.setExternal( v )
Vertical.create ( i, ntrans , toDbU( 7.0), toDbU( 1.0), toDbU( 6.0), toDbU(14.0) ) Vertical.create ( i, ptrans , l( 7.0), l( 1.0), l(26.0), l(39.0) )
Vertical.create ( i, poly , toDbU( 7.0), toDbU( 1.0), toDbU(14.0), toDbU(26.0) ) Vertical.create ( i, ntrans , l( 7.0), l( 1.0), l( 6.0), l(14.0) )
Horizontal.create( i, poly , toDbU(20.0), toDbU( 3.0), toDbU( 4.0), toDbU( 7.0) ) Vertical.create ( i, poly , l( 7.0), l( 1.0), l(14.0), l(26.0) )
Contact.create ( i, contpoly, toDbU( 5.0), toDbU(20.0), toDbU( 1.0), toDbU( 1.0) ) Horizontal.create( i, poly , l(20.0), l( 3.0), l( 4.0), l( 7.0) )
Contact.create ( i, contpoly, l( 5.0), l(20.0), l( 1.0), l( 1.0) )
doBreak( 1, 'Done building i.' ) doBreak( 1, 'Done building i.' )
nq = Net.create ( cell, "nq" ) with UpdateSession():
nq.setExternal( True ) nq = Net.create ( cell, "nq" )
v = Vertical.create( nq, metal1, toDbU(10.0), toDbU(2.0), toDbU(10.0), toDbU(40.0) ) nq.setExternal( True )
NetExternalComponents.setExternal( v ) v = Vertical.create( nq, metal1, l(10.0), l(2.0), l(10.0), l(40.0) )
Vertical.create( nq, pdif , toDbU(10.0), toDbU( 3.0), toDbU(28.0), toDbU(37.0) ) NetExternalComponents.setExternal( v )
Vertical.create( nq, ndif , toDbU(10.0), toDbU( 3.0), toDbU( 8.0), toDbU(12.0) ) Vertical.create( nq, pdif , l(10.0), l( 3.0), l(28.0), l(37.0) )
Contact.create ( nq, contdifp, toDbU(10.0), toDbU(35.0), toDbU( 1.0), toDbU( 1.0) ) Vertical.create( nq, ndif , l(10.0), l( 3.0), l( 8.0), l(12.0) )
Contact.create ( nq, contdifp, toDbU(10.0), toDbU(30.5), toDbU( 1.0), toDbU( 1.0) ) Contact.create ( nq, contdifp, l(10.0), l(35.0), l( 1.0), l( 1.0) )
Contact.create ( nq, contdifn, toDbU(10.0), toDbU(10.0), toDbU( 1.0), toDbU( 1.0) ) Contact.create ( nq, contdifp, l(10.0), l(30.5), l( 1.0), l( 1.0) )
Contact.create ( nq, contdifn, l(10.0), l(10.0), l( 1.0), l( 1.0) )
doBreak( 1, 'Done building q.' ) doBreak( 1, 'Done building q.' )
UpdateSession.close()
AllianceFramework.get().saveCell( cell, Catalog.State.Views ) AllianceFramework.get().saveCell( cell, Catalog.State.Views )
return
def scriptMain ( **kw ): def scriptMain ( **kw ):
"""The Mandatory function to be run by Coriolis interactively."""
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
buildInvertor( editor ) buildInvertor( editor )
return True return True

View File

@ -33,29 +33,25 @@ using the menu:
.. code-block:: Python .. code-block:: Python
def buildInvertor ( editor ): def buildInvertor ( editor ):
UpdateSession.open() """Build step by step an invertor standard cell."""
with UpdateSession():
cell = AllianceFramework.get().createCell( 'invertor' ) cell = AllianceFramework.get().createCell( 'invertor' )
cell.setTerminal( True ) cell.setTerminalNetlist( True )
cell.setAbutmentBox( Box( toDbU(0.0), toDbU(0.0), toDbU(15.0), toDbU(50.0) ) )
cell.setAbutmentBox( Box( l(0.0), l(0.0), l(15.0), l(50.0) ) )
if editor: if editor:
UpdateSession.close() editor.setCell( cell )
editor.setCell( cell ) editor.fit()
editor.fit()
UpdateSession.open()
# The rest of the script... # The rest of the script...
return return
def scriptMain ( **kw ): def scriptMain ( **kw ):
"""The Mandatory function to be run by Coriolis interactively."""
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
buildInvertor( editor ) buildInvertor( editor )
return True return True
@ -64,8 +60,8 @@ using the menu:
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
It is possible to add breakpoints inside a script by calling the ``Breakpoint.stop()`` It is possible to add breakpoints inside a script by calling the ``Breakpoint.stop()``
function. To be able to see exactly what has just been mofied, we must close the function. To be able to see exactly what has just been modified, be sure to have
UpdateSession_ just before calling the breakpoint and reopen it just after. closed any UpdateSession_ before calling breakpoints.
The ``Breakpoint.stop()`` function takes two arguments: The ``Breakpoint.stop()`` function takes two arguments:
#. The ``level`` above which it will be active. #. The ``level`` above which it will be active.
@ -76,6 +72,4 @@ We can create a little function to ease the work:
.. code-block:: Python .. code-block:: Python
def doBreak ( level, message ): def doBreak ( level, message ):
UpdateSession.close()
Breakpoint.stop( level, message ) Breakpoint.stop( level, message )
UpdateSession.open()

View File

@ -23,12 +23,12 @@ allowing to simply write:
.. code-block:: Python .. code-block:: Python
for net in cell.getNets(): for net in cell.getNets():
print 'Components of', net print( 'Components of', net )
for component in net.getComponents(): for component in net.getComponents():
print '|', component print( '|', component )
In C++ we would have written: In C++ we would have been written:
.. code-block:: C++ .. code-block:: C++
@ -54,13 +54,13 @@ loop. For example:
cellNets = [] cellNets = []
for net in cell.getNets(): for net in cell.getNets():
cellNets.append( net ) cellNets.append( net )
# Remove all the anonymous nets. # Remove all the anonymous nets.
for net in cellNets: for net in cellNets:
if net.getName().endswith('nymous_'): if net.getName().endswith('nymous_'):
print 'Destroy', net print( 'Destroy', net )
net.destroy() net.destroy()

View File

@ -37,53 +37,68 @@ Use it like this (don't forget the ``eval`` **and** the backquotes):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You may create, in the directory you are lanching |Coriolis| tools, a special You may create, in the directory you are lanching |Coriolis| tools, a special
sub-directory ``.coriolis2/`` that can contain two configuration files: sub-directory ``coriolis2/`` that can contain the configuration files:
* ``techno.py`` tells which technology to use. * ``__init__.py`` to tell |Python| this directory is a module.
* ``settings.py`` can override almost any default configuration setting. * ``settings.py`` can override almost any default configuration setting.
Those two files are *optional*, if they do not exist the default settings
will be used and the technology is ``symbolic/cmos`` (i.e. purely symbolic).
.. note:: Those two files will by processed by the |Python| interpreter, .. note:: Those two files will by processed by the |Python| interpreter,
so they can contain any code in addition to the mandatory so they can contain any code in addition to the mandatory
variables. variables.
2.2.1 The :cb:`techno.py` File
------------------------------
Must provide one variable named :cb:`technology` which values the path towards 2.3 The :cb:`settings.py` File
the technology file. The available technologies are installed under ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``<CORIOLIS_INSTALL>/etc/coriolis2``. For example, to use the 45nm FreeDPK
which is in: ::
<CORIOLIS_INSTALL>/etc/coriolis2/45/freepdk_45/ The attributes name and definitions of :cb:`cfg` are detailed
in `CGT - The Graphical Interface <../UsersGuide/ViewerTools.html>`_.
The ``techno.py`` file must contain: **Selecting the Technology**
The important line here is:
.. code-block:: Python .. code-block:: Python
technology = '45/freepdk_45' import symbolic.cmos
2.2.2 The :cb:`settings.py` File This import loads and setup the technology used througout this run of
-------------------------------- |Coriolis|. One and only one technology can be loaded in a |Coriolis| run.
The entries of the ``parametersTable`` and their definitions are detailed
in `CGT - The Graphical Interface <../UsersGuide/ViewerTools.html>`_.
Example of file: Example of file:
.. code-block:: Python .. code-block:: Python
defaultStyle = 'Alliance.Classic [black]' # -*- Mode:Python -*-
parametersTable = \ import os
( ('misc.catchCore' , TypeBool , False ) import Cfg
, ('misc.info' , TypeBool , False ) import Viewer
, ('misc.paranoid' , TypeBool , False ) import CRL
, ('misc.bug' , TypeBool , False ) import symbolic.cmos
, ('misc.logMode' , TypeBool , False ) from helpers import overlay
, ('misc.verboseLevel1' , TypeBool , False )
, ('misc.verboseLevel2' , TypeBool , True ) if 'CELLS_TOP' in os.environ:
) cellsTop = os.environ['CELLS_TOP']
else:
cellsTop = '../../../cells'
with overlay.CfgCache(priority=Cfg.Parameter.Priority.UserFile) as cfg:
cfg.misc.catchCore = False
cfg.misc.info = False
cfg.misc.paranoid = False
cfg.misc.bug = False
cfg.misc.logMode = True
cfg.misc.verboseLevel1 = True
cfg.misc.verboseLevel2 = True
cfg.misc.minTraceLevel = 1900
cfg.misc.maxTraceLevel = 3000
cfg.katana.eventsLimit = 1000000
cfg.katana.termSatReservedLocal = 6
cfg.katana.termSatThreshold = 9
Viewer.Graphics.setStyle( 'Alliance.Classic [black]' )
af = CRL.AllianceFramework.get()
env = af.getEnvironment()
env.setCLOCK( '^ck$|m_clock|^clk$' )
env.addSYSTEM_LIBRARY( library=cellsTop+'/nsxlib', mode=CRL.Environment.Prepend )
env.addSYSTEM_LIBRARY( library=cellsTop+'/niolib', mode=CRL.Environment.Prepend )

View File

@ -17,8 +17,25 @@ of |Python| objects or use |Python| containers to store them.
The only limitation is that you may not use |Hurricane| classes as base The only limitation is that you may not use |Hurricane| classes as base
classes in |Python|. classes in |Python|.
All |Hurricane| objects implements the |Python| ``__str__()`` function, All the example scripts given in this tutorial con be found under: ::
they print the result of the C++ method ``::getString()``.
<CORIOLIS_INSTALL>/share/doc/coriolis2/examples/scripts/
Provided scripts:
======================= ==============================================================
**Script** **Feature**
======================= ==============================================================
:cb:`coriolisLogo.py` Draw a layout of the |Coriolis| logo
:cb:`diagonals.py` Test the :cb:`Hurricane::Diagonal` class
:cb:`polygons.py` Test the :cb:`Hurricane::Polygon` class
:cb:`rectilinear.py` Test the :cb:`Hurricane::rectilinear` class
:cb:`invertor.py` Procedural build of the layout of an invertor standard cell
:cb:`fulladder.py` Procedural build of a small netlist along with it's manual
placement and the routing of one net (:cb:`"a"`)
:cb:`toolengines.py` Build the netlist (only) of the full adder then call the
place and route engines
======================= ==============================================================
1.1 Terminology 1.1 Terminology
@ -61,17 +78,45 @@ Mostly:
to use ``string``. to use ``string``.
* Coordinates are expressed in ``DbU`` which are ``long`` with a special * Coordinates are expressed in ``DbU`` which are ``long`` with a special
semantic (see ??). semantic (see ??).
* All |Hurricane| objects implements the |Python| ``__str__()`` function,
they print the result of the C++ method ``::getString()``.
In ``hurricane/Session.h`` header we have: In ``hurricane/Net.h`` header we have:
.. code-block:: c++ .. code-block:: c++
namespace Hurricane { namespace Hurricane {
class UpdateSession { class Net : public Entity {
public: public:
static void open (); class Direction {
static void close (); public: enum Code { DirIn = 0x0001
, DirOut = 0x0002
, DirUndefined = 0x0000
, ConnTristate = 0x0100
, ConnWiredOr = 0x0200
, UNDEFINED = DirUndefined
, IN = DirIn
, OUT = DirOut
, INOUT = DirIn | DirOut
, TRISTATE = DirOut | ConnTristate
, TRANSCV = DirIn | DirOut | ConnTristate
, WOR_OUT = DirOut | ConnWiredOr
, WOR_INOUT = DirIn | DirOut | ConnWiredOr
, DirMask = DirIn | DirOut | DirUndefined
};
// [The rest of Class Direction]
};
public:
static Net* create ( Cell* , const Name& );
bool isGlobal ();
bool isExternal ();
const Direction& getDirection ();
void setName ( Name );
void setGlobal ( bool );
void setExternal ( bool );
void setDirection ( const Direction& );
// [The rest of Class Net]
}; };
} }
@ -81,15 +126,18 @@ So we can use it the following way in C++:
.. code-block:: c++ .. code-block:: c++
#include "hurricane/Session.h" #include "hurricane/Net.h"
using namespace Hurricane; using namespace Hurricane;
void doSomething () void addNetToCell ( Cell* cell )
{ {
UpdateSession::open(); Net* net = Net::create( cell, "new_net" );
// Something... net->setGlobal ( false );
UpdateSession::close(); net->setExternal ( true );
net->setDirection( Net.Direction.IN );
cout << "Created " << net << endl;
return net;
} }
@ -97,12 +145,15 @@ The equivalent |Python| code will be:
.. code-block:: Python .. code-block:: Python
from Hurricane import * from Hurricane import Net
def doSomething (): def addNetToCell ( cell ):
UpdateSession.open() net = Net.create( cell, "new_net" )
# Something... net.setGlobal ( False )
UpdateSession.close() net.setExternal( True )
net.setDirection( Net.Direction.IN )
print( "Created", net )
return net
1.3 Various Kinds of Constructors 1.3 Various Kinds of Constructors
@ -130,9 +181,152 @@ Regarding the memory allocation, the |Hurricane| database contains two kind of o
.. code-block:: Python .. code-block:: Python
from Hurricane import DbU, Box
def myfunc(): def myfunc():
bb = Box( DbU.fromLambda( 0.0) bb = Box( DbU.fromLambda( 0.0)
, DbU.fromLambda( 0.0) , DbU.fromLambda( 0.0)
, DbU.fromLambda(15.0) , DbU.fromLambda(15.0)
, DbU.fromLambda(50.0) ) , DbU.fromLambda(50.0) )
return # bb will be freed at that point. return # bb will be freed at that point.
1.4 Collections and Iterators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hurricane Collection_ behave like containers under |Python| and provide
support for the :cb:`iterator` protocol.
.. code-block:: Python
from Hurricane import Net, Horizontal
def delAllHorizontals ( net ):
horizontals = []
for component in net.getComponents():
if isinstance(component,Horizontal):
horizontals.append( component )
# Now we can remove the Horizontals.
for horizontal in horizontals:
horizontal.destroy()
.. note:: **Never remove an element from a Collection_ while iterating over it**.
You must save the to be removed elements in an auxiliary container
then remove them, like shown in the example above
1.5 Dynamically decorating data-base objects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When writing algorithms directly in Python, it may come in handy to be
able to add attributes over the Hurricane data-base objects. As C++
objects exposed to the Python realm cannot natively do so (it would
means to be able to modify a C++ aobject attributes *at runtime*),
we add a special Property tasked with handling the extra Python
attributes. The syntax has been made as simple as possible.
.. code-block:: python
from Hurricane import PythonAttributes
class MyAttribute ( object ):
count = 0
def __init__ ( self ):
self.value = MyAttribute.count
print( '{} has been created'.format(self) )
MyAttribute.count += 1
def __del__ ( self ):
print( '{} has been deleted'.format(self) )
def __str__ ( self ):
return '<MyAttribute {}>'.format(self.value)
def demoAttributes ( cell ):
PythonAttributes.enable( cell )
cell.myAttribute0 = MyAttribute()
cell.myAttribute1 = MyAttribute()
print( 'cell.myAttribute0 =', cell.myAttribute0 )
del cell.myAttribute0
PythonAttributes.disable( cell )
Detailing the life cycle of Python attributes on a DBo_:
1. Enabling the addition of Python attribute on a DBo_:
.. code-block:: python
PythonAttributes.enable( cell )
2. Adding/removing properties on the DBo_:
.. code-block:: python
cell.myAttribute0 = MyAttribute()
cell.myAttribute1 = MyAttribute()
print( 'cell.myAttribute0 =', cell.myAttribute0 )
del cell.myAttribute0
3. And finally disabling the use of Python attributes on the DBo.
Any still attached Python attributes will be released.
.. code-block:: python
PythonAttributes.disable( cell )
.. note::
When the attributes of a DBo_ are released it does not automatically
imply that they are removed. Their reference count is decreased, and
if they are only referenced here, they will be deleted. But if other
variables still holds reference onto them, they will stay allocateds.
4. There is no need to keep track of all the DBo_ that have Python
attributes to disable them. One can directly call:
.. code-block:: python
PythonAttributes.disableAll()
1.6 Adapting C++ : Overlay
~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometimes, the use of a wrapped C++ feature would be counter intuitive regarding
the |Python| feature. For those cases the :cb:`overlay` module provide an
adaptation of the C++ API for a more *Python-like* code. A typical example is
with the UpdateSession_ mechanism.
Using directly the C++ wrapper, we would write a code like this:
.. code-block:: python
from Hurricane import UpdateSession, Net, Vertical
from helpers import l
def editCell ( cell ):
UpdateSession.open()
net = Net.create( cell, "nwell" )
Vertical.create( net, nwell, l(7.5), l(15.0), l(27.0), l(51.0) )
# Continued cell's layout building.
# ...
UpdateSession.close()
But, using the :cb:`overlay` we got the more *pythonic* code:
.. code-block:: python
from Hurricane import Net, Vertical
from helpers import l
from helpers.overlay import UpdateSession
def editCell ( cell ):
with UpdateSession():
net = Net.create( cell, "nwell" )
Vertical.create( net, nwell, l(7.5), l(15.0), l(27.0), l(51.0) )
# Continued cell's layout building.
# ...

View File

@ -140,9 +140,7 @@ we also must set its *placement status* to ``Instance.PlacementStatus.PLACED``.
.. code-block:: Python .. code-block:: Python
xr2_1.setTransformation( Transformation( DbU.fromLambda( 0.0) xr2_1.setTransformation( Transformation( l(0.0), l(100.0), Transformation.Orientation.MY ) )
, DbU.fromLambda(100.0)
, Transformation.Orientation.MY ) )
xr2_1.setPlacementStatus( Instance.PlacementStatus.PLACED ) xr2_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
@ -196,19 +194,19 @@ contacts.
# Build wiring for a. # Build wiring for a.
# Create RoutingPads first. # Create RoutingPads first.
rp1 = RoutingPad.create( a rp1 = RoutingPad.create( a
, Occurrence( xr2_1.getPlug( xr2_x2.getNet("i0")) ) , Occurrence( xr2_1.getPlug( xr2_x2.getNet("i0")) )
, RoutingPad.BiggestArea ) , RoutingPad.BiggestArea )
rp2 = RoutingPad.create( a rp2 = RoutingPad.create( a
, Occurrence( a2_1.getPlug( a2_x2.getNet("i0")) ) , Occurrence( a2_1.getPlug( a2_x2.getNet("i0")) )
, RoutingPad.BiggestArea ) , RoutingPad.BiggestArea )
# Then regular wiring. # Then regular wiring.
contact1 = Contact.create( rp1, via12, toDbU( 0.0), toDbU(-15.0) ) contact1 = Contact.create( rp1, via12, l( 0.0), l(-15.0) )
contact2 = Contact.create( rp2, via12, toDbU( 0.0), toDbU( 10.0) ) contact2 = Contact.create( rp2, via12, l( 0.0), l( 10.0) )
turn = Contact.create( a , via23, toDbU(10.0), toDbU( 35.0) ) turn = Contact.create( a , via23, l(10.0), l( 35.0) )
Horizontal.create( contact2, turn , metal2, toDbU(35.0), toDbU(2.0) ) Horizontal.create( contact2, turn , metal2, l(35.0), l(2.0) )
Vertical .create( turn , contact1 , metal3, toDbU(10.0), toDbU(2.0) ) Vertical .create( turn , contact1 , metal3, l(10.0), l(2.0) )
.. note:: In order to better see the layout of the wiring only, open the .. note:: In order to better see the layout of the wiring only, open the
@ -227,136 +225,140 @@ directory (under the the root of the |Coriolis| installation).
#!/usr/bin/python #!/usr/bin/python
import sys import sys
from Hurricane import * from Hurricane import DataBase, Instance, Box, Net, Horizontal, Vertical, Contact, \
from CRL import * RoutingPad, Transformation, Occurrence, \
Breakpoint
from CRL import AllianceFramework, Catalog, Gds
def toDbU ( l ): return DbU.fromLambda(l) from helpers import l
from helpers.overlay import UpdateSession
def doBreak ( level, message ): def doBreak ( level, message ):
UpdateSession.close() """Put a breakpoint into the script."""
Breakpoint.stop( level, message ) Breakpoint.stop( level, message )
UpdateSession.open()
def buildFulladder ( editor ): def buildFulladder ( editor ):
"""Build step by step full adder (netlist & placement)."""
# Get the Framework and all the master cells. # Get the Framework and all the master cells.
af = AllianceFramework.get() af = AllianceFramework.get()
xr2_x2 = af.getCell( 'xr2_x1', Catalog.State.Views ) xr2_x2 = af.getCell( 'xr2_x1', Catalog.State.Views )
a2_x2 = af.getCell( 'a2_x2' , Catalog.State.Views ) a2_x2 = af.getCell( 'a2_x2' , Catalog.State.Views )
o2_x2 = af.getCell( 'o2_x2' , Catalog.State.Views ) o2_x2 = af.getCell( 'o2_x2' , Catalog.State.Views )
UpdateSession.open() with UpdateSession():
fulladder = af.createCell( 'fulladder' )
fulladder = af.createCell( 'fulladder' ) fulladder.setAbutmentBox( Box( l(0.0), l(0.0), l(90.0), l(100.0) ) )
fulladder.setAbutmentBox( Box( toDbU(0.0), toDbU(0.0), toDbU(90.0), toDbU(100.0) ) )
if editor: if editor:
UpdateSession.close() editor.setCell( fulladder )
editor.setCell( fulladder ) editor.fit()
editor.fit()
UpdateSession.open()
# Create Instances. with UpdateSession():
a2_1 = Instance.create( fulladder, 'a2_1', a2_x2 ) # Create Instances.
a2_2 = Instance.create( fulladder, 'a2_2', a2_x2 ) a2_1 = Instance.create( fulladder, 'a2_1', a2_x2 )
xr2_1 = Instance.create( fulladder, 'xr2_1', xr2_x2 ) a2_2 = Instance.create( fulladder, 'a2_2', a2_x2 )
xr2_2 = Instance.create( fulladder, 'xr2_2', xr2_x2 ) xr2_1 = Instance.create( fulladder, 'xr2_1', xr2_x2 )
o2_1 = Instance.create( fulladder, 'o2_1', o2_x2 ) xr2_2 = Instance.create( fulladder, 'xr2_2', xr2_x2 )
o2_1 = Instance.create( fulladder, 'o2_1', o2_x2 )
# Create Nets. # Create Nets.
vss = Net.create( fulladder, "vss" ) vss = Net.create( fulladder, "vss" )
vss.setExternal( True ) vss.setExternal( True )
vss.setGlobal ( True ) vss.setGlobal ( True )
vdd = Net.create( fulladder, "vdd" ) vdd = Net.create( fulladder, "vdd" )
vdd.setExternal( True ) vdd.setExternal( True )
vdd.setGlobal ( True ) vdd.setGlobal ( True )
cin = Net.create( fulladder, "cin" ) cin = Net.create( fulladder, "cin" )
cin.setExternal( True ) cin.setExternal( True )
xr2_2.getPlug( xr2_x2.getNet('i0') ).setNet( cin ) xr2_2.getPlug( xr2_x2.getNet('i0') ).setNet( cin )
a2_2 .getPlug( a2_x2.getNet('i0') ).setNet( cin ) a2_2 .getPlug( a2_x2.getNet('i0') ).setNet( cin )
a = Net.create( fulladder, 'a' ) a = Net.create( fulladder, 'a' )
a.setExternal( True ) a.setExternal( True )
xr2_1.getPlug( xr2_x2.getNet('i0') ).setNet( a ) xr2_1.getPlug( xr2_x2.getNet('i0') ).setNet( a )
a2_1 .getPlug( a2_x2.getNet('i0') ).setNet( a ) a2_1 .getPlug( a2_x2.getNet('i0') ).setNet( a )
b = Net.create( fulladder, 'b' ) b = Net.create( fulladder, 'b' )
b.setExternal( True ) b.setExternal( True )
xr2_1.getPlug( xr2_x2.getNet('i1') ).setNet( b ) xr2_1.getPlug( xr2_x2.getNet('i1') ).setNet( b )
a2_1 .getPlug( a2_x2.getNet('i1') ).setNet( b ) a2_1 .getPlug( a2_x2.getNet('i1') ).setNet( b )
sout_1 = Net.create( fulladder, 'sout_1' ) sout_1 = Net.create( fulladder, 'sout_1' )
xr2_1.getPlug( xr2_x2.getNet('q' ) ).setNet( sout_1 ) xr2_1.getPlug( xr2_x2.getNet('q' ) ).setNet( sout_1 )
xr2_2.getPlug( xr2_x2.getNet('i1') ).setNet( sout_1 ) xr2_2.getPlug( xr2_x2.getNet('i1') ).setNet( sout_1 )
a2_2 .getPlug( a2_x2.getNet('i1') ).setNet( sout_1 ) a2_2 .getPlug( a2_x2.getNet('i1') ).setNet( sout_1 )
carry_1 = Net.create( fulladder, 'carry_1' ) carry_1 = Net.create( fulladder, 'carry_1' )
a2_1.getPlug( a2_x2.getNet('q' ) ).setNet( carry_1 ) a2_1.getPlug( a2_x2.getNet('q' ) ).setNet( carry_1 )
o2_1.getPlug( o2_x2.getNet('i1') ).setNet( carry_1 ) o2_1.getPlug( o2_x2.getNet('i1') ).setNet( carry_1 )
carry_2 = Net.create( fulladder, 'carry_2' ) carry_2 = Net.create( fulladder, 'carry_2' )
a2_2.getPlug( a2_x2.getNet('q' ) ).setNet( carry_2 ) a2_2.getPlug( a2_x2.getNet('q' ) ).setNet( carry_2 )
o2_1.getPlug( o2_x2.getNet('i0') ).setNet( carry_2 ) o2_1.getPlug( o2_x2.getNet('i0') ).setNet( carry_2 )
sout = Net.create( fulladder, 'sout' ) sout = Net.create( fulladder, 'sout' )
sout.setExternal( True ) sout.setExternal( True )
xr2_2.getPlug( xr2_x2.getNet('q') ).setNet( sout ) xr2_2.getPlug( xr2_x2.getNet('q') ).setNet( sout )
cout = Net.create( fulladder, 'cout' ) cout = Net.create( fulladder, 'cout' )
cout.setExternal( True ) cout.setExternal( True )
o2_1.getPlug( o2_x2.getNet('q') ).setNet( cout ) o2_1.getPlug( o2_x2.getNet('q') ).setNet( cout )
# Instances placement. # Instances placement.
a2_1.setTransformation( Transformation( toDbU(0.0) with UpdateSession():
, toDbU(0.0) a2_1.setTransformation( Transformation( l(0.0)
, Transformation.Orientation.ID ) ) , l(0.0)
a2_1.setPlacementStatus( Instance.PlacementStatus.PLACED ) , Transformation.Orientation.ID ) )
a2_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
doBreak( 1, 'Placed a2_1' ) doBreak( 1, 'Placed a2_1' )
xr2_1.setTransformation( Transformation( toDbU( 0.0) with UpdateSession():
, toDbU(100.0) xr2_1.setTransformation( Transformation( l( 0.0)
, Transformation.Orientation.MY ) ) , l(100.0)
xr2_1.setPlacementStatus( Instance.PlacementStatus.PLACED ) , Transformation.Orientation.MY ) )
xr2_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
doBreak( 1, 'Placed xr2_1' ) doBreak( 1, 'Placed xr2_1' )
a2_2.setTransformation( Transformation( toDbU(25.0) with UpdateSession():
, toDbU( 0.0) a2_2.setTransformation( Transformation( l(25.0)
, Transformation.Orientation.ID ) ) , l( 0.0)
a2_2.setPlacementStatus( Instance.PlacementStatus.PLACED ) , Transformation.Orientation.ID ) )
a2_2.setPlacementStatus( Instance.PlacementStatus.PLACED )
doBreak( 1, 'Placed a2_2' ) doBreak( 1, 'Placed a2_2' )
xr2_2.setTransformation( Transformation( toDbU( 45.0) with UpdateSession():
, toDbU(100.0) xr2_2.setTransformation( Transformation( l( 45.0)
, Transformation.Orientation.MY ) ) , l(100.0)
xr2_2.setPlacementStatus( Instance.PlacementStatus.PLACED ) , Transformation.Orientation.MY ) )
xr2_2.setPlacementStatus( Instance.PlacementStatus.PLACED )
doBreak( 1, 'Placed xr2_2' ) doBreak( 1, 'Placed xr2_2' )
o2_1.setTransformation( Transformation( toDbU(65.0) with UpdateSession():
, toDbU( 0.0) o2_1.setTransformation( Transformation( l(65.0)
, Transformation.Orientation.ID ) ) , l( 0.0)
o2_1.setPlacementStatus( Instance.PlacementStatus.PLACED ) , Transformation.Orientation.ID ) )
o2_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
doBreak( 1, 'Placed o2_1' ) doBreak( 1, 'Placed o2_1' )
# Add filler cells. # Add filler cells.
tie_x0 = af.getCell( 'tie_x0', Catalog.State.Views ) with UpdateSession():
rowend_x0 = af.getCell( 'rowend_x0', Catalog.State.Views ) tie_x0 = af.getCell( 'tie_x0', Catalog.State.Views )
filler_1 = Instance.create( fulladder, 'filler_1', tie_x0 ) rowend_x0 = af.getCell( 'rowend_x0', Catalog.State.Views )
filler_2 = Instance.create( fulladder, 'filler_2', rowend_x0 ) filler_1 = Instance.create( fulladder, 'filler_1', tie_x0 )
filler_2 = Instance.create( fulladder, 'filler_2', rowend_x0 )
filler_1.setTransformation( Transformation( toDbU(50.0) filler_1.setTransformation( Transformation( l(50.0)
, toDbU( 0.0) , l( 0.0)
, Transformation.Orientation.ID ) ) , Transformation.Orientation.ID ) )
filler_1.setPlacementStatus( Instance.PlacementStatus.PLACED ) filler_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
filler_2.setTransformation( Transformation( toDbU(60.0) filler_2.setTransformation( Transformation( l(60.0)
, toDbU( 0.0) , l( 0.0)
, Transformation.Orientation.ID ) ) , Transformation.Orientation.ID ) )
filler_2.setPlacementStatus( Instance.PlacementStatus.PLACED ) filler_2.setPlacementStatus( Instance.PlacementStatus.PLACED )
doBreak( 1, 'Filler cell placeds' ) doBreak( 1, 'Filler cell placeds' )
# Getting the layers. # Getting the layers.
@ -366,32 +368,30 @@ directory (under the the root of the |Coriolis| installation).
via12 = technology.getLayer( "VIA12" ) via12 = technology.getLayer( "VIA12" )
via23 = technology.getLayer( "VIA23" ) via23 = technology.getLayer( "VIA23" )
# Build wiring for a. with UpdateSession():
# Create RoutingPads first. # Build wiring for a.
rp1 = RoutingPad.create( a # Create RoutingPads first.
, Occurrence( xr2_1.getPlug( xr2_x2.getNet("i0")) ) rp1 = RoutingPad.create( a
, RoutingPad.BiggestArea ) , Occurrence( xr2_1.getPlug( xr2_x2.getNet("i0")) )
rp2 = RoutingPad.create( a , RoutingPad.BiggestArea )
, Occurrence( a2_1.getPlug( a2_x2.getNet("i0")) ) rp2 = RoutingPad.create( a
, RoutingPad.BiggestArea ) , Occurrence( a2_1.getPlug( a2_x2.getNet("i0")) )
, RoutingPad.BiggestArea )
# Then regular wiring. # Then regular wiring.
contact1 = Contact.create( rp1, via12, toDbU( 0.0), toDbU(-15.0) ) contact1 = Contact.create( rp1, via12, l( 0.0), l(-15.0) )
contact2 = Contact.create( rp2, via12, toDbU( 0.0), toDbU( 10.0) ) contact2 = Contact.create( rp2, via12, l( 0.0), l( 10.0) )
turn = Contact.create( a , via23, toDbU(10.0), toDbU( 35.0) ) turn = Contact.create( a , via23, l(10.0), l( 35.0) )
Horizontal.create( contact2, turn , metal2, toDbU(35.0), toDbU(2.0) ) Horizontal.create( contact2, turn , metal2, l(35.0), l(2.0) )
Vertical .create( turn , contact1 , metal3, toDbU(10.0), toDbU(2.0) ) Vertical .create( turn , contact1 , metal3, l(10.0), l(2.0) )
UpdateSession.close()
af.saveCell( fulladder, Catalog.State.Views ) af.saveCell( fulladder, Catalog.State.Views )
return
def scriptMain ( **kw ): def scriptMain ( **kw ):
"""The Mandatory function to be run by Coriolis interactively."""
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
buildFulladder( editor ) buildFulladder( editor )
return True return True

View File

@ -35,15 +35,15 @@ You can configure the placer in two ways:
.. code-block:: Python .. code-block:: Python
parametersTable = \ with overlay.CfgCache(priority=Cfg.Parameter.Priority.UserFile) as cfg:
( ("etesian.effort" , TypeEnumerate , 2 ) cfg.etesian.effort = 2
, ('etesian.uniformDensity' , TypeBool , True ) cfg.etesian.uniformDensity = True
, ('etesian.spaceMargin' , TypePercentage, 3.0 ) cfg.etesian.spaceMargin = 0.8
, ('etesian.aspectRatio' , TypePercentage, 100.0 ) cfg.etesian.aspectRatio = 1.0
)
With this setup, the cells will be spread uniformally over the With this setup, the cells will be spread uniformally over the
area (``etesian.uniformDensity``), with ``3.0%`` of free space area (``etesian.uniformDensity``), with ``80%`` of free space
added and an aspect ratio of ``100%`` (square shape). added and an aspect ratio of ``100%`` (square shape).
@ -87,7 +87,7 @@ previously. The call to the ToolEngines_ is made inside the new function
do not need the wrapper function ``doBreak()`` around the breakpoints. do not need the wrapper function ``doBreak()`` around the breakpoints.
We directly call Breakpoint_. We directly call Breakpoint_.
.. note:: The space margin for this example is very high (``30%``), it's only .. note:: The space margin for this example is very high (``80%``), it's only
because it's too small for the placer to run correctly. For normal because it's too small for the placer to run correctly. For normal
case it is around ``3%``. case it is around ``3%``.
@ -105,91 +105,82 @@ previously. The call to the ToolEngines_ is made inside the new function
# Everybody needs it. # Everybody needs it.
af = AllianceFramework.get() af = AllianceFramework.get()
def toDbU ( l ): return DbU.fromLambda(l)
def buildFulladder ( editor ): def buildFulladder ( editor ):
# Get the Framework and all the master cells.
# Get the Framework and all the master cells.
xr2_x2 = af.getCell( 'xr2_x1', Catalog.State.Views ) xr2_x2 = af.getCell( 'xr2_x1', Catalog.State.Views )
a2_x2 = af.getCell( 'a2_x2' , Catalog.State.Views ) a2_x2 = af.getCell( 'a2_x2' , Catalog.State.Views )
o2_x2 = af.getCell( 'o2_x2' , Catalog.State.Views ) o2_x2 = af.getCell( 'o2_x2' , Catalog.State.Views )
UpdateSession.open() with UpdateSession():
fulladder = af.createCell( 'fulladder' )
fulladder = af.createCell( 'fulladder' ) # Create Instances.
a2_1 = Instance.create( fulladder, 'a2_1', a2_x2 )
a2_2 = Instance.create( fulladder, 'a2_2', a2_x2 )
xr2_1 = Instance.create( fulladder, 'xr2_1', xr2_x2 )
xr2_2 = Instance.create( fulladder, 'xr2_2', xr2_x2 )
o2_1 = Instance.create( fulladder, 'o2_1', o2_x2 )
# Create Instances. # Create Nets.
a2_1 = Instance.create( fulladder, 'a2_1', a2_x2 ) vss = Net.create( fulladder, "vss" )
a2_2 = Instance.create( fulladder, 'a2_2', a2_x2 ) vss.setExternal( True )
xr2_1 = Instance.create( fulladder, 'xr2_1', xr2_x2 ) vss.setGlobal ( True )
xr2_2 = Instance.create( fulladder, 'xr2_2', xr2_x2 )
o2_1 = Instance.create( fulladder, 'o2_1', o2_x2 )
# Create Nets. vdd = Net.create( fulladder, "vdd" )
vss = Net.create( fulladder, "vss" ) vdd.setExternal( True )
vss.setExternal( True ) vdd.setGlobal ( True )
vss.setGlobal ( True )
vdd = Net.create( fulladder, "vdd" ) cin = Net.create( fulladder, "cin" )
vdd.setExternal( True ) cin.setExternal( True )
vdd.setGlobal ( True ) xr2_2.getPlug( xr2_x2.getNet('i0') ).setNet( cin )
a2_2 .getPlug( a2_x2.getNet('i0') ).setNet( cin )
cin = Net.create( fulladder, "cin" ) a = Net.create( fulladder, 'a' )
cin.setExternal( True ) a.setExternal( True )
xr2_2.getPlug( xr2_x2.getNet('i0') ).setNet( cin ) xr2_1.getPlug( xr2_x2.getNet('i0') ).setNet( a )
a2_2 .getPlug( a2_x2.getNet('i0') ).setNet( cin ) a2_1 .getPlug( a2_x2.getNet('i0') ).setNet( a )
a = Net.create( fulladder, 'a' ) b = Net.create( fulladder, 'b' )
a.setExternal( True ) b.setExternal( True )
xr2_1.getPlug( xr2_x2.getNet('i0') ).setNet( a ) xr2_1.getPlug( xr2_x2.getNet('i1') ).setNet( b )
a2_1 .getPlug( a2_x2.getNet('i0') ).setNet( a ) a2_1 .getPlug( a2_x2.getNet('i1') ).setNet( b )
b = Net.create( fulladder, 'b' ) sout_1 = Net.create( fulladder, 'sout_1' )
b.setExternal( True ) xr2_1.getPlug( xr2_x2.getNet('q' ) ).setNet( sout_1 )
xr2_1.getPlug( xr2_x2.getNet('i1') ).setNet( b ) xr2_2.getPlug( xr2_x2.getNet('i1') ).setNet( sout_1 )
a2_1 .getPlug( a2_x2.getNet('i1') ).setNet( b ) a2_2 .getPlug( a2_x2.getNet('i1') ).setNet( sout_1 )
sout_1 = Net.create( fulladder, 'sout_1' ) carry_1 = Net.create( fulladder, 'carry_1' )
xr2_1.getPlug( xr2_x2.getNet('q' ) ).setNet( sout_1 ) a2_1.getPlug( a2_x2.getNet('q' ) ).setNet( carry_1 )
xr2_2.getPlug( xr2_x2.getNet('i1') ).setNet( sout_1 ) o2_1.getPlug( o2_x2.getNet('i1') ).setNet( carry_1 )
a2_2 .getPlug( a2_x2.getNet('i1') ).setNet( sout_1 )
carry_1 = Net.create( fulladder, 'carry_1' ) carry_2 = Net.create( fulladder, 'carry_2' )
a2_1.getPlug( a2_x2.getNet('q' ) ).setNet( carry_1 ) a2_2.getPlug( a2_x2.getNet('q' ) ).setNet( carry_2 )
o2_1.getPlug( o2_x2.getNet('i1') ).setNet( carry_1 ) o2_1.getPlug( o2_x2.getNet('i0') ).setNet( carry_2 )
carry_2 = Net.create( fulladder, 'carry_2' ) sout = Net.create( fulladder, 'sout' )
a2_2.getPlug( a2_x2.getNet('q' ) ).setNet( carry_2 ) sout.setExternal( True )
o2_1.getPlug( o2_x2.getNet('i0') ).setNet( carry_2 ) xr2_2.getPlug( xr2_x2.getNet('q') ).setNet( sout )
sout = Net.create( fulladder, 'sout' ) cout = Net.create( fulladder, 'cout' )
sout.setExternal( True ) cout.setExternal( True )
xr2_2.getPlug( xr2_x2.getNet('q') ).setNet( sout ) o2_1.getPlug( o2_x2.getNet('q') ).setNet( cout )
cout = Net.create( fulladder, 'cout' )
cout.setExternal( True )
o2_1.getPlug( o2_x2.getNet('q') ).setNet( cout )
UpdateSession.close()
af.saveCell( fulladder, Catalog.State.Views ) af.saveCell( fulladder, Catalog.State.Views )
return fulladder return fulladder
def placeAndRoute ( editor, cell ): def placeAndRoute ( editor, cell ):
# Run the placer. # Run the placer.
etesian = Etesian.EtesianEngine.create(cell) etesian = Etesian.EtesianEngine.create(cell)
etesian.place() etesian.place()
if editor: if editor:
editor.setCell( cell ) editor.setCell( cell )
editor.fit() editor.fit()
Breakpoint.stop( 1, 'After placement' ) Breakpoint.stop( 1, 'After placement' )
# Run the router. # Run the router.
katana = Katana.KatanaEngine.create(cell) katana = Katana.KatanaEngine.create(cell)
katana.digitalInit () katana.digitalInit ()
katana.runGlobalRouter () katana.runGlobalRouter ()
@ -198,14 +189,12 @@ previously. The call to the ToolEngines_ is made inside the new function
katana.runNegociate ( Katana.Flags.NoFlags ) katana.runNegociate ( Katana.Flags.NoFlags )
af.saveCell( cell, Catalog.State.Views ) af.saveCell( cell, Catalog.State.Views )
return
def scriptMain ( **kw ): def scriptMain ( **kw ):
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
fulladder = buildFulladder( editor ) fulladder = buildFulladder( editor )
placeAndRoute( editor, fulladder ) placeAndRoute( editor, fulladder )
return True return True

Binary file not shown.

View File

@ -1,23 +0,0 @@
# -*- Mode:Python -*-
defaultStyle = 'Alliance.Classic [black]'
parametersTable = \
( ('misc.catchCore' , TypeBool , False )
, ('misc.info' , TypeBool , False )
, ('misc.paranoid' , TypeBool , False )
, ('misc.bug' , TypeBool , False )
, ('misc.logMode' , TypeBool , False )
, ('misc.verboseLevel1' , TypeBool , False )
, ('misc.verboseLevel2' , TypeBool , True )
, ('misc.traceLevel' , TypeInt , 1000 )
, ('etesian.spaceMargin' , TypePercentage, 30.0 )
, ('etesian.aspectRatio' , TypePercentage, 100.0 )
# Kite parameters.
, ("kite.eventsLimit" , TypeInt , 1000000 )
, ('katabatic.topRoutingLayer', TypeString , 'METAL5')
, ("kite.hTracksReservedLocal", TypeInt , 4 )
, ("kite.vTracksReservedLocal", TypeInt , 3 )
)

View File

@ -1 +0,0 @@
technology = 'symbolic/cmos'

View File

@ -4,6 +4,9 @@
install ( FILES invertor.py install ( FILES invertor.py
fulladder.py fulladder.py
polygons.py polygons.py
toolengines.py DESTINATION ${examplesInstallDir}/scripts ) diagonals.py
install ( DIRECTORY .coriolis2 DESTINATION ${examplesInstallDir}/scripts ) rectilinear.py
coriolisLogo.py
toolengines.py DESTINATION ${examplesInstallDir}/scripts )
install ( DIRECTORY coriolis2 DESTINATION ${examplesInstallDir}/scripts )

View File

@ -0,0 +1,38 @@
# -*- Mode:Python -*-
import os
import Cfg
import Viewer
import CRL
import symbolic.cmos
from helpers import overlay
#if 'CELLS_TOP' in os.environ:
# cellsTop = os.environ['CELLS_TOP']
#else:
# cellsTop = '../../../cells'
with overlay.CfgCache(priority=Cfg.Parameter.Priority.UserFile) as cfg:
cfg.misc.catchCore = False
cfg.misc.info = False
cfg.misc.paranoid = False
cfg.misc.bug = False
cfg.misc.logMode = True
cfg.misc.verboseLevel1 = True
cfg.misc.verboseLevel2 = True
cfg.misc.minTraceLevel = 1900
cfg.misc.maxTraceLevel = 3000
cfg.etesian.effort = 2
cfg.etesian.uniformDensity = True
cfg.etesian.spaceMargin = 0.8
cfg.etesian.aspectRatio = 1.0
cfg.katana.eventsLimit = 1000000
cfg.katana.termSatReservedLocal = 6
cfg.katana.termSatThreshold = 9
Viewer.Graphics.setStyle( 'Alliance.Classic [black]' )
#af = CRL.AllianceFramework.get()
#env = af.getEnvironment()
#env.setCLOCK( '^ck$|m_clock|^clk$' )
#env.addSYSTEM_LIBRARY( library=cellsTop+'/nsxlib', mode=CRL.Environment.Prepend )
#env.addSYSTEM_LIBRARY( library=cellsTop+'/niolib', mode=CRL.Environment.Prepend )

View File

@ -1,73 +1,61 @@
#!/usr/bin/python #!/usr/bin/python
import sys import sys
from Hurricane import * from Hurricane import DataBase, Box, Net, Vertical, Horizontal
from CRL import * from CRL import AllianceFramework, Catalog
from helpers import l
from helpers.overlay import UpdateSession
def toDbU ( l ): return DbU.fromLambda(l)
def doBreak ( level, message ):
UpdateSession.close()
Breakpoint.stop( level, message )
UpdateSession.open()
def drawLogo ( editor ): def drawLogo ( editor ):
UpdateSession.open() """Draw a small logo of Coriolis in GDS."""
with UpdateSession():
cell = AllianceFramework.get().createCell( 'coriolis_logo' ) cell = AllianceFramework.get().createCell( 'coriolis_logo' )
cell.setTerminal( True ) cell.setTerminalNetlist( True )
cell.setAbutmentBox( Box( l(-16.0), l(-16.0), l(76.0), l(76.0) ) )
cell.setAbutmentBox( Box( toDbU(-16.0), toDbU(-16.0), toDbU(76.0), toDbU(76.0) ) )
if editor: if editor:
UpdateSession.close() editor.setCell( cell )
editor.setCell( cell ) editor.fit()
editor.fit()
UpdateSession.open()
technology = DataBase.getDB().getTechnology() with UpdateSession():
metal1 = technology.getLayer( "metal1" ) technology = DataBase.getDB().getTechnology()
metal2 = technology.getLayer( "metal2" ) metal1 = technology.getLayer( "metal1" )
metal4 = technology.getLayer( "metal4" ) metal2 = technology.getLayer( "metal2" )
poly = technology.getLayer( "POLY" ) metal4 = technology.getLayer( "metal4" )
ptrans = technology.getLayer( "PTRANS" ) poly = technology.getLayer( "POLY" )
ntrans = technology.getLayer( "NTRANS" ) ptrans = technology.getLayer( "PTRANS" )
pdif = technology.getLayer( "PDIF" ) ntrans = technology.getLayer( "NTRANS" )
ndif = technology.getLayer( "NDIF" ) pdif = technology.getLayer( "PDIF" )
contdifn = technology.getLayer( "CONT_DIF_N" ) ndif = technology.getLayer( "NDIF" )
contdifp = technology.getLayer( "CONT_DIF_P" ) contdifn = technology.getLayer( "CONT_DIF_N" )
nwell = technology.getLayer( "NWELL" ) contdifp = technology.getLayer( "CONT_DIF_P" )
contpoly = technology.getLayer( "CONT_POLY" ) nwell = technology.getLayer( "NWELL" )
ntie = technology.getLayer( "NTIE" ) contpoly = technology.getLayer( "CONT_POLY" )
ntie = technology.getLayer( "NTIE" )
net = Net.create( cell, 'logo' ) net = Net.create( cell, 'logo' )
net.setExternal( True ) net.setExternal( True )
Vertical .create( net, metal1, toDbU(10.0), toDbU(12.0), toDbU( 4.0), toDbU(56.0) ) Vertical .create( net, metal1, l(10.0), l(12.0), l( 4.0), l(56.0) )
Horizontal.create( net, metal1, toDbU(50.0), toDbU(12.0), toDbU( 4.0), toDbU(56.0) ) Horizontal.create( net, metal1, l(50.0), l(12.0), l( 4.0), l(56.0) )
Vertical .create( net, metal1, toDbU(50.0), toDbU(12.0), toDbU(56.0), toDbU( 4.0) ) Vertical .create( net, metal1, l(50.0), l(12.0), l(56.0), l( 4.0) )
Horizontal.create( net, metal1, toDbU(10.0), toDbU(12.0), toDbU(56.0), toDbU( 4.0) ) Horizontal.create( net, metal1, l(10.0), l(12.0), l(56.0), l( 4.0) )
Vertical .create( net, metal1, toDbU(-6.0), toDbU(12.0), toDbU(22.0), toDbU(56.0) ) Vertical .create( net, metal1, l(-6.0), l(12.0), l(22.0), l(56.0) )
Horizontal.create( net, metal1, toDbU(66.0), toDbU(12.0), toDbU(22.0), toDbU(56.0) ) Horizontal.create( net, metal1, l(66.0), l(12.0), l(22.0), l(56.0) )
Vertical .create( net, metal1, toDbU(66.0), toDbU(12.0), toDbU(36.0), toDbU( 4.0) ) Vertical .create( net, metal1, l(66.0), l(12.0), l(36.0), l( 4.0) )
Horizontal.create( net, metal1, toDbU(-6.0), toDbU(12.0), toDbU(36.0), toDbU( 4.0) ) Horizontal.create( net, metal1, l(-6.0), l(12.0), l(36.0), l( 4.0) )
Horizontal.create( net, nwell, toDbU(30.0), toDbU(92.0), toDbU(-16.0), toDbU(76.0) ) Horizontal.create( net, nwell, l(30.0), l(92.0), l(-16.0), l(76.0) )
UpdateSession.close()
AllianceFramework.get().saveCell( cell, Catalog.State.Views ) AllianceFramework.get().saveCell( cell, Catalog.State.Views )
return
def scriptMain ( **kw ): def scriptMain ( **kw ):
"""The mandatory function to be called by Coriolis CGT/Unicorn."""
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
drawLogo( editor ) drawLogo( editor )
return True return True

View File

@ -1,34 +1,25 @@
#!/usr/bin/python #!/usr/bin/python
import sys import sys
from Hurricane import * from Hurricane import DataBase, DbU, Point, Box, Net, Vertical, Horizontal, Diagonal
from CRL import * from CRL import AllianceFramework, Catalog, Gds
from helpers import l
from helpers.overlay import UpdateSession
def toDbU ( l ): return DbU.fromLambda(l)
def doBreak ( level, message ):
UpdateSession.close()
Breakpoint.stop( level, message )
UpdateSession.open()
def buildDiagonals ( editor ): def buildDiagonals ( editor ):
DbU.setPolygonStep( toDbU(1.0) ) """Check the Diagonal segments of Hurricane."""
DbU.setPolygonStep( l(1.0) )
UpdateSession.open() with UpdateSession():
cell = AllianceFramework.get().createCell( 'diagonal' )
cell.setTerminalNetlist( True )
cell = AllianceFramework.get().createCell( 'diagonal' ) cell.setAbutmentBox( Box( l(-5.0), l(-5.0), l(65.0), l(75.0) ) )
cell.setTerminal( True )
cell.setAbutmentBox( Box( toDbU(-5.0), toDbU(-5.0), toDbU(65.0), toDbU(75.0) ) )
if editor: if editor:
UpdateSession.close() editor.setCell( cell )
editor.setCell( cell ) editor.fit()
editor.fit()
UpdateSession.open()
technology = DataBase.getDB().getTechnology() technology = DataBase.getDB().getTechnology()
metal1 = technology.getLayer( "metal1" ) metal1 = technology.getLayer( "metal1" )
@ -45,45 +36,42 @@ def buildDiagonals ( editor ):
contpoly = technology.getLayer( "CONT_POLY" ) contpoly = technology.getLayer( "CONT_POLY" )
ntie = technology.getLayer( "NTIE" ) ntie = technology.getLayer( "NTIE" )
with UpdateSession():
net = Net.create( cell, 'my_net' )
net.setExternal( True )
net = Net.create( cell, 'my_net' ) Diagonal.create( net, metal2
net.setExternal( True ) , Point( l(20.0), l(10.0) )
, Point( l(10.0), l(20.0) )
Diagonal.create( net, metal2 , l(4.0)
, Point( toDbU(20.0), toDbU(10.0) ) )
, Point( toDbU(10.0), toDbU(20.0) ) Vertical.create( net, metal2, l(10.0), l(4.0), l(20.0), l(30.0) )
, toDbU(4.0) Diagonal.create( net, metal2
) , Point( l(10.0), l(30.0) )
Vertical.create( net, metal2, toDbU(10.0), toDbU(4.0), toDbU(20.0), toDbU(30.0) ) , Point( l(20.0), l(40.0) )
Diagonal.create( net, metal2 , l(4.0)
, Point( toDbU(10.0), toDbU(30.0) ) )
, Point( toDbU(20.0), toDbU(40.0) ) Horizontal.create( net, metal2, l(40.0), l(4.0), l(20.0), l(30.0) )
, toDbU(4.0) Diagonal.create( net, metal2
) , Point( l(30.0), l(40.0) )
Horizontal.create( net, metal2, toDbU(40.0), toDbU(4.0), toDbU(20.0), toDbU(30.0) ) , Point( l(40.0), l(30.0) )
Diagonal.create( net, metal2 , l(4.0)
, Point( toDbU(30.0), toDbU(40.0) ) )
, Point( toDbU(40.0), toDbU(30.0) ) Vertical.create( net, metal2, l(40.0), l(4.0), l(30.0), l(20.0) )
, toDbU(4.0) Diagonal.create( net, metal2
) , Point( l(40.0), l(20.0) )
Vertical.create( net, metal2, toDbU(40.0), toDbU(4.0), toDbU(30.0), toDbU(20.0) ) , Point( l(30.0), l(10.0) )
Diagonal.create( net, metal2 , l(4.0)
, Point( toDbU(40.0), toDbU(20.0) ) )
, Point( toDbU(30.0), toDbU(10.0) ) Horizontal.create( net, metal2, l(10.0), l(4.0), l(30.0), l(20.0) )
, toDbU(4.0)
)
Horizontal.create( net, metal2, toDbU(10.0), toDbU(4.0), toDbU(30.0), toDbU(20.0) )
UpdateSession.close()
Gds.save( cell ) Gds.save( cell )
return
def scriptMain ( **kw ): def scriptMain ( **kw ):
"""The mandatory function to be called by Coriolis CGT/Unicorn."""
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
buildDiagonals( editor ) buildDiagonals( editor )
return True return True

View File

@ -1,172 +1,175 @@
#!/usr/bin/python #!/usr/bin/python
import sys import sys
from Hurricane import * from Hurricane import DataBase, Instance, Box, Net, Horizontal, Vertical, Contact, \
from CRL import * RoutingPad, Transformation, Occurrence, \
Breakpoint
from CRL import AllianceFramework, Catalog, Gds
def toDbU ( l ): return DbU.fromLambda(l) from helpers import l
from helpers.overlay import UpdateSession
def doBreak ( level, message ): def doBreak ( level, message ):
UpdateSession.close()
Breakpoint.stop( level, message ) Breakpoint.stop( level, message )
UpdateSession.open()
def buildFulladder ( editor ): def buildFulladder ( editor ):
"""
# Get the Framework and all the master cells. Build a full adder, place it, add filler cells and create routing
for the "a" net.
"""
# Get the Framework and all the master cells.
af = AllianceFramework.get() af = AllianceFramework.get()
xr2_x2 = af.getCell( 'xr2_x1', Catalog.State.Views ) xr2_x2 = af.getCell( 'xr2_x1', Catalog.State.Views )
a2_x2 = af.getCell( 'a2_x2' , Catalog.State.Views ) a2_x2 = af.getCell( 'a2_x2' , Catalog.State.Views )
o2_x2 = af.getCell( 'o2_x2' , Catalog.State.Views ) o2_x2 = af.getCell( 'o2_x2' , Catalog.State.Views )
UpdateSession.open() with UpdateSession():
fulladder = af.createCell( 'fulladder' )
fulladder = af.createCell( 'fulladder' ) fulladder.setAbutmentBox( Box( l(0.0), l(0.0), l(90.0), l(100.0) ) )
fulladder.setAbutmentBox( Box( toDbU(0.0), toDbU(0.0), toDbU(90.0), toDbU(100.0) ) )
if editor: if editor:
UpdateSession.close() editor.setCell( fulladder )
editor.setCell( fulladder ) editor.fit()
editor.fit()
UpdateSession.open()
# Create Instances. with UpdateSession():
a2_1 = Instance.create( fulladder, 'a2_1', a2_x2 ) # Create Instances.
a2_2 = Instance.create( fulladder, 'a2_2', a2_x2 ) a2_1 = Instance.create( fulladder, 'a2_1', a2_x2 )
xr2_1 = Instance.create( fulladder, 'xr2_1', xr2_x2 ) a2_2 = Instance.create( fulladder, 'a2_2', a2_x2 )
xr2_2 = Instance.create( fulladder, 'xr2_2', xr2_x2 ) xr2_1 = Instance.create( fulladder, 'xr2_1', xr2_x2 )
o2_1 = Instance.create( fulladder, 'o2_1', o2_x2 ) xr2_2 = Instance.create( fulladder, 'xr2_2', xr2_x2 )
o2_1 = Instance.create( fulladder, 'o2_1', o2_x2 )
# Create Nets. # Create Nets.
vss = Net.create( fulladder, "vss" ) vss = Net.create( fulladder, "vss" )
vss.setExternal( True ) vss.setExternal( True )
vss.setGlobal ( True ) vss.setGlobal ( True )
vdd = Net.create( fulladder, "vdd" ) vdd = Net.create( fulladder, "vdd" )
vdd.setExternal( True ) vdd.setExternal( True )
vdd.setGlobal ( True ) vdd.setGlobal ( True )
cin = Net.create( fulladder, "cin" ) cin = Net.create( fulladder, "cin" )
cin.setExternal( True ) cin.setExternal( True )
xr2_2.getPlug( xr2_x2.getNet('i0') ).setNet( cin ) xr2_2.getPlug( xr2_x2.getNet('i0') ).setNet( cin )
a2_2 .getPlug( a2_x2.getNet('i0') ).setNet( cin ) a2_2 .getPlug( a2_x2.getNet('i0') ).setNet( cin )
a = Net.create( fulladder, 'a' ) a = Net.create( fulladder, 'a' )
a.setExternal( True ) a.setExternal( True )
xr2_1.getPlug( xr2_x2.getNet('i0') ).setNet( a ) xr2_1.getPlug( xr2_x2.getNet('i0') ).setNet( a )
a2_1 .getPlug( a2_x2.getNet('i0') ).setNet( a ) a2_1 .getPlug( a2_x2.getNet('i0') ).setNet( a )
b = Net.create( fulladder, 'b' ) b = Net.create( fulladder, 'b' )
b.setExternal( True ) b.setExternal( True )
xr2_1.getPlug( xr2_x2.getNet('i1') ).setNet( b ) xr2_1.getPlug( xr2_x2.getNet('i1') ).setNet( b )
a2_1 .getPlug( a2_x2.getNet('i1') ).setNet( b ) a2_1 .getPlug( a2_x2.getNet('i1') ).setNet( b )
sout_1 = Net.create( fulladder, 'sout_1' ) sout_1 = Net.create( fulladder, 'sout_1' )
xr2_1.getPlug( xr2_x2.getNet('q' ) ).setNet( sout_1 ) xr2_1.getPlug( xr2_x2.getNet('q' ) ).setNet( sout_1 )
xr2_2.getPlug( xr2_x2.getNet('i1') ).setNet( sout_1 ) xr2_2.getPlug( xr2_x2.getNet('i1') ).setNet( sout_1 )
a2_2 .getPlug( a2_x2.getNet('i1') ).setNet( sout_1 ) a2_2 .getPlug( a2_x2.getNet('i1') ).setNet( sout_1 )
carry_1 = Net.create( fulladder, 'carry_1' ) carry_1 = Net.create( fulladder, 'carry_1' )
a2_1.getPlug( a2_x2.getNet('q' ) ).setNet( carry_1 ) a2_1.getPlug( a2_x2.getNet('q' ) ).setNet( carry_1 )
o2_1.getPlug( o2_x2.getNet('i1') ).setNet( carry_1 ) o2_1.getPlug( o2_x2.getNet('i1') ).setNet( carry_1 )
carry_2 = Net.create( fulladder, 'carry_2' ) carry_2 = Net.create( fulladder, 'carry_2' )
a2_2.getPlug( a2_x2.getNet('q' ) ).setNet( carry_2 ) a2_2.getPlug( a2_x2.getNet('q' ) ).setNet( carry_2 )
o2_1.getPlug( o2_x2.getNet('i0') ).setNet( carry_2 ) o2_1.getPlug( o2_x2.getNet('i0') ).setNet( carry_2 )
sout = Net.create( fulladder, 'sout' ) sout = Net.create( fulladder, 'sout' )
sout.setExternal( True ) sout.setExternal( True )
xr2_2.getPlug( xr2_x2.getNet('q') ).setNet( sout ) xr2_2.getPlug( xr2_x2.getNet('q') ).setNet( sout )
cout = Net.create( fulladder, 'cout' ) cout = Net.create( fulladder, 'cout' )
cout.setExternal( True ) cout.setExternal( True )
o2_1.getPlug( o2_x2.getNet('q') ).setNet( cout ) o2_1.getPlug( o2_x2.getNet('q') ).setNet( cout )
# Instances placement. with UpdateSession():
a2_1.setTransformation( Transformation( toDbU(0.0) # Instances placement.
, toDbU(0.0) a2_1.setTransformation( Transformation( l(0.0)
, Transformation.Orientation.ID ) ) , l(0.0)
a2_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Placed a2_1' )
xr2_1.setTransformation( Transformation( toDbU( 0.0)
, toDbU(100.0)
, Transformation.Orientation.MY ) )
xr2_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Placed xr2_1' )
a2_2.setTransformation( Transformation( toDbU(25.0)
, toDbU( 0.0)
, Transformation.Orientation.ID ) )
a2_2.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Placed a2_2' )
xr2_2.setTransformation( Transformation( toDbU( 45.0)
, toDbU(100.0)
, Transformation.Orientation.MY ) )
xr2_2.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Placed xr2_2' )
o2_1.setTransformation( Transformation( toDbU(65.0)
, toDbU( 0.0)
, Transformation.Orientation.ID ) )
o2_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Placed o2_1' )
# Add filler cells.
tie_x0 = af.getCell( 'tie_x0', Catalog.State.Views )
rowend_x0 = af.getCell( 'rowend_x0', Catalog.State.Views )
filler_1 = Instance.create( fulladder, 'filler_1', tie_x0 )
filler_2 = Instance.create( fulladder, 'filler_2', rowend_x0 )
filler_1.setTransformation( Transformation( toDbU(50.0)
, toDbU( 0.0)
, Transformation.Orientation.ID ) ) , Transformation.Orientation.ID ) )
filler_1.setPlacementStatus( Instance.PlacementStatus.PLACED ) a2_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Placed a2_1' )
filler_2.setTransformation( Transformation( toDbU(60.0) with UpdateSession():
, toDbU( 0.0) xr2_1.setTransformation( Transformation( l( 0.0)
, l(100.0)
, Transformation.Orientation.MY ) )
xr2_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Placed xr2_1' )
with UpdateSession():
a2_2.setTransformation( Transformation( l(25.0)
, l( 0.0)
, Transformation.Orientation.ID ) ) , Transformation.Orientation.ID ) )
filler_2.setPlacementStatus( Instance.PlacementStatus.PLACED ) a2_2.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Filler cell placeds' ) #doBreak( 1, 'Placed a2_2' )
#
# Getting the layers. with UpdateSession():
xr2_2.setTransformation( Transformation( l( 45.0)
, l(100.0)
, Transformation.Orientation.MY ) )
xr2_2.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Placed xr2_2' )
with UpdateSession():
o2_1.setTransformation( Transformation( l(65.0)
, l( 0.0)
, Transformation.Orientation.ID ) )
o2_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Placed o2_1' )
with UpdateSession():
# Add filler cells.
tie_x0 = af.getCell( 'tie_x0', Catalog.State.Views )
rowend_x0 = af.getCell( 'rowend_x0', Catalog.State.Views )
filler_1 = Instance.create( fulladder, 'filler_1', tie_x0 )
filler_2 = Instance.create( fulladder, 'filler_2', rowend_x0 )
filler_1.setTransformation( Transformation( l(50.0)
, l( 0.0)
, Transformation.Orientation.ID ) )
filler_1.setPlacementStatus( Instance.PlacementStatus.PLACED )
filler_2.setTransformation( Transformation( l(60.0)
, l( 0.0)
, Transformation.Orientation.ID ) )
filler_2.setPlacementStatus( Instance.PlacementStatus.PLACED )
#doBreak( 1, 'Filler cell placeds' )
# Getting the layers.
technology = DataBase.getDB().getTechnology() technology = DataBase.getDB().getTechnology()
metal2 = technology.getLayer( "METAL2" ) metal2 = technology.getLayer( "METAL2" )
metal3 = technology.getLayer( "METAL3" ) metal3 = technology.getLayer( "METAL3" )
via12 = technology.getLayer( "VIA12" ) via12 = technology.getLayer( "VIA12" )
via23 = technology.getLayer( "VIA23" ) via23 = technology.getLayer( "VIA23" )
# Build wiring for a. with UpdateSession():
# Create RoutingPads first. # Build wiring for a.
rp1 = RoutingPad.create( a # Create RoutingPads first.
, Occurrence( xr2_1.getPlug( xr2_x2.getNet("i0")) ) rp1 = RoutingPad.create( a
, RoutingPad.BiggestArea ) , Occurrence( xr2_1.getPlug( xr2_x2.getNet("i0")) )
rp2 = RoutingPad.create( a , RoutingPad.BiggestArea )
, Occurrence( a2_1.getPlug( a2_x2.getNet("i0")) ) rp2 = RoutingPad.create( a
, RoutingPad.BiggestArea ) , Occurrence( a2_1.getPlug( a2_x2.getNet("i0")) )
, RoutingPad.BiggestArea )
# Then regular wiring. # Then regular wiring.
contact1 = Contact.create( rp1, via12, toDbU( 0.0), toDbU(-15.0) ) contact1 = Contact.create( rp1, via12, l( 0.0), l(-15.0) )
contact2 = Contact.create( rp2, via12, toDbU( 0.0), toDbU( 10.0) ) contact2 = Contact.create( rp2, via12, l( 0.0), l( 10.0) )
turn = Contact.create( a , via23, toDbU(10.0), toDbU( 35.0) ) turn = Contact.create( a , via23, l(10.0), l( 35.0) )
Horizontal.create( contact2, turn , metal2, toDbU(35.0), toDbU(2.0) ) Horizontal.create( contact2, turn , metal2, l(35.0), l(2.0) )
Vertical .create( turn , contact1, metal3, toDbU(10.0), toDbU(2.0) ) Vertical .create( turn , contact1, metal3, l(10.0), l(2.0) )
UpdateSession.close()
af.saveCell( fulladder, Catalog.State.Views ) af.saveCell( fulladder, Catalog.State.Views )
Gds.save( fulladder ) Gds.save( fulladder )
return
def scriptMain ( **kw ): def scriptMain ( **kw ):
"""The mandatory function to be called by Coriolis CGT/Unicorn."""
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
buildFulladder( editor ) buildFulladder( editor )
return True return True

View File

@ -1,32 +1,28 @@
#!/usr/bin/python #!/usr/bin/python
import sys import sys
from Hurricane import * from Hurricane import DataBase, NetExternalComponents, Net, \
from CRL import * DbU, Point, Box, Horizontal, Vertical, Contact, RoutingPad, \
Breakpoint
from CRL import AllianceFramework, Catalog
def toDbU ( l ): return DbU.fromLambda(l) from helpers import l
from helpers.overlay import UpdateSession
def doBreak ( level, message ): def doBreak ( level, message ):
UpdateSession.close() """Put a breakpoint into the script."""
Breakpoint.stop( level, message ) Breakpoint.stop( level, message )
UpdateSession.open()
def buildInvertor ( editor ): def buildInvertor ( editor ):
UpdateSession.open() """Build step by step an invertor standard cell."""
with UpdateSession():
cell = AllianceFramework.get().createCell( 'invertor' ) cell = AllianceFramework.get().createCell( 'invertor' )
cell.setTerminal( True ) cell.setTerminalNetlist( True )
cell.setAbutmentBox( Box( l(0.0), l(0.0), l(15.0), l(50.0) ) )
cell.setAbutmentBox( Box( toDbU(0.0), toDbU(0.0), toDbU(15.0), toDbU(50.0) ) )
if editor: if editor:
UpdateSession.close() editor.setCell( cell )
editor.setCell( cell ) editor.fit()
editor.fit()
UpdateSession.open()
technology = DataBase.getDB().getTechnology() technology = DataBase.getDB().getTechnology()
metal1 = technology.getLayer( "METAL1" ) metal1 = technology.getLayer( "METAL1" )
@ -41,61 +37,62 @@ def buildInvertor ( editor ):
contpoly = technology.getLayer( "CONT_POLY" ) contpoly = technology.getLayer( "CONT_POLY" )
ntie = technology.getLayer( "NTIE" ) ntie = technology.getLayer( "NTIE" )
net = Net.create( cell, "nwell" ) with UpdateSession():
Vertical.create( net, nwell, toDbU(7.5), toDbU(15.0), toDbU(27.0), toDbU(51.0) ) net = Net.create( cell, "nwell" )
Vertical.create( net, nwell, l(7.5), l(15.0), l(27.0), l(51.0) )
vdd = Net.create( cell, "vdd" ) vdd = Net.create( cell, "vdd" )
vdd.setExternal( True ) vdd.setExternal( True )
vdd.setGlobal ( True ) vdd.setGlobal ( True )
h = Horizontal.create(vdd, metal1, toDbU(47.0), toDbU(6.0), toDbU(0.0), toDbU(15.0) ) h = Horizontal.create(vdd, metal1, l(47.0), l(6.0), l(0.0), l(15.0) )
NetExternalComponents.setExternal( h ) NetExternalComponents.setExternal( h )
Contact.create ( vdd, contdifn, toDbU(10.0), toDbU(47.0), toDbU( 1.0), toDbU( 1.0) ) Contact.create ( vdd, contdifn, l(10.0), l(47.0), l( 1.0), l( 1.0) )
Contact.create ( vdd, contdifp, toDbU( 4.0), toDbU(45.0), toDbU( 1.0), toDbU( 1.0) ) Contact.create ( vdd, contdifp, l( 4.0), l(45.0), l( 1.0), l( 1.0) )
Vertical.create( vdd, pdif , toDbU( 3.5), toDbU( 4.0), toDbU(28.0), toDbU(46.0) ) Vertical.create( vdd, pdif , l( 3.5), l( 4.0), l(28.0), l(46.0) )
Vertical.create( vdd, ntie , toDbU(10.0), toDbU( 3.0), toDbU(43.0), toDbU(48.0) ) Vertical.create( vdd, ntie , l(10.0), l( 3.0), l(43.0), l(48.0) )
doBreak( 1, 'Done building vdd.' ) doBreak( 1, 'Done building vdd.' )
vss = Net.create( cell, "vss" ) with UpdateSession():
vss.setExternal( True ) vss = Net.create( cell, "vss" )
vss.setGlobal ( True ) vss.setExternal( True )
h = Horizontal.create(vss, metal1, toDbU(3.0), toDbU(6.0), toDbU(0.0), toDbU(15.0)) vss.setGlobal ( True )
NetExternalComponents.setExternal( h ) h = Horizontal.create(vss, metal1, l(3.0), l(6.0), l(0.0), l(15.0))
Vertical.create( vss, ndif , toDbU(3.5), toDbU(4.0), toDbU(4.0), toDbU(12.0) ) NetExternalComponents.setExternal( h )
Contact.create ( vss, contdifn, toDbU(4.0), toDbU(5.0), toDbU(1.0), toDbU( 1.0) ) Vertical.create( vss, ndif , l(3.5), l(4.0), l(4.0), l(12.0) )
Contact.create ( vss, contdifn, l(4.0), l(5.0), l(1.0), l( 1.0) )
doBreak( 1, 'Done building vss.' ) doBreak( 1, 'Done building vss.' )
i = Net.create( cell, "i" ) with UpdateSession():
i.setExternal( True ) i = Net.create( cell, "i" )
v = Vertical.create ( i, metal1, toDbU(5.0), toDbU(2.0), toDbU(10.0), toDbU(40.0) ) i.setExternal( True )
NetExternalComponents.setExternal( v ) v = Vertical.create ( i, metal1, l(5.0), l(2.0), l(10.0), l(40.0) )
Vertical.create ( i, ptrans , toDbU( 7.0), toDbU( 1.0), toDbU(26.0), toDbU(39.0) ) NetExternalComponents.setExternal( v )
Vertical.create ( i, ntrans , toDbU( 7.0), toDbU( 1.0), toDbU( 6.0), toDbU(14.0) ) Vertical.create ( i, ptrans , l( 7.0), l( 1.0), l(26.0), l(39.0) )
Vertical.create ( i, poly , toDbU( 7.0), toDbU( 1.0), toDbU(14.0), toDbU(26.0) ) Vertical.create ( i, ntrans , l( 7.0), l( 1.0), l( 6.0), l(14.0) )
Horizontal.create( i, poly , toDbU(20.0), toDbU( 3.0), toDbU( 4.0), toDbU( 7.0) ) Vertical.create ( i, poly , l( 7.0), l( 1.0), l(14.0), l(26.0) )
Contact.create ( i, contpoly, toDbU( 5.0), toDbU(20.0), toDbU( 1.0), toDbU( 1.0) ) Horizontal.create( i, poly , l(20.0), l( 3.0), l( 4.0), l( 7.0) )
Contact.create ( i, contpoly, l( 5.0), l(20.0), l( 1.0), l( 1.0) )
doBreak( 1, 'Done building i.' ) doBreak( 1, 'Done building i.' )
nq = Net.create ( cell, "nq" ) with UpdateSession():
nq.setExternal( True ) nq = Net.create ( cell, "nq" )
v = Vertical.create( nq, metal1, toDbU(10.0), toDbU(2.0), toDbU(10.0), toDbU(40.0) ) nq.setExternal( True )
NetExternalComponents.setExternal( v ) v = Vertical.create( nq, metal1, l(10.0), l(2.0), l(10.0), l(40.0) )
Vertical.create( nq, pdif , toDbU(10.0), toDbU( 3.0), toDbU(28.0), toDbU(37.0) ) NetExternalComponents.setExternal( v )
Vertical.create( nq, ndif , toDbU(10.0), toDbU( 3.0), toDbU( 8.0), toDbU(12.0) ) Vertical.create( nq, pdif , l(10.0), l( 3.0), l(28.0), l(37.0) )
Contact.create ( nq, contdifp, toDbU(10.0), toDbU(35.0), toDbU( 1.0), toDbU( 1.0) ) Vertical.create( nq, ndif , l(10.0), l( 3.0), l( 8.0), l(12.0) )
Contact.create ( nq, contdifp, toDbU(10.0), toDbU(30.5), toDbU( 1.0), toDbU( 1.0) ) Contact.create ( nq, contdifp, l(10.0), l(35.0), l( 1.0), l( 1.0) )
Contact.create ( nq, contdifn, toDbU(10.0), toDbU(10.0), toDbU( 1.0), toDbU( 1.0) ) Contact.create ( nq, contdifp, l(10.0), l(30.5), l( 1.0), l( 1.0) )
Contact.create ( nq, contdifn, l(10.0), l(10.0), l( 1.0), l( 1.0) )
doBreak( 1, 'Done building q.' ) doBreak( 1, 'Done building q.' )
UpdateSession.close()
AllianceFramework.get().saveCell( cell, Catalog.State.Views ) AllianceFramework.get().saveCell( cell, Catalog.State.Views )
return
def scriptMain ( **kw ): def scriptMain ( **kw ):
"""The mandatory function to be called by Coriolis CGT/Unicorn."""
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
buildInvertor( editor ) buildInvertor( editor )
return True return True

View File

@ -1,36 +1,24 @@
#!/usr/bin/python #!/usr/bin/python
import sys import sys
from Hurricane import * from Hurricane import DataBase, NetExternalComponents, Net, \
from CRL import * DbU, Point, Box, Polygon
from CRL import AllianceFramework, Catalog, Gds
from helpers import l, u
def toDbU ( l ): return DbU.fromLambda(l) from helpers.overlay import UpdateSession
def toMicron ( u ): return DbU.toPhysical( u, DbU.UnitPowerMicro )
def doBreak ( level, message ):
UpdateSession.close()
Breakpoint.stop( level, message )
UpdateSession.open()
def buildPolygons ( editor ): def buildPolygons ( editor ):
#DbU.setPolygonStep( toDbU(0.1) ) """Draw a set of Polygons checking all possible combination."""
#DbU.setPolygonStep( l(0.1) )
UpdateSession.open() with UpdateSession():
cell = AllianceFramework.get().createCell( 'polygons' )
cell = AllianceFramework.get().createCell( 'polygons' ) cell.setTerminalNetlist( True )
cell.setTerminal( True ) cell.setAbutmentBox( Box( l(-5.0), l(-5.0), l(65.0), l(75.0) ) )
#cell.setAbutmentBox( Box( l(-5.0), l(-5.0), l(21.0), l(35.0) ) )
cell.setAbutmentBox( Box( toDbU(-5.0), toDbU(-5.0), toDbU(65.0), toDbU(75.0) ) )
#cell.setAbutmentBox( Box( toDbU(-5.0), toDbU(-5.0), toDbU(21.0), toDbU(35.0) ) )
if editor: if editor:
UpdateSession.close() editor.setCell( cell )
editor.setCell( cell ) editor.fit()
editor.fit()
UpdateSession.open()
technology = DataBase.getDB().getTechnology() technology = DataBase.getDB().getTechnology()
metal1 = technology.getLayer( "METAL1" ) metal1 = technology.getLayer( "METAL1" )
@ -48,124 +36,117 @@ def buildPolygons ( editor ):
contpoly = technology.getLayer( "CONT_POLY" ) contpoly = technology.getLayer( "CONT_POLY" )
ntie = technology.getLayer( "NTIE" ) ntie = technology.getLayer( "NTIE" )
with UpdateSession():
net = Net.create( cell, 'my_net' )
net.setExternal( True )
#points = [ Point( l( 0.0), l( 0.0) )
# , Point( l( 10.0), l( 0.0) )
# , Point( l( 7.0), l( 8.0) )
# , Point( l( 3.0), l( 8.0) ) ]
#p = Polygon.create( net, metal4, points )
net = Net.create( cell, 'my_net' ) # Counter-clockwise, slope > 1.
net.setExternal( True ) points = [ Point( l( 3.0), l( 0.0) )
#points = [ Point( toDbU( 0.0), toDbU( 0.0) ) , Point( l( 13.0), l( 0.0) )
# , Point( toDbU( 10.0), toDbU( 0.0) ) , Point( l( 16.0), l( 10.0) )
# , Point( toDbU( 7.0), toDbU( 8.0) ) , Point( l( 16.0), l( 20.0) )
# , Point( toDbU( 3.0), toDbU( 8.0) ) ] , Point( l( 13.0), l( 30.0) )
#p = Polygon.create( net, metal4, points ) , Point( l( 3.0), l( 30.0) )
, Point( l( 0.0), l( 20.0) )
, Point( l( 0.0), l( 10.0) ) ]
p = Polygon.create( net, metal2, points )
#p.translate( l(40.0), l(0.0) )
# Counter-clockwise, slope > 1. # clockwise, slope > 1.
points = [ Point( toDbU( 3.0), toDbU( 0.0) ) points = [ Point( l( 0.0), l( 10.0) )
, Point( toDbU( 13.0), toDbU( 0.0) ) , Point( l( 0.0), l( 20.0) )
, Point( toDbU( 16.0), toDbU( 10.0) ) , Point( l( 3.0), l( 30.0) )
, Point( toDbU( 16.0), toDbU( 20.0) ) , Point( l( 13.0), l( 30.0) )
, Point( toDbU( 13.0), toDbU( 30.0) ) , Point( l( 16.0), l( 20.0) )
, Point( toDbU( 3.0), toDbU( 30.0) ) , Point( l( 16.0), l( 10.0) )
, Point( toDbU( 0.0), toDbU( 20.0) ) , Point( l( 13.0), l( 0.0) )
, Point( toDbU( 0.0), toDbU( 10.0) ) ] , Point( l( 3.0), l( 0.0) ) ]
p = Polygon.create( net, metal2, points ) p = Polygon.create( net, metal2, points )
#p.translate( toDbU(40.0), toDbU(0.0) ) p.translate( l(0.0), l(40.0) )
# clockwise, slope > 1. # Counter-clockwise, slope < 1.
points = [ Point( toDbU( 0.0), toDbU( 10.0) ) points = [ Point( l( 10.0), l( 0.0) )
, Point( toDbU( 0.0), toDbU( 20.0) ) , Point( l( 20.0), l( 0.0) )
, Point( toDbU( 3.0), toDbU( 30.0) ) , Point( l( 30.0), l( 3.0) )
, Point( toDbU( 13.0), toDbU( 30.0) ) , Point( l( 30.0), l( 13.0) )
, Point( toDbU( 16.0), toDbU( 20.0) ) , Point( l( 20.0), l( 16.0) )
, Point( toDbU( 16.0), toDbU( 10.0) ) , Point( l( 10.0), l( 16.0) )
, Point( toDbU( 13.0), toDbU( 0.0) ) , Point( l( 0.0), l( 13.0) )
, Point( toDbU( 3.0), toDbU( 0.0) ) ] , Point( l( 0.0), l( 3.0) ) ]
p = Polygon.create( net, metal2, points ) p = Polygon.create( net, metal2, points )
p.translate( toDbU(0.0), toDbU(40.0) ) p.translate( l(30.0), l(0.0) )
# Counter-clockwise, slope < 1. # clockwise.
points = [ Point( toDbU( 10.0), toDbU( 0.0) ) points = [ Point( l( 0.0), l( 3.0) )
, Point( toDbU( 20.0), toDbU( 0.0) ) , Point( l( 0.0), l( 13.0) )
, Point( toDbU( 30.0), toDbU( 3.0) ) , Point( l( 10.0), l( 16.0) )
, Point( toDbU( 30.0), toDbU( 13.0) ) , Point( l( 20.0), l( 16.0) )
, Point( toDbU( 20.0), toDbU( 16.0) ) , Point( l( 30.0), l( 13.0) )
, Point( toDbU( 10.0), toDbU( 16.0) ) , Point( l( 30.0), l( 3.0) )
, Point( toDbU( 0.0), toDbU( 13.0) ) , Point( l( 20.0), l( 0.0) )
, Point( toDbU( 0.0), toDbU( 3.0) ) ] , Point( l( 10.0), l( 0.0) ) ]
p = Polygon.create( net, metal2, points ) p = Polygon.create( net, metal2, points )
p.translate( toDbU(30.0), toDbU(0.0) ) p.translate( l(30.0), l(40.0) )
# clockwise. # Big parallelogram.
points = [ Point( toDbU( 0.0), toDbU( 3.0) ) points = [ Point( l( 0.0), l( 0.0) )
, Point( toDbU( 0.0), toDbU( 13.0) ) , Point( l( 20.0), l( 20.0) )
, Point( toDbU( 10.0), toDbU( 16.0) ) , Point( l( 60.0), l( 20.0) )
, Point( toDbU( 20.0), toDbU( 16.0) ) , Point( l( 40.0), l( 0.0) ) ]
, Point( toDbU( 30.0), toDbU( 13.0) ) p = Polygon.create( net, metal3, points )
, Point( toDbU( 30.0), toDbU( 3.0) ) p.translate( l(70.0), l(0.0) )
, Point( toDbU( 20.0), toDbU( 0.0) )
, Point( toDbU( 10.0), toDbU( 0.0) ) ]
p = Polygon.create( net, metal2, points )
p.translate( toDbU(30.0), toDbU(40.0) )
# Big parallelogram. points = [ Point( l( 0.0), l( 20.0) )
points = [ Point( toDbU( 0.0), toDbU( 0.0) ) , Point( l( 40.0), l( 20.0) )
, Point( toDbU( 20.0), toDbU( 20.0) ) , Point( l( 60.0), l( 0.0) )
, Point( toDbU( 60.0), toDbU( 20.0) ) , Point( l( 20.0), l( 0.0) ) ]
, Point( toDbU( 40.0), toDbU( 0.0) ) ] p = Polygon.create( net, metal3, points )
p = Polygon.create( net, metal3, points ) p.translate( l(140.0), l(0.0) )
p.translate( toDbU(70.0), toDbU(0.0) )
points = [ Point( toDbU( 0.0), toDbU( 20.0) ) points = [ Point( l( 0.0), l( 0.0) )
, Point( toDbU( 40.0), toDbU( 20.0) ) , Point( l( 0.0), l( 10.0) )
, Point( toDbU( 60.0), toDbU( 0.0) ) , Point( l( 20.0), l( 30.0) )
, Point( toDbU( 20.0), toDbU( 0.0) ) ] , Point( l( 60.0), l( 30.0) )
p = Polygon.create( net, metal3, points ) , Point( l( 60.0), l( 20.0) )
p.translate( toDbU(140.0), toDbU(0.0) ) , Point( l( 40.0), l( 0.0) ) ]
p = Polygon.create( net, metal3, points )
p.translate( l(70.0), l(40.0) )
points = [ Point( toDbU( 0.0), toDbU( 0.0) ) points = [ Point( l( 0.0), l( 20.0) )
, Point( toDbU( 0.0), toDbU( 10.0) ) , Point( l( 0.0), l( 30.0) )
, Point( toDbU( 20.0), toDbU( 30.0) ) , Point( l( 40.0), l( 30.0) )
, Point( toDbU( 60.0), toDbU( 30.0) ) , Point( l( 60.0), l( 10.0) )
, Point( toDbU( 60.0), toDbU( 20.0) ) , Point( l( 60.0), l( 0.0) )
, Point( toDbU( 40.0), toDbU( 0.0) ) ] , Point( l( 20.0), l( 0.0) ) ]
p = Polygon.create( net, metal3, points ) p = Polygon.create( net, metal3, points )
p.translate( toDbU(70.0), toDbU(40.0) ) p.translate( l(140.0), l(40.0) )
points = [ Point( toDbU( 0.0), toDbU( 20.0) ) print( 'Normalized and manhattanized contour:' )
, Point( toDbU( 0.0), toDbU( 30.0) ) i = 0
, Point( toDbU( 40.0), toDbU( 30.0) ) for point in p.getMContour():
, Point( toDbU( 60.0), toDbU( 10.0) ) print( '| %d '%i, point, '[%fum %fum]' % ( u(point.getX()), u(point.getY()) ))
, Point( toDbU( 60.0), toDbU( 0.0) ) i += 1
, Point( toDbU( 20.0), toDbU( 0.0) ) ]
p = Polygon.create( net, metal3, points )
p.translate( toDbU(140.0), toDbU(40.0) )
print( 'Sub-polygons (for GDSII generation)' )
print 'Normalized and manhattanized contour:' subpolygons = p.getSubPolygons()
i = 0 for i in range(len(subpolygons)):
for point in p.getMContour(): print( '+ Sub-Polygon %d:' % i )
print '| %d '%i, point \ for j in range(len(subpolygons[i])):
, '[%fum %fum]' % ( toMicron(point.getX()) \ print( ' [%3d]' % j, subpolygons[i][j] \
, toMicron(point.getY()) ) , '[%fum %fum]' % ( u(subpolygons[i][j].getX()), u(subpolygons[i][j].getY()) ))
i += 1
print 'Sub-polygons (for GDSII generation)'
subpolygons = p.getSubPolygons()
for i in range(len(subpolygons)):
print '+ Sub-Polygon %d:' % i
for j in range(len(subpolygons[i])):
print ' [%3d]' % j, subpolygons[i][j] \
, '[%fum %fum]' % ( toMicron(subpolygons[i][j].getX()) \
, toMicron(subpolygons[i][j].getY()) )
UpdateSession.close()
Gds.save( cell ) Gds.save( cell )
return
def scriptMain ( **kw ): def scriptMain ( **kw ):
"""The mandatory function to be called by Coriolis CGT/Unicorn."""
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
buildPolygons( editor ) buildPolygons( editor )
return True return True

View File

@ -1,34 +1,23 @@
#!/usr/bin/python #!/usr/bin/python
import sys import sys
from Hurricane import * from Hurricane import DataBase, Net, \
from CRL import * DbU, Point, Box, Rectilinear
from CRL import AllianceFramework, Catalog, Gds
from helpers import l, u
def toDbU ( l ): return DbU.fromLambda(l) from helpers.overlay import UpdateSession
def toMicron ( u ): return DbU.toPhysical( u, DbU.UnitPowerMicro )
def doBreak ( level, message ):
UpdateSession.close()
Breakpoint.stop( level, message )
UpdateSession.open()
def buildRectilinear ( editor ): def buildRectilinear ( editor ):
UpdateSession.open() """Check Hurricane.Rectilinear class."""
with UpdateSession():
cell = AllianceFramework.get().createCell( 'Rectilinear' ) cell = AllianceFramework.get().createCell( 'Rectilinear' )
cell.setTerminal( True ) cell.setTerminalNetlist( True )
cell.setAbutmentBox( Box( l(-5.0), l(-5.0), l(65.0), l(75.0) ) )
cell.setAbutmentBox( Box( toDbU(-5.0), toDbU(-5.0), toDbU(65.0), toDbU(75.0) ) ) #cell.setAbutmentBox( Box( l(-5.0), l(-5.0), l(21.0), l(35.0) ) )
#cell.setAbutmentBox( Box( toDbU(-5.0), toDbU(-5.0), toDbU(21.0), toDbU(35.0) ) )
if editor: if editor:
UpdateSession.close() editor.setCell( cell )
editor.setCell( cell ) editor.fit()
editor.fit()
UpdateSession.open()
technology = DataBase.getDB().getTechnology() technology = DataBase.getDB().getTechnology()
metal1 = technology.getLayer( "METAL1" ) metal1 = technology.getLayer( "METAL1" )
@ -46,37 +35,32 @@ def buildRectilinear ( editor ):
contpoly = technology.getLayer( "CONT_POLY" ) contpoly = technology.getLayer( "CONT_POLY" )
ntie = technology.getLayer( "NTIE" ) ntie = technology.getLayer( "NTIE" )
with UpdateSession():
net = Net.create( cell, 'my_net' )
net.setExternal( True )
net = Net.create( cell, 'my_net' ) points = [ Point( l( 0.0), l( 0.0) )
net.setExternal( True ) , Point( l( 0.0), l( 10.0) )
, Point( l( 20.0), l( 30.0) )
points = [ Point( toDbU( 0.0), toDbU( 0.0) ) , Point( l( 30.0), l( 30.0) )
, Point( toDbU( 0.0), toDbU( 10.0) ) , Point( l( 30.0), l( 20.0) )
, Point( toDbU( 20.0), toDbU( 30.0) ) , Point( l( 10.0), l( 0.0) ) ]
, Point( toDbU( 30.0), toDbU( 30.0) ) r = Rectilinear.create( net, metal2, points )
, Point( toDbU( 30.0), toDbU( 20.0) )
, Point( toDbU( 10.0), toDbU( 0.0) ) ]
r = Rectilinear.create( net, metal2, points )
#print 'Normalized and manhattanized contour:' #print( 'Normalized and manhattanized contour:' )
#i = 0 #i = 0
#for point in p.getMContour(): #for point in p.getMContour():
# print '| %d '%i, point \ # print( '| %d '%i, point, '[%fum %fum]' % ( u(point.getX()), u(point.getY()) ))
# , '[%fum %fum]' % ( toMicron(point.getX()) \ # i += 1
# , toMicron(point.getY()) )
# i += 1
UpdateSession.close()
Gds.save( cell ) Gds.save( cell )
return
def scriptMain ( **kw ): def scriptMain ( **kw ):
"""The mandatory function to be called by Coriolis CGT/Unicorn."""
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
buildRectilinear( editor ) buildRectilinear( editor )
return True return True

View File

@ -1,8 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
import sys import sys
from Hurricane import * from Hurricane import Instance, Net, Horizontal, Vertical, Contact, \
from CRL import * RoutingPad, Transformation, \
Breakpoint
from CRL import AllianceFramework, Catalog
from helpers import l
from helpers.overlay import UpdateSession
import Etesian import Etesian
import Anabatic import Anabatic
import Katana import Katana
@ -11,112 +15,109 @@ import Katana
af = AllianceFramework.get() af = AllianceFramework.get()
def toDbU ( l ): return DbU.fromLambda(l)
def doBreak ( level, message ): def doBreak ( level, message ):
UpdateSession.close()
Breakpoint.stop( level, message ) Breakpoint.stop( level, message )
UpdateSession.open()
def buildFulladder ( editor ): def buildFulladder ( editor ):
"""Build the netlist of a full adder."""
# Get the Framework and all the master cells. # Get the Framework and all the master cells.
xr2_x2 = af.getCell( 'xr2_x1', Catalog.State.Views ) xr2_x2 = af.getCell( 'xr2_x1', Catalog.State.Views )
a2_x2 = af.getCell( 'a2_x2' , Catalog.State.Views ) a2_x2 = af.getCell( 'a2_x2' , Catalog.State.Views )
o2_x2 = af.getCell( 'o2_x2' , Catalog.State.Views ) o2_x2 = af.getCell( 'o2_x2' , Catalog.State.Views )
UpdateSession.open() with UpdateSession():
fulladder = af.createCell( 'fulladder' )
fulladder = af.createCell( 'fulladder' ) # Create Instances.
a2_1 = Instance.create( fulladder, 'a2_1', a2_x2 )
a2_2 = Instance.create( fulladder, 'a2_2', a2_x2 )
xr2_1 = Instance.create( fulladder, 'xr2_1', xr2_x2 )
xr2_2 = Instance.create( fulladder, 'xr2_2', xr2_x2 )
o2_1 = Instance.create( fulladder, 'o2_1', o2_x2 )
# Create Instances. # Create Nets.
a2_1 = Instance.create( fulladder, 'a2_1', a2_x2 ) vss = Net.create( fulladder, "vss" )
a2_2 = Instance.create( fulladder, 'a2_2', a2_x2 ) vss.setExternal( True )
xr2_1 = Instance.create( fulladder, 'xr2_1', xr2_x2 ) vss.setGlobal ( True )
xr2_2 = Instance.create( fulladder, 'xr2_2', xr2_x2 )
o2_1 = Instance.create( fulladder, 'o2_1', o2_x2 )
# Create Nets. vdd = Net.create( fulladder, "vdd" )
vss = Net.create( fulladder, "vss" ) vdd.setExternal( True )
vss.setExternal( True ) vdd.setGlobal ( True )
vss.setGlobal ( True )
vdd = Net.create( fulladder, "vdd" ) cin = Net.create( fulladder, "cin" )
vdd.setExternal( True ) cin.setExternal( True )
vdd.setGlobal ( True ) xr2_2.getPlug( xr2_x2.getNet('i0') ).setNet( cin )
a2_2 .getPlug( a2_x2.getNet('i0') ).setNet( cin )
cin = Net.create( fulladder, "cin" ) a = Net.create( fulladder, 'a' )
cin.setExternal( True ) a.setExternal( True )
xr2_2.getPlug( xr2_x2.getNet('i0') ).setNet( cin ) xr2_1.getPlug( xr2_x2.getNet('i0') ).setNet( a )
a2_2 .getPlug( a2_x2.getNet('i0') ).setNet( cin ) a2_1 .getPlug( a2_x2.getNet('i0') ).setNet( a )
a = Net.create( fulladder, 'a' ) b = Net.create( fulladder, 'b' )
a.setExternal( True ) b.setExternal( True )
xr2_1.getPlug( xr2_x2.getNet('i0') ).setNet( a ) xr2_1.getPlug( xr2_x2.getNet('i1') ).setNet( b )
a2_1 .getPlug( a2_x2.getNet('i0') ).setNet( a ) a2_1 .getPlug( a2_x2.getNet('i1') ).setNet( b )
b = Net.create( fulladder, 'b' ) sout_1 = Net.create( fulladder, 'sout_1' )
b.setExternal( True ) xr2_1.getPlug( xr2_x2.getNet('q' ) ).setNet( sout_1 )
xr2_1.getPlug( xr2_x2.getNet('i1') ).setNet( b ) xr2_2.getPlug( xr2_x2.getNet('i1') ).setNet( sout_1 )
a2_1 .getPlug( a2_x2.getNet('i1') ).setNet( b ) a2_2 .getPlug( a2_x2.getNet('i1') ).setNet( sout_1 )
sout_1 = Net.create( fulladder, 'sout_1' ) carry_1 = Net.create( fulladder, 'carry_1' )
xr2_1.getPlug( xr2_x2.getNet('q' ) ).setNet( sout_1 ) a2_1.getPlug( a2_x2.getNet('q' ) ).setNet( carry_1 )
xr2_2.getPlug( xr2_x2.getNet('i1') ).setNet( sout_1 ) o2_1.getPlug( o2_x2.getNet('i1') ).setNet( carry_1 )
a2_2 .getPlug( a2_x2.getNet('i1') ).setNet( sout_1 )
carry_1 = Net.create( fulladder, 'carry_1' ) carry_2 = Net.create( fulladder, 'carry_2' )
a2_1.getPlug( a2_x2.getNet('q' ) ).setNet( carry_1 ) a2_2.getPlug( a2_x2.getNet('q' ) ).setNet( carry_2 )
o2_1.getPlug( o2_x2.getNet('i1') ).setNet( carry_1 ) o2_1.getPlug( o2_x2.getNet('i0') ).setNet( carry_2 )
carry_2 = Net.create( fulladder, 'carry_2' ) sout = Net.create( fulladder, 'sout' )
a2_2.getPlug( a2_x2.getNet('q' ) ).setNet( carry_2 ) sout.setExternal( True )
o2_1.getPlug( o2_x2.getNet('i0') ).setNet( carry_2 ) xr2_2.getPlug( xr2_x2.getNet('q') ).setNet( sout )
sout = Net.create( fulladder, 'sout' ) cout = Net.create( fulladder, 'cout' )
sout.setExternal( True ) cout.setExternal( True )
xr2_2.getPlug( xr2_x2.getNet('q') ).setNet( sout ) o2_1.getPlug( o2_x2.getNet('q') ).setNet( cout )
cout = Net.create( fulladder, 'cout' )
cout.setExternal( True )
o2_1.getPlug( o2_x2.getNet('q') ).setNet( cout )
UpdateSession.close()
af.saveCell( fulladder, Catalog.State.Views ) af.saveCell( fulladder, Catalog.State.Views )
return fulladder return fulladder
def placeAndRoute ( editor, cell ): def placeAndRoute ( editor, cell ):
# Run the placer. """
etesian = Etesian.EtesianEngine.create(cell) Direct call of the ToolEngines:
* Etesian: placement.
* Katana: routing.
"""
# Run the placer.
etesian = Etesian.EtesianEngine.create( cell )
etesian.place() etesian.place()
if editor: if editor:
editor.setCell( cell ) editor.setCell( cell )
editor.fit() editor.fit()
Breakpoint.stop( 1, 'After placement' ) Breakpoint.stop( 1, 'After placement' )
# Run the router. # Run the router.
katana = Katana.KatanaEngine.create(cell) katana = Katana.KatanaEngine.create( cell )
katana.digitalInit () katana.digitalInit ()
katana.runGlobalRouter () katana.runGlobalRouter ( Katana.Flags.NoFlags )
katana.loadGlobalRouting( Anabatic.EngineLoadGrByNet ) katana.loadGlobalRouting( Anabatic.EngineLoadGrByNet )
katana.layerAssign ( Anabatic.EngineNoNetLayerAssign ) katana.layerAssign ( Anabatic.EngineNoNetLayerAssign )
katana.runNegociate ( Katana.Flags.NoFlags ) katana.runNegociate ( Katana.Flags.NoFlags )
af.saveCell( cell, Catalog.State.Views ) af.saveCell( cell, Catalog.State.Views )
return
def scriptMain ( **kw ): def scriptMain ( **kw ):
"""The mandatory function to be called by Coriolis CGT/Unicorn."""
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if 'editor' in kw and kw['editor']:
editor = kw['editor'] editor = kw['editor']
fulladder = buildFulladder( editor ) fulladder = buildFulladder( editor )
placeAndRoute( editor, fulladder ) placeAndRoute( editor, fulladder )
return True return True

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -100,7 +100,8 @@ div#contents ul > li > a {
*/ */
span.cb { span.cb {
background: yellow; font-family: "courrier";
font-weight: bold;
} }
div.note { div.note {

View File

@ -100,7 +100,8 @@ div#contents ul > li > a {
*/ */
span.cb { span.cb {
background: yellow; font-family: "courrier";
font-weight: bold;
} }
div.note { div.note {

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
# This file is part of the Coriolis Software. # This file is part of the Coriolis Software.
# Copyright (c) Sorbonne Université 2017-2021, All Rights Reserved # Copyright (c) Sorbonne Université 2017-2022, All Rights Reserved
# #
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+
# | C O R I O L I S | # | C O R I O L I S |
@ -21,20 +21,12 @@ try:
import Viewer import Viewer
import CRL import CRL
import helpers import helpers
from helpers.io import ErrorMessage from helpers import showPythonTrace, trace, l, u, n
from helpers.io import WarningMessage from helpers.io import ErrorMessage, WarningMessage
from helpers import showPythonTrace from helpers.overlay import UpdateSession
import plugins import plugins
from Hurricane import DataBase from Hurricane import DataBase, Breakpoint, DbU, Box, Contact, \
from Hurricane import Breakpoint Vertical, Horizontal, Net, Cell
from Hurricane import UpdateSession
from Hurricane import DbU
from Hurricane import Box
from Hurricane import Contact
from Hurricane import Vertical
from Hurricane import Horizontal
from Hurricane import Net
from Hurricane import Cell
except ImportError as e: except ImportError as e:
serror = str(e) serror = str(e)
if serror.startswith('No module named'): if serror.startswith('No module named'):
@ -44,8 +36,6 @@ except ImportError as e:
if serror.find('cannot open shared object file'): if serror.find('cannot open shared object file'):
library = serror.split(':')[0] library = serror.split(':')[0]
print( '[ERROR] The "{}" shared library cannot be loaded.'.format(library) ) print( '[ERROR] The "{}" shared library cannot be loaded.'.format(library) )
print( ' Under RHEL 6, you must be under devtoolset-2.' )
print( ' (scl enable devtoolset-2 bash)' )
sys.exit(1) sys.exit(1)
except Exception as e: except Exception as e:
print( '[ERROR] A strange exception occurred while loading the basic Coriolis/Python' ) print( '[ERROR] A strange exception occurred while loading the basic Coriolis/Python' )
@ -66,70 +56,66 @@ def runDemo ( cell, editor ):
if cell: if cell:
print( WarningMessage( '"demo_cell" has already been created, do not run twice.' )) print( WarningMessage( '"demo_cell" has already been created, do not run twice.' ))
return return
UpdateSession.open() with UpdateSession():
cell = Cell.create( library, 'demo_cell' ) cell = Cell.create( library, 'demo_cell' )
cell.setAbutmentBox( Box( DbU.fromLambda( 0.0), DbU.fromLambda( 0.0) cell.setAbutmentBox( Box( l( 0.0), l( 0.0), l(15.0), l(50.0) ) )
, DbU.fromLambda(15.0), DbU.fromLambda(50.0) ) )
UpdateSession.close()
if editor: editor.setCell( cell ) if editor: editor.setCell( cell )
Breakpoint.stop( 1, 'Abutment box has been drawn.' ) Breakpoint.stop( 1, 'Abutment box has been drawn.' )
UpdateSession.open() with UpdateSession():
technology = DataBase.getDB().getTechnology()
nwell = technology.getLayer( 'NWELL' )
ntrans = technology.getLayer( 'NTRANS' )
ptrans = technology.getLayer( 'PTRANS' )
diffN = technology.getLayer( 'NDIF' )
diffP = technology.getLayer( 'PDIF' )
contDiffN = technology.getLayer( 'CONT_DIF_N' )
contDiffP = technology.getLayer( 'CONT_DIF_P' )
contPoly = technology.getLayer( 'CONT_POLY' )
poly = technology.getLayer( 'POLY' )
metal1 = technology.getLayer( 'METAL1' )
technology = DataBase.getDB().getTechnology() nwellNet = Net.create( cell, 'nwell' )
nwell = technology.getLayer( 'NWELL' ) Horizontal.create( nwellNet, nwell, l(39.0), l(24.0), l(0.0), l(15.0) )
ntrans = technology.getLayer( 'NTRANS' ) vss = Net.create( cell, 'vss' )
ptrans = technology.getLayer( 'PTRANS' ) vdd = Net.create( cell, 'vdd' )
diffN = technology.getLayer( 'NDIF' ) Horizontal.create( vss, metal1 , l(3.0), l(6.0), l(0.0), l(15.0) )
diffP = technology.getLayer( 'PDIF' ) Vertical.create ( vss, diffN , l(3.5), l(4.0), l(4.0), l(12.0) )
contDiffN = technology.getLayer( 'CONT_DIF_N' ) Contact.create ( vss, contDiffN, l(4.0), l(5.0) )
contDiffP = technology.getLayer( 'CONT_DIF_P' ) Horizontal.create( vdd, metal1 , l(47.0), l( 6.0), l( 0.0), l(15.0) )
contPoly = technology.getLayer( 'CONT_POLY' ) Vertical.create ( vdd, diffP , l( 3.5), l( 4.0), l(28.0), l(46.0) )
poly = technology.getLayer( 'POLY' ) Contact.create ( vdd, contDiffP, l( 4.0), l(45.0) )
metal1 = technology.getLayer( 'METAL1' )
nwellNet = Net.create( cell, 'nwell' )
Horizontal.create( nwellNet, nwell, DbU.fromLambda(39.0), DbU.fromLambda(24.0), DbU.fromLambda(0.0), DbU.fromLambda(15.0) )
vss = Net.create( cell, 'vss' )
vdd = Net.create( cell, 'vdd' )
Horizontal.create( vss, metal1 , DbU.fromLambda(3.0), DbU.fromLambda(6.0), DbU.fromLambda(0.0), DbU.fromLambda(15.0) )
Vertical.create ( vss, diffN , DbU.fromLambda(3.5), DbU.fromLambda(4.0), DbU.fromLambda(4.0), DbU.fromLambda(12.0) )
Contact.create ( vss, contDiffN, DbU.fromLambda(4.0), DbU.fromLambda(5.0) )
Horizontal.create( vdd, metal1 , DbU.fromLambda(47.0), DbU.fromLambda( 6.0), DbU.fromLambda( 0.0), DbU.fromLambda(15.0) )
Vertical.create ( vdd, diffP , DbU.fromLambda( 3.5), DbU.fromLambda( 4.0), DbU.fromLambda(28.0), DbU.fromLambda(46.0) )
Contact.create ( vdd, contDiffP, DbU.fromLambda( 4.0), DbU.fromLambda(45.0) )
UpdateSession.close()
Breakpoint.stop( 1, 'Power nets have been drawn.' ) Breakpoint.stop( 1, 'Power nets have been drawn.' )
UpdateSession.open() with UpdateSession():
nq = Net.create( cell, 'nq' ) nq = Net.create( cell, 'nq' )
Vertical.create ( nq, diffN , DbU.fromLambda(10.0), DbU.fromLambda( 3.0), DbU.fromLambda( 8.0), DbU.fromLambda(12.0) ) Vertical.create ( nq, diffN , l(10.0), l( 3.0), l( 8.0), l(12.0) )
Vertical.create ( nq, diffP , DbU.fromLambda(10.0), DbU.fromLambda( 3.0), DbU.fromLambda(28.0), DbU.fromLambda(37.0) ) Vertical.create ( nq, diffP , l(10.0), l( 3.0), l(28.0), l(37.0) )
Contact.create ( nq, contDiffN, DbU.fromLambda(10.0), DbU.fromLambda(10.0) ) Contact.create ( nq, contDiffN, l(10.0), l(10.0) )
Contact.create ( nq, contDiffP, DbU.fromLambda(10.0), DbU.fromLambda(30.0) ) Contact.create ( nq, contDiffP, l(10.0), l(30.0) )
Contact.create ( nq, contDiffP, DbU.fromLambda(10.0), DbU.fromLambda(35.0) ) Contact.create ( nq, contDiffP, l(10.0), l(35.0) )
Vertical.create ( nq, metal1 , DbU.fromLambda(10.0), DbU.fromLambda( 2.0), DbU.fromLambda(10.0), DbU.fromLambda(40.0) ) Vertical.create ( nq, metal1 , l(10.0), l( 2.0), l(10.0), l(40.0) )
UpdateSession.close()
Breakpoint.stop( 1, 'Output has been drawn.' ) Breakpoint.stop( 1, 'Output has been drawn.' )
UpdateSession.open() with UpdateSession():
i = Net.create( cell, 'i' ) i = Net.create( cell, 'i' )
Vertical.create ( i, ntrans , DbU.fromLambda( 7.0), DbU.fromLambda( 1.0), DbU.fromLambda( 6.0), DbU.fromLambda(14.0) ) Vertical.create ( i, ntrans , l( 7.0), l( 1.0), l( 6.0), l(14.0) )
Vertical.create ( i, poly , DbU.fromLambda( 7.0), DbU.fromLambda( 1.0), DbU.fromLambda(14.0), DbU.fromLambda(26.0) ) Vertical.create ( i, poly , l( 7.0), l( 1.0), l(14.0), l(26.0) )
Vertical.create ( i, ptrans , DbU.fromLambda( 7.0), DbU.fromLambda( 1.0), DbU.fromLambda(26.0), DbU.fromLambda(39.0) ) Vertical.create ( i, ptrans , l( 7.0), l( 1.0), l(26.0), l(39.0) )
Horizontal.create( i, poly , DbU.fromLambda(20.0), DbU.fromLambda( 3.0), DbU.fromLambda( 4.0), DbU.fromLambda( 7.0) ) Horizontal.create( i, poly , l(20.0), l( 3.0), l( 4.0), l( 7.0) )
Contact.create ( i, contPoly , DbU.fromLambda( 5.0), DbU.fromLambda(20.0) ) Contact.create ( i, contPoly , l( 5.0), l(20.0) )
Vertical.create ( i, metal1 , DbU.fromLambda( 5.0), DbU.fromLambda( 2.0), DbU.fromLambda(10.0), DbU.fromLambda(40.0) ) Vertical.create ( i, metal1 , l( 5.0), l( 2.0), l(10.0), l(40.0) )
UpdateSession.close()
Breakpoint.stop( 1, 'Input has been drawn.' ) Breakpoint.stop( 1, 'Input has been drawn.' )
return
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# Plugin hook functions, unicornHook:menus, ScritMain:call # Plugin hook functions, unicornHook:menus, ScritMain:call
def unicornHook ( **kw ): def unicornHook ( **kw ):
"""
The mandatory function to make the plugin appears in the menus.
"""
editor = kw['editor'] editor = kw['editor']
editor.addMenu( 'tutorials' , 'Tutorials', Viewer.CellViewer.TopMenu ) editor.addMenu( 'tutorials' , 'Tutorials', Viewer.CellViewer.TopMenu )
#editor.addMenu( 'tutorials.plugins', 'Plugins' , Viewer.CellViewer.NoFlags ) #editor.addMenu( 'tutorials.plugins', 'Plugins' , Viewer.CellViewer.NoFlags )
@ -143,13 +129,17 @@ def unicornHook ( **kw ):
def scriptMain ( **kw ): def scriptMain ( **kw ):
try: """
helpers.staticInitialization( quiet=True ) The mandatory function from which a plugin will be called by Coriolis CGT/Unicorn.
#helpers.setTraceLevel( 550 ) """
Breakpoint.setStopLevel( 1 )
print( ' o Breakpoint level: {}.'.format(Breakpoint.getStopLevel()) ) try:
cell, editor = plugins.kwParseMain( **kw ) helpers.staticInitialization( quiet=True )
runDemo( cell, editor ) #helpers.setTraceLevel( 550 )
except Exception as e: Breakpoint.setStopLevel( 1 )
helpers.io.catch( e ) print( ' o Breakpoint level: {}.'.format(Breakpoint.getStopLevel()) )
return 0 cell, editor = plugins.kwParseMain( **kw )
runDemo( cell, editor )
except Exception as e:
helpers.io.catch( e )
return 0