lambdapdk 0.1.55__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,9 @@
1
- import os
2
- import siliconcompiler
3
- from lambdapdk import register_data_source
1
+ from pathlib import Path
4
2
 
3
+ from lambdapdk import LambdaPDK
5
4
 
6
- ####################################################
7
- # PDK Setup
8
- ####################################################
9
- def setup():
5
+
6
+ class ASAP7PDK(LambdaPDK):
10
7
  '''
11
8
  The asap7 PDK was developed at ASU in collaboration with ARM Research.
12
9
  With funding from the DARPA IDEA program, the PDK was released
@@ -38,97 +35,74 @@ def setup():
38
35
 
39
36
 
40
37
  Sources: https://github.com/The-OpenROAD-Project/asap7
41
-
42
- .. warning::
43
- Work in progress (not ready for use)
44
38
  '''
45
39
 
46
- foundry = 'virtual'
47
- process = 'asap7'
48
- node = 7
49
- rev = 'r1p7'
50
- stackup = '10M'
51
- wafersize = 300
52
- libtype = '7p5t'
53
- pdkdir = os.path.join('lambdapdk', 'asap7', 'base')
54
-
55
- pdk = siliconcompiler.PDK(process, package='lambdapdk')
56
- register_data_source(pdk)
57
-
58
- # process name
59
- pdk.set('pdk', process, 'foundry', foundry)
60
- pdk.set('pdk', process, 'node', node)
61
- pdk.set('pdk', process, 'wafersize', wafersize)
62
- pdk.set('pdk', process, 'version', rev)
63
- pdk.set('pdk', process, 'stackup', stackup)
64
-
65
- # APR tech file
66
- for tool in ('openroad', 'klayout', 'magic'):
67
- pdk.set('pdk', process, 'aprtech', tool, stackup, libtype, 'lef',
68
- pdkdir + '/apr/asap7_tech.lef')
69
-
70
- pdk.set('pdk', process, 'minlayer', stackup, 'M2')
71
- pdk.set('pdk', process, 'maxlayer', stackup, 'M7')
72
-
73
- # Device models
74
- pdk.set('pdk', process, 'devmodel', 'xyce', 'hspice', stackup,
75
- pdkdir + '/spice/hspice/7nm.lib')
76
-
77
- # Klayout setup file
78
- pdk.set('pdk', process, 'layermap', 'klayout', 'def', 'klayout', stackup,
79
- pdkdir + '/setup/klayout/asap7.lyt')
80
- pdk.set('pdk', process, 'layermap', 'klayout', 'def', 'gds', stackup,
81
- pdkdir + '/apr/asap7.layermap')
82
-
83
- pdk.set('pdk', process, 'display', 'klayout', stackup,
84
- pdkdir + '/setup/klayout/asap7.lyp')
85
-
86
- # Openroad global routing grid derating
87
- openroad_layer_adjustments = {
88
- 'M1': 1.0,
89
- 'M2': 0.8,
90
- 'M3': 0.7,
91
- 'M4': 0.4,
92
- 'M5': 0.4,
93
- 'M6': 0.4,
94
- 'M7': 0.4,
95
- 'M8': 0.4,
96
- 'M9': 0.4,
97
- 'Pad': 1.0
98
- }
99
- for layer, adj in openroad_layer_adjustments.items():
100
- pdk.set('pdk', process, 'var', 'openroad', f'{layer}_adjustment', stackup, str(adj))
101
-
102
- pdk.set('pdk', process, 'var', 'openroad', 'rclayer_signal', stackup, 'M3')
103
- pdk.set('pdk', process, 'var', 'openroad', 'rclayer_clock', stackup, 'M3')
104
-
105
- pdk.set('pdk', process, 'var', 'openroad', 'pin_layer_vertical', stackup, 'M5')
106
- pdk.set('pdk', process, 'var', 'openroad', 'pin_layer_horizontal', stackup, 'M4')
107
-
108
- # PEX
109
- pdk.set('pdk', process, 'pexmodel', 'openroad', stackup, 'typical',
110
- pdkdir + '/pex/openroad/typical.tcl')
111
- pdk.set('pdk', process, 'pexmodel', 'openroad-openrcx', stackup, 'typical',
112
- pdkdir + '/pex/openroad/typical.rules')
113
-
114
- # Relaxed routing rules
115
- pdk.set('pdk', process, 'file', 'openroad', 'relax_routing_rules', stackup,
116
- pdkdir + '/apr/openroad_relaxed_rules.tcl')
117
-
118
- # Hide the DIEAREA layer 235/*.
119
- pdk.add('pdk', process, 'var', 'klayout', 'hide_layers', stackup, '235/0')
120
- pdk.add('pdk', process, 'var', 'klayout', 'hide_layers', stackup, '235/5')
121
- # Hide boundary layer
122
- pdk.add('pdk', process, 'var', 'klayout', 'hide_layers', stackup, '100/0')
123
- # Hide vt layers
124
- pdk.add('pdk', process, 'var', 'klayout', 'hide_layers', stackup, '97/0')
125
- pdk.add('pdk', process, 'var', 'klayout', 'hide_layers', stackup, '98/0')
126
-
127
- return pdk
128
-
129
-
130
- #########################
131
- if __name__ == "__main__":
132
- pdk = setup()
133
- register_data_source(pdk)
134
- pdk.check_filepaths()
40
+ def __init__(self):
41
+ super().__init__()
42
+ self.set_name("asap7")
43
+
44
+ pdk_path = Path("lambdapdk", "asap7", "base")
45
+
46
+ self.set_foundry("virtual")
47
+ self.package.set_version("r1p7")
48
+ self.set_node(7)
49
+ self.set_stackup("10M")
50
+ self.set_wafersize(300)
51
+ self.set_scribewidth(0.1, 0.1)
52
+ self.set_edgemargin(2)
53
+ self.set_defectdensity(1.25)
54
+
55
+ with self.active_dataroot("lambdapdk"):
56
+ # APR Setup
57
+ with self.active_fileset("views.lef"):
58
+ self.add_file(pdk_path / "apr" / "asap7_tech.lef")
59
+ for tool in ('openroad', 'klayout', 'magic'):
60
+ self.add_aprtechfileset(tool)
61
+
62
+ with self.active_fileset("layermap"):
63
+ self.add_file(pdk_path / "apr" / "asap7.layermap", filetype="layermap")
64
+
65
+ with self.active_fileset("models.spice"):
66
+ self.add_file(pdk_path / "spice" / "hspice" / "7nm.lib", filetype="library")
67
+ self.add_devmodelfileset("xyce", "spice")
68
+
69
+ # Klayout setup
70
+ with self.active_fileset("klayout.techmap"):
71
+ self.add_file(pdk_path / "setup" / "klayout" / "asap7.lyt", filetype="layermap")
72
+ self.add_file(pdk_path / "setup" / "klayout" / "asap7.lyp", filetype="display")
73
+ self.add_layermapfileset("klayout", "def", "klayout")
74
+ self.add_displayfileset("klayout")
75
+ self.add_layermapfileset("klayout", "def", "gds", fileset="layermap")
76
+
77
+ self.set_aprroutinglayers(min="M2", max="M7")
78
+
79
+ # OpenROAD setup
80
+ self.set_openroad_rclayers(signal="M3", clock="M3")
81
+
82
+ # Openroad global routing grid derating
83
+ for layer, derate in [
84
+ ('M1', 0.25),
85
+ ('M2', 0.25),
86
+ ('M3', 0.25),
87
+ ('M4', 0.25),
88
+ ('M5', 0.25),
89
+ ('M6', 0.25),
90
+ ('M7', 0.25),
91
+ ('M8', 0.25),
92
+ ('M9', 0.25),
93
+ ('Pad', 0.25)]:
94
+ self.set_openroad_globalroutingderating(layer, derate)
95
+
96
+ self.add_openroad_pinlayers(vertical="M5", horizontal="M4")
97
+
98
+ with self.active_fileset("openroad.routing"):
99
+ # Relaxed routing rules
100
+ self.add_file(pdk_path / "apr" / "openroad_relaxed_rules.tcl", filetype="tcl")
101
+
102
+ # PEX
103
+ with self.active_fileset("openroad.pex"):
104
+ self.add_file(pdk_path / "pex" / "openroad" / "typical.tcl", filetype="tcl")
105
+ self.add_file(pdk_path / "pex" / "openroad" / "typical.rules", filetype="openrcx")
106
+
107
+ self.add_pexmodelfileset("openroad", "typical")
108
+ self.add_pexmodelfileset("openroad-openrcx", "typical")
@@ -1,162 +1,127 @@
1
- import os
2
- import siliconcompiler
3
- from lambdapdk import register_data_source
4
-
5
-
6
- def _setup_lib(libname, suffix):
7
- lib = siliconcompiler.Library(libname, package='lambdapdk')
8
- register_data_source(lib)
9
-
10
- process = 'asap7'
11
- stackup = '10M'
12
- libtype = '7p5t'
13
- rev = '28'
14
- corners = {'typical': 'TT',
15
- 'fast': 'FF',
16
- 'slow': 'SS'}
17
-
18
- libdir = os.path.join('lambdapdk', process, 'libs', libname)
19
-
20
- # rev
21
- lib.set('package', 'version', rev)
22
-
23
- # todo: remove later
24
- lib.set('option', 'pdk', process)
25
-
26
- # timing
27
- for corner_name, lib_corner in corners.items():
28
- for lib_type in ('AO', 'INVBUF', 'OA', 'SEQ', 'SIMPLE'):
29
- lib.add('output', corner_name, 'nldm',
30
- libdir + f'/nldm/asap7sc7p5t_{lib_type}_{suffix}VT_{lib_corner}_nldm.lib.gz')
31
- # spice
32
- lib.add('output', corner_name, 'spice', libdir + f'/netlist/asap7sc7p5t_28_{suffix}.sp')
33
-
34
- # lef
35
- lib.add('output', stackup, 'lef', libdir + f'/lef/asap7sc7p5t_28_{suffix}.lef')
36
-
37
- # gds
38
- lib.add('output', stackup, 'gds', libdir + f'/gds/asap7sc7p5t_28_{suffix}.gds.gz')
39
-
40
- # cdl
41
- lib.add('output', stackup, 'cdl', libdir + f'/netlist/asap7sc7p5t_28_{suffix}.cdl')
42
-
43
- # lib arch
44
- lib.set('asic', 'libarch', libtype)
45
-
46
- # site name
47
- lib.set('asic', 'site', libtype, 'asap7sc7p5t')
48
-
49
- # tie cells
50
- lib.add('asic', 'cells', 'tie', [f"TIEHIx1_ASAP7_75t_{suffix}",
51
- f"TIELOx1_ASAP7_75t_{suffix}"])
52
-
53
- # filler
54
- lib.add('asic', 'cells', 'filler', [f"FILLER_ASAP7_75t_{suffix}",
55
- f"FILLERxp5_ASAP7_75t_{suffix}"])
56
-
57
- # decap
58
- lib.add('asic', 'cells', 'decap', [f"DECAPx1_ASAP7_75t_{suffix}",
59
- f"DECAPx2_ASAP7_75t_{suffix}",
60
- f"DECAPx4_ASAP7_75t_{suffix}",
61
- f"DECAPx6_ASAP7_75t_{suffix}",
62
- f"DECAPx10_ASAP7_75t_{suffix}"])
63
-
64
- # Stupid small cells
65
- lib.add('asic', 'cells', 'dontuse', ["*x1p*_ASAP7*",
66
- "*xp*_ASAP7*",
67
- "SDF*",
68
- "ICG*"])
69
-
70
- # Tapcell
71
- lib.add('asic', 'cells', 'tap', f"TAPCELL_ASAP7_75t_{suffix}")
72
-
73
- # Endcap
74
- lib.add('asic', 'cells', 'endcap', f"DECAPx1_ASAP7_75t_{suffix}")
75
-
76
- # Yosys techmap
77
- lib.add('option', 'file', 'yosys_techmap', libdir + '/techmap/yosys/cells_latch.v')
78
- lib.add('option', 'file', 'yosys_addermap', libdir + '/techmap/yosys/cells_adders.v')
79
- lib.set('option', 'file', 'yosys_dff_liberty',
80
- libdir + f'/nldm/asap7sc7p5t_SEQ_{suffix}VT_SS_nldm.lib.gz')
81
-
82
- # Defaults for OpenROAD tool variables
83
- lib.set('option', 'var', 'openroad_place_density', '0.60')
84
- lib.set('option', 'var', 'openroad_pad_global_place', '0')
85
- lib.set('option', 'var', 'openroad_pad_detail_place', '0')
86
- lib.set('option', 'var', 'openroad_macro_place_halo', ['5', '5'])
87
- lib.set('option', 'var', 'openroad_macro_place_channel', ['6', '6'])
88
-
89
- lib.set('option', 'var', 'openroad_cts_distance_between_buffers', "60")
90
-
91
- lib.set('option', 'var', 'yosys_abc_clock_multiplier', "1") # convert from ps -> ps
92
-
93
- cap_table = { # BUFx2_ASAP7_75t_
94
- 'R': "2.308fF",
95
- 'L': "2.383fF",
96
- 'SL': "2.464fF"
97
- }
98
- lib.set('option', 'var', 'yosys_abc_constraint_load', cap_table[suffix])
99
- lib.set('option', 'var', 'yosys_driver_cell', f"BUFx2_ASAP7_75t_{suffix}")
100
- lib.set('option', 'var', 'yosys_buffer_cell', f"BUFx2_ASAP7_75t_{suffix}")
101
- lib.set('option', 'var', 'yosys_buffer_input', "A")
102
- lib.set('option', 'var', 'yosys_buffer_output', "Y")
103
- for tool in ('yosys', 'openroad'):
104
- lib.set('option', 'var', f'{tool}_tiehigh_cell', f"TIEHIx1_ASAP7_75t_{suffix}")
105
- lib.set('option', 'var', f'{tool}_tiehigh_port', "H")
106
- lib.set('option', 'var', f'{tool}_tielow_cell', f"TIELOx1_ASAP7_75t_{suffix}")
107
- lib.set('option', 'var', f'{tool}_tielow_port', "L")
108
-
109
- # Openroad APR setup files
110
- lib.set('option', 'file', 'openroad_tracks', libdir + '/apr/openroad/tracks.tcl')
111
- lib.set('option', 'file', 'openroad_tapcells', libdir + '/apr/openroad/tapcells.tcl')
112
- lib.set('option', 'file', 'openroad_pdngen', libdir + '/apr/openroad/pdngen.tcl')
113
- lib.set('option', 'file', 'openroad_global_connect',
114
- libdir + '/apr/openroad/global_connect.tcl')
115
-
116
- # Bambu setup
117
- lib.set('option', 'var', 'bambu_device', 'asap7-WC')
118
- lib.set('option', 'var', 'bambu_clock_multiplier', "0.001") # convert from ps -> ns
119
-
120
- libs = [lib]
121
- std_lambda_lib = siliconcompiler.Library(f'lambdalib_stdlib_{libname}',
122
- package='lambdapdk')
123
- register_data_source(std_lambda_lib)
124
- std_lambda_lib.add('option', 'ydir', libdir + '/lambda/stdlib')
125
- std_lambda_lib.use(lib)
126
- std_lambda_lib.set('asic', 'logiclib', lib.design)
127
- libs.append(std_lambda_lib)
128
- aux_lambda_lib = siliconcompiler.Library(f'lambdalib_auxlib_{libname}',
129
- package='lambdapdk')
130
- register_data_source(aux_lambda_lib)
131
- aux_lambda_lib.add('option', 'ydir', libdir + '/lambda/auxlib')
132
- aux_lambda_lib.use(std_lambda_lib)
133
- aux_lambda_lib.use(lib)
134
- aux_lambda_lib.set('asic', 'logiclib', lib.design)
135
- aux_lambda_lib.set('option', 'library', std_lambda_lib.design)
136
- libs.append(aux_lambda_lib)
137
-
138
- return libs
139
-
140
-
141
- def setup():
142
- '''
143
- ASAP 7 7.5-track standard cell library.
144
- '''
145
- all_libs = {
146
- 'asap7sc7p5t_rvt': 'R',
147
- 'asap7sc7p5t_lvt': 'L',
148
- 'asap7sc7p5t_slvt': 'SL'
149
- }
150
-
151
- libs = []
152
- for libname, suffix in all_libs.items():
153
- libs.extend(_setup_lib(libname, suffix))
1
+ from pathlib import Path
154
2
 
