siliconcompiler 0.26.5__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 (251) hide show
  1. siliconcompiler/__init__.py +24 -0
  2. siliconcompiler/__main__.py +12 -0
  3. siliconcompiler/_common.py +49 -0
  4. siliconcompiler/_metadata.py +36 -0
  5. siliconcompiler/apps/__init__.py +0 -0
  6. siliconcompiler/apps/_common.py +76 -0
  7. siliconcompiler/apps/sc.py +92 -0
  8. siliconcompiler/apps/sc_dashboard.py +94 -0
  9. siliconcompiler/apps/sc_issue.py +178 -0
  10. siliconcompiler/apps/sc_remote.py +199 -0
  11. siliconcompiler/apps/sc_server.py +39 -0
  12. siliconcompiler/apps/sc_show.py +142 -0
  13. siliconcompiler/apps/smake.py +232 -0
  14. siliconcompiler/checklists/__init__.py +0 -0
  15. siliconcompiler/checklists/oh_tapeout.py +41 -0
  16. siliconcompiler/core.py +3221 -0
  17. siliconcompiler/data/RobotoMono/LICENSE.txt +202 -0
  18. siliconcompiler/data/RobotoMono/RobotoMono-Regular.ttf +0 -0
  19. siliconcompiler/data/heartbeat.v +18 -0
  20. siliconcompiler/data/logo.png +0 -0
  21. siliconcompiler/flowgraph.py +570 -0
  22. siliconcompiler/flows/__init__.py +0 -0
  23. siliconcompiler/flows/_common.py +67 -0
  24. siliconcompiler/flows/asicflow.py +180 -0
  25. siliconcompiler/flows/asictopflow.py +38 -0
  26. siliconcompiler/flows/dvflow.py +86 -0
  27. siliconcompiler/flows/fpgaflow.py +202 -0
  28. siliconcompiler/flows/generate_openroad_rcx.py +66 -0
  29. siliconcompiler/flows/lintflow.py +35 -0
  30. siliconcompiler/flows/screenshotflow.py +51 -0
  31. siliconcompiler/flows/showflow.py +59 -0
  32. siliconcompiler/flows/signoffflow.py +53 -0
  33. siliconcompiler/flows/synflow.py +128 -0
  34. siliconcompiler/fpgas/__init__.py +0 -0
  35. siliconcompiler/fpgas/lattice_ice40.py +42 -0
  36. siliconcompiler/fpgas/vpr_example.py +109 -0
  37. siliconcompiler/issue.py +300 -0
  38. siliconcompiler/libs/__init__.py +0 -0
  39. siliconcompiler/libs/asap7sc7p5t.py +8 -0
  40. siliconcompiler/libs/gf180mcu.py +8 -0
  41. siliconcompiler/libs/nangate45.py +8 -0
  42. siliconcompiler/libs/sky130hd.py +8 -0
  43. siliconcompiler/libs/sky130io.py +8 -0
  44. siliconcompiler/package.py +412 -0
  45. siliconcompiler/pdks/__init__.py +0 -0
  46. siliconcompiler/pdks/asap7.py +8 -0
  47. siliconcompiler/pdks/freepdk45.py +8 -0
  48. siliconcompiler/pdks/gf180.py +8 -0
  49. siliconcompiler/pdks/skywater130.py +8 -0
  50. siliconcompiler/remote/__init__.py +36 -0
  51. siliconcompiler/remote/client.py +891 -0
  52. siliconcompiler/remote/schema.py +106 -0
  53. siliconcompiler/remote/server.py +507 -0
  54. siliconcompiler/remote/server_schema/requests/cancel_job.json +51 -0
  55. siliconcompiler/remote/server_schema/requests/check_progress.json +61 -0
  56. siliconcompiler/remote/server_schema/requests/check_server.json +38 -0
  57. siliconcompiler/remote/server_schema/requests/delete_job.json +51 -0
  58. siliconcompiler/remote/server_schema/requests/get_results.json +48 -0
  59. siliconcompiler/remote/server_schema/requests/remote_run.json +40 -0
  60. siliconcompiler/remote/server_schema/responses/cancel_job.json +18 -0
  61. siliconcompiler/remote/server_schema/responses/check_progress.json +30 -0
  62. siliconcompiler/remote/server_schema/responses/check_server.json +32 -0
  63. siliconcompiler/remote/server_schema/responses/delete_job.json +18 -0
  64. siliconcompiler/remote/server_schema/responses/get_results.json +21 -0
  65. siliconcompiler/remote/server_schema/responses/remote_run.json +25 -0
  66. siliconcompiler/report/__init__.py +13 -0
  67. siliconcompiler/report/html_report.py +74 -0
  68. siliconcompiler/report/report.py +355 -0
  69. siliconcompiler/report/streamlit_report.py +137 -0
  70. siliconcompiler/report/streamlit_viewer.py +944 -0
  71. siliconcompiler/report/summary_image.py +117 -0
  72. siliconcompiler/report/summary_table.py +105 -0
  73. siliconcompiler/report/utils.py +163 -0
  74. siliconcompiler/scheduler/__init__.py +2092 -0
  75. siliconcompiler/scheduler/docker_runner.py +253 -0
  76. siliconcompiler/scheduler/run_node.py +138 -0
  77. siliconcompiler/scheduler/send_messages.py +178 -0
  78. siliconcompiler/scheduler/slurm.py +208 -0
  79. siliconcompiler/scheduler/validation/email_credentials.json +54 -0
  80. siliconcompiler/schema/__init__.py +7 -0
  81. siliconcompiler/schema/schema_cfg.py +4014 -0
  82. siliconcompiler/schema/schema_obj.py +1841 -0
  83. siliconcompiler/schema/utils.py +93 -0
  84. siliconcompiler/sphinx_ext/__init__.py +0 -0
  85. siliconcompiler/sphinx_ext/dynamicgen.py +1006 -0
  86. siliconcompiler/sphinx_ext/schemagen.py +221 -0
  87. siliconcompiler/sphinx_ext/utils.py +166 -0
  88. siliconcompiler/targets/__init__.py +0 -0
  89. siliconcompiler/targets/asap7_demo.py +68 -0
  90. siliconcompiler/targets/asic_demo.py +38 -0
  91. siliconcompiler/targets/fpgaflow_demo.py +47 -0
  92. siliconcompiler/targets/freepdk45_demo.py +59 -0
  93. siliconcompiler/targets/gf180_demo.py +77 -0
  94. siliconcompiler/targets/skywater130_demo.py +70 -0
  95. siliconcompiler/templates/email/general.j2 +66 -0
  96. siliconcompiler/templates/email/summary.j2 +43 -0
  97. siliconcompiler/templates/issue/README.txt +26 -0
  98. siliconcompiler/templates/issue/run.sh +6 -0
  99. siliconcompiler/templates/report/bootstrap.min.css +7 -0
  100. siliconcompiler/templates/report/bootstrap.min.js +7 -0
  101. siliconcompiler/templates/report/bootstrap_LICENSE.md +24 -0
  102. siliconcompiler/templates/report/sc_report.j2 +427 -0
  103. siliconcompiler/templates/slurm/run.sh +9 -0
  104. siliconcompiler/templates/tcl/manifest.tcl.j2 +137 -0
  105. siliconcompiler/tools/__init__.py +0 -0
  106. siliconcompiler/tools/_common/__init__.py +432 -0
  107. siliconcompiler/tools/_common/asic.py +115 -0
  108. siliconcompiler/tools/_common/sdc/sc_constraints.sdc +76 -0
  109. siliconcompiler/tools/_common/tcl/sc_pin_constraints.tcl +63 -0
  110. siliconcompiler/tools/bambu/bambu.py +32 -0
  111. siliconcompiler/tools/bambu/convert.py +77 -0
  112. siliconcompiler/tools/bluespec/bluespec.py +40 -0
  113. siliconcompiler/tools/bluespec/convert.py +103 -0
  114. siliconcompiler/tools/builtin/_common.py +155 -0
  115. siliconcompiler/tools/builtin/builtin.py +26 -0
  116. siliconcompiler/tools/builtin/concatenate.py +85 -0
  117. siliconcompiler/tools/builtin/join.py +27 -0
  118. siliconcompiler/tools/builtin/maximum.py +46 -0
  119. siliconcompiler/tools/builtin/minimum.py +57 -0
  120. siliconcompiler/tools/builtin/mux.py +70 -0
  121. siliconcompiler/tools/builtin/nop.py +38 -0
  122. siliconcompiler/tools/builtin/verify.py +83 -0
  123. siliconcompiler/tools/chisel/SCDriver.scala +10 -0
  124. siliconcompiler/tools/chisel/build.sbt +27 -0
  125. siliconcompiler/tools/chisel/chisel.py +37 -0
  126. siliconcompiler/tools/chisel/convert.py +140 -0
  127. siliconcompiler/tools/execute/exec_input.py +41 -0
  128. siliconcompiler/tools/execute/execute.py +17 -0
  129. siliconcompiler/tools/genfasm/bitstream.py +61 -0
  130. siliconcompiler/tools/genfasm/genfasm.py +40 -0
  131. siliconcompiler/tools/ghdl/convert.py +87 -0
  132. siliconcompiler/tools/ghdl/ghdl.py +41 -0
  133. siliconcompiler/tools/icarus/compile.py +87 -0
  134. siliconcompiler/tools/icarus/icarus.py +36 -0
  135. siliconcompiler/tools/icepack/bitstream.py +20 -0
  136. siliconcompiler/tools/icepack/icepack.py +43 -0
  137. siliconcompiler/tools/klayout/export.py +117 -0
  138. siliconcompiler/tools/klayout/klayout.py +119 -0
  139. siliconcompiler/tools/klayout/klayout_export.py +205 -0
  140. siliconcompiler/tools/klayout/klayout_operations.py +363 -0
  141. siliconcompiler/tools/klayout/klayout_show.py +242 -0
  142. siliconcompiler/tools/klayout/klayout_utils.py +176 -0
  143. siliconcompiler/tools/klayout/operations.py +194 -0
  144. siliconcompiler/tools/klayout/screenshot.py +98 -0
  145. siliconcompiler/tools/klayout/show.py +101 -0
  146. siliconcompiler/tools/magic/drc.py +49 -0
  147. siliconcompiler/tools/magic/extspice.py +19 -0
  148. siliconcompiler/tools/magic/magic.py +85 -0
  149. siliconcompiler/tools/magic/sc_drc.tcl +96 -0
  150. siliconcompiler/tools/magic/sc_extspice.tcl +54 -0
  151. siliconcompiler/tools/magic/sc_magic.tcl +47 -0
  152. siliconcompiler/tools/montage/montage.py +30 -0
  153. siliconcompiler/tools/montage/tile.py +66 -0
  154. siliconcompiler/tools/netgen/count_lvs.py +132 -0
  155. siliconcompiler/tools/netgen/lvs.py +90 -0
  156. siliconcompiler/tools/netgen/netgen.py +36 -0
  157. siliconcompiler/tools/netgen/sc_lvs.tcl +46 -0
  158. siliconcompiler/tools/nextpnr/apr.py +24 -0
  159. siliconcompiler/tools/nextpnr/nextpnr.py +59 -0
  160. siliconcompiler/tools/openfpgaloader/openfpgaloader.py +39 -0
  161. siliconcompiler/tools/openroad/__init__.py +0 -0
  162. siliconcompiler/tools/openroad/cts.py +45 -0
  163. siliconcompiler/tools/openroad/dfm.py +66 -0
  164. siliconcompiler/tools/openroad/export.py +131 -0
  165. siliconcompiler/tools/openroad/floorplan.py +70 -0
  166. siliconcompiler/tools/openroad/openroad.py +977 -0
  167. siliconcompiler/tools/openroad/physyn.py +27 -0
  168. siliconcompiler/tools/openroad/place.py +41 -0
  169. siliconcompiler/tools/openroad/rcx_bench.py +95 -0
  170. siliconcompiler/tools/openroad/rcx_extract.py +34 -0
  171. siliconcompiler/tools/openroad/route.py +45 -0
  172. siliconcompiler/tools/openroad/screenshot.py +60 -0
  173. siliconcompiler/tools/openroad/scripts/sc_apr.tcl +499 -0
  174. siliconcompiler/tools/openroad/scripts/sc_cts.tcl +64 -0
  175. siliconcompiler/tools/openroad/scripts/sc_dfm.tcl +20 -0
  176. siliconcompiler/tools/openroad/scripts/sc_export.tcl +98 -0
  177. siliconcompiler/tools/openroad/scripts/sc_floorplan.tcl +413 -0
  178. siliconcompiler/tools/openroad/scripts/sc_metrics.tcl +158 -0
  179. siliconcompiler/tools/openroad/scripts/sc_physyn.tcl +7 -0
  180. siliconcompiler/tools/openroad/scripts/sc_place.tcl +84 -0
  181. siliconcompiler/tools/openroad/scripts/sc_procs.tcl +423 -0
  182. siliconcompiler/tools/openroad/scripts/sc_rcx.tcl +63 -0
  183. siliconcompiler/tools/openroad/scripts/sc_rcx_bench.tcl +20 -0
  184. siliconcompiler/tools/openroad/scripts/sc_rcx_extract.tcl +12 -0
  185. siliconcompiler/tools/openroad/scripts/sc_route.tcl +133 -0
  186. siliconcompiler/tools/openroad/scripts/sc_screenshot.tcl +21 -0
  187. siliconcompiler/tools/openroad/scripts/sc_write.tcl +5 -0
  188. siliconcompiler/tools/openroad/scripts/sc_write_images.tcl +361 -0
  189. siliconcompiler/tools/openroad/show.py +94 -0
  190. siliconcompiler/tools/openroad/templates/pex.tcl +8 -0
  191. siliconcompiler/tools/opensta/__init__.py +101 -0
  192. siliconcompiler/tools/opensta/report_libraries.py +28 -0
  193. siliconcompiler/tools/opensta/scripts/sc_procs.tcl +47 -0
  194. siliconcompiler/tools/opensta/scripts/sc_report_libraries.tcl +74 -0
  195. siliconcompiler/tools/opensta/scripts/sc_timing.tcl +268 -0
  196. siliconcompiler/tools/opensta/timing.py +214 -0
  197. siliconcompiler/tools/slang/__init__.py +49 -0
  198. siliconcompiler/tools/slang/lint.py +101 -0
  199. siliconcompiler/tools/surelog/__init__.py +123 -0
  200. siliconcompiler/tools/surelog/parse.py +183 -0
  201. siliconcompiler/tools/surelog/templates/output.v +7 -0
  202. siliconcompiler/tools/sv2v/convert.py +46 -0
  203. siliconcompiler/tools/sv2v/sv2v.py +37 -0
  204. siliconcompiler/tools/template/template.py +125 -0
  205. siliconcompiler/tools/verilator/compile.py +139 -0
  206. siliconcompiler/tools/verilator/lint.py +19 -0
  207. siliconcompiler/tools/verilator/parse.py +27 -0
  208. siliconcompiler/tools/verilator/verilator.py +172 -0
  209. siliconcompiler/tools/vivado/__init__.py +7 -0
  210. siliconcompiler/tools/vivado/bitstream.py +21 -0
  211. siliconcompiler/tools/vivado/place.py +21 -0
  212. siliconcompiler/tools/vivado/route.py +21 -0
  213. siliconcompiler/tools/vivado/scripts/sc_bitstream.tcl +6 -0
  214. siliconcompiler/tools/vivado/scripts/sc_place.tcl +2 -0
  215. siliconcompiler/tools/vivado/scripts/sc_route.tcl +4 -0
  216. siliconcompiler/tools/vivado/scripts/sc_run.tcl +45 -0
  217. siliconcompiler/tools/vivado/scripts/sc_syn_fpga.tcl +25 -0
  218. siliconcompiler/tools/vivado/syn_fpga.py +20 -0
  219. siliconcompiler/tools/vivado/vivado.py +147 -0
  220. siliconcompiler/tools/vpr/_json_constraint.py +63 -0
  221. siliconcompiler/tools/vpr/_xml_constraint.py +109 -0
  222. siliconcompiler/tools/vpr/place.py +137 -0
  223. siliconcompiler/tools/vpr/route.py +124 -0
  224. siliconcompiler/tools/vpr/screenshot.py +54 -0
  225. siliconcompiler/tools/vpr/show.py +88 -0
  226. siliconcompiler/tools/vpr/vpr.py +357 -0
  227. siliconcompiler/tools/xyce/xyce.py +36 -0
  228. siliconcompiler/tools/yosys/lec.py +56 -0
  229. siliconcompiler/tools/yosys/prepareLib.py +59 -0
  230. siliconcompiler/tools/yosys/sc_lec.tcl +84 -0
  231. siliconcompiler/tools/yosys/sc_syn.tcl +79 -0
  232. siliconcompiler/tools/yosys/syn_asic.py +565 -0
  233. siliconcompiler/tools/yosys/syn_asic.tcl +377 -0
  234. siliconcompiler/tools/yosys/syn_asic_fpga_shared.tcl +31 -0
  235. siliconcompiler/tools/yosys/syn_fpga.py +146 -0
  236. siliconcompiler/tools/yosys/syn_fpga.tcl +233 -0
  237. siliconcompiler/tools/yosys/syn_strategies.tcl +81 -0
  238. siliconcompiler/tools/yosys/techmaps/lcu_kogge_stone.v +39 -0
  239. siliconcompiler/tools/yosys/templates/abc.const +2 -0
  240. siliconcompiler/tools/yosys/yosys.py +147 -0
  241. siliconcompiler/units.py +259 -0
  242. siliconcompiler/use.py +177 -0
  243. siliconcompiler/utils/__init__.py +423 -0
  244. siliconcompiler/utils/asic.py +158 -0
  245. siliconcompiler/utils/showtools.py +25 -0
  246. siliconcompiler-0.26.5.dist-info/LICENSE +190 -0
  247. siliconcompiler-0.26.5.dist-info/METADATA +195 -0
  248. siliconcompiler-0.26.5.dist-info/RECORD +251 -0
  249. siliconcompiler-0.26.5.dist-info/WHEEL +5 -0
  250. siliconcompiler-0.26.5.dist-info/entry_points.txt +12 -0
  251. siliconcompiler-0.26.5.dist-info/top_level.txt +1 -0
