siliconcompiler 0.28.0__py3-none-any.whl → 0.28.2__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.
Files changed (94) hide show
  1. siliconcompiler/_metadata.py +1 -1
  2. siliconcompiler/apps/sc_install.py +192 -0
  3. siliconcompiler/core.py +15 -0
  4. siliconcompiler/flows/dvflow.py +51 -14
  5. siliconcompiler/libs/sg13g2_stdcell.py +8 -0
  6. siliconcompiler/pdks/ihp130.py +8 -0
  7. siliconcompiler/schema/schema_cfg.py +2 -2
  8. siliconcompiler/targets/ihp130_demo.py +68 -0
  9. siliconcompiler/tools/_common/tcl/sc_pin_constraints.tcl +6 -5
  10. siliconcompiler/tools/openroad/scripts/sc_floorplan.tcl +1 -5
  11. siliconcompiler/tools/openroad/scripts/sc_metrics.tcl +1 -1
  12. siliconcompiler/tools/openroad/scripts/sc_procs.tcl +42 -16
  13. siliconcompiler/tools/openroad/scripts/sc_route.tcl +1 -1
  14. siliconcompiler/tools/openroad/scripts/sc_write_images.tcl +10 -10
  15. siliconcompiler/tools/opensta/scripts/sc_procs.tcl +3 -3
  16. siliconcompiler/tools/xdm/__init__.py +28 -0
  17. siliconcompiler/tools/xdm/convert.py +71 -0
  18. siliconcompiler/tools/xyce/__init__.py +40 -0
  19. siliconcompiler/tools/xyce/simulate.py +70 -0
  20. siliconcompiler/tools/yosys/syn_asic.tcl +1 -1
  21. siliconcompiler/toolscripts/_tools.json +131 -0
  22. siliconcompiler/toolscripts/_tools.py +222 -0
  23. siliconcompiler/toolscripts/ubuntu20/install-bambu.sh +49 -0
  24. siliconcompiler/toolscripts/ubuntu20/install-bluespec.sh +35 -0
  25. siliconcompiler/toolscripts/ubuntu20/install-chisel.sh +26 -0
  26. siliconcompiler/toolscripts/ubuntu20/install-ghdl.sh +25 -0
  27. siliconcompiler/toolscripts/ubuntu20/install-icarus.sh +25 -0
  28. siliconcompiler/toolscripts/ubuntu20/install-icepack.sh +22 -0
  29. siliconcompiler/toolscripts/ubuntu20/install-klayout.sh +29 -0
  30. siliconcompiler/toolscripts/ubuntu20/install-magic.sh +24 -0
  31. siliconcompiler/toolscripts/ubuntu20/install-montage.sh +5 -0
  32. siliconcompiler/toolscripts/ubuntu20/install-netgen.sh +24 -0
  33. siliconcompiler/toolscripts/ubuntu20/install-nextpnr.sh +32 -0
  34. siliconcompiler/toolscripts/ubuntu20/install-openroad.sh +31 -0
  35. siliconcompiler/toolscripts/ubuntu20/install-slang.sh +38 -0
  36. siliconcompiler/toolscripts/ubuntu20/install-slurm.sh +32 -0
  37. siliconcompiler/toolscripts/ubuntu20/install-surelog.sh +30 -0
  38. siliconcompiler/toolscripts/ubuntu20/install-sv2v.sh +26 -0
  39. siliconcompiler/toolscripts/ubuntu20/install-verible.sh +24 -0
  40. siliconcompiler/toolscripts/ubuntu20/install-verilator.sh +34 -0
  41. siliconcompiler/toolscripts/ubuntu20/install-vpr.sh +27 -0
  42. siliconcompiler/toolscripts/ubuntu20/install-xyce.sh +65 -0
  43. siliconcompiler/toolscripts/ubuntu20/install-yosys.sh +24 -0
  44. siliconcompiler/toolscripts/ubuntu22/install-bambu.sh +49 -0
  45. siliconcompiler/toolscripts/ubuntu22/install-bluespec.sh +35 -0
  46. siliconcompiler/toolscripts/ubuntu22/install-chisel.sh +26 -0
  47. siliconcompiler/toolscripts/ubuntu22/install-ghdl.sh +25 -0
  48. siliconcompiler/toolscripts/ubuntu22/install-icarus.sh +25 -0
  49. siliconcompiler/toolscripts/ubuntu22/install-icepack.sh +22 -0
  50. siliconcompiler/toolscripts/ubuntu22/install-klayout.sh +29 -0
  51. siliconcompiler/toolscripts/ubuntu22/install-magic.sh +24 -0
  52. siliconcompiler/toolscripts/ubuntu22/install-montage.sh +5 -0
  53. siliconcompiler/toolscripts/ubuntu22/install-netgen.sh +24 -0
  54. siliconcompiler/toolscripts/ubuntu22/install-nextpnr.sh +32 -0
  55. siliconcompiler/toolscripts/ubuntu22/install-openroad.sh +31 -0
  56. siliconcompiler/toolscripts/ubuntu22/install-slang.sh +28 -0
  57. siliconcompiler/toolscripts/ubuntu22/install-slurm.sh +32 -0
  58. siliconcompiler/toolscripts/ubuntu22/install-surelog.sh +25 -0
  59. siliconcompiler/toolscripts/ubuntu22/install-sv2v.sh +26 -0
  60. siliconcompiler/toolscripts/ubuntu22/install-verible.sh +24 -0
  61. siliconcompiler/toolscripts/ubuntu22/install-verilator.sh +34 -0
  62. siliconcompiler/toolscripts/ubuntu22/install-vpr.sh +27 -0
  63. siliconcompiler/toolscripts/ubuntu22/install-xyce.sh +65 -0
  64. siliconcompiler/toolscripts/ubuntu22/install-yosys.sh +24 -0
  65. siliconcompiler/toolscripts/ubuntu24/install-bambu.sh +49 -0
  66. siliconcompiler/toolscripts/ubuntu24/install-bluespec.sh +35 -0
  67. siliconcompiler/toolscripts/ubuntu24/install-chisel.sh +26 -0
  68. siliconcompiler/toolscripts/ubuntu24/install-ghdl.sh +25 -0
  69. siliconcompiler/toolscripts/ubuntu24/install-icarus.sh +25 -0
  70. siliconcompiler/toolscripts/ubuntu24/install-icepack.sh +22 -0
  71. siliconcompiler/toolscripts/ubuntu24/install-klayout.sh +29 -0
  72. siliconcompiler/toolscripts/ubuntu24/install-magic.sh +24 -0
  73. siliconcompiler/toolscripts/ubuntu24/install-montage.sh +5 -0
  74. siliconcompiler/toolscripts/ubuntu24/install-netgen.sh +24 -0
  75. siliconcompiler/toolscripts/ubuntu24/install-nextpnr.sh +32 -0
  76. siliconcompiler/toolscripts/ubuntu24/install-openroad.sh +31 -0
  77. siliconcompiler/toolscripts/ubuntu24/install-slang.sh +28 -0
  78. siliconcompiler/toolscripts/ubuntu24/install-slurm.sh +32 -0
  79. siliconcompiler/toolscripts/ubuntu24/install-surelog.sh +25 -0
  80. siliconcompiler/toolscripts/ubuntu24/install-sv2v.sh +26 -0
  81. siliconcompiler/toolscripts/ubuntu24/install-verible.sh +24 -0
  82. siliconcompiler/toolscripts/ubuntu24/install-verilator.sh +34 -0
  83. siliconcompiler/toolscripts/ubuntu24/install-vpr.sh +27 -0
  84. siliconcompiler/toolscripts/ubuntu24/install-xyce.sh +65 -0
  85. siliconcompiler/toolscripts/ubuntu24/install-yosys.sh +24 -0
  86. {siliconcompiler-0.28.0.dist-info → siliconcompiler-0.28.2.dist-info}/METADATA +5 -5
  87. {siliconcompiler-0.28.0.dist-info → siliconcompiler-0.28.2.dist-info}/RECORD +91 -22
  88. {siliconcompiler-0.28.0.dist-info → siliconcompiler-0.28.2.dist-info}/entry_points.txt +1 -0
  89. siliconcompiler/tools/openfpgaloader/__init__.py +0 -0
  90. siliconcompiler/tools/openfpgaloader/openfpgaloader.py +0 -39
  91. siliconcompiler/tools/xyce/xyce.py +0 -36
  92. {siliconcompiler-0.28.0.dist-info → siliconcompiler-0.28.2.dist-info}/LICENSE +0 -0
  93. {siliconcompiler-0.28.0.dist-info → siliconcompiler-0.28.2.dist-info}/WHEEL +0 -0
  94. {siliconcompiler-0.28.0.dist-info → siliconcompiler-0.28.2.dist-info}/top_level.txt +0 -0