155
- return libs
3
+ from lambdapdk import LambdaLibrary
4
+ from lambdapdk.asap7 import ASAP7PDK
156
5
 
157
6
 
158
- #########################
159
- if __name__ == "__main__":
160
- for lib in setup(siliconcompiler.Chip('<lib>')):
161
- register_data_source(lib)
162
- lib.check_filepaths()
7
+ class _ASAP7SC7p5Base(LambdaLibrary):
8
+ '''
9
+ ASAP 7 7.5-track standard cell library.
10
+ '''
11
+ def __init__(self, vt, suffix):
12
+ super().__init__()
13
+ self.set_name(f"asap7sc7p5t_{vt}")
14
+
15
+ # version
16
+ self.package.set_version("28")
17
+
18
+ # PDK
19
+ self.add_asic_pdk(ASAP7PDK())
20
+
21
+ # site name
22
+ self.add_asic_site('asap7sc7p5t')
23
+
24
+ # tie cells
25
+ self.add_asic_celllist('tie', [f"TIEHIx1_ASAP7_75t_{suffix}",
26
+ f"TIELOx1_ASAP7_75t_{suffix}"])
27
+
28
+ # filler
29
+ self.add_asic_celllist('filler', [f"FILLER_ASAP7_75t_{suffix}",
30
+ f"FILLERxp5_ASAP7_75t_{suffix}"])
31
+
32
+ # decap
33
+ self.add_asic_celllist('decap', [f"DECAPx1_ASAP7_75t_{suffix}",
34
+ f"DECAPx2_ASAP7_75t_{suffix}",
35
+ f"DECAPx4_ASAP7_75t_{suffix}",
36
+ f"DECAPx6_ASAP7_75t_{suffix}",
37
+ f"DECAPx10_ASAP7_75t_{suffix}"])
38
+
39
+ # Stupid small cells
40
+ self.add_asic_celllist('dontuse', ["*x1p*_ASAP7*",
41
+ "*xp*_ASAP7*",
42
+ "SDF*",
43
+ "ICG*"])
44
+
45
+ # Tapcell
46
+ self.add_asic_celllist('tap', f"TAPCELL_ASAP7_75t_{suffix}")
47
+
48
+ # Endcap
49
+ self.add_asic_celllist('endcap', f"DECAPx1_ASAP7_75t_{suffix}")
50
+
51
+ lib_path = Path("lambdapdk", "asap7", "libs", f"asap7sc7p5t_{vt}")
52
+
53
+ # General filelists
54
+ with self.active_dataroot("lambdapdk"):
55
+ for corner_name, lib_corner in [
56
+ ('typical', 'TT'),
57
+ ('fast', 'FF'),
58
+ ('slow', 'SS')]:
59
+
60
+ for lib_type in ('AO', 'INVBUF', 'OA', 'SEQ', 'SIMPLE'):
61
+ with self.active_fileset(f"models.timing.{corner_name}.nldm.{lib_type}"):
62
+ self.add_file(lib_path / "nldm" /
63
+ f"asap7sc7p5t_{lib_type}_{suffix}VT_{lib_corner}_nldm.lib.gz")
64
+ self.add_asic_libcornerfileset(corner_name, "nldm")
65
+
66
+ with self.active_fileset("models.spice"):
67
+ self.add_file(lib_path / "netlist" / f"asap7sc7p5t_28_{suffix}.sp")
68
+
69
+ with self.active_fileset("models.physical"):
70
+ self.add_file(lib_path / "lef" / f"asap7sc7p5t_28_{suffix}.lef")
71
+ self.add_file(lib_path / "gds" / f"asap7sc7p5t_28_{suffix}.gds.gz")
72
+ self.add_asic_aprfileset()
73
+
74
+ with self.active_fileset("models.lvs"):
75
+ self.add_file(lib_path / "netlist" / f"asap7sc7p5t_28_{suffix}.cdl")
76
+ self.add_asic_aprfileset()
77
+
78
+ # Setup for yosys
79
+ with self.active_dataroot("lambdapdk"):
80
+ self.set_yosys_driver_cell(f"BUFx2_ASAP7_75t_{suffix}")
81
+ self.set_yosys_buffer_cell(f"BUFx2_ASAP7_75t_{suffix}", "A", "Y")
82
+ self.set_yosys_tielow_cell(f"TIELOx1_ASAP7_75t_{suffix}", "L")
83
+ self.set_yosys_tiehigh_cell(f"TIEHIx1_ASAP7_75t_{suffix}", "H")
84
+
85
+ cap_table = { # BUFx2_ASAP7_75t_, fF
86
+ 'R': "2.308",
87
+ 'L': "2.383",
88
+ 'SL': "2.464"
89
+ }
90
+ self.set_yosys_abc(1, cap_table[suffix])
91
+ self.set_yosys_adder_map(lib_path / "techmap" / "yosys" / "cells_adders.v")
92
+ self.add_yosys_tech_map(lib_path / "techmap" / "yosys" / "cells_latch.v")
93
+
94
+ # Setup for openroad
95
+ with self.active_dataroot("lambdapdk"):
96
+ with self.active_fileset("openroad.powergrid"):
97
+ self.add_file(lib_path / "apr" / "openroad" / "pdngen.tcl")
98
+ self.add_openroad_powergridfileset()
99
+ with self.active_fileset("openroad.globalconnect"):
100
+ self.add_file(lib_path / "apr" / "openroad" / "global_connect.tcl")
101
+ self.add_openroad_globalconnectfileset()
102
+
103
+ self.set_openroad_placement_density(0.60)
104
+ self.set_openroad_tielow_cell(f"TIELOx1_ASAP7_75t_{suffix}", "L")
105
+ self.set_openroad_tiehigh_cell(f"TIEHIx1_ASAP7_75t_{suffix}", "H")
106
+ self.set_openroad_macro_placement_halo(5, 5)
107
+ self.set_openroad_tracks_file(lib_path / "apr" / "openroad" / "tracks.tcl")
108
+ self.set_openroad_tapcells_file(lib_path / "apr" / "openroad" / "tapcells.tcl")
109
+
110
+ # Setup for bambu
111
+ self.set_bambu_device_name("asap7-WC")
112
+ self.set_bambu_clock_multiplier(0.001)
113
+
114
+
115
+ class ASAP7SC7p5RVT(_ASAP7SC7p5Base):
116
+ def __init__(self):
117
+ super().__init__("rvt", "R")
118
+
119
+
120
+ class ASAP7SC7p5LVT(_ASAP7SC7p5Base):
121
+ def __init__(self):
122
+ super().__init__("lvt", "L")
123
+
124
+
125
+ class ASAP7SC7p5SLVT(_ASAP7SC7p5Base):
126
+ def __init__(self):
127
+ super().__init__("slvt", "SL")