Skip to content
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

Add Vivado power optimization option flag #414

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion edalize/templates/vivado/vivado-run.tcl.j2
@@ -1,5 +1,9 @@
# Create a bin file which can be used to program the flash on the FPGA
set_property STEPS.WRITE_BITSTREAM.ARGS.BIN_FILE true [get_runs impl_1]
{% if tool_options.power_opt == 1 -%}
# Enable power optimizations during implementation
set_property strategy Power_DefaultOpt [get_runs impl_1]
{%- endif %}

# Vivado will raise an error if impl_1 is launched when it is already done. So
# check the progress first and only launch if its not complete.
Expand Down Expand Up @@ -31,4 +35,4 @@ if { [get_property PROGRESS [get_runs impl_1]] != "100%"} {
# default bitstream in the "Program Device" dialog; non-standard names need to
# be selected from a file picker first.
set vivadoDefaultBitstreamFile [ get_property DIRECTORY [current_run] ]/[ get_property top [current_fileset] ].bit
file copy -force $vivadoDefaultBitstreamFile [pwd]/[current_project].bit
file copy -force $vivadoDefaultBitstreamFile [pwd]/[current_project].bit
6 changes: 5 additions & 1 deletion edalize/tools/templates/vivado/vivado-run.tcl.j2
@@ -1,5 +1,9 @@
# Create a bin file which can be used to program the flash on the FPGA
set_property STEPS.WRITE_BITSTREAM.ARGS.BIN_FILE true [get_runs impl_1]
{% if power_opt == 1 -%}
# Enable power optimizations during implementation
set_property strategy Power_DefaultOpt [get_runs impl_1]
{%- endif %}

# Vivado will raise an error if impl_1 is launched when it is already done. So
# check the progress first and only launch if its not complete.
Expand Down Expand Up @@ -30,4 +34,4 @@ if { [get_property PROGRESS [get_runs impl_1]] != "100%"} {
# default bitstream in the "Program Device" dialog; non-standard names need to
# be selected from a file picker first.
set vivadoDefaultBitstreamFile [ get_property DIRECTORY [current_run] ]/[ get_property top [current_fileset] ].bit
file copy -force $vivadoDefaultBitstreamFile [pwd]/[current_project].bit
file copy -force $vivadoDefaultBitstreamFile [pwd]/[current_project].bit
8 changes: 7 additions & 1 deletion edalize/tools/vivado.py
Expand Up @@ -64,6 +64,10 @@ class Vivado(Edatool):
"type": "str",
"desc": "A pattern matching a board identifier. Refer to the Vivado documentation for ``get_hw_targets`` for details. Example: ``*/xilinx_tcf/Digilent/123456789123A``",
},
"power_opt": {
"type": "int",
"desc": "When set to 1, it enables the Power Optimization stage during implementation.",
},
}

def get_version(self):
Expand Down Expand Up @@ -182,9 +186,11 @@ def setup(self, edam):
"bd_files": bd_files,
}
jobs = self.tool_options.get("jobs", None)
power_opt = self.tool_options.get("power_opt", None)

self.run_template_vars = {
"jobs": " -jobs " + str(jobs) if jobs is not None else ""
"jobs": " -jobs " + str(jobs) if jobs is not None else "",
"power_opt": power_opt if power_opt is not None else 0,
}

self.synth_template_vars = {
Expand Down
7 changes: 6 additions & 1 deletion edalize/vivado.py
Expand Up @@ -91,6 +91,11 @@ def get_doc(cls, api_ver):
"type": "String",
"desc": "",
},
{
"name": "power_opt",
"type": "int",
"desc": "When defined, it enables the Power Optimization stage during implementation.",
},
],
}

Expand Down Expand Up @@ -129,4 +134,4 @@ def build_pre(self):
pass

def build_post(self):
pass
pass