use --recursive on git submodule not --remote - one does a "latest update"
[soclayout.git] / experiments9 / pll.py
1
2 import CRL
3 import Hurricane
4 import Viewer
5 import Cfg
6 from Hurricane import Technology, DataBase, DbU, Library, \
7 Layer, BasicLayer, Cell, Net, Vertical, \
8 Rectilinear, Box, Point, Instance, \
9 Transformation, NetExternalComponents, \
10 Horizontal, Pad
11 from helpers import u, l
12 from helpers.overlay import UpdateSession
13
14
15 __all__ = [ "setup" ]
16
17
18 def _load():
19 print( ' o pll.py: Create dummy abstract of "pll".' )
20
21 af = CRL.AllianceFramework.get()
22 rg = af.getRoutingGauge()
23 cg = af.getCellGauge()
24 db = DataBase.getDB()
25 tech = db.getTechnology()
26 rootlib = db.getRootLibrary()
27 sliceHeight = cg.getSliceHeight()
28 METAL2 = tech.getLayer( 'METAL2' )
29 METAL3 = tech.getLayer( 'METAL3' )
30 METAL4 = tech.getLayer( 'METAL4' )
31 METAL5 = tech.getLayer( 'METAL5' )
32 BLOCKAGE1 = tech.getLayer( 'BLOCKAGE1' )
33 BLOCKAGE2 = tech.getLayer( 'BLOCKAGE2' )
34 BLOCKAGE3 = tech.getLayer( 'BLOCKAGE3' )
35 BLOCKAGE4 = tech.getLayer( 'BLOCKAGE4' )
36 BLOCKAGE5 = tech.getLayer( 'BLOCKAGE5' )
37
38 with UpdateSession():
39 lib = Library.create( rootlib, 'pll' )
40 cell = Cell.create( lib, 'pll' )
41
42 cell.setAbutmentBox( Box( 0, 0, (15+2)*sliceHeight, (13+2)*sliceHeight ) )
43 nets = {}
44 netSpecs = ( ( 'a0' , None , Net.Direction.IN , True )
45 , ( 'a1' , None , Net.Direction.IN , True )
46 , ( 'ref_v' , None , Net.Direction.IN , True )
47 , ( 'out_v' , None , Net.Direction.OUT, True )
48 , ( 'vco_test_ana', None , Net.Direction.OUT, True )
49 , ( 'div_out_test', None , Net.Direction.OUT, True )
50 , ( 'vdd' , Net.Type.POWER , Net.Direction.IN , True )
51 , ( 'vss' , Net.Type.GROUND, Net.Direction.IN , True )
52 , ( 'blockageNet' , None , Net.Direction.IN , True )
53 )
54 for name, netType, direction, external in netSpecs:
55 nets[ name ] = Net.create( cell, name )
56 if netType is not None: nets[name].setType ( netType )
57 if direction is not None: nets[name].setDirection( direction )
58 if external is not None: nets[name].setExternal ( external )
59 blockageArea = Box( cell.getAbutmentBox() )
60 blockageArea.inflate( -sliceHeight )
61 for layer in (BLOCKAGE1, BLOCKAGE2, BLOCKAGE3, BLOCKAGE4):
62 Pad.create( nets['blockageNet'], layer, blockageArea )
63 METAL2pitch = rg.getLayerGauge( METAL2 ).getPitch()
64 METAL3pitch = rg.getLayerGauge( METAL3 ).getPitch()
65 METAL2width = rg.getLayerGauge( METAL2 ).getWireWidth()
66 METAL3width = rg.getLayerGauge( METAL3 ).getWireWidth()
67
68 xref = cell.getAbutmentBox().getXMin() + sliceHeight
69 yref = cell.getAbutmentBox().getYMax() - sliceHeight + METAL2pitch
70 for name, xpitchs in (('a0',20), ('ref_v',75), ('a1',130)):
71 segment = Vertical.create( nets[name]
72 , METAL3
73 , xref + xpitchs*METAL3pitch
74 , METAL3width
75 , yref
76 , yref - sliceHeight )
77 segment = Vertical.create( nets[name]
78 , METAL3
79 , xref + xpitchs*METAL3pitch
80 , METAL3width
81 , yref
82 , yref - METAL2pitch )
83 NetExternalComponents.setExternal( segment )
84
85 xref = cell.getAbutmentBox().getXMin() + sliceHeight - METAL3pitch
86 yref = cell.getAbutmentBox().getYMin() + sliceHeight
87 for name, ypitchs in (('vco_test_ana',65), ('div_out_test',120)):
88 segment = Horizontal.create( nets[name]
89 , METAL2
90 , yref + ypitchs*METAL2pitch
91 , METAL2width
92 , xref
93 , xref + sliceHeight )
94 segment = Horizontal.create( nets[name]
95 , METAL2
96 , yref + ypitchs*METAL2pitch
97 , METAL2width
98 , xref
99 , xref + METAL3pitch )
100 NetExternalComponents.setExternal( segment )
101
102 xref = cell.getAbutmentBox().getXMax() - 2*sliceHeight + METAL3pitch
103 yref = cell.getAbutmentBox().getYMin() + sliceHeight
104 for name, ypitchs in (('out_v',120),):
105 segment = Horizontal.create( nets[name]
106 , METAL2
107 , yref + ypitchs*METAL2pitch
108 , METAL2width
109 , xref
110 , xref + sliceHeight )
111 segment = Horizontal.create( nets[name]
112 , METAL2
113 , yref + ypitchs*METAL2pitch
114 , METAL2width
115 , xref + sliceHeight
116 , xref + sliceHeight - METAL3pitch )
117 NetExternalComponents.setExternal( segment )
118
119 xmin = cell.getAbutmentBox().getXMin() + sliceHeight
120 xmax = cell.getAbutmentBox().getXMax() - sliceHeight
121 yref = cell.getAbutmentBox().getYMin() + 2*sliceHeight
122 for i in range(4):
123 net = nets['vdd']
124 if i % 2:
125 net = nets['vss']
126 segment = Horizontal.create( net
127 , METAL5
128 , yref + sliceHeight*3*i
129 , 2*sliceHeight
130 , xmin
131 , xmax )
132 NetExternalComponents.setExternal( segment )
133
134 af.wrapLibrary( lib, 0 )
135
136 return lib
137
138 def setup():
139 lib = _load()
140 return lib