Skip to content

Commit

Permalink
Allow setting tags on files
Browse files Browse the repository at this point in the history
This does not affect FuseSoC, but allows Edalize backends to take
different decisions depending on which tags that are set. Use-cases
for this is to mark HDL source files as simulation files to avoid
having them being sent to synthesis, and marking which tool in a flow
that should consume a particular TCL file.
  • Loading branch information
olofk committed Apr 17, 2023
1 parent 681ccc6 commit 857a628
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions fusesoc/capi2/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def get_files(self, flags):
for k, v in attributes.items()
if (type(v) == bool and v == True)
or (type(v) == str and len(v)) > 0
or (type(v) == list and len(v)) > 0
}

_src_files.append(attributes)
Expand Down
5 changes: 4 additions & 1 deletion fusesoc/capi2/coredata.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ def _setup_file(self, file, fs):
"is_include_file": False,
"include_path": "",
"logical_name": "",
"tags": [],
}

# Check if file_type or logical_name are present globally in fileset
# Check if tag, file_type or logical_name are present globally in fileset
if "tags" in fs:
d["tags"] = fs["tags"][:]
if "file_type" in fs:
d["file_type"] = fs["file_type"]
if "logical_name" in fs:
Expand Down
14 changes: 14 additions & 0 deletions fusesoc/capi2/json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@
"description": "Default logical_name (i.e. library) for files in fileset",
"type": "string"
},
"^tags$": {
"description": "Default tags for files in fileset",
"type": "array",
"items": {
"type": "string"
}
},
"^files(_append)?$": {
"description": "Files in fileset",
"type": "array",
Expand Down Expand Up @@ -237,6 +244,13 @@
"description": "Logical name, i.e. library for VHDL/SystemVerilog. Overrides the logical_name set on the containing fileset",
"type": "string"
},
"tags": {
"description": "Tags, special file-specific hints for the backends. Appends the tags set on the containing fileset",
"type": "array",
"items": {
"type": "string"
}
},
"copyto": {
"description": "Copy the source file to this path in the work directory",
"type": "string"
Expand Down

0 comments on commit 857a628

Please sign in to comment.