siliconcompiler 0.34.1__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.
- siliconcompiler/__init__.py +23 -4
- siliconcompiler/__main__.py +1 -7
- siliconcompiler/_metadata.py +1 -1
- siliconcompiler/apps/_common.py +104 -23
- siliconcompiler/apps/sc.py +4 -8
- siliconcompiler/apps/sc_dashboard.py +6 -4
- siliconcompiler/apps/sc_install.py +10 -6
- siliconcompiler/apps/sc_issue.py +7 -5
- siliconcompiler/apps/sc_remote.py +1 -1
- siliconcompiler/apps/sc_server.py +9 -14
- siliconcompiler/apps/sc_show.py +7 -6
- siliconcompiler/apps/smake.py +130 -94
- siliconcompiler/apps/utils/replay.py +4 -7
- siliconcompiler/apps/utils/summarize.py +3 -5
- siliconcompiler/asic.py +420 -0
- siliconcompiler/checklist.py +25 -2
- siliconcompiler/cmdlineschema.py +534 -0
- siliconcompiler/constraints/__init__.py +17 -0
- siliconcompiler/constraints/asic_component.py +378 -0
- siliconcompiler/constraints/asic_floorplan.py +449 -0
- siliconcompiler/constraints/asic_pins.py +489 -0
- siliconcompiler/constraints/asic_timing.py +517 -0
- siliconcompiler/core.py +10 -35
- siliconcompiler/data/templates/tcl/manifest.tcl.j2 +8 -0
- siliconcompiler/dependencyschema.py +96 -202
- siliconcompiler/design.py +327 -241
- siliconcompiler/filesetschema.py +250 -0
- siliconcompiler/flowgraph.py +298 -106
- siliconcompiler/fpga.py +124 -1
- siliconcompiler/library.py +331 -0
- siliconcompiler/metric.py +327 -92
- siliconcompiler/metrics/__init__.py +7 -0
- siliconcompiler/metrics/asic.py +245 -0
- siliconcompiler/metrics/fpga.py +220 -0
- siliconcompiler/package/__init__.py +391 -67
- siliconcompiler/package/git.py +92 -16
- siliconcompiler/package/github.py +114 -22
- siliconcompiler/package/https.py +79 -16
- siliconcompiler/packageschema.py +341 -16
- siliconcompiler/pathschema.py +255 -0
- siliconcompiler/pdk.py +566 -1
- siliconcompiler/project.py +1460 -0
- siliconcompiler/record.py +38 -1
- siliconcompiler/remote/__init__.py +5 -2
- siliconcompiler/remote/client.py +11 -6
- siliconcompiler/remote/schema.py +5 -23
- siliconcompiler/remote/server.py +41 -54
- siliconcompiler/report/__init__.py +3 -3
- siliconcompiler/report/dashboard/__init__.py +48 -14
- siliconcompiler/report/dashboard/cli/__init__.py +99 -21
- siliconcompiler/report/dashboard/cli/board.py +364 -179
- siliconcompiler/report/dashboard/web/__init__.py +90 -12
- siliconcompiler/report/dashboard/web/components/__init__.py +219 -240
- siliconcompiler/report/dashboard/web/components/flowgraph.py +49 -26
- siliconcompiler/report/dashboard/web/components/graph.py +139 -100
- siliconcompiler/report/dashboard/web/layouts/__init__.py +29 -1
- siliconcompiler/report/dashboard/web/layouts/_common.py +38 -2
- siliconcompiler/report/dashboard/web/layouts/vertical_flowgraph.py +39 -26
- siliconcompiler/report/dashboard/web/layouts/vertical_flowgraph_node_tab.py +50 -50
- siliconcompiler/report/dashboard/web/layouts/vertical_flowgraph_sac_tabs.py +49 -46
- siliconcompiler/report/dashboard/web/state.py +141 -14
- siliconcompiler/report/dashboard/web/utils/__init__.py +79 -16
- siliconcompiler/report/dashboard/web/utils/file_utils.py +74 -11
- siliconcompiler/report/dashboard/web/viewer.py +25 -1
- siliconcompiler/report/report.py +5 -2
- siliconcompiler/report/summary_image.py +29 -11
- siliconcompiler/scheduler/__init__.py +9 -1
- siliconcompiler/scheduler/docker.py +81 -4
- siliconcompiler/scheduler/run_node.py +37 -20
- siliconcompiler/scheduler/scheduler.py +211 -36
- siliconcompiler/scheduler/schedulernode.py +394 -60
- siliconcompiler/scheduler/send_messages.py +77 -29
- siliconcompiler/scheduler/slurm.py +76 -12
- siliconcompiler/scheduler/taskscheduler.py +142 -21
- siliconcompiler/schema/__init__.py +0 -4
- siliconcompiler/schema/baseschema.py +338 -59
- siliconcompiler/schema/editableschema.py +14 -6
- siliconcompiler/schema/journal.py +28 -17
- siliconcompiler/schema/namedschema.py +22 -14
- siliconcompiler/schema/parameter.py +89 -28
- siliconcompiler/schema/parametertype.py +2 -0
- siliconcompiler/schema/parametervalue.py +258 -15
- siliconcompiler/schema/safeschema.py +25 -2
- siliconcompiler/schema/schema_cfg.py +23 -19
- siliconcompiler/schema/utils.py +2 -2
- siliconcompiler/schema_obj.py +24 -5
- siliconcompiler/tool.py +1131 -265
- siliconcompiler/tools/bambu/__init__.py +41 -0
- siliconcompiler/tools/builtin/concatenate.py +2 -2
- siliconcompiler/tools/builtin/minimum.py +2 -1
- siliconcompiler/tools/builtin/mux.py +2 -1
- siliconcompiler/tools/builtin/nop.py +2 -1
- siliconcompiler/tools/builtin/verify.py +2 -1
- siliconcompiler/tools/klayout/__init__.py +95 -0
- siliconcompiler/tools/openroad/__init__.py +289 -0
- siliconcompiler/tools/openroad/scripts/apr/preamble.tcl +3 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_detailed_route.tcl +7 -2
- siliconcompiler/tools/openroad/scripts/apr/sc_global_route.tcl +8 -4
- siliconcompiler/tools/openroad/scripts/apr/sc_init_floorplan.tcl +9 -5
- siliconcompiler/tools/openroad/scripts/common/write_images.tcl +5 -1
- siliconcompiler/tools/slang/__init__.py +1 -1
- siliconcompiler/tools/slang/elaborate.py +2 -1
- siliconcompiler/tools/vivado/scripts/sc_run.tcl +1 -1
- siliconcompiler/tools/vivado/scripts/sc_syn_fpga.tcl +8 -1
- siliconcompiler/tools/vivado/syn_fpga.py +6 -0
- siliconcompiler/tools/vivado/vivado.py +35 -2
- siliconcompiler/tools/vpr/__init__.py +150 -0
- siliconcompiler/tools/yosys/__init__.py +369 -1
- siliconcompiler/tools/yosys/scripts/procs.tcl +0 -1
- siliconcompiler/toolscripts/_tools.json +5 -10
- siliconcompiler/utils/__init__.py +66 -0
- siliconcompiler/utils/flowgraph.py +2 -2
- siliconcompiler/utils/issue.py +2 -1
- siliconcompiler/utils/logging.py +14 -0
- siliconcompiler/utils/multiprocessing.py +256 -0
- siliconcompiler/utils/showtools.py +10 -0
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/METADATA +6 -6
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/RECORD +122 -115
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/entry_points.txt +3 -0
- siliconcompiler/schema/cmdlineschema.py +0 -250
- siliconcompiler/schema/packageschema.py +0 -101
- siliconcompiler/toolscripts/rhel8/install-slang.sh +0 -40
- siliconcompiler/toolscripts/rhel9/install-slang.sh +0 -40
- siliconcompiler/toolscripts/ubuntu20/install-slang.sh +0 -47
- siliconcompiler/toolscripts/ubuntu22/install-slang.sh +0 -37
- siliconcompiler/toolscripts/ubuntu24/install-slang.sh +0 -37
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/WHEEL +0 -0
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/licenses/LICENSE +0 -0
- {siliconcompiler-0.34.1.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
|
-
|
|
27
|
-
|
|
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
|
-
|
|
37
|
-
|
|
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
|
-
|
|
42
|
-
|
|
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
|
-
|
|
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
|
|
55
|
-
|
|
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
|
-
|
|
71
|
+
# Display the main metrics table
|
|
64
72
|
components.metrics_viewer(metric_dataframe, metric_to_metric_unit_map)
|
|
65
73
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
sac.TabsItem(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
57
|
-
|
|
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
|
-
|
|
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
|
|
70
|
-
|
|
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
|
-
|
|
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
|
|
99
|
-
|
|
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
|
-
|
|
101
|
+
elif tab_selected == "Manifest":
|
|
103
102
|
components.manifest_viewer(chip)
|
|
104
103
|
|
|
105
|
-
|
|
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
|
-
|
|
110
|
+
elif tab_selected == "Design Preview":
|
|
112
111
|
components.file_viewer(chip, f'{chip.getworkdir()}/{chip.design}.png')
|
|
113
112
|
|
|
114
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
sac.TabsItem(
|
|
28
|
-
|
|
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
|
-
#
|
|
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
|
-
|
|
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
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
|
67
|
-
|
|
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
|
-
|
|
77
|
+
# Display the main metrics table
|
|
76
78
|
components.metrics_viewer(metric_dataframe, metric_to_metric_unit_map)
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
|
92
|
-
|
|
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
|
-
|
|
97
|
+
elif tab_selected == "Manifest":
|
|
96
98
|
components.manifest_viewer(chip)
|
|
97
99
|
|
|
98
|
-
|
|
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
|
-
|
|
106
|
+
elif tab_selected == "Design Preview":
|
|
105
107
|
components.file_viewer(chip, f'{chip.getworkdir()}/{chip.design}.png')
|
|
106
108
|
|
|
107
|
-
|
|
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()
|