2 from __future__
import print_function
8 helpers
.loadUserSettings()
9 from helpers
import trace
, l
, u
, n
10 from helpers
.io
import ErrorMessage
, WarningMessage
11 from helpers
.overlay
import UpdateSession
13 from Hurricane
import Breakpoint
, DbU
, Point
, Box
, Transformation
, Instance
, \
15 from plugins
.alpha
.macro
.macro
import Macro
16 from plugins
.alpha
.block
.block
import Block
17 from plugins
.alpha
.block
.configuration
import IoPin
, GaugeConf
18 from plugins
.alpha
.core2chip
.libresocio
import CoreToChip
19 from plugins
.alpha
.chip
.configuration
import ChipConf
20 from plugins
.alpha
.chip
.chip
import Chip
23 af
= CRL
.AllianceFramework
.get()
26 def isiterable ( pyobj
):
27 if isinstance(pyobj
,collections
.Iterable
): return True
31 def doIoPinVector ( ioSpec
, bits
):
33 if not isiterable(bits
): bits
= range(bits
)
35 raise ErrorMessage( 1, [ 'doIoPinVector(): Argument "ioSpec" must have excatly 5 fields ({})'.format(len(ioSpec
))
36 , '(ioSpec={})'.format(ioSpec
)
39 raise ErrorMessage( 1, [ 'doIoPinVector(): Argument "bits" is neither a width nor an iterable.'
40 , '(bits={})'.format(bits
)
45 , ioSpec
[2].format(bit
)
46 , ioSpec
[3].format(bit
)
47 , ioSpec
[4].format(bit
) ))
51 def scriptMain ( **kw
):
52 """The mandatory function to be called by Coriolis CGT/Unicorn."""
56 #helpers.setTraceLevel( 550 )
57 Breakpoint
.setStopLevel( 100 )
59 cell
, editor
= plugins
.kwParseMain( **kw
)
60 cell
= af
.getCell( 'memory', CRL
.Catalog
.State
.Logical
)
62 editor
.setCell( cell
)
63 editor
.setDbuMode( DbU
.StringModePhysical
)
66 ioPadsSpec
+= doIoPinVector( (IoPin
.WEST
, None, 'a_{}', 'a({})', 'a({})'), 8 )
67 ioPadsSpec
+= doIoPinVector( (IoPin
.SOUTH
, None, 'b_{}', 'b({})', 'b({})'), 8 )
68 ioPadsSpec
+= doIoPinVector( (IoPin
.EAST
, None, 'f_{}', 'f({})', 'f({})'), 8 )
69 ioPadsSpec
+= doIoPinVector( (IoPin
.NORTH
, None, 'we_{}', 'we({})', 'we({})'), range(0,4) )
70 ioPadsSpec
+= [ (IoPin
.NORTH
, None, 'clk' , 'clk', 'clk' )
71 , (IoPin
.NORTH
, None, 'power_0' , 'vdd' )
72 , (IoPin
.NORTH
, None, 'ground_0' , 'vss' )
73 , (IoPin
.NORTH
, None, 'ioground_0', 'iovss' )
74 , (IoPin
.NORTH
, None, 'iopower_0' , 'iovdd' )
75 , (IoPin
.NORTH
, None, 'iopower_1' , 'iovdd' )
76 , (IoPin
.NORTH
, None, 'rst' , 'rst', 'rst' )
78 ioPadsSpec
+= doIoPinVector( (IoPin
.NORTH
, None, 'we_{}', 'we({})', 'we({})'), range(4,8) )
79 ioPinsSpec
= [ (IoPin
.WEST |IoPin
.A_BEGIN
, 'a({})' , u( 3.3), u( 6.6), 64)
80 , (IoPin
.SOUTH|IoPin
.A_BEGIN
, 'b({})' , u( 3.3), u( 6.6), 64)
81 , (IoPin
.EAST |IoPin
.A_BEGIN
, 'f({})' , u( 3.3), u( 6.6), 64)
82 , (IoPin
.NORTH|IoPin
.A_BEGIN
, 'we({})' , u( 3.3), u( 6.6), 8)
83 , (IoPin
.NORTH|IoPin
.A_BEGIN
, 'rst' , u( 33.0), 0 , 1)
84 , (IoPin
.NORTH|IoPin
.A_BEGIN
, 'clk' , u( 66.0), 0 , 1)
86 memoryConf
= ChipConf( cell
, ioPins
=ioPinsSpec
, ioPads
=ioPadsSpec
)
87 memoryConf
.cfg
.viewer
.pixelThreshold
= 5
88 memoryConf
.cfg
.etesian
.bloat
= 'nsxlib'
89 memoryConf
.cfg
.etesian
.uniformDensity
= True
90 memoryConf
.cfg
.etesian
.aspectRatio
= 1.0
91 # etesian.spaceMargin is ignored if the coreSize is directly set.
92 memoryConf
.cfg
.etesian
.spaceMargin
= 0.20
93 memoryConf
.cfg
.anabatic
.searchHalo
= 2
94 memoryConf
.cfg
.anabatic
.globalIterations
= 20
95 memoryConf
.cfg
.anabatic
.topRoutingLayer
= 'METAL5'
96 memoryConf
.cfg
.katana
.hTracksReservedLocal
= 6
97 memoryConf
.cfg
.katana
.vTracksReservedLocal
= 3
98 memoryConf
.cfg
.katana
.hTracksReservedMin
= 3
99 memoryConf
.cfg
.katana
.vTracksReservedMin
= 1
100 memoryConf
.cfg
.block
.spareSide
= u(200)
101 #memoryConf.cfg.chip.padCoreSide = 'North'
102 #memoryConf.cfg.chip.use45corners = False
103 memoryConf
.cfg
.chip
.useAbstractPads
= True
104 memoryConf
.cfg
.chip
.supplyRailWidth
= u(35)
105 memoryConf
.cfg
.chip
.supplyRailPitch
= u(90)
106 memoryConf
.editor
= editor
107 memoryConf
.useSpares
= True
108 memoryConf
.useClockTree
= True
109 memoryConf
.useHFNS
= False
110 memoryConf
.bColumns
= 2
112 memoryConf
.chipName
= 'chip'
113 memoryConf
.chipConf
.ioPadGauge
= 'LibreSOCIO'
114 memoryConf
.coreSize
= ( u( 988.0), u( 988.0) )
115 memoryConf
.chipSize
= ( u(2000.0), u(2000.0) )
117 with
UpdateSession():
118 coreAb
= Box( 0, 0, u(988.0), u(988.0) )
119 cell
.setAbutmentBox( coreAb
)
122 memoryToChip
= CoreToChip( memoryConf
)
123 memoryToChip
.buildChip()
124 chipBuilder
= Chip( memoryConf
)
125 chipBuilder
.doChipFloorplan()
126 with
UpdateSession():
127 sramName
= 'spblock_512w64b8w'
128 sram
= DataBase
.getDB().getCell( 'spblock_512w64b8w' )
130 print( '[ERROR] SRAM cell "{}" not found.'.format(sramName
) )
132 sliceHeight
= memoryToChip
.conf
.sliceHeight
133 coreAb
= cell
.getAbutmentBox()
134 sramAb
= sram
.getAbutmentBox()
135 position
= Transformation( coreAb
.getXMax() - sramAb
.getWidth() - 2*sliceHeight
137 , Transformation
.Orientation
.ID
)
138 chipBuilder
.placeMacro( 'spblock_512w64b8w', position
)
139 memoryConf
.placeArea
= Box( coreAb
.getXMin()
140 , coreAb
.getYMax() - sliceHeight
*26
141 , coreAb
.getXMin() + sliceHeight
*25
144 Breakpoint
.stop( 99, 'After core block placement.' )
145 rvalue
= chipBuilder
.doPnR()
147 CRL
.Gds
.save( memoryConf
.chip
)
149 blockBuilder
= Block( memoryConf
)
150 rvalue
= blockBuilder
.doPnR()
152 CRL
.Gds
.save( memoryConf
.cell
)
154 helpers
.io
.catch( e
)