diff --git a/edalize/icestorm.py b/edalize/icestorm.py index d30818164..cd7ad3a63 100644 --- a/edalize/icestorm.py +++ b/edalize/icestorm.py @@ -31,6 +31,12 @@ def get_doc(cls, api_ver): {'name' : 'yosys_synth_options', 'type' : 'String', 'desc' : 'Additional options for the synth_ice40 command'}, + {'name' : 'yosys_read_options', + 'type' : 'String', + 'desc' : 'Addtional options for the read_* command (e.g. read_verlog or read_uhdm)'}, + {'name' : 'surelog_options', + 'type' : 'String', + 'desc' : 'Additional options for the Surelog'}, ]} combined_members = icestorm_help['members'] @@ -47,8 +53,11 @@ def get_doc(cls, api_ver): def configure_main(self): # Write yosys script file - (src_files, incdirs) = self._get_fileset_files() - yosys_synth_options = self.tool_options.get('yosys_synth_options', '') + (src_files, incdirs) = self._get_fileset_files() + yosys_synth_options = self.tool_options.get('yosys_synth_options', []) + yosys_read_options = self.tool_options.get('yosys_read_options', []) + yosys_synth_options = ["-nomux"] + yosys_synth_options + yosys_edam = { 'files' : self.files, 'name' : self.name, @@ -57,8 +66,10 @@ def configure_main(self): 'tool_options' : {'yosys' : { 'arch' : 'ice40', 'yosys_synth_options' : yosys_synth_options, + 'yosys_read_options' : yosys_read_options, 'yosys_as_subtool' : True, 'yosys_template' : self.tool_options.get('yosys_template'), + 'surelog_options' : surelog_options, } } } diff --git a/edalize/surelog.py b/edalize/surelog.py index e7701e248..35efb5621 100644 --- a/edalize/surelog.py +++ b/edalize/surelog.py @@ -13,11 +13,6 @@ class Surelog(Edatool): def get_doc(cls, api_ver): if api_ver == 0: return {'description' : "Surelog", - "members" : [ - {'name' : 'library_files', - 'type' : 'String', - 'desc' : 'List of the library files for Surelog'}, - ], 'lists' : [ {'name' : 'surelog_options', 'type' : 'String', @@ -34,15 +29,8 @@ def configure_main(self): if f.file_type.startswith('systemVerilogSource'): systemverilog_file_list.append("-sv " + f.name) - library_files = self.tool_options.get('library_files', None) surelog_options = self.tool_options.get('surelog_options', []) - - if library_files: - print(library_files) - library_files = library_files.split(",") - - pattern = len(library_files) * " -v %s" - library_command = pattern % tuple(library_files) + arch = self.tool_options.get('arch', None) pattern = len(self.vlogparam.keys()) * " -P%s=%%s" verilog_params_command = pattern % tuple(self.vlogparam.keys()) % tuple(self.vlogparam.values()) @@ -60,7 +48,7 @@ def configure_main(self): 'name' : self.name, 'sources' : ' '.join(verilog_file_list), 'sv_sources' : ' '.join(systemverilog_file_list), - 'library_command' : library_command, + 'arch' : arch, 'verilog_params_command' : verilog_params_command, 'verilog_defines_command' : verilog_defines_command, 'include_files_command' : include_files_command, diff --git a/edalize/symbiflow.py b/edalize/symbiflow.py index 25bca1be5..7ca694275 100644 --- a/edalize/symbiflow.py +++ b/edalize/symbiflow.py @@ -76,11 +76,6 @@ def get_doc(cls, api_ver): "type" : "String", "desc" : 'Select yosys frontend. Currently "uhdm" and "verilog" frontends are supported.' }, - { - "name" : "library_files", - "type" : "String", - "desc" : "list of the library files for surelog" - }, ], 'lists' : [ {'name' : 'surelog_options', @@ -242,7 +237,6 @@ def configure_vpr(self): 'toplevel' : self.toplevel, 'parameters' : self.parameters, 'tool_options' : {'surelog' : { - 'library_files' : self.tool_options.get('library_files', []), 'surelog_options' : self.tool_options.get('surelog_options', []), } } diff --git a/edalize/templates/surelog/surelog-makefile.j2 b/edalize/templates/surelog/surelog-makefile.j2 index ed98ad55e..b6d8e56e6 100644 --- a/edalize/templates/surelog/surelog-makefile.j2 +++ b/edalize/templates/surelog/surelog-makefile.j2 @@ -4,9 +4,7 @@ VERILOG := {{ sources }} SYSTEMVERILOG := {{ sv_sources }} TOP := {{ top }} -{% if library_command -%} -LIBRARY_COMMAND = {{ library_command }} -{%- endif %} +LIBRARY_COMMAND := -v $(shell yosys-config --datdir)/{{ arch }}/cells_bb.v {% if verilog_params_command -%} PARAMS_COMMAND = {{ verilog_params_command }} diff --git a/edalize/templates/yosys/yosys-makefile.j2 b/edalize/templates/yosys/yosys-makefile.j2 index 7d9b29605..1131feca2 100644 --- a/edalize/templates/yosys/yosys-makefile.j2 +++ b/edalize/templates/yosys/yosys-makefile.j2 @@ -8,17 +8,17 @@ all: $(TARGET).{{ default_target }} {{ top }}.uhdm: $(MAKE) -f surelog.mk -DEPENDENCIES := {{ top }}.uhdm {{ yosys_template }} }} +DEPENDENCIES := {{ top }}.uhdm {{ yosys_template }} {% else %} -DEPENDENCIES := {{ yosys_template }} }} +DEPENDENCIES := {{ yosys_template }} {%- endif %} %.blif: ${DEPENDENCIES} - $(EDALIZE_LAUNCHER) yosys -l yosys.log -p "tcl {{ yosys_template }} }}" + $(EDALIZE_LAUNCHER) yosys -l yosys.log -p "tcl {{ yosys_template }}" %.json: ${DEPENDENCIES} - $(EDALIZE_LAUNCHER) yosys -l yosys.log -p "tcl {{ yosys_template }} }}" + $(EDALIZE_LAUNCHER) yosys -l yosys.log -p "tcl {{ yosys_template }}" %.edif: ${DEPENDENCIES} - $(EDALIZE_LAUNCHER) yosys -l yosys.log -p "tcl {{ yosys_template }} }}" + $(EDALIZE_LAUNCHER) yosys -l yosys.log -p "tcl {{ yosys_template }}" clean: rm -f $(TARGET).blif $(TARGET).json $(TARGET).edif diff --git a/edalize/trellis.py b/edalize/trellis.py index d8d79347f..b2bd5d5c7 100644 --- a/edalize/trellis.py +++ b/edalize/trellis.py @@ -24,6 +24,12 @@ def get_doc(cls, api_ver): {'name' : 'yosys_synth_options', 'type' : 'String', 'desc' : 'Additional options for the synth_ecp5 command'}, + {'name' : 'yosys_read_options', + 'type' : 'String', + 'desc' : 'Addtional options for the read_* command (e.g. read_verlog or read_uhdm)'}, + {'name' : 'surelog_options', + 'type' : 'String', + 'desc' : 'Additional options for the Surelog'}, ]} combined_members = [] @@ -40,9 +46,11 @@ def get_doc(cls, api_ver): def configure_main(self): # Write yosys script file - (src_files, incdirs) = self._get_fileset_files() - yosys_synth_options = self.tool_options.get('yosys_synth_options', []) - yosys_synth_options = ["-nomux"] + yosys_synth_options + (src_files, incdirs) = self._get_fileset_files() + yosys_synth_options = self.tool_options.get('yosys_synth_options', []) + yosys_read_options = self.tool_options.get('yosys_read_options', []) + yosys_synth_options = ["-nomux"] + yosys_synth_options + surelog_options = self.tool_options.get('surelog_options', []) yosys_edam = { 'files' : self.files, 'name' : self.name, @@ -51,7 +59,9 @@ def configure_main(self): 'tool_options' : {'yosys' : { 'arch' : 'ecp5', 'yosys_synth_options' : yosys_synth_options, + 'yosys_read_options' : yosys_read_options, 'yosys_as_subtool' : True, + 'surelog_options' : surelog_options, } } } diff --git a/edalize/vivado.py b/edalize/vivado.py index 0ede28b4c..e3d934285 100644 --- a/edalize/vivado.py +++ b/edalize/vivado.py @@ -58,9 +58,6 @@ def get_doc(cls, api_ver): {'name' : 'hw_target', 'type' : 'Description', 'desc' : 'Board identifier (e.g. */xilinx_tcf/Digilent/123456789123A'}, - {'name' : 'library_files', - 'type' : 'String', - 'desc' : 'List of the library files for Surelog'}, ], 'lists' : [ {'name' : 'yosys_synth_options', @@ -127,7 +124,6 @@ def configure_main(self): 'yosys_read_options' : yosys_read_options, '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 0c10ae92c..ee1207ddb 100644 --- a/edalize/yosys.py +++ b/edalize/yosys.py @@ -58,6 +58,11 @@ def configure_main(self): yosys_read_options = " ".join(self.tool_options.get('yosys_read_options', [])) file_table = [] yosys_synth_options = self.tool_options.get('yosys_synth_options', []) + + arch = self.tool_options.get('arch', None) + if not arch: + logger.error("ERROR: arch is not defined.") + use_surelog = False if "frontend=surelog" in yosys_synth_options: use_surelog = True @@ -69,8 +74,8 @@ def configure_main(self): 'toplevel' : self.toplevel, 'parameters' : self.parameters, 'tool_options' : {'surelog' : { - 'library_files' : self.tool_options.get('library_files', []), 'surelog_options' : self.tool_options.get('surelog_options', []), + 'arch' : arch, } } } @@ -108,10 +113,6 @@ def configure_main(self): self.toplevel)) output_format = self.tool_options.get('output_format', 'blif') - arch = self.tool_options.get('arch', None) - - if not arch: - logger.error("ERROR: arch is not defined.") makefile_name = self.tool_options.get('makefile_name', self.name + '.mk') template_vars = {