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
= "20.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())
104 self
.place_submodule(add
, h_margin
, v_margin
+add_wid
)
105 self
.place_submodule(sub
, width
-sub
.ab_width
-h_margin
+sub_ht
-45,
108 # TODO: replace with some form of lazy evaluation?
109 y_north
= self
.from_dbu(self
.ab
.getYMax())
110 for pin_conf
in self
.north_pins
:
111 pin_conf
['y'] = y_north
116 self
.editor
.setCell(self
.cell
)
118 # place first (in middle, between two)
119 # this puts all the remaining cells (little ones)
120 # into this (small) space so that they do not go
121 # "all over the place" around the add and sub
123 # XXX this doesn't work: box is far too big, covers the entire
124 # area (including "under" the add and sub)
126 self
.to_dbu((width
-self
.ab_width
)/2 - h_margin
),
127 self
.to_dbu(v_margin
),
128 self
.to_dbu((width
+self
.ab_width
)/2 + h_margin
),
129 self
.to_dbu(height
- v_margin
)
131 self
.ab
= Box(self
.to_dbu(450), self
.to_dbu(15),
132 self
.to_dbu(835), self
.to_dbu(370))
133 self
.place() # place only
135 # then route (globally)
136 # this connects up not just in the remaining (little) cells,
137 # it connects *to add and sub and the outside world as well*
138 self
.ab
= Box(0, 0, self
.to_dbu(width
), self
.to_dbu(height
))
139 result
= self
.route()
145 def ScriptMain(editor
=None, **kwargs
):
151 {'net': 'a({})', 'x': 10.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
152 {'net': 'b({})', 'x': 15.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
153 {'net': 'o({})', 'x': 180.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
158 'b({})'.format(BIT_WIDTH
-1): (
159 'BLOCKAGE2', 'BLOCKAGE3', 'BLOCKAGE4',
162 orientation
=Transformation
.Orientation
.R3
,
167 {'net': 'a({})', 'x': 180.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
168 {'net': 'b({})', 'x': 185.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
169 {'net': 'o({})', 'x': 10.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
174 'b({})'.format(BIT_WIDTH
-1): (
175 'BLOCKAGE2', 'BLOCKAGE3', 'BLOCKAGE4',
178 orientation
=Transformation
.Orientation
.R1
,
182 'alu16', editor
, submodules
=[add
, sub
],
184 {'net': 'o({})', 'x': 500.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
188 {'net': 'a({})', 'x': 500.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
189 {'net': 'b({})', 'x': 700.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
192 {'net': 'rst', 'y': 140.0, 'layer': 'METAL2'},
198 if __name__
== '__main__':
200 success
= ScriptMain(**kwargs
)
205 sys
.exit(shellSuccess
)