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,13 +1,9 @@
1
+ from pathlib import Path
1
2
 
2
- import os
3
- import siliconcompiler
4
- from lambdapdk import register_data_source
3
+ from lambdapdk import LambdaPDK
5
4
 
6
5
 
7
- ####################################################
8
- # PDK Setup
9
- ####################################################
10
- def setup():
6
+ class FreePDK45PDK(LambdaPDK):
11
7
  '''
12
8
  The freepdk45 PDK is a virtual PDK derived from the work done at
13
9
  NCSU (NCSU_TechLib_FreePDK45.) It supplies techfiles, display
@@ -24,85 +20,59 @@ def setup():
24
20
 
25
21
  * https://eda.ncsu.edu/freepdk/freepdk45/
26
22
  '''
27
-
28
- ###############################################
29
- # Process
30
- ###############################################
31
-
32
- foundry = 'virtual'
33
- process = 'freepdk45'
34
- rev = 'r1p0'
35
- stackup = '10M'
36
- libtype = '10t'
37
- node = 45
38
- wafersize = 300
39
- hscribe = 0.1
40
- vscribe = 0.1
41
- edgemargin = 2
42
- d0 = 1.25
43
-
44
- pdkdir = os.path.join('lambdapdk', 'freepdk45', 'base')
45
-
46
- pdk = siliconcompiler.PDK(process, package='lambdapdk')
47
- register_data_source(pdk)
48
-
49
- # process name
50
- pdk.set('pdk', process, 'foundry', foundry)
51
- pdk.set('pdk', process, 'node', node)
52
- pdk.set('pdk', process, 'version', rev)
53
- pdk.set('pdk', process, 'stackup', stackup)
54
- pdk.set('pdk', process, 'wafersize', wafersize)
55
- pdk.set('pdk', process, 'edgemargin', edgemargin)
56
- pdk.set('pdk', process, 'scribe', (hscribe, vscribe))
57
- pdk.set('pdk', process, 'd0', d0)
58
-
59
- # APR Setup
60
- for tool in ('openroad', 'klayout', 'magic'):
61
- pdk.set('pdk', process, 'aprtech', tool, stackup, libtype, 'lef',
62
- pdkdir + '/apr/freepdk45.tech.lef')
63
-
64
- pdk.set('pdk', process, 'minlayer', stackup, 'metal2')
65
- pdk.set('pdk', process, 'maxlayer', stackup, 'metal7')
66
-
67
- # Klayout setup file
68
- pdk.set('pdk', process, 'layermap', 'klayout', 'def', 'klayout', stackup,
69
- pdkdir + '/setup/klayout/freepdk45.lyt')
70
-
71
- pdk.set('pdk', process, 'display', 'klayout', stackup, pdkdir + '/setup/klayout/freepdk45.lyp')
72
-
73
- # Openroad global routing grid derating
74
- openroad_layer_adjustments = {
75
- 'metal1': 1.0,
76
- 'metal2': 0.5,
77
- 'metal3': 0.5,
78
- 'metal4': 0.25,
79
- 'metal5': 0.25,
80
- 'metal6': 0.25,
81
- 'metal7': 0.25,
82
- 'metal8': 0.25,
83
- 'metal9': 0.25,
84
- 'metal10': 0.25
85
- }
86
- for layer, adj in openroad_layer_adjustments.items():
87
- pdk.set('pdk', process, 'var', 'openroad', f'{layer}_adjustment', stackup, str(adj))
88
-
89
- pdk.set('pdk', process, 'var', 'openroad', 'rclayer_signal', stackup, 'metal3')
90
- pdk.set('pdk', process, 'var', 'openroad', 'rclayer_clock', stackup, 'metal5')
91
-
92
- pdk.set('pdk', process, 'var', 'openroad', 'pin_layer_vertical', stackup, 'metal6')
93
- pdk.set('pdk', process, 'var', 'openroad', 'pin_layer_horizontal', stackup, 'metal5')
94
-
95
- # PEX
96
- pdk.set('pdk', process, 'pexmodel', 'openroad', stackup, 'typical',
97
- pdkdir + '/pex/openroad/typical.tcl')
98
- pdk.set('pdk', process, 'pexmodel', 'openroad-openrcx', stackup, 'typical',
99
- pdkdir + '/pex/openroad/typical.rules')
100
-
101
- return pdk
102
-
103
-
104
- #########################
105
- if __name__ == "__main__":
106
- pdk = setup()
107
- register_data_source(pdk)
108
- pdk.check_filepaths()
23
+ def __init__(self):
24
+ super().__init__()
25
+ self.set_name("freepdk45")
26
+
27
+ pdk_path = Path("lambdapdk", "freepdk45", "base")
28
+
29
+ self.set_foundry("virtual")
30
+ self.package.set_version("r1p0")
31
+ self.set_node(45)
32
+ self.set_stackup("10M")
33
+ self.set_wafersize(300)
34
+ self.set_scribewidth(0.1, 0.1)
35
+ self.set_edgemargin(2)
36
+ self.set_defectdensity(1.25)
37
+
38
+ with self.active_dataroot("lambdapdk"):
39
+ # APR Setup
40
+ with self.active_fileset("views.lef"):
41
+ self.add_file(pdk_path / "apr" / "freepdk45.tech.lef")
42
+ for tool in ('openroad', 'klayout', 'magic'):
43
+ self.add_aprtechfileset(tool)
44
+
45
+ self.set_aprroutinglayers(min="metal2", max="metal7")
46
+
47
+ # Klayout setup file
48
+ with self.active_fileset("klayout.techmap"):
49
+ self.add_file(pdk_path / "setup" / "klayout" / "freepdk45.lyt", filetype="layermap")
50
+ self.add_file(pdk_path / "setup" / "klayout" / "freepdk45.lyp", filetype="display")
51
+ self.add_layermapfileset("klayout", "def", "klayout")
52
+ self.add_displayfileset("klayout")
53
+
54
+ self.set_openroad_rclayers(signal="metal3", clock="metal5")
55
+
56
+ # Openroad global routing grid derating
57
+ for layer, derate in [
58
+ ('metal1', 1.0),
59
+ ('metal2', 0.5),
60
+ ('metal3', 0.5),
61
+ ('metal4', 0.25),
62
+ ('metal5', 0.25),
63
+ ('metal6', 0.25),
64
+ ('metal7', 0.25),
65
+ ('metal8', 0.25),
66
+ ('metal9', 0.25),
67
+ ('metal10', 0.25)]:
68
+ self.set_openroad_globalroutingderating(layer, derate)
69
+
70
+ self.add_openroad_pinlayers(vertical="metal6", horizontal="metal5")
71
+
72
+ # PEX
73
+ with self.active_fileset("openroad.pex"):
74
+ self.add_file(pdk_path / "pex" / "openroad" / "typical.tcl", filetype="tcl")
75
+ self.add_file(pdk_path / "pex" / "openroad" / "typical.rules", filetype="openrcx")
76
+
77
+ self.add_pexmodelfileset("openroad", "typical")
78
+ self.add_pexmodelfileset("openroad-openrcx", "typical")
@@ -1,36 +1,84 @@
1
- from siliconcompiler import Library
2
- from lambdapdk import register_data_source
1
+ from pathlib import Path
3
2
 
