Skip to content

Commit 857a628

Browse files
committed
Allow setting tags on files
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.
1 parent 681ccc6 commit 857a628

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

fusesoc/capi2/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ def get_files(self, flags):
269269
for k, v in attributes.items()
270270
if (type(v) == bool and v == True)
271271
or (type(v) == str and len(v)) > 0
272+
or (type(v) == list and len(v)) > 0
272273
}
273274

274275
_src_files.append(attributes)

fusesoc/capi2/coredata.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,12 @@ def _setup_file(self, file, fs):
9898
"is_include_file": False,
9999
"include_path": "",
100100
"logical_name": "",
101+
"tags": [],
101102
}
102103

103-
# Check if file_type or logical_name are present globally in fileset
104+
# Check if tag, file_type or logical_name are present globally in fileset
105+
if "tags" in fs:
106+
d["tags"] = fs["tags"][:]
104107
if "file_type" in fs:
105108
d["file_type"] = fs["file_type"]
106109
if "logical_name" in fs:

fusesoc/capi2/json_schema.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@
203203
"description": "Default logical_name (i.e. library) for files in fileset",
204204
"type": "string"
205205
},
206+
"^tags$": {
207+
"description": "Default tags for files in fileset",
208+
"type": "array",
209+
"items": {
210+
"type": "string"
211+
}
212+
},
206213
"^files(_append)?$": {
207214
"description": "Files in fileset",
208215
"type": "array",
@@ -237,6 +244,13 @@
237244
"description": "Logical name, i.e. library for VHDL/SystemVerilog. Overrides the logical_name set on the containing fileset",
238245
"type": "string"
239246
},
247+
"tags": {
248+
"description": "Tags, special file-specific hints for the backends. Appends the tags set on the containing fileset",
249+
"type": "array",
250+
"items": {
251+
"type": "string"
252+
}
253+
},
240254
"copyto": {
241255
"description": "Copy the source file to this path in the work directory",
242256
"type": "string"

0 commit comments

Comments
 (0)