2 # -*- coding: utf-8 -*-
3 from __future__
import print_function
8 from Hurricane
import Box
9 from coriolis2
.settings
import af
10 from utils
import Module
, SessionManager
, Config
12 import symbolic
.cmos
# do not remove
18 with
Config(Cfg
.Parameter
.Priority
.UserFile
) as cfg
:
19 cfg
.misc_catchCore
= False
21 cfg
.misc_paranoid
= False
23 cfg
.misc_logMode
= True
24 cfg
.misc_verboseLevel1
= True
25 cfg
.misc_verboseLevel2
= True
26 cfg
.etesian_effort
= 2
27 cfg
.etesian_spaceMargin
= "20.0%"
28 cfg
.etesian_aspectRatio
= "100.0%"
29 cfg
.etesian_uniformDensity
= True
30 cfg
.anabatic_edgeLenght
= 24
31 cfg
.anabatic_edgeWidth
= 8
32 cfg
.anabatic_topRoutingLayer
= 'METAL5'
33 cfg
.katana_searchHalo
= 30
34 cfg
.katana_eventsLimit
= 1000000
35 cfg
.katana_hTracksReservedLocal
= 7
36 cfg
.katana_vTracksReservedLocal
= 6
38 env
= af
.getEnvironment()
39 env
.setCLOCK('^clk$|m_clock')
49 with
SessionManager():
54 self
.editor
.setCell(self
.cell
)
56 result
= self
.place_and_route()
58 with
SessionManager():
68 self
.name
= self
.name
+ '_r'
69 self
.af
.saveCell(self
.cell
, CRL
.Catalog
.State
.Views
)
70 super(ALU16
, self
).save()
74 if not self
.build_submodules():
77 # at this point we have the (auto-calculated) submodules' dimensions
78 # in their `ab` properties.
80 with
SessionManager():
82 self
.place_submodules()
84 # TODO: replace with some form of lazy evaluation?
85 y_north
= self
.from_dbu(self
.cell
.getAbutmentBox().getYMax())
86 for pin_conf
in self
.north_pins
:
87 pin_conf
['y'] = y_north
92 self
.editor
.setCell(self
.cell
)
94 # place first (in middle, between two)
95 # this puts all the remaining cells (little ones)
96 # into this (small) space so that they do not go
97 # "all over the place" around the add and sub
98 self
.ab
= Box(self
.to_dbu(400.0), self
.to_dbu(50.0),
99 self
.to_dbu(700.0), self
.to_dbu(500.0))
102 # then route (globally)
103 # this connects up not just in the remaining (little) cells,
104 # it connects *to add and sub and the outside world as well*
106 result
= self
.place_and_route()
112 def ScriptMain(editor
=None, **kwargs
):
118 {'net': 'a({})', 'x': 10.0, 'delta': 20.0, 'repeat': BIT_WIDTH
},
119 {'net': 'b({})', 'x': 20.0, 'delta': 20.0, 'repeat': BIT_WIDTH
},
122 {'net': 'o({})', 'x': 100.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
125 'b({})'.format(BIT_WIDTH
-1): (
126 'BLOCKAGE2', 'BLOCKAGE3', 'BLOCKAGE4',
133 {'net': 'a({})', 'x': 10.0, 'delta': 20.0, 'repeat': BIT_WIDTH
},
134 {'net': 'b({})', 'x': 20.0, 'delta': 20.0, 'repeat': BIT_WIDTH
},
137 {'net': 'o({})', 'x': 100.0, 'delta': 10.0, 'repeat': BIT_WIDTH
},
140 'b({})'.format(BIT_WIDTH
-1): (
141 'BLOCKAGE2', 'BLOCKAGE3', 'BLOCKAGE4',
147 'alu16', editor
, width
=1100.0, height
=570.0,
148 submodules
=[(add
, 25.0, 75.0), (sub
, 725.0, 75.0)],
150 {'net': 'o({})', 'x': 50.0, 'delta': 60.0, 'repeat': BIT_WIDTH
},
154 {'net': 'a({})', 'x': 50.0, 'delta': 60.0, 'repeat': BIT_WIDTH
},
155 {'net': 'b({})', 'x': 80.0, 'delta': 60.0, 'repeat': BIT_WIDTH
},
158 {'net': 'rst', 'y': 140.0, 'layer': 'METAL2'},
164 if __name__
== '__main__':
166 success
= ScriptMain(**kwargs
)
171 sys
.exit(shellSuccess
)