-
Notifications
You must be signed in to change notification settings - Fork 202
symbiyosys: honour include paths #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -25,6 +25,10 @@ class Symbiyosys(Edatool): | |
# A list of task names to pass to sby. Defaults to empty (in which case | ||
# sby will run each task in the .sby file) | ||
- my_proof | ||
extra_options: | ||
# A list of extra command line arguments to sby. Defaults to empty. | ||
- -d | ||
- build | ||
|
||
The SymbiYosys tool expects a configuration file telling it what to do. This | ||
file includes a list of all the source files, together with various flags which | ||
|
@@ -108,8 +112,10 @@ class Symbiyosys(Edatool): | |
"lists": { | ||
# A list of tasks to run from the .sby file. Passed on the sby | ||
# command line. | ||
"tasknames": "String" | ||
} | ||
"tasknames": "String", | ||
# A list of extra arguments to the sby command. | ||
"extra_options": "String", | ||
}, | ||
} | ||
|
||
def __init__(self, edam=None, work_root=None, eda_api=None, verbose=True): | ||
|
@@ -126,6 +132,10 @@ def __init__(self, edam=None, work_root=None, eda_api=None, verbose=True): | |
# configure time by _get_file_names) | ||
self.incdirs = None | ||
|
||
# The list of include files in the fileset (populated at | ||
# configure time) | ||
self.includes = None | ||
|
||
# The name of the interpolated .sby file that we create in the work | ||
# root | ||
self.sby_name = "test.sby" | ||
|
@@ -143,15 +153,46 @@ def get_doc(api_ver): | |
"A list of the .sby file's tasks to run. " | ||
"Passed on the sby command line." | ||
), | ||
} | ||
}, | ||
{ | ||
"name": "extra_options", | ||
"type": "String", | ||
"desc": ( | ||
"A list of extra arguments. " | ||
"Passed on the sby command line." | ||
), | ||
}, | ||
], | ||
} | ||
|
||
def _get_include_files(self, force_slash=False): | ||
class Include: | ||
def __init__(self, name, rel_name): | ||
self.name = name | ||
self.rel_name = rel_name | ||
|
||
includes = [] | ||
for f in self.files: | ||
if f.get("is_include_file"): | ||
# The fully-qualified name | ||
_name = f["name"] | ||
# The working set base directory | ||
_incdir = f.get("include_path") or os.path.dirname(f["name"]) or "." | ||
if force_slash: | ||
_incdir = _incdir.replace("\\", "/") | ||
_name = _incdir.replace("\\", "/") | ||
# The path to copy the include to in the working set | ||
_rel_name = _name.removeprefix(_incdir) | ||
_rel_name = _rel_name.removeprefix("/") | ||
includes.append(Include(_name, _rel_name)) | ||
return includes | ||
|
||
def _get_file_names(self): | ||
"""Read the fileset to get our file names""" | ||
assert self.rtl_paths is None | ||
|
||
src_files, self.incdirs = self._get_fileset_files() | ||
self.includes = self._get_include_files() | ||
self.rtl_paths = [] | ||
bn_to_path = {} | ||
sby_names = [] | ||
|
@@ -205,7 +246,6 @@ def _get_read_flags(self): | |
"-D{}={}".format(key, self._param_value_str(value)) | ||
for key, value in self.vlogdefine.items() | ||
] | ||
+ ["-I{}".format(inc) for inc in self.incdirs] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer do includes with flags. This doesn't work |
||
) | ||
|
||
def _get_chparam(self): | ||
|
@@ -275,7 +315,7 @@ def _interpolate_sby(self, src): | |
"as a Jinja2 template: {}.".format(src_path, err) | ||
) | ||
|
||
files = "\n".join(self.rtl_paths) | ||
files = "\n".join(map(lambda x: f"{x.rel_name} {x.name}", self.includes)) + "\n" + "\n".join(self.rtl_paths) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update the files template to contain include files in |
||
|
||
template_ctxt = { | ||
"chparam": self._get_chparam(), | ||
|
@@ -317,5 +357,11 @@ def run_main(self): | |
'"tasknames" tool option should be ' | ||
"a list of strings. Got {!r}.".format(tasknames) | ||
) | ||
extra_options = self.tool_options.get("extra_options", []) | ||
if not isinstance(extra_options, list): | ||
raise RuntimeError( | ||
'"extra_options" tool option should be ' | ||
"a list of strings. Got {!r}.".format(extra_options) | ||
) | ||
|
||
self._run_tool("sby", ["-d", "build", self.sby_name] + tasknames) | ||
self._run_tool("sby", extra_options + [self.sby_name] + tasknames) |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the include file name, no just the include directory