siliconcompiler 0.34.2__py3-none-any.whl → 0.34.3__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 (121) hide show
  1. siliconcompiler/__init__.py +12 -5
  2. siliconcompiler/__main__.py +1 -7
  3. siliconcompiler/_metadata.py +1 -1
  4. siliconcompiler/apps/_common.py +104 -23
  5. siliconcompiler/apps/sc.py +4 -8
  6. siliconcompiler/apps/sc_dashboard.py +6 -4
  7. siliconcompiler/apps/sc_install.py +10 -6
  8. siliconcompiler/apps/sc_issue.py +7 -5
  9. siliconcompiler/apps/sc_remote.py +1 -1
  10. siliconcompiler/apps/sc_server.py +9 -14
  11. siliconcompiler/apps/sc_show.py +6 -5
  12. siliconcompiler/apps/smake.py +130 -94
  13. siliconcompiler/apps/utils/replay.py +4 -7
  14. siliconcompiler/apps/utils/summarize.py +3 -5
  15. siliconcompiler/asic.py +420 -0
  16. siliconcompiler/checklist.py +25 -2
  17. siliconcompiler/cmdlineschema.py +534 -0
  18. siliconcompiler/constraints/asic_component.py +2 -2
  19. siliconcompiler/constraints/asic_pins.py +2 -2
  20. siliconcompiler/constraints/asic_timing.py +3 -3
  21. siliconcompiler/core.py +7 -32
  22. siliconcompiler/data/templates/tcl/manifest.tcl.j2 +8 -0
  23. siliconcompiler/dependencyschema.py +89 -31
  24. siliconcompiler/design.py +176 -207
  25. siliconcompiler/filesetschema.py +250 -0
  26. siliconcompiler/flowgraph.py +274 -95
  27. siliconcompiler/fpga.py +124 -1
  28. siliconcompiler/library.py +218 -20
  29. siliconcompiler/metric.py +233 -20
  30. siliconcompiler/package/__init__.py +271 -50
  31. siliconcompiler/package/git.py +92 -16
  32. siliconcompiler/package/github.py +108 -12
  33. siliconcompiler/package/https.py +79 -16
  34. siliconcompiler/packageschema.py +88 -7
  35. siliconcompiler/pathschema.py +31 -2
  36. siliconcompiler/pdk.py +566 -1
  37. siliconcompiler/project.py +1095 -94
  38. siliconcompiler/record.py +38 -1
  39. siliconcompiler/remote/__init__.py +5 -2
  40. siliconcompiler/remote/client.py +11 -6
  41. siliconcompiler/remote/schema.py +5 -23
  42. siliconcompiler/remote/server.py +41 -54
  43. siliconcompiler/report/__init__.py +3 -3
  44. siliconcompiler/report/dashboard/__init__.py +48 -14
  45. siliconcompiler/report/dashboard/cli/__init__.py +99 -21
  46. siliconcompiler/report/dashboard/cli/board.py +364 -179
  47. siliconcompiler/report/dashboard/web/__init__.py +90 -12
  48. siliconcompiler/report/dashboard/web/components/__init__.py +219 -240
  49. siliconcompiler/report/dashboard/web/components/flowgraph.py +49 -26
  50. siliconcompiler/report/dashboard/web/components/graph.py +139 -100
  51. siliconcompiler/report/dashboard/web/layouts/__init__.py +29 -1
  52. siliconcompiler/report/dashboard/web/layouts/_common.py +38 -2
  53. siliconcompiler/report/dashboard/web/layouts/vertical_flowgraph.py +39 -26
  54. siliconcompiler/report/dashboard/web/layouts/vertical_flowgraph_node_tab.py +50 -50
  55. siliconcompiler/report/dashboard/web/layouts/vertical_flowgraph_sac_tabs.py +49 -46
  56. siliconcompiler/report/dashboard/web/state.py +141 -14
  57. siliconcompiler/report/dashboard/web/utils/__init__.py +79 -16
  58. siliconcompiler/report/dashboard/web/utils/file_utils.py +74 -11
  59. siliconcompiler/report/dashboard/web/viewer.py +25 -1
  60. siliconcompiler/report/report.py +5 -2
  61. siliconcompiler/report/summary_image.py +29 -11
  62. siliconcompiler/scheduler/__init__.py +9 -1
  63. siliconcompiler/scheduler/docker.py +79 -1
  64. siliconcompiler/scheduler/run_node.py +35 -19
  65. siliconcompiler/scheduler/scheduler.py +208 -24
  66. siliconcompiler/scheduler/schedulernode.py +372 -46
  67. siliconcompiler/scheduler/send_messages.py +77 -29
  68. siliconcompiler/scheduler/slurm.py +76 -12
  69. siliconcompiler/scheduler/taskscheduler.py +140 -20
  70. siliconcompiler/schema/__init__.py +0 -2
  71. siliconcompiler/schema/baseschema.py +194 -38
  72. siliconcompiler/schema/journal.py +7 -4
  73. siliconcompiler/schema/namedschema.py +16 -10
  74. siliconcompiler/schema/parameter.py +55 -9
  75. siliconcompiler/schema/parametervalue.py +60 -0
  76. siliconcompiler/schema/safeschema.py +25 -2
  77. siliconcompiler/schema/schema_cfg.py +5 -5
  78. siliconcompiler/schema/utils.py +2 -2
  79. siliconcompiler/schema_obj.py +20 -3
  80. siliconcompiler/tool.py +979 -302
  81. siliconcompiler/tools/bambu/__init__.py +41 -0
  82. siliconcompiler/tools/builtin/concatenate.py +2 -2
  83. siliconcompiler/tools/builtin/minimum.py +2 -1
  84. siliconcompiler/tools/builtin/mux.py +2 -1
  85. siliconcompiler/tools/builtin/nop.py +2 -1
  86. siliconcompiler/tools/builtin/verify.py +2 -1
  87. siliconcompiler/tools/klayout/__init__.py +95 -0
  88. siliconcompiler/tools/openroad/__init__.py +289 -0
  89. siliconcompiler/tools/openroad/scripts/apr/preamble.tcl +3 -0
  90. siliconcompiler/tools/openroad/scripts/apr/sc_detailed_route.tcl +7 -2
  91. siliconcompiler/tools/openroad/scripts/apr/sc_global_route.tcl +8 -4
  92. siliconcompiler/tools/openroad/scripts/apr/sc_init_floorplan.tcl +9 -5
  93. siliconcompiler/tools/openroad/scripts/common/write_images.tcl +5 -1
  94. siliconcompiler/tools/slang/__init__.py +1 -1
  95. siliconcompiler/tools/slang/elaborate.py +2 -1
  96. siliconcompiler/tools/vivado/scripts/sc_run.tcl +1 -1
  97. siliconcompiler/tools/vivado/scripts/sc_syn_fpga.tcl +8 -1
  98. siliconcompiler/tools/vivado/syn_fpga.py +6 -0
  99. siliconcompiler/tools/vivado/vivado.py +35 -2
  100. siliconcompiler/tools/vpr/__init__.py +150 -0
  101. siliconcompiler/tools/yosys/__init__.py +369 -1
  102. siliconcompiler/tools/yosys/scripts/procs.tcl +0 -1
  103. siliconcompiler/toolscripts/_tools.json +5 -10
  104. siliconcompiler/utils/__init__.py +66 -0
  105. siliconcompiler/utils/flowgraph.py +2 -2
  106. siliconcompiler/utils/issue.py +2 -1
  107. siliconcompiler/utils/logging.py +14 -0
  108. siliconcompiler/utils/multiprocessing.py +256 -0
  109. siliconcompiler/utils/showtools.py +10 -0
  110. {siliconcompiler-0.34.2.dist-info → siliconcompiler-0.34.3.dist-info}/METADATA +5 -5
  111. {siliconcompiler-0.34.2.dist-info → siliconcompiler-0.34.3.dist-info}/RECORD +115 -118
  112. {siliconcompiler-0.34.2.dist-info → siliconcompiler-0.34.3.dist-info}/entry_points.txt +3 -0
  113. siliconcompiler/schema/cmdlineschema.py +0 -250
  114. siliconcompiler/toolscripts/rhel8/install-slang.sh +0 -40
  115. siliconcompiler/toolscripts/rhel9/install-slang.sh +0 -40
  116. siliconcompiler/toolscripts/ubuntu20/install-slang.sh +0 -47
  117. siliconcompiler/toolscripts/ubuntu22/install-slang.sh +0 -37
  118. siliconcompiler/toolscripts/ubuntu24/install-slang.sh +0 -37
  119. {siliconcompiler-0.34.2.dist-info → siliconcompiler-0.34.3.dist-info}/WHEEL +0 -0
  120. {siliconcompiler-0.34.2.dist-info → siliconcompiler-0.34.3.dist-info}/licenses/LICENSE +0 -0
  121. {siliconcompiler-0.34.2.dist-info → siliconcompiler-0.34.3.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,7 @@
1
+ """
2
+ Defines a dashboard layout that organizes different views into a set of
3
+ vertical tabs using Streamlit's native `st.tabs` component.
4
+ """
1
5
  import os
2
6
  import streamlit
3
7
 
@@ -9,12 +13,23 @@ from siliconcompiler.report.dashboard.web.layouts import _common
9
13
 
10
14
 
11
15
  def layout():
16
+ """
17
+ Constructs a layout using Streamlit's native tabs.
18
+
19
+ This function sets up the main page header and then creates a tabbed
20
+ interface for the primary content areas. The "Metrics" tab is a
21
+ comprehensive view containing the flowgraph, metrics table, and detailed
22
+ node information. Other views like the Manifest, File Viewer, and Graphs
23
+ are in separate, conditionally rendered tabs.
24
+ """
12
25
  chip = state.get_chip()
13
26
  metric_dataframe, node_to_step_index_map, metric_to_metric_unit_map = \
14
27
  utils.generate_metric_dataframe(chip)
15
28
 
29
+ # Render the main page header (title, job selector, settings)
16
30
  components.page_header()
17
31
 
32
+ # --- Dynamically create tabs based on available data ---
18
33
  tab_headings = ["Metrics", "Manifest", "File Viewer"]
19
34
  if os.path.isfile(f'{chip.getworkdir()}/{chip.design}.png'):
20
35
  tab_headings.append("Design Preview")
@@ -23,50 +38,43 @@ def layout():
23
38
  if has_graphs:
24
39
  tab_headings.append("Graphs")
25
40
 
26
- tabs = {
27
- name: tab for name, tab in zip(tab_headings, streamlit.tabs(tab_headings))
28
- }
41
+ # Create a dictionary mapping tab names to the tab container objects
42
+ tabs = {name: tab for name, tab in zip(tab_headings, streamlit.tabs(tab_headings))}
29
43
 
44
+ # --- Populate the "Metrics" tab ---
30
45
  with tabs["Metrics"]:
31
- # Add flowgraph
32
46
  if state.get_key(state.DISPLAY_FLOWGRAPH):
47
+ # Create a two-column layout for the flowgraph and main content
33
48
  default_flowgraph_width_in_percent = 0.4
34
49
  flowgraph_col_width_in_pixels = 520
35
- flowgraph_col_width_in_percent = \
36
- state.compute_component_size(
37
- default_flowgraph_width_in_percent,
38
- flowgraph_col_width_in_pixels)
50
+ flowgraph_col_width_in_percent = state.compute_component_size(
51
+ default_flowgraph_width_in_percent,
52
+ flowgraph_col_width_in_pixels)
39
53
 
40
- flowgraph_col, metrics_container = \
41
- streamlit.columns(
42
- [flowgraph_col_width_in_percent, 1 - flowgraph_col_width_in_percent],
43
- gap="large")
54
+ flowgraph_col, metrics_container = streamlit.columns(
55
+ [flowgraph_col_width_in_percent, 1 - flowgraph_col_width_in_percent],
56
+ gap="large")
44
57
 
45
58
  with flowgraph_col:
46
- header_col, flowgraph_toggle_container = streamlit.columns(2, gap="large")
47
- with header_col:
48
- streamlit.header('Flowgraph')
59
+ streamlit.header('Flowgraph')
49
60
  components.flowgraph_viewer(chip)
50
61
  else:
51
- flowgraph_toggle_container = streamlit.container()
52
62
  metrics_container = streamlit.container()
53
63
 
54
- with flowgraph_toggle_container:
55
- streamlit.markdown("")
56
- streamlit.markdown("")
57
-
64
+ with metrics_container:
65
+ # Add a toggle to hide/show the flowgraph
58
66
  if state.set_key(state.DISPLAY_FLOWGRAPH, not streamlit.checkbox(
59
- 'Hide flowgraph',
67
+ 'Hide flowgraph', not state.get_key(state.DISPLAY_FLOWGRAPH),
60
68
  help='Click here to hide the flowgraph')):
61
69
  state.set_key(state.APP_RERUN, "Flowgraph")
62
70
 
63
- with metrics_container:
71
+ # Display the main metrics table
64
72
  components.metrics_viewer(metric_dataframe, metric_to_metric_unit_map)
65
73
 
66
- header_col, settings_col = \
67
- streamlit.columns(
68
- [0.7, 0.3],
69
- gap='small')
74
+ streamlit.divider()
75
+
76
+ # Display the node information section within the same tab
77
+ header_col, settings_col = streamlit.columns([0.7, 0.3], gap='small')
70
78
  with header_col:
71
79
  streamlit.header('Node Information')
72
80
  with settings_col:
@@ -76,15 +84,18 @@ def layout():
76
84
  step, index = node_to_step_index_map[state.get_selected_node()]
77
85
  components.node_viewer(chip, step, index, metric_dataframe)
78
86
 
87
+ # --- Populate the "Manifest" tab ---
79
88
  with tabs["Manifest"]:
80
89
  components.manifest_viewer(chip)
81
90
 
91
+ # --- Populate the "File Viewer" tab ---
82
92
  with tabs["File Viewer"]:
83
93
  components.file_viewer(
84
94
  chip,
85
95
  state.get_key(state.SELECTED_FILE),
86
96
  page_key=state.SELECTED_FILE_PAGE)
87
97
 
98
+ # --- Populate conditional tabs ---
88
99
  if "Design Preview" in tabs:
89
100
  with tabs["Design Preview"]:
90
101
  components.file_viewer(chip, f'{chip.getworkdir()}/{chip.design}.png')
@@ -93,4 +104,6 @@ def layout():
93
104
  with tabs["Graphs"]:
94
105
  graph.viewer(node_to_step_index_map)
95
106
 
107
+ # Check if a rerun is needed to switch to a different tab (not applicable
108
+ # for st.tabs, but kept for consistency with other layouts).
96
109
  _common.check_rerun()
@@ -1,3 +1,7 @@
1
+ """
2
+ Defines a dashboard layout that organizes different views into a set of tabs
3
+ using the streamlit-antd-components library.
4
+ """
1
5
  import os
2
6
  import streamlit
3
7
 
@@ -11,81 +15,76 @@ import streamlit_antd_components as sac
11
15
 
12
16
 
13
17
  def layout():
18
+ """
19
+ Constructs a tab-based layout for the web dashboard.
20
+
21
+ This function sets up the main page header and creates a tab group for
22
+ navigating between different views:
23
+ - Metrics: Shows the flowgraph alongside a table of key metrics.
24
+ - Node Information: Provides a detailed view of a selected node's data and files.
25
+ - Manifest: A searchable viewer for the chip's manifest.
26
+ - File Viewer: Displays the content of a selected file.
27
+ - Design Preview: Shows a preview image of the design, if available.
28
+ - Graphs: Interactive charts for comparing metrics across runs.
29
+
30
+ It handles the logic for displaying the content of the currently selected tab.
31
+ """
14
32
  chip = state.get_chip()
15
33
  metric_dataframe, node_to_step_index_map, metric_to_metric_unit_map = \
16
34
  utils.generate_metric_dataframe(chip)
17
35
 
36
+ # Render the main page header (title, job selector, settings)
18
37
  components.page_header()
19
38
 
39
+ # --- Define the tab items ---
20
40
  tab_headings = [
21
- sac.TabsItem(
22
- "Metrics",
23
- icon='stack'),
24
- sac.TabsItem(
25
- "Node Information",
26
- icon='diagram-2'),
27
- sac.TabsItem(
28
- "Manifest",
29
- icon=file_utils.get_file_icon('manifest.pkg.json')),
30
- sac.TabsItem(
31
- "File Viewer",
32
- icon=file_utils.get_file_icon(state.get_key(state.SELECTED_FILE))),
33
- sac.TabsItem(
34
- "Design Preview",
35
- icon=file_utils.get_file_icon('design.png'),
36
- disabled=not os.path.isfile(f'{chip.getworkdir()}/{chip.design}.png')),
37
- sac.TabsItem(
38
- "Graphs",
39
- icon='graph-up',
40
- disabled=len(state.get_key(state.LOADED_CHIPS)) == 1)
41
+ sac.TabsItem("Metrics", icon='stack'),
42
+ sac.TabsItem("Node Information", icon='diagram-2'),
43
+ sac.TabsItem("Manifest", icon=file_utils.get_file_icon('manifest.pkg.json')),
44
+ sac.TabsItem("File Viewer",
45
+ icon=file_utils.get_file_icon(state.get_key(state.SELECTED_FILE))),
46
+ sac.TabsItem("Design Preview", icon=file_utils.get_file_icon('design.png'),
47
+ disabled=not os.path.isfile(f'{chip.getworkdir()}/{chip.design}.png')),
48
+ sac.TabsItem("Graphs", icon='graph-up',
49
+ disabled=len(state.get_key(state.LOADED_CHIPS)) <= 1)
41
50
  ]
42
51
 
52
+ # Render the tabs and get the user's selection
43
53
  tab_selected = _common.sac_tabs(tab_headings)
44
54
 
55
+ # --- Render the content for the selected tab ---
45
56
  if tab_selected == "Metrics":
46
- # Add flowgraph
47
57
  if state.get_key(state.DISPLAY_FLOWGRAPH):
58
+ # Create a two-column layout for the flowgraph and metrics table
48
59
  default_flowgraph_width_in_percent = 0.4
49
60
  flowgraph_col_width_in_pixels = 520
50
- flowgraph_col_width_in_percent = \
51
- state.compute_component_size(
52
- default_flowgraph_width_in_percent,
53
- flowgraph_col_width_in_pixels)
61
+ flowgraph_col_width_in_percent = state.compute_component_size(
62
+ default_flowgraph_width_in_percent, flowgraph_col_width_in_pixels)
54
63
 
55
- flowgraph_col, metrics_container = \
56
- streamlit.columns(
57
- [flowgraph_col_width_in_percent, 1 - flowgraph_col_width_in_percent],
58
- gap="large")
64
+ flowgraph_col, metrics_container = streamlit.columns(
65
+ [flowgraph_col_width_in_percent, 1 - flowgraph_col_width_in_percent],
66
+ gap="large")
59
67
 
60
68
  with flowgraph_col:
61
- header_col, flowgraph_toggle_container = streamlit.columns(2, gap="large")
62
- with header_col:
63
- streamlit.header('Flowgraph')
69
+ streamlit.header('Flowgraph')
64
70
  components.flowgraph_viewer(chip)
65
71
  else:
66
- flowgraph_toggle_container = streamlit.container()
67
72
  metrics_container = streamlit.container()
68
73
 
69
- with flowgraph_toggle_container:
70
- streamlit.markdown("")
71
- streamlit.markdown("")
72
-
74
+ with metrics_container:
75
+ # Add a toggle to hide/show the flowgraph
73
76
  if state.set_key(state.DISPLAY_FLOWGRAPH, not streamlit.checkbox(
74
- 'Hide flowgraph',
77
+ 'Hide flowgraph', not state.get_key(state.DISPLAY_FLOWGRAPH),
75
78
  help='Click here to hide the flowgraph')):
76
79
  state.set_key(state.APP_RERUN, "Flowgraph")
77
80
 
78
- with metrics_container:
79
81
  components.metrics_viewer(
80
82
  metric_dataframe,
81
83
  metric_to_metric_unit_map,
82
84
  height=1000)
83
85
 
84
- if tab_selected == "Node Information":
85
- header_col, settings_col = \
86
- streamlit.columns(
87
- [0.7, 0.3],
88
- gap='small')
86
+ elif tab_selected == "Node Information":
87
+ header_col, settings_col = streamlit.columns([0.7, 0.3], gap='small')
89
88
  with header_col:
90
89
  streamlit.header('Node Information')
91
90
  with settings_col:
@@ -95,23 +94,24 @@ def layout():
95
94
  step, index = node_to_step_index_map[state.get_selected_node()]
96
95
  current_file = state.get_key(state.SELECTED_FILE)
97
96
  components.node_viewer(chip, step, index, metric_dataframe, height=1000)
98
- if state.get_key(state.SELECTED_FILE) and \
99
- current_file != state.get_key(state.SELECTED_FILE):
97
+ # Check if a file was selected within the node viewer
98
+ if current_file != state.get_key(state.SELECTED_FILE):
100
99
  state.set_key(state.APP_RERUN, "File")
101
100
 
102
- if tab_selected == "Manifest":
101
+ elif tab_selected == "Manifest":
103
102
  components.manifest_viewer(chip)
104
103
 
105
- if tab_selected == "File Viewer":
104
+ elif tab_selected == "File Viewer":
106
105
  components.file_viewer(
107
106
  chip,
108
107
  state.get_key(state.SELECTED_FILE),
109
108
  page_key=state.SELECTED_FILE_PAGE)
110
109
 
111
- if tab_selected == "Design Preview":
110
+ elif tab_selected == "Design Preview":
112
111
  components.file_viewer(chip, f'{chip.getworkdir()}/{chip.design}.png')
113
112
 
114
- if tab_selected == "Graphs":
113
+ elif tab_selected == "Graphs":
115
114
  graph.viewer(node_to_step_index_map)
116
115
 
116
+ # Check if a rerun is needed to switch to a different tab
117
117
  _common.check_rerun()
@@ -1,3 +1,7 @@
1
+ """
2
+ Defines a dashboard layout where the detailed node information is integrated
3
+ directly into the main 'Metrics' tab, below the primary metrics table.
4
+ """
1
5
  import os
2
6
  import streamlit
3
7
 
@@ -11,74 +15,72 @@ import streamlit_antd_components as sac
11
15
 
12
16
 
13
17
  def layout():
18
+ """
19
+ Constructs an integrated layout for the web dashboard.
20
+
21
+ This function sets up the main page header and a tab group. The primary
22
+ "Metrics" tab is designed as a comprehensive view, containing the flowgraph,
23
+ the main metrics table, and the detailed node information viewer all in one
24
+ place. Other views like the Manifest, File Viewer, and Graphs are in
25
+ separate tabs.
26
+ """
14
27
  chip = state.get_chip()
15
28
  metric_dataframe, node_to_step_index_map, metric_to_metric_unit_map = \
16
29
  utils.generate_metric_dataframe(chip)
17
30
 
31
+ # Render the main page header (title, job selector, settings)
18
32
  components.page_header()
19
33
 
34
+ # --- Define the tab items ---
35
+ # Note: "Node Information" is not a separate tab in this layout.
20
36
  tab_headings = [
21
- sac.TabsItem(
22
- "Metrics",
23
- icon='stack'),
24
- sac.TabsItem(
25
- "Manifest",
26
- icon=file_utils.get_file_icon('manifest.pkg.json')),
27
- sac.TabsItem(
28
- "File Viewer",
29
- icon=file_utils.get_file_icon(state.get_key(state.SELECTED_FILE))),
30
- sac.TabsItem(
31
- "Design Preview",
32
- icon=file_utils.get_file_icon('design.png'),
33
- disabled=not os.path.isfile(f'{chip.getworkdir()}/{chip.design}.png')),
34
- sac.TabsItem(
35
- "Graphs",
36
- icon='graph-up',
37
- disabled=len(state.get_key(state.LOADED_CHIPS)) == 1)
37
+ sac.TabsItem("Metrics", icon='stack'),
38
+ sac.TabsItem("Manifest", icon=file_utils.get_file_icon('manifest.pkg.json')),
39
+ sac.TabsItem("File Viewer",
40
+ icon=file_utils.get_file_icon(state.get_key(state.SELECTED_FILE))),
41
+ sac.TabsItem("Design Preview", icon=file_utils.get_file_icon('design.png'),
42
+ disabled=not os.path.isfile(f'{chip.getworkdir()}/{chip.design}.png')),
43
+ sac.TabsItem("Graphs", icon='graph-up',
44
+ disabled=len(state.get_key(state.LOADED_CHIPS)) <= 1)
38
45
  ]
39
46
 
47
+ # Render the tabs and get the user's selection
40
48
  tab_selected = _common.sac_tabs(tab_headings)
41
49
 
50
+ # --- Render the content for the selected tab ---
42
51
  if tab_selected == "Metrics":
43
- # Add flowgraph
52
+ # This tab contains the flowgraph, metrics table, and node details.
44
53
  if state.get_key(state.DISPLAY_FLOWGRAPH):
54
+ # Create a two-column layout for the flowgraph and main content
45
55
  default_flowgraph_width_in_percent = 0.4
46
56
  flowgraph_col_width_in_pixels = 520
47
- flowgraph_col_width_in_percent = \
48
- state.compute_component_size(
49
- default_flowgraph_width_in_percent,
50
- flowgraph_col_width_in_pixels)
57
+ flowgraph_col_width_in_percent = state.compute_component_size(
58
+ default_flowgraph_width_in_percent, flowgraph_col_width_in_pixels)
51
59
 
52
- flowgraph_col, metrics_container = \
53
- streamlit.columns(
54
- [flowgraph_col_width_in_percent, 1 - flowgraph_col_width_in_percent],
55
- gap="large")
60
+ flowgraph_col, metrics_container = streamlit.columns(
61
+ [flowgraph_col_width_in_percent, 1 - flowgraph_col_width_in_percent],
62
+ gap="large")
56
63
 
57
64
  with flowgraph_col:
58
- header_col, flowgraph_toggle_container = streamlit.columns(2, gap="large")
59
- with header_col:
60
- streamlit.header('Flowgraph')
65
+ streamlit.header('Flowgraph')
61
66
  components.flowgraph_viewer(chip)
62
67
  else:
63
- flowgraph_toggle_container = streamlit.container()
64
68
  metrics_container = streamlit.container()
65
69
 
66
- with flowgraph_toggle_container:
67
- streamlit.markdown("")
68
- streamlit.markdown("")
69
-
70
+ with metrics_container:
71
+ # Add a toggle to hide/show the flowgraph
70
72
  if state.set_key(state.DISPLAY_FLOWGRAPH, not streamlit.checkbox(
71
- 'Hide flowgraph',
73
+ 'Hide flowgraph', not state.get_key(state.DISPLAY_FLOWGRAPH),
72
74
  help='Click here to hide the flowgraph')):
73
75
  state.set_key(state.APP_RERUN, "Flowgraph")
74
76
 
75
- with metrics_container:
77
+ # Display the main metrics table
76
78
  components.metrics_viewer(metric_dataframe, metric_to_metric_unit_map)
77
79
 
78
- header_col, settings_col = \
79
- streamlit.columns(
80
- [0.7, 0.3],
81
- gap='small')
80
+ streamlit.divider()
81
+
82
+ # Display the node information section within the same tab
83
+ header_col, settings_col = streamlit.columns([0.7, 0.3], gap='small')
82
84
  with header_col:
83
85
  streamlit.header('Node Information')
84
86
  with settings_col:
@@ -88,23 +90,24 @@ def layout():
88
90
  step, index = node_to_step_index_map[state.get_selected_node()]
89
91
  current_file = state.get_key(state.SELECTED_FILE)
90
92
  components.node_viewer(chip, step, index, metric_dataframe)
91
- if state.get_key(state.SELECTED_FILE) and \
92
- current_file != state.get_key(state.SELECTED_FILE):
93
+ # Check if a file was selected to trigger a tab switch
94
+ if current_file != state.get_key(state.SELECTED_FILE):
93
95
  state.set_key(state.APP_RERUN, "File")
94
96
 
95
- if tab_selected == "Manifest":
97
+ elif tab_selected == "Manifest":
96
98
  components.manifest_viewer(chip)
97
99
 
98
- if tab_selected == "File Viewer":
100
+ elif tab_selected == "File Viewer":
99
101
  components.file_viewer(
100
102
  chip,
101
103
  state.get_key(state.SELECTED_FILE),
102
104
  page_key=state.SELECTED_FILE_PAGE)
103
105
 
104
- if tab_selected == "Design Preview":
106
+ elif tab_selected == "Design Preview":
105
107
  components.file_viewer(chip, f'{chip.getworkdir()}/{chip.design}.png')
106
108
 
107
- if tab_selected == "Graphs":
109
+ elif tab_selected == "Graphs":
108
110
  graph.viewer(node_to_step_index_map)
109
111
 
112
+ # Check if a rerun is needed to switch to a different tab
110
113
  _common.check_rerun()