diff --git a/edalize/surelog.py b/edalize/surelog.py index 4290b6387..a954c8798 100644 --- a/edalize/surelog.py +++ b/edalize/surelog.py @@ -17,43 +17,48 @@ def get_doc(cls, api_ver): {'name' : 'library_files', 'type' : 'String', 'desc' : 'List of the library files for Surelog'}, + {'name' : 'surelog_options', + 'type' : 'String', + 'desc' : 'List of the Surelog parameters'}, ]} def configure_main(self): (src_files, incdirs) = self._get_fileset_files() - file_list = [] + verilog_file_list = [] + systemverilog_file_list = [] for f in src_files: if f.file_type.startswith('verilogSource'): - file_list.append(f.name) + verilog_file_list.append(f.name) if f.file_type.startswith('systemVerilogSource'): - file_list.append(f.name) + systemverilog_file_list.append("-sv " + f.name) library_files = self.tool_options.get('library_files', []) - library_command = "" + surelog_options = self.tool_options.get('surelog_options', []) - for library_file in library_files: - library_command = library_command + " -v " + library_file + pattern = len(library_files) * "-v %s" + library_command = pattern % tuple(library_files) - verilog_params_command = "" - for key, value in self.vlogparam.items(): - verilog_params_command += ' -P{key}={value}'.format(key=key, value=value) + pattern = len(self.vlogparam.keys()) * " -P%s=%%s" + verilog_params_command = pattern % tuple(self.vlogparam.keys()) % tuple(self.vlogparam.values()) verilog_defines_command = "+define" if self.vlogdefine.items() else "" - for key, value in self.vlogdefine.items(): - verilog_defines_command += '+{key}={value}'.format(key=key, value=value) + pattern = len(self.vlogdefine.keys()) * "+%s=%%s" + verilog_defines_command += pattern % tuple(self.vlogdefine.keys()) % tuple(self.vlogdefine.values()) + + pattern = len(incdirs) * " -I%s" + include_files_command = pattern % tuple(incdirs) - include_files_command = "" - for include_file in incdirs: - include_files_command = include_files_command + " -I" + include_file template_vars = { 'top' : self.toplevel, 'name' : self.name, - 'sources' : ' '.join(file_list), + 'sources' : ' '.join(verilog_file_list), + 'sv_sources' : ' '.join(systemverilog_file_list), 'library_command' : library_command, 'verilog_params_command' : verilog_params_command, 'verilog_defines_command' : verilog_defines_command, 'include_files_command' : include_files_command, + 'surelog_options' : ' '.join(surelog_options), } diff --git a/edalize/templates/surelog/surelog-makefile.j2 b/edalize/templates/surelog/surelog-makefile.j2 index ef5a44ce5..ed98ad55e 100644 --- a/edalize/templates/surelog/surelog-makefile.j2 +++ b/edalize/templates/surelog/surelog-makefile.j2 @@ -1,8 +1,8 @@ #Auto generated by Edalize -SHELL = bash -VERILOG := {{ sources }} -TOP := {{ top }} +VERILOG := {{ sources }} +SYSTEMVERILOG := {{ sv_sources }} +TOP := {{ top }} {% if library_command -%} LIBRARY_COMMAND = {{ library_command }} @@ -20,8 +20,12 @@ DEFINES_COMMAND = {{ verilog_defines_command }} INCLUDE_COMMAND = {{ include_files_command }} {%- endif %} +{% if surelog_options -%} +SURELOG_OPTIONS = {{ surelog_options }} +{%- endif %} + all: ${TOP}.uhdm ${TOP}.uhdm: - surelog -parse -sverilog ${LIBRARY_COMMAND} ${DEFINES_COMMAND} ${PARAMS_COMMAND} -top ${TOP} ${INCLUDE_COMMAND} ${VERILOG} + surelog ${SURELOG_OPTIONS} -parse ${LIBRARY_COMMAND} ${DEFINES_COMMAND} ${PARAMS_COMMAND} -top ${TOP} ${INCLUDE_COMMAND} ${VERILOG} ${SYSTEMVERILOG} cp slpp_all/surelog.uhdm ${TOP}.uhdm diff --git a/edalize/vivado.py b/edalize/vivado.py index fec0f454d..8b67c2558 100644 --- a/edalize/vivado.py +++ b/edalize/vivado.py @@ -59,6 +59,9 @@ def get_doc(cls, api_ver): {'name' : 'library_files', 'type' : 'String', 'desc' : 'List of the library files for Surelog'}, + {'name' : 'surelog_options', + 'type' : 'String', + 'desc' : 'Additional options for the Surelog'}, ]} """ Get tool version @@ -115,6 +118,7 @@ def configure_main(self): 'yosys_as_subtool' : True, 'script_name' : 'yosys.tcl', 'library_files' : self.tool_options.get('library_files', []), + 'surelog_options' : self.tool_options.get('surelog_options', []), } } } diff --git a/edalize/yosys.py b/edalize/yosys.py index e03281ce2..4e033ce3a 100644 --- a/edalize/yosys.py +++ b/edalize/yosys.py @@ -42,6 +42,9 @@ def get_doc(cls, api_ver): {'name' : 'library_files', 'type' : 'String', 'desc' : 'List of the library files for Surelog'}, + {'name' : 'surelog_options', + 'type' : 'String', + 'desc' : 'Additional options for the Surelog'}, ]} def configure_main(self): @@ -64,6 +67,7 @@ def configure_main(self): 'parameters' : self.parameters, 'tool_options' : {'surelog' : { 'library_files' : self.tool_options.get('library_files', []), + 'surelog_options' : self.tool_options.get('surelog_options', []), } } }