siliconcompiler 0.31.1__py3-none-any.whl → 0.32.1__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/_metadata.py +1 -1
- siliconcompiler/apps/_common.py +23 -6
- siliconcompiler/apps/sc.py +1 -0
- siliconcompiler/apps/sc_dashboard.py +7 -1
- siliconcompiler/apps/sc_show.py +6 -0
- siliconcompiler/apps/utils/summarize.py +1 -1
- siliconcompiler/core.py +37 -42
- siliconcompiler/flows/_common.py +10 -4
- siliconcompiler/fpgas/lattice_ice40.py +6 -16
- siliconcompiler/package/__init__.py +18 -61
- siliconcompiler/package/git.py +4 -1
- siliconcompiler/package/github.py +124 -0
- siliconcompiler/package/https.py +12 -2
- siliconcompiler/report/dashboard/components/__init__.py +18 -7
- siliconcompiler/report/dashboard/components/flowgraph.py +3 -0
- siliconcompiler/report/dashboard/utils/__init__.py +5 -2
- siliconcompiler/report/report.py +6 -6
- siliconcompiler/report/utils.py +3 -0
- siliconcompiler/scheduler/run_node.py +4 -1
- siliconcompiler/schema/schema_obj.py +3 -2
- siliconcompiler/schema/utils.py +0 -3
- siliconcompiler/targets/fpgaflow_demo.py +0 -2
- siliconcompiler/tools/openroad/_apr.py +15 -5
- siliconcompiler/tools/openroad/scripts/common/reports.tcl +10 -0
- siliconcompiler/tools/openroad/scripts/common/write_images.tcl +27 -0
- siliconcompiler/tools/slang/__init__.py +123 -33
- siliconcompiler/tools/slang/elaborate.py +123 -18
- siliconcompiler/tools/slang/lint.py +20 -10
- siliconcompiler/tools/surelog/__init__.py +17 -4
- siliconcompiler/toolscripts/_tools.json +3 -3
- siliconcompiler/toolscripts/ubuntu24/install-icarus.sh +2 -1
- siliconcompiler/toolscripts/ubuntu24/install-netgen.sh +1 -1
- siliconcompiler/units.py +10 -7
- siliconcompiler/use.py +5 -2
- siliconcompiler/utils/__init__.py +5 -14
- {siliconcompiler-0.31.1.dist-info → siliconcompiler-0.32.1.dist-info}/METADATA +3 -6
- {siliconcompiler-0.31.1.dist-info → siliconcompiler-0.32.1.dist-info}/RECORD +41 -45
- {siliconcompiler-0.31.1.dist-info → siliconcompiler-0.32.1.dist-info}/WHEEL +1 -1
- {siliconcompiler-0.31.1.dist-info → siliconcompiler-0.32.1.dist-info}/entry_points.txt +1 -0
- siliconcompiler/fpgas/vpr_example.py +0 -116
- siliconcompiler/toolscripts/rhel8/install-ghdl.sh +0 -25
- siliconcompiler/toolscripts/rhel8/install-yosys-moosic.sh +0 -17
- siliconcompiler/toolscripts/rhel8/install-yosys-slang.sh +0 -22
- siliconcompiler/toolscripts/rhel8/install-yosys.sh +0 -23
- {siliconcompiler-0.31.1.dist-info → siliconcompiler-0.32.1.dist-info}/LICENSE +0 -0
- {siliconcompiler-0.31.1.dist-info → siliconcompiler-0.32.1.dist-info}/top_level.txt +0 -0
|
@@ -24,8 +24,9 @@ def make_node_to_step_index_map(chip, metric_dataframe):
|
|
|
24
24
|
nodes of the selected chip
|
|
25
25
|
'''
|
|
26
26
|
node_to_step_index_map = {}
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
if chip.get('option', 'flow'):
|
|
28
|
+
for step, index in _get_flowgraph_nodes(chip, chip.get('option', 'flow')):
|
|
29
|
+
node_to_step_index_map[f'{step}{index}'] = (step, index)
|
|
29
30
|
|
|
30
31
|
# concatenate step and index
|
|
31
32
|
metric_dataframe.columns = metric_dataframe.columns.map(lambda x: f'{x[0]}{x[1]}')
|
|
@@ -54,6 +55,8 @@ def make_metric_to_metric_unit_map(metric_dataframe):
|
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
def is_running(chip):
|
|
58
|
+
if not chip.get('option', 'flow'):
|
|
59
|
+
return False
|
|
57
60
|
for step, index in _get_flowgraph_nodes(chip, chip.get('option', 'flow')):
|
|
58
61
|
state = chip.get('record', 'status', step=step, index=index)
|
|
59
62
|
if not NodeStatus.is_done(state):
|
siliconcompiler/report/report.py
CHANGED
|
@@ -302,20 +302,20 @@ def get_metrics_source(chip, step, index):
|
|
|
302
302
|
index (string) : Index of node.
|
|
303
303
|
'''
|
|
304
304
|
file_to_metric = {}
|
|
305
|
+
metric_primary_source = {}
|
|
305
306
|
tool, task = get_tool_task(chip, step, index)
|
|
306
307
|
if not chip.valid('tool', tool, 'task', task, 'report'):
|
|
307
|
-
return file_to_metric
|
|
308
|
+
return metric_primary_source, file_to_metric
|
|
308
309
|
|
|
309
310
|
metrics = chip.getkeys('tool', tool, 'task', task, 'report')
|
|
310
311
|
|
|
311
312
|
for metric in metrics:
|
|
312
313
|
sources = chip.get('tool', tool, 'task', task, 'report', metric, step=step, index=index)
|
|
314
|
+
if sources:
|
|
315
|
+
metric_primary_source.setdefault(sources[0], []).append(metric)
|
|
313
316
|
for source in sources:
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
else:
|
|
317
|
-
file_to_metric[source] = [metric]
|
|
318
|
-
return file_to_metric
|
|
317
|
+
file_to_metric.setdefault(source, []).append(metric)
|
|
318
|
+
return metric_primary_source, file_to_metric
|
|
319
319
|
|
|
320
320
|
|
|
321
321
|
def get_files(chip, step, index):
|
siliconcompiler/report/utils.py
CHANGED
|
@@ -40,6 +40,9 @@ def _find_summary_metrics(chip, metrics_map):
|
|
|
40
40
|
def _collect_data(chip, flow=None, flowgraph_nodes=None, format_as_string=True):
|
|
41
41
|
if not flow:
|
|
42
42
|
flow = chip.get('option', 'flow')
|
|
43
|
+
if not flow:
|
|
44
|
+
return [], {}, {}, {}, [], {}
|
|
45
|
+
|
|
43
46
|
if not flowgraph_nodes:
|
|
44
47
|
flowgraph_nodes = nodes_to_execute(chip)
|
|
45
48
|
# only report tool based steps functions
|
|
@@ -45,6 +45,9 @@ def main():
|
|
|
45
45
|
metavar='<package>:<directory>',
|
|
46
46
|
nargs='+',
|
|
47
47
|
help='Map of caches to prepopulate runner with')
|
|
48
|
+
parser.add_argument('-fetch_cache',
|
|
49
|
+
action='store_true',
|
|
50
|
+
help='Allow for cache downloads')
|
|
48
51
|
parser.add_argument('-step',
|
|
49
52
|
required=True,
|
|
50
53
|
metavar='<step>',
|
|
@@ -105,7 +108,7 @@ def main():
|
|
|
105
108
|
|
|
106
109
|
# Populate cache
|
|
107
110
|
for package in chip.getkeys('package', 'source'):
|
|
108
|
-
sc_path(chip, package)
|
|
111
|
+
sc_path(chip, package, fetch=args.fetch_cache)
|
|
109
112
|
|
|
110
113
|
# Run the task.
|
|
111
114
|
error = True
|
|
@@ -39,7 +39,7 @@ except ImportError:
|
|
|
39
39
|
_has_yaml = False
|
|
40
40
|
|
|
41
41
|
from .schema_cfg import schema_cfg
|
|
42
|
-
from .utils import escape_val_tcl,
|
|
42
|
+
from .utils import escape_val_tcl, translate_loglevel, PerNode, Scope
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
class Schema:
|
|
@@ -1122,7 +1122,8 @@ class Schema:
|
|
|
1122
1122
|
|
|
1123
1123
|
if template:
|
|
1124
1124
|
fout.write(template.render(manifest_dict='\n'.join(tcl_set_cmds),
|
|
1125
|
-
scroot=os.path.abspath(
|
|
1125
|
+
scroot=os.path.abspath(
|
|
1126
|
+
os.path.join(os.path.dirname(__file__), '..')),
|
|
1126
1127
|
record_access=self._do_record_access(),
|
|
1127
1128
|
record_access_id=Schema._RECORD_ACCESS_IDENTIFIER))
|
|
1128
1129
|
else:
|
siliconcompiler/schema/utils.py
CHANGED
|
@@ -4,13 +4,10 @@
|
|
|
4
4
|
# SC dependencies outside of its directory, since it may be used by tool drivers
|
|
5
5
|
# that have isolated Python environments.
|
|
6
6
|
|
|
7
|
-
import os
|
|
8
7
|
import re
|
|
9
8
|
import sys
|
|
10
9
|
from enum import Enum
|
|
11
10
|
|
|
12
|
-
PACKAGE_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
|
|
13
|
-
|
|
14
11
|
|
|
15
12
|
#############################################################################
|
|
16
13
|
# ENUM DEFINITIONs
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import siliconcompiler
|
|
2
2
|
from siliconcompiler import SiliconCompilerError
|
|
3
3
|
from siliconcompiler.fpgas import lattice_ice40
|
|
4
|
-
from siliconcompiler.fpgas import vpr_example
|
|
5
4
|
|
|
6
5
|
from siliconcompiler.flows import fpgaflow
|
|
7
6
|
|
|
@@ -30,7 +29,6 @@ def setup(chip, partname=None):
|
|
|
30
29
|
|
|
31
30
|
# 2. Load all available FPGAs
|
|
32
31
|
chip.use(lattice_ice40)
|
|
33
|
-
chip.use(vpr_example)
|
|
34
32
|
|
|
35
33
|
# 3. Load flow
|
|
36
34
|
chip.use(fpgaflow, partname=partname)
|
|
@@ -84,12 +84,16 @@ def extract_metrics(chip):
|
|
|
84
84
|
metric_reports = {
|
|
85
85
|
"setuptns": [
|
|
86
86
|
"timing/total_negative_slack.rpt",
|
|
87
|
-
"timing/setup.rpt"
|
|
87
|
+
"timing/setup.rpt",
|
|
88
|
+
"timing/setup.histogram.rpt",
|
|
89
|
+
"images/timing/setup.histogram.png"
|
|
88
90
|
],
|
|
89
91
|
"setupslack": [
|
|
90
92
|
"timing/worst_slack.setup.rpt",
|
|
91
93
|
"timing/setup.rpt",
|
|
92
|
-
"timing/setup.topN.rpt"
|
|
94
|
+
"timing/setup.topN.rpt",
|
|
95
|
+
"timing/setup.histogram.rpt",
|
|
96
|
+
"images/timing/setup.histogram.png"
|
|
93
97
|
],
|
|
94
98
|
"setupskew": [
|
|
95
99
|
"timing/skew.setup.rpt",
|
|
@@ -99,12 +103,16 @@ def extract_metrics(chip):
|
|
|
99
103
|
],
|
|
100
104
|
"setuppaths": [
|
|
101
105
|
"timing/setup.rpt",
|
|
102
|
-
"timing/setup.topN.rpt"
|
|
106
|
+
"timing/setup.topN.rpt",
|
|
107
|
+
"timing/setup.histogram.rpt",
|
|
108
|
+
"images/timing/setup.histogram.png"
|
|
103
109
|
],
|
|
104
110
|
"holdslack": [
|
|
105
111
|
"timing/worst_slack.hold.rpt",
|
|
106
112
|
"timing/hold.rpt",
|
|
107
|
-
"timing/hold.topN.rpt"
|
|
113
|
+
"timing/hold.topN.rpt",
|
|
114
|
+
"timing/hold.histogram.rpt",
|
|
115
|
+
"images/timing/hold.histogram.png"
|
|
108
116
|
],
|
|
109
117
|
"holdskew": [
|
|
110
118
|
"timing/skew.hold.rpt",
|
|
@@ -114,7 +122,9 @@ def extract_metrics(chip):
|
|
|
114
122
|
],
|
|
115
123
|
"holdpaths": [
|
|
116
124
|
"timing/hold.rpt",
|
|
117
|
-
"timing/hold.topN.rpt"
|
|
125
|
+
"timing/hold.topN.rpt",
|
|
126
|
+
"timing/hold.histogram.rpt",
|
|
127
|
+
"images/timing/hold.histogram.png"
|
|
118
128
|
],
|
|
119
129
|
"unconstrained": [
|
|
120
130
|
"timing/unconstrained.rpt",
|
|
@@ -27,6 +27,11 @@ if { [sc_cfg_tool_task_check_in_list setup var reports] } {
|
|
|
27
27
|
tee -file reports/timing/total_negative_slack.rpt \
|
|
28
28
|
"report_tns"
|
|
29
29
|
report_tns_metric -setup
|
|
30
|
+
|
|
31
|
+
if { [sc_check_version 19519] } {
|
|
32
|
+
tee -quiet -file reports/timing/setup.histogram.rpt \
|
|
33
|
+
"report_timing_histogram -num_bins 20 -setup"
|
|
34
|
+
}
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
if { [sc_cfg_tool_task_check_in_list hold var reports] } {
|
|
@@ -42,6 +47,11 @@ if { [sc_cfg_tool_task_check_in_list hold var reports] } {
|
|
|
42
47
|
report_worst_slack_metric -hold
|
|
43
48
|
|
|
44
49
|
report_tns_metric -hold
|
|
50
|
+
|
|
51
|
+
if { [sc_check_version 19519] } {
|
|
52
|
+
tee -quiet -file reports/timing/hold.histogram.rpt \
|
|
53
|
+
"report_timing_histogram -num_bins 20 -hold"
|
|
54
|
+
}
|
|
45
55
|
}
|
|
46
56
|
|
|
47
57
|
if { [sc_cfg_tool_task_check_in_list unconstrained var reports] } {
|
|
@@ -304,6 +304,30 @@ proc sc_image_clocktree { } {
|
|
|
304
304
|
gui::hide_widget "Clock Tree Viewer"
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
+
proc sc_image_timing_histograms { } {
|
|
308
|
+
if { ![sc_check_version 19526] } {
|
|
309
|
+
return
|
|
310
|
+
}
|
|
311
|
+
file mkdir reports/images/timing
|
|
312
|
+
|
|
313
|
+
if { [sc_cfg_tool_task_check_in_list setup var reports] } {
|
|
314
|
+
set path reports/images/timing/setup.histogram.png
|
|
315
|
+
utl::info FLW 1 "Saving setup timing histogram to $path"
|
|
316
|
+
save_histogram_image $path \
|
|
317
|
+
-mode setup \
|
|
318
|
+
-width 500 \
|
|
319
|
+
-height 500
|
|
320
|
+
}
|
|
321
|
+
if { [sc_cfg_tool_task_check_in_list hold var reports] } {
|
|
322
|
+
set path reports/images/timing/hold.histogram.png
|
|
323
|
+
utl::info FLW 1 "Saving hold timing histogram to $path"
|
|
324
|
+
save_histogram_image $path \
|
|
325
|
+
-mode hold \
|
|
326
|
+
-width 500 \
|
|
327
|
+
-height 500
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
307
331
|
proc sc_image_optimizer { } {
|
|
308
332
|
global sc_design
|
|
309
333
|
sc_image_setup_default
|
|
@@ -390,6 +414,9 @@ if { [sc_cfg_tool_task_check_in_list module_view var reports] } {
|
|
|
390
414
|
# Markers
|
|
391
415
|
sc_image_markers
|
|
392
416
|
|
|
417
|
+
# Histograms
|
|
418
|
+
sc_image_timing_histograms
|
|
419
|
+
|
|
393
420
|
# Heatmaps
|
|
394
421
|
if { [sc_cfg_tool_task_check_in_list placement_density var reports] } {
|
|
395
422
|
sc_image_placement_density
|
|
@@ -10,55 +10,56 @@ Sources: https://github.com/MikePopoloski/slang
|
|
|
10
10
|
|
|
11
11
|
Installation: https://sv-lang.com/building.html
|
|
12
12
|
'''
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import os
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
import pyslang
|
|
17
|
+
except ModuleNotFoundError:
|
|
18
|
+
pyslang = None
|
|
19
|
+
|
|
16
20
|
from siliconcompiler.tools._common import \
|
|
17
|
-
get_frontend_options, get_input_files,
|
|
21
|
+
add_require_input, add_frontend_requires, get_frontend_options, get_input_files, \
|
|
22
|
+
get_tool_task, record_metric
|
|
18
23
|
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
################################
|
|
23
|
-
def setup(chip):
|
|
24
|
-
tool = 'slang'
|
|
25
|
+
def has_pyslang():
|
|
26
|
+
return pyslang is not None
|
|
25
27
|
|
|
26
|
-
# Standard Setup
|
|
27
|
-
chip.set('tool', tool, 'exe', 'slang')
|
|
28
|
-
chip.set('tool', tool, 'vswitch', '--version')
|
|
29
|
-
chip.set('tool', tool, 'version', '>=6.0', clobber=False)
|
|
30
28
|
|
|
29
|
+
def test_version():
|
|
30
|
+
if not has_pyslang():
|
|
31
|
+
return "pyslang is not installed"
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
version = pyslang.VersionInfo
|
|
34
|
+
if version.getMajor() >= 7 and version.getMinor() >= 0:
|
|
35
|
+
return None
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
return stdout.strip().split()[-1].split('+')[0]
|
|
37
|
+
ver = f"{version.getMajor()}.{version.getMinor()}.{version.getPatch()}"
|
|
38
38
|
|
|
39
|
+
return f"incorrect pyslang version: {ver}"
|
|
39
40
|
|
|
40
|
-
def post_process(chip):
|
|
41
|
-
step = chip.get('arg', 'step')
|
|
42
|
-
index = chip.get('arg', 'index')
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
################################
|
|
43
|
+
# Setup Tool (pre executable)
|
|
44
|
+
################################
|
|
45
|
+
def setup(chip):
|
|
46
|
+
add_require_input(chip, 'input', 'rtl', 'verilog')
|
|
47
|
+
add_require_input(chip, 'input', 'rtl', 'systemverilog')
|
|
48
|
+
add_require_input(chip, 'input', 'cmdfile', 'f')
|
|
49
|
+
add_frontend_requires(chip, ['ydir', 'idir', 'vlib', 'libext', 'define', 'param'])
|
|
51
50
|
|
|
52
51
|
|
|
53
52
|
def common_runtime_options(chip):
|
|
54
|
-
options = []
|
|
55
|
-
|
|
56
53
|
step = chip.get('arg', 'step')
|
|
57
54
|
index = chip.get('arg', 'index')
|
|
58
55
|
tool, task = get_tool_task(chip, step, index)
|
|
59
56
|
|
|
60
|
-
options
|
|
61
|
-
|
|
57
|
+
options = chip.get('tool', tool, 'task', task, 'option', step=step, index=index)
|
|
58
|
+
|
|
59
|
+
options.append('--single-unit')
|
|
60
|
+
|
|
61
|
+
options.extend(['--threads', str(chip.get('tool', tool, 'task', task, 'threads',
|
|
62
|
+
step=step, index=index))])
|
|
62
63
|
|
|
63
64
|
opts = get_frontend_options(chip,
|
|
64
65
|
['ydir',
|
|
@@ -113,7 +114,7 @@ def common_runtime_options(chip):
|
|
|
113
114
|
#######################
|
|
114
115
|
# Top Module
|
|
115
116
|
#######################
|
|
116
|
-
options.append('--top ' + chip.top())
|
|
117
|
+
options.append('--top ' + chip.top(step, index))
|
|
117
118
|
|
|
118
119
|
###############################
|
|
119
120
|
# Parameters (top module only)
|
|
@@ -124,3 +125,92 @@ def common_runtime_options(chip):
|
|
|
124
125
|
options.append(f'-G {param}={value}')
|
|
125
126
|
|
|
126
127
|
return options
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def _get_driver(chip, options_func, ignored_diagnotics=None):
|
|
131
|
+
driver = pyslang.Driver()
|
|
132
|
+
driver.addStandardArgs()
|
|
133
|
+
|
|
134
|
+
options = options_func(chip)
|
|
135
|
+
|
|
136
|
+
parseOpts = pyslang.CommandLineOptions()
|
|
137
|
+
parseOpts.ignoreProgramName = True
|
|
138
|
+
opts = " ".join(options)
|
|
139
|
+
code = 0
|
|
140
|
+
if not driver.parseCommandLine(opts, parseOpts):
|
|
141
|
+
code = 1
|
|
142
|
+
|
|
143
|
+
if code == 0 and not driver.processOptions():
|
|
144
|
+
code = 2
|
|
145
|
+
|
|
146
|
+
step = chip.get('arg', 'step')
|
|
147
|
+
index = chip.get('arg', 'index')
|
|
148
|
+
tool, task = get_tool_task(chip, step, index)
|
|
149
|
+
for warning in chip.get('tool', tool, 'task', task, 'warningoff', step=step, index=index):
|
|
150
|
+
if hasattr(pyslang.Diags, warning):
|
|
151
|
+
driver.diagEngine.setSeverity(
|
|
152
|
+
getattr(pyslang.Diags, warning),
|
|
153
|
+
pyslang.DiagnosticSeverity.Ignored)
|
|
154
|
+
elif not chip.get('option', 'quiet', step=step, index=index):
|
|
155
|
+
chip.logger.warning(f'{warning} is not a valid slang category')
|
|
156
|
+
|
|
157
|
+
if not ignored_diagnotics:
|
|
158
|
+
ignored_diagnotics = []
|
|
159
|
+
for ignore in ignored_diagnotics:
|
|
160
|
+
driver.diagEngine.setSeverity(
|
|
161
|
+
ignore,
|
|
162
|
+
pyslang.DiagnosticSeverity.Ignored)
|
|
163
|
+
|
|
164
|
+
return driver, code
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def _compile(chip, driver):
|
|
168
|
+
ok = driver.parseAllSources()
|
|
169
|
+
compilation = driver.createCompilation()
|
|
170
|
+
return compilation, ok
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _diagnostics(chip, driver, compilation):
|
|
174
|
+
step = chip.get('arg', 'step')
|
|
175
|
+
index = chip.get('arg', 'index')
|
|
176
|
+
|
|
177
|
+
report = {
|
|
178
|
+
"error": [],
|
|
179
|
+
"warning": [],
|
|
180
|
+
}
|
|
181
|
+
diags = driver.diagEngine
|
|
182
|
+
for diag in compilation.getAllDiagnostics():
|
|
183
|
+
severity = diags.getSeverity(diag.code, diag.location)
|
|
184
|
+
report_level = None
|
|
185
|
+
if severity == pyslang.DiagnosticSeverity.Warning:
|
|
186
|
+
report_level = "warning"
|
|
187
|
+
elif severity == pyslang.DiagnosticSeverity.Error:
|
|
188
|
+
report_level = "error"
|
|
189
|
+
elif severity == pyslang.DiagnosticSeverity.Fatal:
|
|
190
|
+
report_level = "error"
|
|
191
|
+
|
|
192
|
+
if report_level:
|
|
193
|
+
for n, line in enumerate(diags.reportAll(driver.sourceManager, [diag]).splitlines()):
|
|
194
|
+
if line.strip():
|
|
195
|
+
if n == 0:
|
|
196
|
+
line_parts = line.split(":")
|
|
197
|
+
if os.path.exists(line_parts[0]):
|
|
198
|
+
line_parts[0] = os.path.abspath(line_parts[0])
|
|
199
|
+
line = ":".join(line_parts)
|
|
200
|
+
|
|
201
|
+
report[report_level].append(line)
|
|
202
|
+
|
|
203
|
+
if not chip.get('option', 'quiet', step=step, index=index):
|
|
204
|
+
if report["warning"]:
|
|
205
|
+
for line in report["warning"]:
|
|
206
|
+
chip.logger.warning(line)
|
|
207
|
+
if report["error"]:
|
|
208
|
+
for line in report["error"]:
|
|
209
|
+
chip.logger.error(line)
|
|
210
|
+
|
|
211
|
+
diags.clearCounts()
|
|
212
|
+
for diag in compilation.getAllDiagnostics():
|
|
213
|
+
diags.issue(diag)
|
|
214
|
+
|
|
215
|
+
record_metric(chip, step, index, 'errors', diags.numErrors, [])
|
|
216
|
+
record_metric(chip, step, index, 'warnings', diags.numWarnings, [])
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
from siliconcompiler import utils
|
|
2
2
|
from siliconcompiler.tools import slang
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import os
|
|
4
|
+
from siliconcompiler.tools._common import get_tool_task, has_input_files
|
|
5
|
+
from siliconcompiler.tools.slang import pyslang
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def setup(chip):
|
|
8
9
|
'''
|
|
9
10
|
Elaborate verilog design files and generate a unified file.
|
|
10
11
|
'''
|
|
12
|
+
if slang.test_version():
|
|
13
|
+
return slang.test_version()
|
|
14
|
+
|
|
15
|
+
if not has_input_files(chip, 'input', 'rtl', 'verilog') and \
|
|
16
|
+
not has_input_files(chip, 'input', 'rtl', 'systemverilog'):
|
|
17
|
+
return "no files in [input,rtl,systemverilog] or [input,rtl,verilog]"
|
|
18
|
+
|
|
11
19
|
slang.setup(chip)
|
|
12
20
|
|
|
13
21
|
step = chip.get('arg', 'step')
|
|
@@ -17,30 +25,127 @@ def setup(chip):
|
|
|
17
25
|
chip.set('tool', tool, 'task', task, 'threads', utils.get_cores(chip),
|
|
18
26
|
clobber=False, step=step, index=index)
|
|
19
27
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
add_frontend_requires(chip, ['ydir', 'idir', 'vlib', 'libext', 'define', 'param'])
|
|
23
|
-
|
|
24
|
-
chip.set('tool', tool, 'task', task, 'stdout', 'destination', 'output', step=step, index=index)
|
|
25
|
-
chip.set('tool', tool, 'task', task, 'stdout', 'suffix', 'v', step=step, index=index)
|
|
28
|
+
chip.set('tool', tool, 'task', task, 'stdout', 'destination', 'log', step=step, index=index)
|
|
29
|
+
chip.set('tool', tool, 'task', task, 'stderr', 'destination', 'log', step=step, index=index)
|
|
26
30
|
|
|
27
31
|
chip.set('tool', tool, 'task', task, 'output', __outputfile(chip), step=step, index=index)
|
|
28
32
|
|
|
33
|
+
chip.set('tool', tool, 'task', task, 'var', 'include_source_paths', True,
|
|
34
|
+
step=step, index=index, clobber=False)
|
|
35
|
+
chip.set('tool', tool, 'task', task, 'var', 'include_source_paths',
|
|
36
|
+
"true/false, if true add the source file path information", field="help")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def __outputfile(chip):
|
|
40
|
+
is_systemverilog = has_input_files(chip, 'input', 'rtl', 'systemverilog')
|
|
41
|
+
if is_systemverilog:
|
|
42
|
+
return f'{chip.top()}.sv'
|
|
43
|
+
return f'{chip.top()}.v'
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __get_files(manager, tree):
|
|
47
|
+
files = set()
|
|
48
|
+
|
|
49
|
+
from queue import Queue
|
|
50
|
+
nodes = Queue(maxsize=0)
|
|
51
|
+
nodes.put(tree.root)
|
|
52
|
+
|
|
53
|
+
def procRange(range):
|
|
54
|
+
files.add(manager.getFileName(range.start))
|
|
55
|
+
files.add(manager.getFileName(range.end))
|
|
56
|
+
|
|
57
|
+
while not nodes.empty():
|
|
58
|
+
node = nodes.get()
|
|
59
|
+
procRange(node.sourceRange)
|
|
60
|
+
for token in node:
|
|
61
|
+
if isinstance(token, pyslang.Token):
|
|
62
|
+
procRange(token.range)
|
|
63
|
+
else:
|
|
64
|
+
nodes.put(token)
|
|
65
|
+
|
|
66
|
+
return sorted([os.path.abspath(f) for f in files if os.path.isfile(f)])
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def run(chip):
|
|
70
|
+
# Override default errors
|
|
71
|
+
ignored = [
|
|
72
|
+
pyslang.Diags.MissingTimeScale,
|
|
73
|
+
pyslang.Diags.UsedBeforeDeclared,
|
|
74
|
+
pyslang.Diags.UnusedParameter,
|
|
75
|
+
pyslang.Diags.UnusedDefinition,
|
|
76
|
+
pyslang.Diags.UnusedVariable,
|
|
77
|
+
pyslang.Diags.UnusedPort,
|
|
78
|
+
pyslang.Diags.UnusedButSetNet,
|
|
79
|
+
pyslang.Diags.UnusedImplicitNet,
|
|
80
|
+
pyslang.Diags.UnusedButSetVariable,
|
|
81
|
+
pyslang.Diags.UnusedButSetPort,
|
|
82
|
+
pyslang.Diags.UnusedTypedef,
|
|
83
|
+
pyslang.Diags.UnusedGenvar,
|
|
84
|
+
pyslang.Diags.UnusedAssertionDecl
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
driver, exitcode = slang._get_driver(
|
|
88
|
+
chip,
|
|
89
|
+
runtime_options,
|
|
90
|
+
ignored_diagnotics=ignored)
|
|
91
|
+
if exitcode:
|
|
92
|
+
return exitcode
|
|
93
|
+
|
|
94
|
+
compilation, ok = slang._compile(chip, driver)
|
|
95
|
+
|
|
96
|
+
slang._diagnostics(chip, driver, compilation)
|
|
97
|
+
|
|
98
|
+
manager = compilation.sourceManager
|
|
99
|
+
|
|
100
|
+
step = chip.get('arg', 'step')
|
|
101
|
+
index = chip.get('arg', 'index')
|
|
102
|
+
tool, task = get_tool_task(chip, step, index)
|
|
103
|
+
add_source = chip.get('tool', tool, 'task', task, 'var', 'include_source_paths',
|
|
104
|
+
step=step, index=index)[0] == 'true'
|
|
105
|
+
|
|
106
|
+
def printFiles(out, files):
|
|
107
|
+
for src_file in files:
|
|
108
|
+
out.write(f'// File: {src_file}\n')
|
|
109
|
+
|
|
110
|
+
with open(f'outputs/{__outputfile(chip)}', 'w') as out:
|
|
111
|
+
for tree in compilation.getSyntaxTrees():
|
|
112
|
+
files = []
|
|
113
|
+
if add_source:
|
|
114
|
+
files = __get_files(manager, tree)
|
|
115
|
+
|
|
116
|
+
writer = pyslang.SyntaxPrinter(manager)
|
|
117
|
+
|
|
118
|
+
writer.setIncludeMissing(False)
|
|
119
|
+
writer.setIncludeSkipped(False)
|
|
120
|
+
writer.setIncludeDirectives(False)
|
|
121
|
+
|
|
122
|
+
writer.setIncludePreprocessed(True)
|
|
123
|
+
writer.setIncludeTrivia(True)
|
|
124
|
+
writer.setIncludeComments(True)
|
|
125
|
+
writer.setSquashNewlines(True)
|
|
126
|
+
|
|
127
|
+
out.write("////////////////////////////////////////////////////////////////\n")
|
|
128
|
+
out.write("// Start:\n")
|
|
129
|
+
printFiles(out, files)
|
|
130
|
+
|
|
131
|
+
out.write(writer.print(tree).str() + '\n')
|
|
132
|
+
|
|
133
|
+
out.write("// End:\n")
|
|
134
|
+
printFiles(out, files)
|
|
135
|
+
out.write("////////////////////////////////////////////////////////////////\n")
|
|
136
|
+
|
|
137
|
+
if ok:
|
|
138
|
+
return 0
|
|
139
|
+
else:
|
|
140
|
+
return 1
|
|
141
|
+
|
|
29
142
|
|
|
30
143
|
def runtime_options(chip):
|
|
31
144
|
options = slang.common_runtime_options(chip)
|
|
32
145
|
options.extend([
|
|
33
|
-
"--
|
|
34
|
-
"--comments",
|
|
146
|
+
"--allow-use-before-declare",
|
|
35
147
|
"--ignore-unknown-modules",
|
|
36
|
-
"
|
|
148
|
+
"-Weverything"
|
|
37
149
|
])
|
|
38
150
|
|
|
39
151
|
return options
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def __outputfile(chip):
|
|
43
|
-
is_systemverilog = has_input_files(chip, 'input', 'rtl', 'systemverilog')
|
|
44
|
-
if is_systemverilog:
|
|
45
|
-
return f'{chip.top()}.sv'
|
|
46
|
-
return f'{chip.top()}.v'
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
from siliconcompiler import utils
|
|
2
2
|
from siliconcompiler.tools import slang
|
|
3
|
-
from siliconcompiler.tools._common import
|
|
4
|
-
add_require_input, add_frontend_requires, get_tool_task
|
|
3
|
+
from siliconcompiler.tools._common import get_tool_task
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
def setup(chip):
|
|
8
7
|
'''
|
|
9
8
|
Lint system verilog
|
|
10
9
|
'''
|
|
10
|
+
if slang.test_version():
|
|
11
|
+
return slang.test_version()
|
|
12
|
+
|
|
11
13
|
slang.setup(chip)
|
|
12
14
|
|
|
13
15
|
step = chip.get('arg', 'step')
|
|
@@ -17,19 +19,27 @@ def setup(chip):
|
|
|
17
19
|
chip.set('tool', tool, 'task', task, 'threads', utils.get_cores(chip),
|
|
18
20
|
clobber=False, step=step, index=index)
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
def run(chip):
|
|
24
|
+
driver, exitcode = slang._get_driver(chip, runtime_options)
|
|
25
|
+
if exitcode:
|
|
26
|
+
return exitcode
|
|
27
|
+
|
|
28
|
+
compilation, ok = slang._compile(chip, driver)
|
|
29
|
+
slang._diagnostics(chip, driver, compilation)
|
|
30
|
+
|
|
31
|
+
if ok:
|
|
32
|
+
return 0
|
|
33
|
+
else:
|
|
34
|
+
return 1
|
|
23
35
|
|
|
24
36
|
|
|
25
37
|
def runtime_options(chip):
|
|
26
38
|
options = slang.common_runtime_options(chip)
|
|
27
39
|
options.extend([
|
|
28
|
-
"--lint-only"
|
|
40
|
+
"--lint-only",
|
|
41
|
+
"-Weverything",
|
|
42
|
+
"-Werror"
|
|
29
43
|
])
|
|
30
44
|
|
|
31
45
|
return options
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def post_process(chip):
|
|
35
|
-
slang.post_process(chip)
|