3
+ from lambdalib import LambalibTechLibrary
4
+ from lambdapdk import LambdaLibrary, _LambdaPath
5
+ from lambdapdk.freepdk45 import FreePDK45PDK
4
6
 
5
- def setup():
6
- libs = []
7
- stackup = '10M'
8
- corner = 'typical'
9
7
 
10
- for config in ('64x32', '128x32', '256x32', '256x64', '512x32', '512x64'):
11
- mem_name = f'fakeram45_{config}'
12
- lib = Library(mem_name, package='lambdapdk')
13
- register_data_source(lib)
14
- path_base = 'lambdapdk/freepdk45/libs/fakeram45'
15
- lib.add('output', stackup, 'lef', f'{path_base}/lef/{mem_name}.lef')
16
- lib.add('output', corner, 'nldm', f'{path_base}/nldm/{mem_name}.lib')
8
+ class _FakeRAM45Library(LambdaLibrary):
9
+ def __init__(self, config):
10
+ super().__init__()
11
+ self.set_name(f"fakeram45_{config}")
17
12
 
18
- lib.set('option', 'file', 'openroad_pdngen',
19
- f'{path_base}/apr/openroad/pdngen.tcl')
20
- lib.set('option', 'file', 'openroad_global_connect',
21
- f'{path_base}/apr/openroad/global_connect.tcl')
13
+ self.add_asic_pdk(FreePDK45PDK())
22
14
 