@@ -0,0 +1,76 @@
1
+ # Default constraints file that sets up clocks based on definitions in schema.
2
+
3
+ source sc_manifest.tcl > /dev/null
4
+
5
+ ### Create clocks
6
+ if { [sc_cfg_exists datasheet pin] } {
7
+ set clock_idx 0
8
+ foreach pin [dict keys [sc_cfg_get datasheet pin]] {
9
+ if { [sc_cfg_get datasheet pin $pin type global] == "clock" } {
10
+ # If clock...
11
+
12
+ set periodtuple [sc_cfg_get datasheet pin $pin tperiod global]
13
+ set period [sta::time_sta_ui [lindex $periodtuple 1]]
14
+ set jittertuple [sc_cfg_get datasheet pin $pin tjitter global]
15
+ set jitter [sta::time_sta_ui [lindex $jittertuple 1]]
16
+
17
+ set clk_name "clk${clock_idx}"
18
+ incr clock_idx
19
+
20
+ set period_fmt \
21
+ [sta::format_time [sta::time_ui_sta $period] 3][sta::unit_scale_abbreviation time]
22
+ set jitter_fmt \
23
+ [sta::format_time [sta::time_ui_sta $jitter] 3][sta::unit_scale_abbreviation time]
24
+ puts \
25
+ "Creating clock $clk_name with ${period_fmt}s period and ${jitter_fmt}s jitter."
26
+ create_clock -name $clk_name -period $period $pin
27
+ set_clock_uncertainty $jitter [get_clock $clk_name]
28
+ }
29
+ }
30
+ }
31
+
32
+ ### Create IO constraints
33
+ set sc_sdc_buffer []
34
+ if { [sc_cfg_tool_task_exists {var} sdc_buffer] } {
35
+ set sc_sdc_buffer [sc_cfg_tool_task_get {var} sdc_buffer]
36
+ }
37
+ set buffer_cell "NULL"
38
+ if { [llength $sc_sdc_buffer] == 0 } {
39
+ foreach cell [get_lib_cells *] {
40
+ if { [get_property $cell is_buffer] } {
41
+ # Find first buffer and use that as IO constraints
42
+ set buffer_cell $cell
43
+ break
44
+ }
45
+ }
46
+ } else {
47
+ set buffer_cell [get_lib_cells [lindex $sc_sdc_buffer 0]]
48
+ }
49
+
50
+ if { $buffer_cell != "NULL" && $buffer_cell != "" } {
51
+ puts "Using [get_name $buffer_cell] as the SDC IO constraint cell"
52
+
53
+ set driving_port "NULL"
54
+ set load_cap 0.0
55
+ set port_itr [$buffer_cell liberty_port_iterator]
56
+ while { [$port_itr has_next] } {
57
+ set port [$port_itr next]
58
+ set pcap [$port capacitance NULL max]
59
+ if { [get_property $port direction] == "input" } {
60
+ set load_cap [expr { 10 * $pcap }]
61
+ } elseif { [get_property $port direction] == "output" } {
62
+ set driving_port [get_name $port]
63
+ }
64
+ }
65
+ $port_itr finish
66
+
67
+ if { $load_cap > 0.0 } {
68
+ set cap_fmt [sta::format_capacitance $load_cap 3][sta::unit_scale_abbreviation capacitance]
69
+ puts "Setting output load constraint to ${cap_fmt}F."
70
+ set_load [sta::capacitance_sta_ui $load_cap] [all_outputs]
71
+ }
72
+ if { $driving_port != "NULL" } {
73
+ puts "Setting input driving pin constraint to [get_name $buffer_cell]/$driving_port."
74
+ set_driving_cell -lib_cell [$buffer_cell name] -pin $driving_port [all_inputs]
75
+ }
76
+ }
@@ -0,0 +1,63 @@
1
+ proc sc_collect_pin_constraints { \
2
+ placement_pins_arg \
3
+ ordered_pins_arg \
4
+ sc_side_layer_func \
5
+ { print_func puts } } {
6
+
7
+ upvar 1 $placement_pins_arg placement_pins
8
+ upvar 1 $ordered_pins_arg ordered_pins
9
+
10
+ set pin_order [dict create]
11
+ set placement_pins [list ]
12
+
13
+ dict for {name params} [sc_cfg_get constraint pin] {
14
+ set order [dict get $params order]
15
+ set side [dict get $params side]
16
+ set place [dict get $params placement]
17
+
18
+ if { [llength $place] != 0 } {
19
+ # Pin has placement information
20
+ if { [llength $order] != 0 } {
21
+ # Pin also has order information
22
+ $print_func "Pin $name has placement specified in constraints, but also order."
23
+ }
24
+ lappend placement_pins $name
25
+ } else {
26
+ # Pin doesn't have placement
27
+ if { [llength $side] == 0 || [llength $order] == 0 } {
28
+ # Pin information is incomplete
29
+ $print_func \
30
+ "Warning: Pin $name doesn't have enough information to perform placement."
31
+ } else {
32
+ set side [lindex $side 0]
33
+ set order [lindex $order 0]
34
+ if { ![dict exists $pin_order $side $order] } {
35
+ dict set pin_order $side $order []
36
+ }
37
+
38
+ set pin_list [dict get $pin_order $side $order]
39
+ lappend pin_list $name
40
+ dict set pin_order $side $order $pin_list
41
+ }
42
+ }
43
+ }
44
+
45
+ set ordered_pins [dict create]
46
+ dict for {side pins} $pin_order {
47
+ if { [dict size $pins] == 0 } {
48
+ continue
49
+ }
50
+
51
+ set side_pin_order []
52
+ dict for {index pin} $pins {
53
+ lappend side_pin_order {*}$pin
54
+ }
55
+
56
+ set pin_layer_ordering [dict create]
57
+ foreach pin $side_pin_order {
58
+ set layer [$sc_side_layer_func $pin]
59
+ dict lappend pin_layer_ordering $layer $pin
60
+ }
61
+ dict set ordered_pins $side $pin_layer_ordering
62
+ }
63
+ }
@@ -0,0 +1,32 @@
1
+ '''
2
+ The primary objective of the PandA project is to develop a usable framework that will
3
+ enable the research of new ideas in the HW-SW Co-Design field.
4
+
5
+ The PandA framework includes methodologies supporting the research on high-level synthesis
6
+ of hardware accelerators, on parallelism extraction for embedded systems, on hardware/software
7
+ partitioning and mapping, on metrics for performance estimation of embedded software
8
+ applications and on dynamic reconfigurable devices.
9
+
10
+ Documentation: https://github.com/ferrandi/PandA-bambu
11
+
12
+ Sources: https://github.com/ferrandi/PandA-bambu
13
+
14
+ Installation: https://panda.dei.polimi.it/?page_id=88
15
+ '''
16
+
17
+ from siliconcompiler.tools.bambu import convert
18
+
19
+
20
+ ####################################################################
21
+ # Make Docs
22
+ ####################################################################
23
+ def make_docs(chip):
24
+ convert.setup(chip)
25
+ return chip
26
+
27
+
28
+ def parse_version(stdout):
29
+ # Long multiline output, but second-to-last line looks like:
30
+ # Version: PandA 0.9.6 - Revision 5e5e306b86383a7d85274d64977a3d71fdcff4fe-main
31
+ version_line = stdout.split('\n')[-3]
32
+ return version_line.split()[2]
@@ -0,0 +1,77 @@
1
+ import os
2
+ import shutil
3
+ from siliconcompiler.tools._common import \
4
+ add_frontend_requires, add_require_input, get_frontend_options, get_input_files, \
5
+ get_tool_task, has_input_files
6
+
7
+
8
+ def setup(chip):
9
+ '''
10
+ Performs high level synthesis to generate a verilog output
11
+ '''
12
+
13
+ if not has_input_files(chip, 'input', 'hll', 'c'):
14
+ return "no files in [input,hll,c]"
15
+
16
+ tool = 'bambu'
17
+ step = chip.get('arg', 'step')
18
+ index = chip.get('arg', 'index')
19
+ _, task = get_tool_task(chip, step, index)
20
+
21
+ # Standard Setup
22
+ refdir = 'tools/' + tool
23
+ chip.set('tool', tool, 'exe', 'bambu')
24
+ chip.set('tool', tool, 'vswitch', '--version')
25
+ chip.set('tool', tool, 'version', '>=2024.03', clobber=False)
26
+
27
+ chip.set('tool', tool, 'task', task, 'refdir', refdir,
28
+ step=step, index=index,
29
+ package='siliconcompiler', clobber=False)
30
+ chip.set('tool', tool, 'task', task, 'threads', os.cpu_count(),
31
+ step=step, index=index, clobber=False)
32
+
33
+ # Input/Output requirements
34
+ chip.add('tool', tool, 'task', task, 'output', chip.top() + '.v', step=step, index=index)
35
+
36
+ # Schema requirements
37
+ add_require_input(chip, 'input', 'hll', 'c')
38
+ add_frontend_requires(chip, ['idir', 'define'])
39
+
40
+
41
+ ################################
42
+ # Custom runtime options
43
+ ################################
44
+ def runtime_options(chip):
45
+ cmdlist = []
46
+
47
+ cmdlist.append('--memory-allocation-policy=NO_BRAM')
48
+
49
+ opts = get_frontend_options(chip, ['idir', 'define'])
50
+
51
+ for value in opts['idir']:
52
+ cmdlist.append('-I' + value)
53
+ for value in opts['define']:
54
+ cmdlist.append('-D' + value)
55
+ for value in get_input_files(chip, 'input', 'hll', 'c'):
56
+ cmdlist.append(value)
57
+
58
+ cmdlist.append('--memory-allocation-policy=NO_BRAM')
59
+
60
+ step = chip.get('arg', 'step')
61
+ index = chip.get('arg', 'index')
62
+
63
+ cmdlist.append(f'--top-fname={chip.top(step, index)}')
64
+
65
+ return cmdlist
66
+
67
+
68
+ ################################
69
+ # Post_process (post executable)
70
+ ################################
71
+ def post_process(chip):
72
+ ''' Tool specific function to run after step execution
73
+ '''
74
+ step = chip.get('arg', 'step')
75
+ index = chip.get('arg', 'index')
76
+
77
+ shutil.copy2(f'{chip.top(step, index)}.v', os.path.join('outputs', f'{chip.top()}.v'))
@@ -0,0 +1,40 @@
1
+
2
+ '''
3
+ Bluespec is a high-level hardware description language. It has a variety of
4
+ advanced features including a powerful type system that can prevent errors
5
+ prior to synthesis time, and its most distinguishing feature, Guarded Atomic
6
+ Actions, allow you to define hardware components in a modular manner based
7
+ on their invariants, and let the compiler pick a scheduler.
8
+
9
+ Documentation: https://github.com/B-Lang-org/bsc#documentation
10
+
11
+ Sources: https://github.com/B-Lang-org/bsc
12
+
13
+ Installation: https://github.com/B-Lang-org/bsc#download
14
+ '''
15
+
16
+ from siliconcompiler.tools.bluespec import convert
17
+
18
+
19
+ ####################################################################
20
+ # Make Docs
21
+ ####################################################################
22
+ def make_docs(chip):
23
+ convert.setup(chip)
24
+ return chip
25
+
26
+
27
+ # Directory inside step/index dir to store bsc intermediate results.
28
+ VLOG_DIR = 'verilog'
29
+
30
+
31
+ ################################
32
+ # Setup Tool (pre executable)
33
+ ################################
34
+ def parse_version(stdout):
35
+ # Examples:
36
+ # Bluespec Compiler, version 2021.12.1-27-g9a7d5e05 (build 9a7d5e05)
37
+ # Bluespec Compiler, version 2021.07 (build 4cac6eba)
38
+
39
+ long_version = stdout.split()[3]
40
+ return long_version.split('-')[0]
@@ -0,0 +1,103 @@
1
+ import os
2
+ import shutil
3
+ from siliconcompiler.tools._common import \
4
+ add_require_input, add_frontend_requires, get_frontend_options, get_input_files, \
5
+ get_tool_task, has_input_files
6
+ from siliconcompiler import sc_open
7
+
8
+ # Directory inside step/index dir to store bsc intermediate results.
9
+ VLOG_DIR = 'verilog'
10
+
11
+
12
+ def setup(chip):
13
+ '''
14
+ Performs high level synthesis to generate a verilog output
15
+ '''
16
+
17
+ if not has_input_files(chip, 'input', 'hll', 'bsv'):
18
+ return "no files in [input,hll,bsv]"
19
+
20
+ tool = 'bluespec'
21
+ step = chip.get('arg', 'step')
22
+ index = chip.get('arg', 'index')
23
+ _, task = get_tool_task(chip, step, index)
24
+
25
+ # Standard Setup
26
+ refdir = 'tools/' + tool
27
+ chip.set('tool', tool, 'exe', 'bsc')
28
+ # This is technically the 'verbose' flag, but used alone it happens to give
29
+ # us the version and exit cleanly, so we'll use it here.
30
+ chip.set('tool', tool, 'vswitch', '-v')
31
+ chip.set('tool', tool, 'version', '>=2021.07', clobber=False)
32
+
33
+ chip.set('tool', tool, 'task', task, 'refdir', refdir,
34
+ step=step, index=index,
35
+ package='siliconcompiler', clobber=False)
36
+ chip.set('tool', tool, 'task', task, 'threads', os.cpu_count(),
37
+ step=step, index=index, clobber=False)
38
+
39
+ # Input/Output requirements
40
+ chip.add('tool', tool, 'task', task, 'output', chip.top() + '.v', step=step, index=index)
41
+
42
+ # Schema requirements
43
+ add_require_input(chip, 'input', 'hll', 'bsv')
44
+ add_frontend_requires(chip, ['idir', 'ydir', 'define'])
45
+
46
+
47
+ ################################
48
+ # Pre-process
49
+ ################################
50
+ def pre_process(chip):
51
+ # bsc requires its output directory exists before being called.
52
+ if os.path.isdir(VLOG_DIR):
53
+ shutil.rmtree(VLOG_DIR)
54
+ os.makedirs(VLOG_DIR)
55
+
56
+
57
+ ################################
58
+ # Custom runtime options
59
+ ################################
60
+ def runtime_options(chip):
61
+ cmdlist = []
62
+
63
+ step = chip.get('arg', 'step')
64
+ index = chip.get('arg', 'index')
65
+
66
+ opts = get_frontend_options(chip, ['idir', 'ydir', 'define'])
67
+
68
+ cmdlist.append('-verilog')
69
+ cmdlist.append(f'-vdir {VLOG_DIR}')
70
+ cmdlist.append('-u')
71
+
72
+ cmdlist.append(f'-g {chip.top(step, index)}')
73
+
74
+ bsc_path = ':'.join(opts['ydir'] + ['%/Libraries'])
75
+ cmdlist.append('-p ' + bsc_path)
76
+
77
+ for value in opts['idir']:
78
+ cmdlist.append('-I ' + value)
79
+ for value in opts['define']:
80
+ cmdlist.append('-D ' + value)
81
+
82
+ sources = get_input_files(chip, 'input', 'hll', 'bsv', add_library_files=False)
83
+ if len(sources) != 1:
84
+ raise ValueError('Bluespec frontend only supports one source file!')
85
+ cmdlist.extend(sources)
86
+
87
+ return cmdlist
88
+
89
+
90
+ ################################
91
+ # Post-process (post executable)
92
+ ################################
93
+ def post_process(chip):
94
+ ''' Tool specific function to run after step execution
95
+ '''
96
+
97
+ # bsc outputs each compiled module to its own Verilog file, so we
98
+ # concatenate them all to create a pickled output we can pass along.
99
+ design = chip.top()
100
+ with open(os.path.join('outputs', f'{design}.v'), 'w') as pickled_vlog:
101
+ for src in os.listdir(VLOG_DIR):
102
+ with sc_open(os.path.join(VLOG_DIR, src)) as vlog_mod:
103
+ pickled_vlog.write(vlog_mod.read())
@@ -0,0 +1,155 @@
1
+
2
+ from siliconcompiler import NodeStatus, SiliconCompilerError
3
+ from siliconcompiler import utils
4
+ import shutil
5
+ from siliconcompiler.tools._common import get_tool_task
6
+ from siliconcompiler.flowgraph import _get_pruned_node_inputs
7
+
8
+
9
+ ###########################################################################
10
+ def _mux(chip, *nodes, operations=None):
11
+ '''
12
+ Shared function used for min and max calculation.
13
+ '''
14
+
15
+ nodelist = list(nodes)
16
+
17
+ # Keeping track of the steps/indexes that have goals met
18
+ failed = {}
19
+ for step, index in nodelist:
20
+ if step not in failed:
21
+ failed[step] = {}
22
+ failed[step][index] = False
23
+
24
+ if chip.get('record', 'status', step=step, index=index) == NodeStatus.ERROR:
25
+ failed[step][index] = True
26
+ else:
27
+ failed[step][index] = False
28
+
29
+ candidates = [(step, index) for step, index in nodelist if not failed[step][index]]
30
+ best_score = 0
31
+ for metric, op in operations:
32
+ if op not in ('minimum', 'maximum'):
33
+ raise ValueError('Invalid op')
34
+
35
+ values = [chip.get('metric', metric, step=step, index=index) for step, index in candidates]
36
+
37
+ if op == 'minimum':
38
+ target = min(values)
39
+ else:
40
+ target = max(values)
41
+
42
+ winners = []
43
+ for value, node in zip(values, candidates):
44
+ if value == target:
45
+ winners.append(node)
46
+ candidates = winners
47
+
48
+ if len(candidates) == 1:
49
+ break
50
+
51
+ if len(candidates) == 0:
52
+ # Restore step list and pick first step
53
+ candidates = nodelist
54
+
55
+ return (best_score, candidates[0])
56
+
57
+
58
+ ###########################################################################
59
+ def _minmax(chip, *nodes, op=None):
60
+ '''
61
+ Shared function used for min and max calculation.
62
+ '''
63
+
64
+ if op not in ('minimum', 'maximum'):
65
+ raise ValueError('Invalid op')
66
+
67
+ flow = chip.get('option', 'flow')
68
+ nodelist = list(nodes)
69
+
70
+ # Keeping track of the steps/indexes that have goals met
71
+ failed = {}
72
+ for step, index in nodelist:
73
+ if step not in failed:
74
+ failed[step] = {}
75
+ failed[step][index] = False
76
+
77
+ if chip.get('record', 'status', step=step, index=index) == NodeStatus.ERROR:
78
+ failed[step][index] = True
79
+ else:
80
+ for metric in chip.getkeys('metric'):
81
+ if chip.valid('flowgraph', flow, step, index, 'goal', metric):
82
+ goal = chip.get('flowgraph', flow, step, index, 'goal', metric)
83
+ real = chip.get('metric', metric, step=step, index=index)
84
+ if real is None:
85
+ raise SiliconCompilerError(
86
+ f'Metric {metric} has goal for {step}{index} '
87
+ 'but it has not been set.', chip=chip)
88
+ if abs(real) > goal:
89
+ chip.logger.warning(f"Step {step}{index} failed "
90
+ f"because it didn't meet goals for '{metric}' "
91
+ "metric.")
92
+ failed[step][index] = True
93
+
94
+ # Calculate max/min values for each metric
95
+ max_val = {}
96
+ min_val = {}
97
+ for metric in chip.getkeys('metric'):
98
+ max_val[metric] = 0
99
+ min_val[metric] = float("inf")
100
+ for step, index in nodelist:
101
+ if not failed[step][index]:
102
+ real = chip.get('metric', metric, step=step, index=index)
103
+ if real is None:
104
+ continue
105
+ max_val[metric] = max(max_val[metric], real)
106
+ min_val[metric] = min(min_val[metric], real)
107
+
108
+ # Select the minimum index
109
+ best_score = float('inf') if op == 'minimum' else float('-inf')
110
+ winner = None
111
+ for step, index in nodelist:
112
+ if failed[step][index]:
113
+ continue
114
+
115
+ score = 0.0
116
+ for metric in chip.getkeys('flowgraph', flow, step, index, 'weight'):
117
+ weight = chip.get('flowgraph', flow, step, index, 'weight', metric)
118
+ if not weight:
119
+ # skip if weight is 0 or None
120
+ continue
121
+
122
+ real = chip.get('metric', metric, step=step, index=index)
123
+ if real is None:
124
+ raise SiliconCompilerError(
125
+ f'Metric {metric} has weight for {step}{index} '
126
+ 'but it has not been set.', chip=chip)
127
+
128
+ if not (max_val[metric] - min_val[metric]) == 0:
129
+ scaled = (real - min_val[metric]) / (max_val[metric] - min_val[metric])
130
+ else:
131
+ scaled = max_val[metric]
132
+ score = score + scaled * weight
133
+
134
+ if ((op == 'minimum' and score < best_score) or (op == 'maximum' and score > best_score)):
135
+ best_score = score
136
+ winner = (step, index)
137
+
138
+ return (best_score, winner)
139
+
140
+
141
+ def run(chip):
142
+ return 0
143
+
144
+
145
+ def post_process(chip):
146
+ shutil.copytree('inputs', 'outputs', dirs_exist_ok=True, copy_function=utils.link_symlink_copy)
147
+
148
+
149
+ def _select_inputs(chip, step, index):
150
+ _, task = get_tool_task(chip, step, index)
151
+
152
+ chip.logger.info(f"Running builtin task '{task}'")
153
+
154
+ flow = chip.get('option', 'flow')
155
+ return _get_pruned_node_inputs(chip, flow, (step, index))
@@ -0,0 +1,26 @@
1
+ '''
2
+ Builtin tools for SiliconCompiler
3
+ '''
4
+ from siliconcompiler.tools._common import input_provides, get_tool_task
5
+
6
+
7
+ ####################################################################
8
+ # Make Docs
9
+ ####################################################################
10
+ def make_docs(chip):
11
+ return chip
12
+
13
+
14
+ def set_io_files(chip, inputs=True, outputs=True):
15
+ step = chip.get('arg', 'step')
16
+ index = chip.get('arg', 'index')
17
+ tool, task = get_tool_task(chip, step, index)
18
+
19
+ if inputs:
20
+ chip.set('tool', tool, 'task', task, 'input',
21
+ list(input_provides(chip, step, index).keys()),
22
+ step=step, index=index)
23
+ if outputs:
24
+ chip.set('tool', tool, 'task', task, 'output',
25
+ list(input_provides(chip, step, index).keys()),
26
+ step=step, index=index)
@@ -0,0 +1,85 @@
1
+ from siliconcompiler.tools.builtin import _common
2
+ import os
3
+ from siliconcompiler import sc_open, SiliconCompilerError
4
+ from siliconcompiler import utils
5
+ from siliconcompiler.tools._common import input_provides, input_file_node_name, get_tool_task
6
+ from siliconcompiler import flowgraph
7
+
8
+
9
+ def setup(chip):
10
+ '''
11
+ A file concatenation pass that merges input files into a single set of outputs.
12
+ '''
13
+
14
+ step = chip.get('arg', 'step')
15
+ index = chip.get('arg', 'index')
16
+ tool, task = get_tool_task(chip, step, index)
17
+
18
+ input_nodes = set()
19
+ for nodes in input_provides(chip, step, index).values():
20
+ input_nodes.update(nodes)
21
+
22
+ if not input_nodes:
23
+ raise SiliconCompilerError("Concatenate will not receive anything")
24
+ if len(input_nodes) == 1:
25
+ # nothing to concate to so remove
26
+ return "no need to concatenate file"
27
+
28
+ chip.set('tool', tool, 'task', task, 'input', [], step=step, index=index)
29
+ chip.set('tool', tool, 'task', task, 'output', [], step=step, index=index)
30
+ for file, nodes in input_provides(chip, step, index).items():
31
+ chip.add('tool', tool, 'task', task, 'output', file,
32
+ step=step, index=index)
33
+ for in_step, in_index in nodes:
34
+ chip.add('tool', tool, 'task', task, 'input',
35
+ input_file_node_name(file, in_step, in_index),
36
+ step=step, index=index)
37
+
38
+
39
+ def _select_inputs(chip, step, index):
40
+ return _common._select_inputs(chip, step, index)
41
+
42
+
43
+ def _gather_outputs(chip, step, index):
44
+ '''Return set of filenames that are guaranteed to be in outputs
45
+ directory after a successful run of step/index.'''
46
+
47
+ flow = chip.get('option', 'flow')
48
+
49
+ in_nodes = chip.get('flowgraph', flow, step, index, 'input')
50
+ in_task_outputs = [flowgraph._gather_outputs(chip, *node) for node in in_nodes]
51
+
52
+ if len(in_task_outputs) > 0:
53
+ return in_task_outputs[0].union(*in_task_outputs[1:])
54
+
55
+ return []
56
+
57
+
58
+ def run(chip):
59
+ return _common.run(chip)
60
+
61
+
62
+ def post_process(chip):
63
+ step = chip.get('arg', 'step')
64
+ index = chip.get('arg', 'index')
65
+
66
+ def comment_flag(ext):
67
+ if ext.startswith('tcl'):
68
+ return '#'
69
+ if ext.startswith('v'):
70
+ return '//'
71
+ return None
72
+
73
+ for file, nodes in input_provides(chip, step, index).items():
74
+ comment = comment_flag(utils.get_file_ext(file))
75
+ with open(f'outputs/{file}', 'w') as out:
76
+ for in_step, in_index in nodes:
77
+ ifile = f'inputs/{input_file_node_name(file, in_step, in_index)}'
78
+ if not os.path.isfile(ifile):
79
+ continue
80
+ with sc_open(ifile) as in_file:
81
+ if comment:
82
+ out.write(f'{comment} Start of SiliconCompiler input: {ifile}\n')
83
+ out.write(in_file.read())
84
+ if comment:
85
+ out.write(f'{comment} End of SiliconCompiler input: {ifile}\n\n')
@@ -0,0 +1,27 @@
1
+ from siliconcompiler.tools.builtin import _common
2
+ from siliconcompiler.tools.builtin import nop
3
+ from siliconcompiler.tools.builtin.builtin import set_io_files
4
+
5
+
6
+ def setup(chip):
7
+ '''
8
+ Merges outputs from a list of input tasks.
9
+ '''
10
+
11
+ set_io_files(chip)
12
+
13
+
14
+ def _select_inputs(chip, step, index):
15
+ return _common._select_inputs(chip, step, index)
16
+
17
+
18
+ def _gather_outputs(chip, step, index):
19
+ return nop._gather_outputs(chip, step, index)
20
+
21
+
22
+ def run(chip):
23
+ return _common.run(chip)
24
+
25
+
26
+ def post_process(chip):
27
+ _common.post_process(chip)