Skip to content

Commit

Permalink
Add GHDL support for generic parameters and deprecate vlogparam support
Browse files Browse the repository at this point in the history
  • Loading branch information
GCHQDeveloper560 authored and olofk committed Jul 20, 2019
1 parent 3ef840b commit 0497185
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
17 changes: 14 additions & 3 deletions edalize/ghdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Ghdl(Edatool):
_description = "GHDL is an open source VHDL simulator, which fully supports IEEE 1076-1987, IEEE 1076-1993, IEE 1076-2002 and partially the 1076-2008 version of VHDL"
tool_options = {'lists' : {'analyze_options' : 'String',
'run_options' : 'String'}}
argtypes = ['vlogparam']
argtypes = ['vlogparam', 'generic']

@classmethod
def get_doc(cls, api_ver):
Expand Down Expand Up @@ -90,9 +90,20 @@ def run_main(self):
cmd = 'make'
args = ['run']

# GHDL doesn't support Verilog, but the backend used vlogparam since
# edalize didn't support generic at the time. Now that generic support
# has been added support for vlogparam is deprecated and will be
# removed in the future. For now support either option.

if self.vlogparam:
logger.warning("GHDL backend support for vlogparam is deprecated and will be removed.\n"+
"Use generic instead."
)

if self.vlogparam or self.generic:
extra_options='EXTRA_OPTIONS='
for k,v in self.vlogparam.items():
extra_options += ' -g{}={}'.format(k,self._param_value_str(v,'"'))
for d in [self.vlogparam, self.generic]:
for k,v in d.items():
extra_options += ' -g{}={}'.format(k,self._param_value_str(v,'"'))
args.append(extra_options)
self._run_tool(cmd, args)
2 changes: 1 addition & 1 deletion tests/test_ghdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def test_ghdl():
from edalize_common import compare_files, setup_backend, tests_dir

ref_dir = os.path.join(tests_dir, __name__)
paramtypes = ['vlogparam']
paramtypes = ['generic']
name = 'test_ghdl'
tool = 'ghdl'
tool_options = {'analyze_options' : ['some', 'analyze_options'],
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ghdl/elab-run.cmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--elab-run some analyze_options --std=08 top_module a few run_options -gvlogparam_bool=1 -gvlogparam_int=42 -gvlogparam_str=hello
--elab-run some analyze_options --std=08 top_module a few run_options -ggeneric_bool=1 -ggeneric_int=42 -ggeneric_str=hello

0 comments on commit 0497185

Please sign in to comment.