23
- lib.set('option', 'var', 'klayout_allow_missing_cell', mem_name)
15
+ path_base = Path("lambdapdk", "freepdk45", "libs", "fakeram45")
24
16
 
25
- libs.append(lib)
17
+ with self.active_dataroot("lambdapdk"):
18
+ with self.active_fileset("models.physical"):
19
+ self.add_file(path_base / "lef" / f"{self.name}.lef")
20
+ self.add_asic_aprfileset()
26
21
 
27
- lambda_lib = Library('lambdalib_fakeram45', package='lambdapdk')
28
- register_data_source(lambda_lib)
29
- lambda_lib.add('option', 'ydir', 'lambdapdk/freepdk45/libs/fakeram45/lambda')
30
- for lib in libs:
31
- lambda_lib.use(lib)
32
- lambda_lib.add('asic', 'macrolib', lib.design)
22
+ with self.active_fileset("models.timing.nldm"):
23
+ self.add_file(path_base / "nldm" / f"{self.name}.lib")
24
+ self.add_asic_libcornerfileset("generic", "nldm")
33
25
 
34
- libs.append(lambda_lib)
26
+ with self.active_fileset("openroad.powergrid"):
27
+ self.add_file(path_base / "apr" / "openroad" / "pdngen.tcl")
28
+ self.add_openroad_powergridfileset()
29
+ with self.active_fileset("openroad.globalconnect"):
30
+ self.add_file(path_base / "apr" / "openroad" / "global_connect.tcl")
31
+ self.add_openroad_globalconnectfileset()
35
32
 
36
- return libs
33
+ self.add_klayout_allowmissingcell(self.name)
34
+
35
+
36
+ class FakeRAM45_64x32(_FakeRAM45Library):
37
+ def __init__(self):
38
+ super().__init__("64x32")
39
+
40
+
41
+ class FakeRAM45_128x32(_FakeRAM45Library):
42
+ def __init__(self):
43
+ super().__init__("128x32")
44
+
45
+
46
+ class FakeRAM45_256x32(_FakeRAM45Library):
47
+ def __init__(self):
48
+ super().__init__("256x32")
49
+
50
+
51
+ class FakeRAM45_256x64(_FakeRAM45Library):
52
+ def __init__(self):
53
+ super().__init__("256x64")
54
+
55
+
56
+ class FakeRAM45_512x32(_FakeRAM45Library):
57
+ def __init__(self):
58
+ super().__init__("512x32")
59
+
60
+
61
+ class FakeRAM45_512x64(_FakeRAM45Library):
62
+ def __init__(self):
63
+ super().__init__("512x64")
64
+
65
+
66
+ class FakeRAM45Lambdalib_SinglePort(LambalibTechLibrary, _LambdaPath):
67
+ def __init__(self):
68
+ super().__init__("la_spram", [
69
+ FakeRAM45_64x32,
70
+ FakeRAM45_128x32,
71
+ FakeRAM45_256x32,
72
+ FakeRAM45_256x64,
73
+ FakeRAM45_512x32,
74
+ FakeRAM45_512x64])
75
+ self.set_name("fakeram45_la_spram")
76
+
77
+ # version
78
+ self.package.set_version("v1")
79
+
80
+ lib_path = Path("lambdapdk", "freepdk45", "libs", "fakeram45")
81
+
82
+ with self.active_dataroot("lambdapdk"):
83
+ with self.active_fileset("rtl"):
84
+ self.add_file(lib_path / "lambda" / "la_spram.v")
@@ -1,130 +1,95 @@
1
- import os
2
- import siliconcompiler
3
- from lambdapdk import register_data_source
1
+ from pathlib import Path
4
2
 
