2 # -*- coding: utf-8 -*-
3 from __future__
import print_function
8 from Hurricane
import Box
9 from Hurricane
import Transformation
10 from coriolis2
.settings
import af
11 from utils
import Module
, SessionManager
, Config
13 import symbolic
.cmos
# do not remove
19 with
Config(Cfg
.Parameter
.Priority
.UserFile
) as cfg
:
20 cfg
.misc_catchCore
= False
22 cfg
.misc_paranoid
= False
24 cfg
.misc_logMode
= True
25 cfg
.misc_verboseLevel1
= True
26 cfg
.misc_verboseLevel2
= True
27 cfg
.etesian_effort
= 2
28 cfg
.etesian_spaceMargin
= "10.0%"
29 cfg
.etesian_aspectRatio
= "100.0%"
30 cfg
.etesian_uniformDensity
= True
31 cfg
.anabatic_edgeLenght
= 24
32 cfg
.anabatic_edgeWidth
= 8
33 cfg
.anabatic_topRoutingLayer
= 'METAL5'
34 cfg
.katana_searchHalo
= 30
35 cfg
.katana_eventsLimit
= 1000000
36 cfg
.katana_hTracksReservedLocal
= 7
37 cfg
.katana_vTracksReservedLocal
= 6
39 env
= af
.getEnvironment()
40 env
.setCLOCK('^clk$|m_clock')
50 with
SessionManager():
55 self
.editor
.setCell(self
.cell
)
57 result
= self
.place_and_route()
59 with
SessionManager():
69 self
.name
= self
.name
+ '_r'
70 self
.af
.saveCell(self
.cell
, CRL
.Catalog
.State
.Views
)
71 super(ALU16
, self
).save()
78 if not self
.build_submodules():
81 # at this point we have the (auto-calculated) submodules' dimensions
82 # in their `ab` properties.
84 add
, sub
= self
.submodules
86 with
SessionManager():
89 width
= self
.from_dbu(
90 self
.ab
.getWidth() + add
.ab
.getWidth() + sub
.ab
.getWidth()
92 height
= self
.from_dbu(max([
93 self
.ab
.getHeight(), add
.ab
.getHeight(), sub
.ab
.getHeight()
96 # experiment, over-ride
100 self
.ab
= Box(0, 0, self
.to_dbu(width
), self
.to_dbu(height
))
102 add_wid
= self
.from_dbu(add
.ab
.getWidth())
103 sub_ht
= self
.from_dbu(sub
.ab
.getHeight())
105 self
.place_submodule(add
, 25, v_margin
+add_wid
)
106 self
.place_submodule(sub
, width
-sub
.ab_width
-h_margin
+sub_ht
-35,
109 # TODO: replace with some form of lazy evaluation?
110 y_north
= self
.from_dbu(self
.ab
.getYMax())
111 for pin_conf
in self
.north_pins
:
112 pin_conf
['y'] = y_north
117 self
.editor
.setCell(self
.cell
)
119 # place first (in middle, between two)
120 # this puts all the remaining cells (little ones)
121 # into this (small) space so that they do not go
122 # "all over the place" around the add and sub
124 # XXX this doesn't work: box is far too big, covers the entire
125 # area (including "under" the add and sub)
127 self
.to_dbu((width
-self
.ab_width
)/2 - h_margin
),
128 self
.to_dbu(v_margin
),
129 self
.to_dbu((width
+self
.ab_width
)/2 + h_margin
),
130 self
.to_dbu(height
- v_margin
)
132 self
.ab
= Box(self
.to_dbu(475), self
.to_dbu(10),
133 self
.to_dbu(840), self
.to_dbu(360))
134 self
.place() # place only
136 # then route (globally)
137 # this connects up not just in the remaining (little) cells,
138 # it connects *to add and sub and the outside world as well*
139 self
.ab
= Box(0, 0, self
.to_dbu(width
), self
.to_dbu(height
))
140 result
= self
.route()
146 def ScriptMain(editor
=None, **kwargs
):
152 {'net': 'a({})', 'x': 165.0, 'delta': -10.0, 'repeat': BIT_WIDTH
},
153 {'net': 'b({})', 'x': 160.0, 'delta': -10.0, 'repeat': BIT_WIDTH
},
154 {'net': 'o({})', 'x': 340.0, 'delta': -10.0, 'repeat': BIT_WIDTH
},
159 'b({})'.format(BIT_WIDTH
-1): (
160 'BLOCKAGE2', 'BLOCKAGE3', 'BLOCKAGE4',
163 orientation
=Transformation
.Orientation
.R3
,
168 {'net': 'a({})', 'x': 180.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
169 {'net': 'b({})', 'x': 185.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
170 {'net': 'o({})', 'x': 10.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
175 'b({})'.format(BIT_WIDTH
-1): (
176 'BLOCKAGE2', 'BLOCKAGE3', 'BLOCKAGE4',
179 orientation
=Transformation
.Orientation
.R1
,
183 'alu16', editor
, submodules
=[add
, sub
],
185 {'net': 'o({})', 'x': 500.0, 'delta': 20.0, 'repeat': BIT_WIDTH
},
189 {'net': 'a({})', 'x': 500.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
190 {'net': 'b({})', 'x': 700.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
193 {'net': 'rst', 'y': 140.0, 'layer': 'METAL2'},
199 if __name__
== '__main__':
201 success
= ScriptMain(**kwargs
)
206 sys
.exit(shellSuccess
)