@@ -54,7 +54,7 @@ proc sc_image_heatmap { name ident image_name title { allow_bin_adjust 1 } } {
54
54
  gui::set_display_controls "Heat Maps/${name}" visible false
55
55
  }
56
56
 
57
- proc sc_image_placement {} {
57
+ proc sc_image_placement { } {
58
58
  if { ![sc_has_placed_instances] } {
59
59
  return
60
60
  }
@@ -70,7 +70,7 @@ proc sc_image_placement {} {
70
70
  sc_save_image "placement" reports/images/${sc_design}.placement.png
71
71
  }
72
72
 
73
- proc sc_image_routing {} {
73
+ proc sc_image_routing { } {
74
74
  if { ![sc_has_routing] } {
75
75
  return
76
76
  }
@@ -85,7 +85,7 @@ proc sc_image_routing {} {
85
85
  sc_save_image "routing" reports/images/${sc_design}.routing.png
86
86
  }
87
87
 
88
- proc sc_image_everything {} {
88
+ proc sc_image_everything { } {
89
89
  global sc_design
90
90
 
91
91
  sc_image_setup_default
@@ -134,7 +134,7 @@ proc sc_image_irdrop { net corner } {
134
134
  }
135
135
  }
136
136
 
137
- proc sc_image_routing_congestion {} {
137
+ proc sc_image_routing_congestion { } {
138
138
  if { ![sc_has_global_routing] } {
139
139
  return
140
140
  }
@@ -148,7 +148,7 @@ proc sc_image_routing_congestion {} {
148
148
  0
149
149
  }
150
150
 
151
- proc sc_image_estimated_routing_congestion {} {
151
+ proc sc_image_estimated_routing_congestion { } {
152
152
  if { ![sc_has_placed_instances] } {
153
153
  return
154
154
  }
@@ -166,7 +166,7 @@ proc sc_image_estimated_routing_congestion {} {
166
166
  unsuppress_message GRT 10
167
167
  }
168
168
 
169
- proc sc_image_power_density {} {
169
+ proc sc_image_power_density { } {
170
170
  if { ![sc_has_placed_instances] } {
171
171
  return
172
172
  }
@@ -188,7 +188,7 @@ proc sc_image_power_density {} {
188
188
  }
189
189
  }
190
190
 
191
- proc sc_image_placement_density {} {
191
+ proc sc_image_placement_density { } {
192
192
  if { ![sc_has_placed_instances] } {
193
193
  return
194
194
  }
@@ -201,7 +201,7 @@ proc sc_image_placement_density {} {
201
201
  "placement density"
202
202
  }
203
203
 
204
- proc sc_image_clocks {} {
204
+ proc sc_image_clocks { } {
205
205
  if { ![sc_has_placed_instances] } {
206
206
  return
207
207
  }
@@ -223,7 +223,7 @@ proc sc_image_clocks {} {
223
223
  sc_save_image "clocks" reports/images/${sc_design}.clocks.png
224
224
  }
225
225
 
226
- proc sc_image_clocktree {} {
226
+ proc sc_image_clocktree { } {
227
227
  gui::show_widget "Clock Tree Viewer"
228
228
  global sc_scenarios
229
229
 
@@ -263,7 +263,7 @@ proc sc_image_clocktree {} {
263
263
  gui::hide_widget "Clock Tree Viewer"
264
264
  }
265
265
 
266
- proc sc_image_optimizer {} {
266
+ proc sc_image_optimizer { } {
267
267
  global sc_design
268
268
  sc_image_setup_default
269
269
 
@@ -2,7 +2,7 @@
2
2
  # Count the logic depth of the critical path
3
3
  ###########################
4
4
 
5
- proc sc_count_logic_depth {} {
5
+ proc sc_count_logic_depth { } {
6
6
  set count 0
7
7
  set paths [find_timing_paths -sort_by_slack]
8
8
  if { [llength $paths] == 0 } {
@@ -24,7 +24,7 @@ proc sc_count_logic_depth {} {
24
24
  return [expr { $count - 1 }]
25
25
  }
26
26
 
27
- proc sc_design_area {} {
27
+ proc sc_design_area { } {
28
28
  set area 0
29
29
  foreach inst [get_cells -hierarchical *] {
30
30
  set lib_cell [$inst liberty_cell]
@@ -35,7 +35,7 @@ proc sc_design_area {} {
35
35
  return $area
36
36
  }
37
37
 
38
- proc sc_display_report {report} {
38
+ proc sc_display_report { report } {
39
39
  if { ![file exists $report] } {
40
40
  return
41
41
  }
@@ -0,0 +1,28 @@
1
+ '''
2
+ Xyce XDM netlist converter, used to convert PSPICE and HSPICE netists into Xyce format.
3
+
4
+ Sources: https://github.com/Xyce/XDM
5
+
6
+ Installation: https://github.com/Xyce/XDM
7
+
8
+ Status: SC integration WIP
9
+ '''
10
+ from siliconcompiler.tools._common import get_tool_task
11
+
12
+
13
+ def setup(chip):
14
+ step = chip.get('arg', 'step')
15
+ index = chip.get('arg', 'index')
16
+ tool, task = get_tool_task(chip, step, index)
17
+
18
+ chip.set('tool', tool, 'exe', 'xdm_bdl')
19
+ chip.set('tool', tool, 'vswitch', '-h')
20
+ chip.set('tool', tool, 'version', '>=v2.7.0', clobber=False)
21
+
22
+
23
+ ################################
24
+ # Version Check
25
+ ################################
26
+ def parse_version(stdout):
27
+ line = stdout.splitlines()[5]
28
+ return line.split()[1]
@@ -0,0 +1,71 @@
1
+ from siliconcompiler.tools._common import input_provides, get_tool_task
2
+ from siliconcompiler.tools.xdm import setup as tool_setup
3
+ import os
4
+ import shutil
5
+
6
+
7
+ def setup(chip):
8
+ tool_setup(chip)
9
+
10
+ step = chip.get('arg', 'step')
11
+ index = chip.get('arg', 'index')
12
+ tool, task = get_tool_task(chip, step, index)
13
+
14
+ design = chip.top()
15
+
16
+ if f'{design}.cir' in input_provides(chip, step, index):
17
+ chip.add('tool', tool, 'task', task, 'input', f'{design}.cir',
18
+ step=step, index=index)
19
+ else:
20
+ chip.add('tool', tool, 'task', task, 'require', 'input,netlist,spice',
21
+ step=step, index=index)
22
+
23
+ chip.add('tool', tool, 'task', task, 'output', f'{design}.xyce', step=step, index=index)
24
+
25
+ chip.add('tool', tool, 'task', task, 'option', '--auto',
26
+ step=step, index=index)
27
+ chip.add('tool', tool, 'task', task, 'option', '--source_file_format hspice',
28
+ step=step, index=index)
29
+ chip.add('tool', tool, 'task', task, 'option', f'--dir_out outputs/{design}.xyce',
30
+ step=step, index=index)
31
+
32
+ chip.set('tool', 'xdm', 'task', 'convert', 'var', 'rename', 'true',
33
+ step=step, index=index, clobber=False)
34
+ chip.set('tool', 'xdm', 'task', 'convert', 'var', 'rename',
35
+ 'true/false: indicate whether to rename the output file to match the '
36
+ 'naming scheme for siliconcompiler', field='help')
37
+
38
+
39
+ def runtime_options(chip):
40
+ return __get_input_file(chip)
41
+
42
+
43
+ def __get_input_file(chip):
44
+ step = chip.get('arg', 'step')
45
+ index = chip.get('arg', 'index')
46
+ design = chip.top()
47
+
48
+ if f'{design}.cir' in input_provides(chip, step, index):
49
+ return [f'inputs/{design}.cir']
50
+
51
+ return chip.find_files('input', 'netlist', 'spice',
52
+ step=step, index=index)
53
+
54
+
55
+ def post_process(chip):
56
+ step = chip.get('arg', 'step')
57
+ index = chip.get('arg', 'index')
58
+
59
+ if chip.get('tool', 'xdm', 'task', 'convert', 'var', 'rename',
60
+ step=step, index=index) == ['false']:
61
+ return
62
+
63
+ inputfile = __get_input_file(chip)[0]
64
+
65
+ outdir = f'outputs/{chip.top()}.xyce'
66
+
67
+ inputfile_base = os.path.basename(inputfile)
68
+ outputfile_base = f'{chip.top()}.cir'
69
+
70
+ if inputfile_base != outputfile_base:
71
+ shutil.move(os.path.join(outdir, inputfile_base), os.path.join(outdir, outputfile_base))
@@ -0,0 +1,40 @@
1
+ '''
2
+ Xyce is a high performance SPICE-compatible circuit simulator
3
+ capable capable of solving extremely large circuit problems by
4
+ supporting large-scale parallel computing platforms. It also
5
+ supports serial execution on all common desktop platforms,
6
+ and small-scale parallel runs on Unix-like systems.
7
+
8
+ Documentation: https://xyce.sandia.gov/documentation-tutorials/
9
+
10
+ Sources: https://github.com/Xyce/Xyce
11
+
12
+ Installation: https://xyce.sandia.gov/documentation-tutorials/building-guide/
13
+
14
+ Status: SC integration WIP
15
+ '''
16
+ from siliconcompiler.tools._common import get_tool_task
17
+
18
+
19
+ ################################
20
+ # Setup Tool (pre executable)
21
+ ################################
22
+ def setup(chip):
23
+
24
+ step = chip.get('arg', 'step')
25
+ index = chip.get('arg', 'index')
26
+ tool, task = get_tool_task(chip, step, index)
27
+
28
+ chip.set('tool', tool, 'exe', 'Xyce')
29
+ chip.set('tool', tool, 'vswitch', '-v')
30
+ chip.set('tool', tool, 'version', '>=v7.8')
31
+
32
+ chip.set('tool', tool, 'task', task, 'regex', 'warnings', 'warning',
33
+ step=step, index=index, clobber=False)
34
+ chip.set('tool', tool, 'task', task, 'regex', 'errors', 'error',
35
+ step=step, index=index, clobber=False)
36
+
37
+
38
+ def parse_version(stdout):
39
+ ver = stdout.split()[-1]
40
+ return ver.split('-')[0]
@@ -0,0 +1,70 @@
1
+ from siliconcompiler.tools._common import input_provides, get_tool_task
2
+ from siliconcompiler.tools.xyce import setup as tool_setup
3
+ import os
4
+
5
+
6
+ def setup(chip):
7
+ tool_setup(chip)
8
+
9
+ step = chip.get('arg', 'step')
10
+ index = chip.get('arg', 'index')
11
+ tool, task = get_tool_task(chip, step, index)
12
+
13
+ design = chip.top()
14
+
15
+ if f'{design}.xyce' in input_provides(chip, step, index):
16
+ chip.add('tool', tool, 'task', task, 'input', f'{design}.xyce',
17
+ step=step, index=index)
18
+ elif f'{design}.cir' in input_provides(chip, step, index):
19
+ chip.add('tool', tool, 'task', task, 'input', f'{design}.cir',
20
+ step=step, index=index)
21
+ else:
22
+ chip.add('tool', tool, 'task', task, 'require', 'input,netlist,spice',
23
+ step=step, index=index)
24
+
25
+ chip.set('tool', tool, 'task', task, 'var', 'trace', 'false',
26
+ step=step, index=index, clobber=False)
27
+ chip.set('tool', tool, 'task', task, 'var', 'trace', 'true/false, enable dumping all signals',
28
+ field='help')
29
+
30
+ allowed_traced = ['ASCII', 'binary']
31
+ chip.set('tool', tool, 'task', task, 'var', 'trace_format', 'ASCII',
32
+ step=step, index=index, clobber=False)
33
+ chip.set('tool', tool, 'task', task, 'var', 'trace_format', 'Format to use for traces. '
34
+ f'Allowed values are {allowed_traced}',
35
+ field='help')
36
+
37
+ if chip.get('tool', tool, 'task', task, 'var', 'trace_format', step=step, index=index)[0] \
38
+ not in allowed_traced:
39
+ raise ValueError(f"{chip.get('tool', tool, 'task', task, 'var', 'trace_format')[0]} "
40
+ "is not an accepted value")
41
+
42
+ if chip.get('tool', tool, 'task', task, 'var', 'trace_format', step=step, index=index) == \
43
+ ['ASCII']:
44
+ chip.add('tool', tool, 'task', task, 'option', '-a',
45
+ step=step, index=index)
46
+
47
+ if chip.get('tool', tool, 'task', task, 'var', 'trace',
48
+ step=step, index=index) == ['true']:
49
+ chip.add('tool', tool, 'task', task, 'output', f'{design}.raw',
50
+ step=step, index=index)
51
+ chip.add('tool', tool, 'task', task, 'option', f'-r outputs/{design}.raw',
52
+ step=step, index=index)
53
+
54
+
55
+ def runtime_options(chip):
56
+ design = chip.top()
57
+ step = chip.get('arg', 'step')
58
+ index = chip.get('arg', 'index')
59
+
60
+ if f'{design}.xyce' in input_provides(chip, step, index):
61
+ if os.path.isfile(f'inputs/{design}.xyce'):
62
+ return [f'inputs/{design}.xyce']
63
+ elif os.path.isfile(f'inputs/{design}.xyce/{design}.cir'):
64
+ return [f'inputs/{design}.xyce/{design}.cir']
65
+ else:
66
+ return [f'inputs/{design}.xyce']
67
+ elif f'{design}.cir' in input_provides(chip, step, index):
68
+ return [f'inputs/{design}.cir']
69
+
70
+ return chip.find_files('input', 'netlist', 'spice', step=step, index=index)
@@ -3,7 +3,7 @@
3
3
  ####################
4
4
  source "$sc_refdir/syn_asic_fpga_shared.tcl"
5
5
 
6
- proc preserve_modules {} {
6
+ proc preserve_modules { } {
7
7
  global sc_cfg
8
8
  global sc_tool
9
9
  global sc_task
@@ -0,0 +1,131 @@
1
+ {
2
+ "openroad": {
3
+ "git-url": "https://github.com/The-OpenROAD-Project/OpenROAD.git",
4
+ "git-commit": "81c8892339ff090147b9e769195f32489cba38f9",
5
+ "docker-cmds": [
6
+ "# Remove OR-Tools files",
7
+ "RUN rm -f $SC_PREFIX/Makefile $SC_PREFIX/README.md",
8
+ "# Remove OpenROAD Env file",
9
+ "RUN rm -f $SC_PREFIX/env.sh"
10
+ ],
11
+ "auto-update": true
12
+ },
13
+ "surelog": {
14
+ "git-url": "https://github.com/chipsalliance/Surelog.git",
15
+ "git-commit": "v1.84",
16
+ "auto-update": true
17
+ },
18
+ "netgen": {
19
+ "git-url": "https://github.com/RTimothyEdwards/netgen.git",
20
+ "git-commit": "fb7876c7a6f9d58a3d88a49e302e682c1d12e00d",
21
+ "auto-update": false
22
+ },
23
+ "ghdl": {
24
+ "git-url": "https://github.com/ghdl/ghdl.git",
25
+ "git-commit": "v4.1.0",
26
+ "auto-update": false
27
+ },
28
+ "magic": {
29
+ "git-url": "https://github.com/RTimothyEdwards/magic.git",
30
+ "git-commit": "c7f11d2169f6af8751ae22b5d70250b331e1a667",
31
+ "auto-update": false
32
+ },
33
+ "bluespec": {
34
+ "git-url": "https://github.com/B-Lang-org/bsc.git",
35
+ "git-commit": "4cac6ebae076e8b8378597aba1d2119aa29ec419",
36
+ "auto-update": false
37
+ },
38
+ "klayout": {
39
+ "version": "0.29.7",
40
+ "git-url": "https://github.com/KLayout/klayout.git",
41
+ "docker-skip": true,
42
+ "auto-update": true,
43
+ "run-version": "source version.sh && echo $KLAYOUT_VERSION",
44
+ "release-notes": "https://www.klayout.de/development.html"
45
+ },
46
+ "sv2v": {
47
+ "git-url": "https://github.com/zachjs/sv2v.git",
48
+ "git-commit": "5374679e4bb26e115b9a9b4a2d8ef4253d7a8bf3",
49
+ "auto-update": true
50
+ },
51
+ "verilator": {
52
+ "git-url": "https://github.com/verilator/verilator.git",
53
+ "git-commit": "563faeb33f3b9b5374f558f54adfea11873f1cd7",
54
+ "auto-update": true
55
+ },
56
+ "bambu": {
57
+ "git-url": "https://github.com/ferrandi/PandA-bambu.git",
58
+ "git-commit": "v2024.03",
59
+ "auto-update": false,
60
+ "docker-cmds": [
61
+ "# Remove ORFS Stuff",
62
+ "RUN rm -rf $SC_PREFIX/share/panda/asap7",
63
+ "RUN rm -rf $SC_PREFIX/share/panda/nangate45",
64
+ "RUN rm -rf $SC_PREFIX/share/panda/scripts"
65
+ ]
66
+ },
67
+ "vpr": {
68
+ "git-url": "https://github.com/verilog-to-routing/vtr-verilog-to-routing.git",
69
+ "git-commit": "9dd5ff66e3ab43238f5a4cb14cafe17bc4afe527",
70
+ "auto-update": false
71
+ },
72
+ "icepack": {
73
+ "git-url": "https://github.com/YosysHQ/icestorm.git",
74
+ "git-commit": "d20a5e9001f46262bf0cef220f1a6943946e421d",
75
+ "auto-update": false
76
+ },
77
+ "nextpnr": {
78
+ "git-url": "https://github.com/YosysHQ/nextpnr.git",
79
+ "git-commit": "f89b959b5f56ba8d91e1e7f8a645b267a5a7bb89",
80
+ "docker-depends": "icepack"
81
+ },
82
+ "chisel": {
83
+ "version": "1.8.0",
84
+ "git-url": "https://github.com/sbt/sbt.git",
85
+ "auto-update": false
86
+ },
87
+ "icarus": {
88
+ "git-url": "https://github.com/steveicarus/iverilog.git",
89
+ "git-commit": "01441687235135d1c12eeef920f75d97995da333",
90
+ "auto-update": false
91
+ },
92
+ "yosys": {
93
+ "git-url": "https://github.com/YosysHQ/yosys.git",
94
+ "git-commit": "yosys-0.44",
95
+ "version-prefix": "yosys-",
96
+ "auto-update": true
97
+ },
98
+ "xyce": {
99
+ "git-url": "https://github.com/Xyce/Xyce.git",
100
+ "version": "7.8.0",
101
+ "auto-update": false
102
+ },
103
+ "slurm": {
104
+ "version": "22.05.7",
105
+ "git-url": "https://github.com/SchedMD/slurm.git",
106
+ "auto-update": false,
107
+ "docker-extra-files": [
108
+ "docker/slurm"
109
+ ],
110
+ "docker-cmds": [
111
+ "COPY slurm $SC_PREFIX/slurm_cfg",
112
+ "RUN mv $SC_PREFIX/slurm_cfg/install-slurm.sh $SC_PREFIX/",
113
+ "RUN chmod +x $SC_PREFIX/install-slurm.sh"
114
+ ]
115
+ },
116
+ "montage": {
117
+ "version": "6.9.11",
118
+ "auto-update": false,
119
+ "docker-skip": true
120
+ },
121
+ "verible": {
122
+ "version": "v0.0-3303-gd87f2420",
123
+ "git-url": "https://github.com/chipsalliance/verible.git",
124
+ "auto-update": false
125
+ },
126
+ "slang": {
127
+ "git-commit": "v7.0",
128
+ "git-url": "https://github.com/MikePopoloski/slang.git",
129
+ "auto-update": true
130
+ }
131
+ }
@@ -0,0 +1,222 @@
1
+ #!/usr/bin/env python3
2
+ # Copyright 2023 Silicon Compiler Authors. All Rights Reserved.
3
+
4
+ import argparse
5
+ import json
6
+ import os
7
+ import tempfile
8
+ import subprocess
9
+ import re
10
+
11
+ tools = None
12
+ data_file = os.path.join(os.path.dirname(__file__), "_tools.json")
13
+ with open(data_file, "r") as f:
14
+ tools = json.load(f)
15
+
16
+
17
+ def __make_github_url(url, old_version, new_version):
18
+ if 'github' not in url:
19
+ return None
20
+
21
+ if url.endswith('.git'):
22
+ url = url[0:-4]
23
+
24
+ return f'{url}/compare/{old_version}...{new_version}'
25
+
26
+
27
+ def bump_commit(tools, tool):
28
+ if "git-url" not in tools[tool]:
29
+ return (None, None)
30
+
31
+ if not re.fullmatch(r"[a-f0-9]{40}", tools[tool]["git-commit"]):
32
+ return bump_commit_tag(tools, tool)
33
+
34
+ import git
35
+
36
+ with tempfile.TemporaryDirectory(prefix=tool) as repo_work_dir:
37
+ repo = git.Repo.clone_from(tools[tool]["git-url"], repo_work_dir)
38
+
39
+ return (repo.head.commit.hexsha,
40
+ __make_github_url(tools[tool]["git-url"],
41
+ tools[tool]["git-commit"],
42
+ repo.head.commit.hexsha))
43
+
44
+ return (None, None)
45
+
46
+
47
+ def bump_commit_tag(tools, tool):
48
+ if "git-url" not in tools[tool]:
49
+ return (None, None)
50
+
51
+ import git
52
+
53
+ version_prefix = 'v'
54
+ if "version-prefix" in tools[tool]:
55
+ version_prefix = tools[tool]["version-prefix"]
56
+
57
+ with tempfile.TemporaryDirectory(prefix=tool) as repo_work_dir:
58
+ repo = git.Repo.clone_from(tools[tool]["git-url"], repo_work_dir)
59
+
60
+ newest = None
61
+ for tag in repo.tags:
62
+ if not tag.name.startswith(version_prefix):
63
+ continue
64
+
65
+ if not newest or tag.commit.committed_datetime > newest.commit.committed_datetime:
66
+ newest = tag
67
+ if newest:
68
+ newest = newest.name
69
+ return (newest,
70
+ __make_github_url(tools[tool]["git-url"],
71
+ tools[tool]["git-commit"],
72
+ newest))
73
+
74
+ return (None, None)
75
+
76
+
77
+ def bump_version(tools, tool):
78
+ if "git-url" not in tools[tool]:
79
+ return (None, None)
80
+
81
+ import git
82
+
83
+ with tempfile.TemporaryDirectory(prefix=tool) as repo_work_dir:
84
+ repo = git.Repo.clone_from(tools[tool]["git-url"], repo_work_dir)
85
+
86
+ if "run-version" in tools[tool]:
87
+ script = os.path.join(repo_work_dir, 'sc_get_version.sh')
88
+ with open(script, 'w') as f:
89
+ f.write(tools[tool]["run-version"])
90
+ os.chmod(script, 0o700)
91
+ proc = subprocess.run(['bash', script],
92
+ stdout=subprocess.PIPE,
93
+ stderr=subprocess.STDOUT,
94
+ universal_newlines=True,
95
+ cwd=repo_work_dir)
96
+ version = proc.stdout.strip()
97
+ if not version:
98
+ return (None, None)
99
+
100
+ releasenotes = None
101
+ if "release-notes" in tools[tool]:
102
+ releasenotes = tools[tool]["release-notes"]
103
+ return (version, releasenotes)
104
+
105
+ newest = None
106
+ for tag in repo.tags:
107
+ if not newest:
108
+ newest = tag
109
+ else:
110
+ if tag.commit.committed_datetime > newest.commit.committed_datetime:
111
+ newest = tag
112
+ if newest:
113
+ newest = newest.name
114
+ has_v = False
115
+ if newest[0] == 'v':
116
+ newest = newest[1:]
117
+ has_v = True
118
+
119
+ new_version = newest
120
+ old_version = tools[tool]["version"]
121
+ if has_v:
122
+ new_version = f'v{new_version}'
123
+ old_version = f'v{old_version}'
124
+
125
+ return (newest,
126
+ __make_github_url(tools[tool]["git-url"],
127
+ old_version,
128
+ new_version))
129
+
130
+ return (None, None)
131
+
132
+ return (None, None)
133
+
134
+
135
+ def has_tool(tool):
136
+ return tool in tools
137
+
138
+
139
+ def get_field(tool, field):
140
+ if field not in tools[tool]:
141
+ return None
142
+ return tools[tool][field]
143
+
144
+
145
+ def get_tools():
146
+ return list(tools.keys())
147
+
148
+
149
+ if __name__ == "__main__":
150
+ supported_tools = ", ".join(get_tools())
151
+ supported_fields = set()
152
+ for tool, fields in tools.items():
153
+ for field in fields:
154
+ supported_fields.add(field)
155
+ supported_fields = ", ".join(supported_fields)
156
+
157
+ parser = argparse.ArgumentParser(
158
+ prog="SiliconCompiler Tool Helper",
159
+ description="Maintains current known good versions for all install scripts to use")
160
+ parser.add_argument("--tool", type=str,
161
+ help=f"Tool name, supported tools: {supported_tools}")
162
+ parser.add_argument("--json_tools", action="store_true",
163
+ help="Flag to get json matrix used by github to update tools")
164
+
165
+ parser.add_argument("--field", type=str,
166
+ help=f"Field to get information from, supported fields: {supported_fields}")
167
+ parser.add_argument("--bump_commit", action="store_true",
168
+ help="Flag to indicate that the specified tool should be updated.")
169
+
170
+ args = parser.parse_args()
171
+
172
+ if args.json_tools:
173
+ json_tools = {'include': []}
174
+ for tool in get_tools():
175
+ field = get_field(tool, "git-url")
176
+ update = get_field(tool, "auto-update")
177
+ if field and update:
178
+ json_tools['include'].append({"tool": tool})
179
+ if len(json_tools['include']) == 0:
180
+ print(json.dumps({}))
181
+ else:
182
+ print(json.dumps(json_tools))
183
+ exit(0)
184
+
185
+ if not has_tool(args.tool):
186
+ print(f"{args.tool} is not a supported tool.")
187
+ print(f"Supported tools are: {supported_tools}")
188
+ exit(1)
189
+
190
+ if not args.bump_commit:
191
+ tool_fields = tools[args.tool]
192
+ if args.field not in tool_fields:
193
+ print(f"{args.field} is not a supported field for {args.tool}.")
194
+ tool_supported_fields = ", ".join(tool_fields.keys())
195
+ print(f"Supported fields are: {tool_supported_fields}")
196
+ exit(1)
197
+
198
+ print(tool_fields[args.field])
199
+ exit(0)
200
+
201
+ if "git-commit" in tools[args.tool]:
202
+ new_value, url = bump_commit(tools, args.tool)
203
+ if new_value and tools[args.tool]["git-commit"] != new_value:
204
+ print(f"Updating {args.tool} from {tools[args.tool]['git-commit']} to {new_value}")
205
+ if url:
206
+ print(f'Check {url} for changes')
207
+ tools[args.tool]["git-commit"] = new_value
208
+ elif "version" in tools[args.tool]:
209
+ new_value, url = bump_version(tools, args.tool)
210
+ if new_value and tools[args.tool]["version"] != new_value:
211
+ print(f"Updating {args.tool} from {tools[args.tool]['version']} to {new_value}")
212
+ if url:
213
+ print(f'Check {url} for changes')
214
+ tools[args.tool]["version"] = new_value
215
+ else:
216
+ print('Unsupported update tool')
217
+ exit(1)
218
+
219
+ with open(data_file, "w") as f:
220
+ f.write(json.dumps(tools, indent=2))
221
+
222
+ exit(0)