experiments9: Ignore pinmux generated files.
[soclayout.git] / experiments7 / doAlu16Flat.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 from __future__ import print_function
4 import sys
5 import re
6
7 import CRL
8 import Cfg
9 from Hurricane import Box
10 from Hurricane import Transformation
11 from Hurricane import Breakpoint
12 from Hurricane import Instance
13 from coriolis2.settings import af
14 from utils import Module, SessionManager, Config
15
16 import symbolic.cmos # do not remove
17
18 BIT_WIDTH = 16
19 widths = {16 : 465.0, 32: 800.0}
20 offsets = {16 : 0.0, 32: 200.0}
21
22 def coriolis_setup():
23 with Config(Cfg.Parameter.Priority.UserFile) as cfg:
24 cfg.misc_catchCore = False
25 cfg.misc_info = False
26 cfg.misc_paranoid = False
27 cfg.misc_bug = False
28 cfg.misc_logMode = True
29 cfg.misc_verboseLevel1 = True
30 cfg.misc_verboseLevel2 = True
31 cfg.etesian_effort = 2
32 cfg.etesian_spaceMargin = "5.0%"
33 cfg.etesian_aspectRatio = "100.0%"
34 cfg.etesian_uniformDensity = True
35 cfg.anabatic_edgeLenght = 24
36 cfg.anabatic_edgeWidth = 8
37 cfg.anabatic_topRoutingLayer = 'METAL5'
38 cfg.katana_searchHalo = 30
39 cfg.katana_eventsLimit = 1000000
40 cfg.katana_hTracksReservedLocal = 7
41 cfg.katana_vTracksReservedLocal = 6
42
43 env = af.getEnvironment()
44 env.setCLOCK('^clk$|m_clock')
45 env.setPOWER('vdd')
46 env.setGROUND('vss')
47
48
49 class AddSub(Module):
50
51 def build(self):
52 """ Main routine. """
53
54 return True
55
56
57 class ALU16(Module):
58
59 def save(self):
60 self.name = self.name + '_r'
61 self.af.saveCell(self.cell, CRL.Catalog.State.Views)
62 super(ALU16, self).save()
63
64 def build(self):
65
66 h_margin = 0.0
67 v_margin = 50.0
68
69 if not self.build_submodules():
70 return False
71
72 # at this point we have the (auto-calculated) submodules' dimensions
73 # in their `ab` properties.
74
75 add, sub = self.submodules
76
77 with SessionManager():
78 # TODO: replace with some form of lazy evaluation?
79 y_north = self.from_dbu(self.ab.getYMax())
80 for pin_conf in self.north_pins:
81 pin_conf['y'] = y_north
82
83 self.create_pins()
84
85 if self.editor:
86 self.editor.setCell(self.cell)
87
88 self.place() # place only
89 Breakpoint.stop(1, 'After ALU16 placement.')
90 result = self.route()
91
92 self.save()
93 return result
94
95
96 def scriptMain(editor=None, **kwargs):
97 coriolis_setup()
98
99 add = AddSub(
100 'add', editor,
101 pads={
102 'b({})'.format(BIT_WIDTH-1): (
103 'BLOCKAGE2', 'BLOCKAGE3', 'BLOCKAGE4',
104 ),
105 },
106 orientation=Transformation.Orientation.ID,
107 )
108 sub = AddSub(
109 'sub', editor,
110 pads={
111 'b({})'.format(BIT_WIDTH-1): (
112 'BLOCKAGE2', 'BLOCKAGE3', 'BLOCKAGE4',
113 ),
114 },
115 orientation=Transformation.Orientation.ID,
116 )
117
118 o = offsets[BIT_WIDTH]
119 alu16 = ALU16(
120 'alu16', editor, submodules=[add, sub],
121 north_pins=[
122 {'net': 'o({})', 'x': o+365.0, 'delta': -5.0, 'repeat': BIT_WIDTH},
123 {'net': 'op'},
124 ],
125 south_pins=[
126 {'net': 'a({})', 'x': o+205.0, 'delta': 5.0, 'repeat': BIT_WIDTH},
127 {'net': 'b({})', 'x': o+295.0, 'delta': 5.0, 'repeat': BIT_WIDTH},
128 ],
129 west_pins=[
130 {'net': 'rst', 'y': 10.0, 'layer': 'METAL2'},
131 ],
132 )
133 alu16.set_ab( widths[BIT_WIDTH], BIT_WIDTH * 50.0 )
134 return alu16.build()
135
136
137 if __name__ == '__main__':
138 kwargs = {}
139 success = scriptMain(**kwargs)
140 shellSuccess = 0
141 if not success:
142 shellSuccess = 1
143
144 sys.exit(shellSuccess)