Skip to content

Commit

Permalink
Ascent Lint: Fix parameter passing
Browse files Browse the repository at this point in the history
Parameters in Ascent Lint need to be passed to the `elaborate` command,
not through the file list.
  • Loading branch information
imphil authored and olofk committed May 8, 2019
1 parent 1d9d71c commit 3faaeae
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
4 changes: 3 additions & 1 deletion edalize/ascentlint.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class Ascentlint(Edatool):
def configure_main(self):
(src_files, incdirs) = self._get_fileset_files(force_slash=True)

self._write_fileset_to_f_file(os.path.join(self.work_root, 'sources.f'))
self._write_fileset_to_f_file(os.path.join(self.work_root, 'sources.f'),
include_vlogparams = False)

tcl_source_files = [f for f in src_files if f.file_type == 'tclSource']
waiver_files = [f for f in src_files if f.file_type == 'waiver']
Expand All @@ -32,6 +33,7 @@ def configure_main(self):
'tcl_source_files' : tcl_source_files,
'waiver_files' : waiver_files,
'toplevel' : self.toplevel,
'vlogparam' : self.vlogparam,
}

self.render_template('run-ascentlint.tcl.j2',
Expand Down
9 changes: 5 additions & 4 deletions edalize/edatool.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def _run_tool(self, cmd, args=[]):
_s = "'{}' exited with an error code"
raise RuntimeError(_s.format(cmd))

def _write_fileset_to_f_file(self, output_file):
def _write_fileset_to_f_file(self, output_file, include_vlogparams = True):
""" Write a file list (*.f) file
Returns a list of all files which were not added to the *.f file
Expand All @@ -309,9 +309,10 @@ def _write_fileset_to_f_file(self, output_file):
define_str = self._param_value_str(param_value = value)
f.write('+define+{}={}\n'.format(key, define_str))

for key, value in self.vlogparam.items():
param_str = self._param_value_str(param_value = value, str_quote_style = '"')
f.write('+parameter+{}.{}={}\n'.format(self.toplevel, key, param_str))
if include_vlogparams:
for key, value in self.vlogparam.items():
param_str = self._param_value_str(param_value = value, str_quote_style = '"')
f.write('+parameter+{}.{}={}\n'.format(self.toplevel, key, param_str))

for id in incdirs:
f.write("+incdir+" + id + '\n')
Expand Down
4 changes: 3 additions & 1 deletion edalize/templates/ascentlint/run-ascentlint.tcl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ source {{ waiver_file.name }}
{% endfor %}

analyze -f sources.f
elaborate {{ toplevel }}
elaborate {% if vlogparam -%}
-params { {% for k, v in vlogparam.items() %}{ {{ k }} {{ v|param_value_str(str_quote_style = '"') }} } {% endfor -%} }
{%- endif%} {{ toplevel }}
report_policy -skip_empty_summary_status -compat -output ascentlint.rpt NEW
exit
3 changes: 2 additions & 1 deletion edalize/vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class Vcs(Edatool):
argtypes = ['plusarg', 'vlogdefine', 'vlogparam']

def configure_main(self):
self._write_fileset_to_f_file(os.path.join(self.work_root, self.name + '.scr'))
self._write_fileset_to_f_file(os.path.join(self.work_root, self.name + '.scr'),
include_vlogparams = True)

plusargs = []
if self.plusarg:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ascentlint/defaults/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ report-violations: ascentlint.log
@(egrep -q "(Found [0-9]+ info lint violations|No lint violations found)" \
ascentlint.log && echo "***PASSED***") || \
(echo "***ERROR*** Lint run found new errors or warnings." \
"Please check ascentlint.rpt" && exit 1)
"Please check ascentlint.rpt" && exit 1)
4 changes: 2 additions & 2 deletions tests/test_ascentlint/defaults/run-ascentlint.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ source tcl_file.tcl


analyze -f sources.f
elaborate top_module
elaborate -params { { vlogparam_bool 1 } { vlogparam_int 42 } { vlogparam_str "hello" } } top_module
report_policy -skip_empty_summary_status -compat -output ascentlint.rpt NEW
exit
exit
3 changes: 0 additions & 3 deletions tests/test_ascentlint/defaults/sources.f
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
+define+vlogdefine_bool=1
+define+vlogdefine_int=42
+define+vlogdefine_str=hello
+parameter+top_module.vlogparam_bool=1
+parameter+top_module.vlogparam_int=42
+parameter+top_module.vlogparam_str="hello"
+incdir+.
sv_file.sv
vlog_file.v
Expand Down

0 comments on commit 3faaeae

Please sign in to comment.