Skip to content

Commit 2759689

Browse files
committed
Support passing vlogparams to Genus
_Note_: this is written from the viewpoint of a FuseSoC user, but this applies to all usages of edalize itself. FuseSoC already accepts `vlogparam`s for the `genus` backend/tool, but does not write them to any TCL-file or other way to access it from the user-defined Genus script. Therefore one could not easily add parameters to the top-level module when synthesizing with Genus, effectively ren- dering them unusable. In order to resolve this issue, this commit creates new variable called `ELABORATE_PARAMETERS`, which is set unconditionally. Its value is constructed in such a way, that the value can be passed directly to the `elaborate`-command inside the user-supplied Genus TCL script like so: ```tcl elaborate -parameters "$ELABORATE_PARAMETERS" "$TOP_MODULE" ``` This way, the user-supplied TCL-script can be kept generic (without the need for special-casing parameter) and FuseSoC makes use of the defined parameters.
1 parent e438f9f commit 2759689

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

edalize/genus.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ def make_list(opt):
8686
jobs = self.tool_options.get("jobs", None)
8787
jobs = "$nproc" if "all" in jobs else jobs
8888

89+
# Build up parameters in the format that the `elaborate` command expects
90+
parameters = [f"{{ {name} {value} }}" for name, value in self.vlogparam.items()]
91+
elaborate_parameters = "{ " + ' '.join(parameters) + " }"
92+
8993
template_vars = {
9094
"name": self.name,
9195
"src_files": src_files,
@@ -95,6 +99,7 @@ def make_list(opt):
9599
"genus_script": make_list(self.tool_options.get("genus_script")),
96100
"report_dir": make_list(self.tool_options.get("report_dir")),
97101
"common_config": make_list(self.tool_options.get("common_config")),
102+
"parameters": elaborate_parameters,
98103
"jobs": make_list(jobs),
99104
"toplevel": self.toplevel,
100105
}

edalize/templates/genus/genus-project.tcl.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ set_multi_cpu_usage -local_cpu {{jobs}}
2828

2929
set READ_SOURCES {{ name }}-read-sources
3030

31+
# A variable containing all top-module parameters passed by FuseSoC, ready to
32+
# be passed on to the `elaborate`-command (within the `$GENUS_SCRIPT` like this:
33+
#
34+
# elaborate -parameters "$ELABORATE_PARAMETERS" "$TOP_MODULE"
35+
set ELABORATE_PARAMETERS {{ parameters }}
36+
3137
{% if script_dir -%}
3238
set SCRIPT_DIR {{ script_dir }}
3339
{% else %}

0 commit comments

Comments
 (0)