6 from Hurricane
import Technology
, DataBase
, DbU
, Library
, \
7 Layer
, BasicLayer
, Cell
, Net
, Vertical
, \
8 Rectilinear
, Box
, Point
, Instance
, \
9 Transformation
, NetExternalComponents
, \
11 from common
.colors
import toRGB
12 from common
.patterns
import toHexa
13 from helpers
import u
, l
14 from helpers
.technology
import setEnclosures
15 from helpers
.overlay
import CfgCache
, UpdateSession
22 print( ' o LibreSOCMem.py: create dummy abstract of "spblock_512w64b8w".' )
24 af
= CRL
.AllianceFramework
.get()
25 rg
= af
.getRoutingGauge()
26 cg
= af
.getCellGauge()
28 tech
= db
.getTechnology()
29 rootlib
= db
.getRootLibrary()
30 sliceHeight
= cg
.getSliceHeight()
31 METAL2
= tech
.getLayer( 'METAL2' )
32 METAL3
= tech
.getLayer( 'METAL3' )
33 BLOCKAGE1
= tech
.getLayer( 'BLOCKAGE1' )
34 BLOCKAGE2
= tech
.getLayer( 'BLOCKAGE2' )
35 BLOCKAGE3
= tech
.getLayer( 'BLOCKAGE3' )
38 lib
= Library
.create( rootlib
, 'LibreSOCMem' )
39 cell
= Cell
.create( lib
, 'spblock_512w64b8w' )
41 cell
.setAbutmentBox( Box( 0, 0, (55+2)*sliceHeight
, (45+2)*sliceHeight
) )
42 nets
= { 'clk' : Net
.create( cell
, 'clk' )
43 , 'vdd' : Net
.create( cell
, 'vdd' )
44 , 'vss' : Net
.create( cell
, 'vss' )
45 , 'blockageNet': Net
.create( cell
, 'blockageNet' )
47 nets
['clk'].setType( Net
.Type
.CLOCK
)
48 nets
['clk'].setExternal( True )
49 nets
['clk'].setDirection( Net
.Direction
.IN
)
50 nets
['vdd'].setType( Net
.Type
.POWER
)
51 nets
['vdd'].setExternal( True )
52 nets
['vdd'].setDirection( Net
.Direction
.IN
)
53 nets
['vss'].setType( Net
.Type
.GROUND
)
54 nets
['vss'].setExternal( True )
55 nets
['vss'].setDirection( Net
.Direction
.IN
)
56 blockageArea
= Box( cell
.getAbutmentBox() )
57 blockageArea
.inflate( -sliceHeight
)
58 for layer
in (BLOCKAGE1
, BLOCKAGE2
, BLOCKAGE3
):
59 Pad
.create( nets
['blockageNet'], layer
, blockageArea
)
60 for name
, width
in ( ('a', 9), ('d', 64), ('q', 64), ('we', 8) ):
61 for bit
in range(width
):
62 bitName
= '{}({})'.format( name
, bit
)
63 nets
[ bitName
] = Net
.create( cell
, bitName
)
64 nets
[ bitName
].setExternal( True )
65 direction
= Net
.Direction
.IN
67 direction
= Net
.Direction
.OUT
68 nets
[ bitName
].setDirection( direction
)
69 METAL2pitch
= rg
.getLayerGauge( METAL2
).getPitch()
70 METAL3pitch
= rg
.getLayerGauge( METAL3
).getPitch()
71 METAL2width
= rg
.getLayerGauge( METAL2
).getWireWidth()
72 METAL3width
= rg
.getLayerGauge( METAL3
).getWireWidth()
74 yref
= cell
.getAbutmentBox().getYMin() + sliceHeight
- METAL2pitch
75 for bitpair
in range(32):
76 xref
= cell
.getAbutmentBox().getXMax() \
77 - sliceHeight
- ( (bitpair
+1)*southSideStep
+ 2 )*METAL3pitch
79 pinSpecs
= [ ('q', (63-bitpair
*2) , 0)
80 , ('d', (63-bitpair
*2) , 10)
81 , ('d', (63-bitpair
*2)-1, 12)
82 , ('q', (63-bitpair
*2)-1, 14)
85 pinSpecs
.append( ('we', 7-bitpair
//4, 8) )
86 for name
, bit
, deltaPitch
in pinSpecs
:
87 net
= nets
[ '{}({})'.format(name
,bit
) ]
88 xaxis
= xref
- METAL3pitch
*deltaPitch
89 segment
= Vertical
.create( net
94 , yref
+8*METAL2pitch
)
95 segment
= Vertical
.create( net
101 NetExternalComponents
.setExternal( segment
)
102 segment
= Vertical
.create( nets
['clk']
104 , cell
.getAbutmentBox().getXMin()
105 + sliceHeight
+ 5*METAL3pitch
108 , yref
+8*METAL2pitch
)
109 segment
= Vertical
.create( nets
['clk']
111 , cell
.getAbutmentBox().getXMin()
112 + sliceHeight
+ 5*METAL3pitch
116 NetExternalComponents
.setExternal( segment
)
118 xref
= cell
.getAbutmentBox().getXMin() + sliceHeight
- METAL3pitch
119 yref
= cell
.getAbutmentBox().getYMax() - sliceHeight
121 net
= nets
[ '{}({})'.format('a',8-bit
) ]
122 yaxis
= yref
- 2*sliceHeight
*bit
- METAL3pitch
*5
124 yaxis
-= 20*sliceHeight
125 segment
= Horizontal
.create( net
130 , xref
+8*METAL3pitch
)
131 segment
= Horizontal
.create( net
137 NetExternalComponents
.setExternal( segment
)
139 xmin
= cell
.getAbutmentBox().getXMin() + 2*sliceHeight
140 xmax
= cell
.getAbutmentBox().getXMax() - 2*sliceHeight
141 yref
= cell
.getAbutmentBox().getYMin() + 2*sliceHeight
146 segment
= Horizontal
.create( net
148 , yref
+ sliceHeight
*i
152 NetExternalComponents
.setExternal( segment
)
154 af
.wrapLibrary( lib
, 0 )