-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
from edalize.tools.edatool import Edatool | ||
from edalize.utils import EdaCommands | ||
|
||
|
||
class Flist(Edatool): | ||
|
||
description = "F-list generator" | ||
|
||
TOOL_OPTIONS = {} | ||
|
||
def setup(self, edam): | ||
super().setup(edam) | ||
|
||
self.f = [] | ||
|
||
for key, value in self.vlogdefine.items(): | ||
define_str = self._param_value_str(param_value=value) | ||
self.f.append(f"+define+{key}={define_str}") | ||
|
||
for key, value in self.vlogparam.items(): | ||
param_str = self._param_value_str(param_value=value, str_quote_style='"') | ||
self.f.append(f"-pvalue+{self.toplevel}.{key}={param_str}") | ||
|
||
incdirs = [] | ||
vlog_files = [] | ||
depfiles = [] | ||
unused_files = [] | ||
|
||
for f in self.files: | ||
file_type = f.get("file_type", "") | ||
depfile = True | ||
if file_type.startswith("systemVerilogSource") or file_type.startswith( | ||
"verilogSource" | ||
): | ||
if not self._add_include_dir(f, incdirs): | ||
vlog_files.append(f["name"]) | ||
else: | ||
unused_files.append(f) | ||
depfile = False | ||
|
||
if depfile: | ||
depfiles.append(f["name"]) | ||
|
||
for include_dir in incdirs: | ||
self.f.append(f"+incdir+{include_dir}") | ||
|
||
for vlog_file in vlog_files: | ||
self.f.append(f"{vlog_file}") | ||
|
||
self.edam = edam.copy() | ||
self.edam["files"] = unused_files | ||
|
||
output_file = self.name + ".f" | ||
self.edam = edam.copy() | ||
self.edam["files"] = unused_files | ||
self.edam["files"].append( | ||
{ | ||
"name": output_file, | ||
"file_type": "verilogSource", | ||
} | ||
) | ||
|
||
commands = EdaCommands() | ||
commands.add( | ||
[], | ||
[output_file], | ||
depfiles, | ||
) | ||
|
||
commands.set_default_target(output_file) | ||
self.commands = commands | ||
|
||
def write_config_files(self): | ||
self.update_config_file(self.name + ".f", "\n".join(self.f) + "\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import pytest | ||
from .edalize_tool_common import tool_fixture | ||
|
||
|
||
def test_tool_flist(tool_fixture): | ||
from .edalize_tool_common import FILES | ||
|
||
tf = tool_fixture("flist") | ||
|
||
tf.tool.configure() | ||
tf.compare_config_files(["design.f"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Auto generated by Edalize | ||
|
||
all: design.f | ||
|
||
design.f: sv_file.sv vlog_file.v vlog05_file.v vlog_incfile another_sv_file.sv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
+define+vlogdefine_bool=1 | ||
+define+vlogdefine_int=42 | ||
+define+vlogdefine_str=hello | ||
-pvalue+top_module.vlogparam_bool=1 | ||
-pvalue+top_module.vlogparam_int=42 | ||
-pvalue+top_module.vlogparam_str="hello" | ||
+incdir+. | ||
sv_file.sv | ||
vlog_file.v | ||
vlog05_file.v | ||
another_sv_file.sv |