3
+ from lambdapdk import LambdaLibrary
5
4
 
6
- def setup():
5
+ from lambdapdk.freepdk45 import FreePDK45PDK
6
+
7
+
8
+ class Nangate45(LambdaLibrary):
7
9
  '''
8
10
  Nangate open standard cell library for FreePDK45.
9
11
  '''
10
- libname = 'nangate45'
11
- process = 'freepdk45'
12
- stackup = '10M'
13
- libtype = '10t'
14
- version = 'r1p0'
15
- corner = 'typical'
16
-
17
- lib = siliconcompiler.Library(libname, package='lambdapdk')
18
- register_data_source(lib)
19
-
20
- libdir = os.path.join('lambdapdk', process, 'libs', libname)
21
-
22
- # version
23
- lib.set('package', 'version', version)
24
-
25
- # list of stackups supported
26
- lib.set('option', 'stackup', stackup)
27
-
28
- # list of pdks supported
29
- lib.set('option', 'pdk', process)
30
-
31
- # footprint/type/sites
32
- lib.set('asic', 'libarch', libtype)
33
- lib.set('asic', 'site', libtype, 'FreePDK45_38x28_10R_NP_162NW_34O')
34
-
35
- # timing
36
- lib.add('output', corner, 'nldm', libdir + '/nldm/NangateOpenCellLibrary_typical.lib')
37
-
38
- # lef
39
- lib.add('output', stackup, 'lef', libdir + '/lef/NangateOpenCellLibrary.macro.mod.lef')
40
-
41
- # gds
42
- lib.add('output', stackup, 'gds', libdir + '/gds/NangateOpenCellLibrary.gds')
43
-
44
- # cdl
45
- lib.add('output', stackup, 'cdl', libdir + '/cdl/NangateOpenCellLibrary.cdl')
46
-
47
- # clock buffers
48
- lib.set('asic', 'cells', 'clkbuf', ["CLKBUF_X1",
49
- "CLKBUF_X2",
50
- "CLKBUF_X3"])
51
-
52
- # tie cells
53
- lib.add('asic', 'cells', 'tie', ["LOGIC1_X1",
54
- "LOGIC0_X1"])
55
-
56
- # filler
57
- lib.add('asic', 'cells', 'filler', ["FILLCELL_X1",
58
- "FILLCELL_X2",
59
- "FILLCELL_X4",
60
- "FILLCELL_X8",
61
- "FILLCELL_X16",
62
- "FILLCELL_X32"])
63
-
64
- # Stupid small cells
65
- lib.add('asic', 'cells', 'dontuse', ["OAI211_X1"])
66
-
67
- # Tapcell
68
- lib.add('asic', 'cells', 'tap', "TAPCELL_X1")
69
-
70
- # Endcap
71
- lib.add('asic', 'cells', 'endcap', "TAPCELL_X1")
72
-
73
- # Techmap
74
- lib.add('option', 'file', 'yosys_techmap', libdir + '/techmap/yosys/cells_latch.v')
75
- lib.add('option', 'file', 'yosys_addermap', libdir + '/techmap/yosys/cells_adders.v')
76
- lib.add('option', 'file', 'yosys_tbufmap', libdir + '/techmap/yosys/cells_tristatebuf.v')
77
-
78
- # Defaults for OpenROAD tool variables
79
- lib.set('option', 'var', 'openroad_place_density', '0.50')
80
- lib.set('option', 'var', 'openroad_pad_global_place', '0')
81
- lib.set('option', 'var', 'openroad_pad_detail_place', '0')
82
- lib.set('option', 'var', 'openroad_macro_place_halo', ['22.4', '15.12'])
83
- lib.set('option', 'var', 'openroad_macro_place_channel', ['18.8', '19.95'])
84
-
85
- lib.set('option', 'file', 'openroad_tapcells', libdir + '/apr/openroad/tapcell.tcl')
86
- lib.set('option', 'file', 'openroad_pdngen', libdir + '/apr/openroad/pdngen.tcl')
87
- lib.set('option', 'file', 'openroad_global_connect',
88
- libdir + '/apr/openroad/global_connect.tcl')
89
-
90
- lib.set('option', 'var', 'yosys_abc_clock_multiplier', "1000") # convert from ns -> ps
91
- lib.set('option', 'var', 'yosys_abc_constraint_load', "3.899fF") # BUF_X1 = 0.974659 x 4
92
- lib.set('option', 'var', 'yosys_driver_cell', "BUF_X4")
93
- lib.set('option', 'var', 'yosys_buffer_cell', "BUF_X1")
94
- lib.set('option', 'var', 'yosys_buffer_input', "A")
95
- lib.set('option', 'var', 'yosys_buffer_output', "Z")
96
- for tool in ('yosys', 'openroad'):
97
- lib.set('option', 'var', f'{tool}_tiehigh_cell', "LOGIC1_X1")
98
- lib.set('option', 'var', f'{tool}_tiehigh_port', "Z")
99
- lib.set('option', 'var', f'{tool}_tielow_cell', "LOGIC0_X1")
100
- lib.set('option', 'var', f'{tool}_tielow_port', "Z")
101
-
102
- # Bambu setup
103
- lib.set('option', 'var', 'bambu_device', 'nangate45')
104
- lib.set('option', 'var', 'bambu_clock_multiplier', 1) # convert from ns -> ns
105
-
106
- libs = [lib]
107
- std_lambda_lib = siliconcompiler.Library(f'lambdalib_stdlib_{libname}',
108
- package='lambdapdk')
109
- register_data_source(std_lambda_lib)
110
- std_lambda_lib.add('option', 'ydir', libdir + '/lambda/stdlib')
111
- std_lambda_lib.use(lib)
112
- std_lambda_lib.set('asic', 'logiclib', lib.design)
113
- libs.append(std_lambda_lib)
114
- aux_lambda_lib = siliconcompiler.Library(f'lambdalib_auxlib_{libname}',
115
- package='lambdapdk')
116
- register_data_source(aux_lambda_lib)
117
- aux_lambda_lib.add('option', 'ydir', libdir + '/lambda/auxlib')
118
- aux_lambda_lib.use(std_lambda_lib)
119
- aux_lambda_lib.use(lib)
120
- aux_lambda_lib.set('asic', 'logiclib', lib.design)
121
- aux_lambda_lib.set('option', 'library', std_lambda_lib.design)
122
- libs.append(aux_lambda_lib)
123
-
124
- return libs
125
-
126
-
127
- #########################
128
- if __name__ == "__main__":
129
- lib = setup()
130
- lib.write_manifest(f'{lib.top()}.json')
12
+ def __init__(self):
13
+ super().__init__()
14
+ self.set_name("nangate45")
15
+
16
+ # version
17
+ self.package.set_version("r1p0")
18
+
19
+ self.add_asic_pdk(FreePDK45PDK())
20
+
21
+ self.add_asic_site("FreePDK45_38x28_10R_NP_162NW_34O")
22
+
23
+ # clock buffers
24
+ self.add_asic_celllist("clkbuf", ["CLKBUF_X1",
25
+ "CLKBUF_X2",
26
+ "CLKBUF_X3"])
27
+
28
+ # tie cells
29
+ self.add_asic_celllist("tie", ["LOGIC0_X1",
30
+ "LOGIC1_X1"])
31
+
32
+ # filler
33
+ self.add_asic_celllist("filler", ["FILLCELL_X1",
34
+ "FILLCELL_X2",
35
+ "FILLCELL_X4",
36
+ "FILLCELL_X8",
37
+ "FILLCELL_X16",
38
+ "FILLCELL_X32"])
39
+
40
+ # Dont use for synthesis
41
+ self.add_asic_celllist("dontuse", "OAI211_X1")
42
+
43
+ # Tapcell
44
+ self.add_asic_celllist("tap", "TAPCELL_X1")
45
+
46
+ # Endcap
47
+ self.add_asic_celllist("endcap", "TAPCELL_X1")
48
+
49
+ lib_path = Path("lambdapdk", "freepdk45", "libs", "nangate45")
50
+
51
+ # General filelists
52
+ with self.active_dataroot("lambdapdk"):
53
+ with self.active_fileset("models.timing.nldm"):
54
+ self.add_file(lib_path / "nldm" / "NangateOpenCellLibrary_typical.lib")
55
+ self.add_asic_libcornerfileset("typical", "nldm")
56
+
57
+ with self.active_fileset("models.physical"):
58
+ self.add_file(lib_path / "lef" / "NangateOpenCellLibrary.macro.mod.lef")
59
+ self.add_file(lib_path / "gds" / "NangateOpenCellLibrary.gds")
60
+ self.add_asic_aprfileset()
61
+
62
+ with self.active_fileset("models.lvs"):
63
+ self.add_file(lib_path / "cdl" / "NangateOpenCellLibrary.cdl")
64
+ self.add_asic_aprfileset()
65
+
66
+ # Setup for yosys
67
+ with self.active_dataroot("lambdapdk"):
68
+ self.set_yosys_driver_cell("BUF_X4")
69
+ self.set_yosys_buffer_cell("BUF_X1", "A", "Z")
70
+ self.set_yosys_tielow_cell("LOGIC0_X1", "Z")
71
+ self.set_yosys_tiehigh_cell("LOGIC1_X1", "Z")
72
+ self.set_yosys_abc(1000, 3.899)
73
+ self.set_yosys_tristatebuffer_map(
74
+ lib_path / "techmap" / "yosys" / "cells_tristatebuf.v")
75
+ self.set_yosys_adder_map(lib_path / "techmap" / "yosys" / "cells_adders.v")
76
+ self.add_yosys_tech_map(lib_path / "techmap" / "yosys" / "cells_latch.v")
77
+
78
+ # Setup for openroad
79
+ with self.active_dataroot("lambdapdk"):
80
+ with self.active_fileset("openroad.powergrid"):
81
+ self.add_file(lib_path / "apr" / "openroad" / "pdngen.tcl")
82
+ self.add_openroad_powergridfileset()
83
+ with self.active_fileset("openroad.globalconnect"):
84
+ self.add_file(lib_path / "apr" / "openroad" / "global_connect.tcl")
85
+ self.add_openroad_globalconnectfileset()
86
+
87
+ self.set_openroad_placement_density(0.50)
88
+ self.set_openroad_tielow_cell("LOGIC0_X1", "Z")
89
+ self.set_openroad_tiehigh_cell("LOGIC1_X1", "Z")
90
+ self.set_openroad_macro_placement_halo(22.4, 15.12)
91
+ self.set_openroad_tapcells_file(lib_path / "apr" / "openroad" / "tapcell.tcl")
92
+
93
+ # Setup for bambu
94
+ self.set_bambu_device_name("nangate45")
95
+ self.set_bambu_clock_multiplier(1)