Skip to content

Commit

Permalink
vivado: Add pnr option to only do synthesis
Browse files Browse the repository at this point in the history
  • Loading branch information
olofk committed Jun 19, 2019
1 parent 520cc83 commit f9f1bb9
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
5 changes: 5 additions & 0 deletions edalize/templates/vivado/vivado-makefile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ $(NAME).xpr: $(NAME).tcl

build-gui: $(NAME).xpr
vivado $<

$(NAME).runs/synth_1: $(NAME)_synth.tcl $(NAME).xpr
vivado -mode batch -source $^

synth: $(NAME).runs/synth_1
2 changes: 2 additions & 0 deletions edalize/templates/vivado/vivado-synth.tcl.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
launch_runs synth_1
wait_on_run synth_1
25 changes: 24 additions & 1 deletion edalize/vivado.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def get_doc(cls, api_ver):
'members' : [
{'name' : 'part',
'type' : 'String',
'desc' : 'FPGA part number (e.g. xc7a35tcsg324-1)'}]}
'desc' : 'FPGA part number (e.g. xc7a35tcsg324-1)'},
{'name' : 'pnr',
'type' : 'String',
'desc' : 'P&R tool. Allowed values are vivado (default) and none (to just run synthesis)'},
]}

""" Configuration is the first phase of the build
Expand Down Expand Up @@ -72,6 +76,9 @@ def configure_main(self):
self.render_template('vivado-run.tcl.j2',
self.name+"_run.tcl")

self.render_template('vivado-synth.tcl.j2',
self.name+"_synth.tcl")

self.render_template('vivado-program.tcl.j2',
self.name+"_pgm.tcl",
{'part' : self.tool_options.get('part', ""),
Expand Down Expand Up @@ -105,12 +112,28 @@ def _vhdl_source(f):
f.file_type))
return ''

def build_main(self):
logger.info("Building")
args = []
if 'pnr' in self.tool_options:
if self.tool_options['pnr'] == 'vivado':
pass
elif self.tool_options['pnr'] == 'none':
args.append('synth')
self._run_tool('make', args)

""" Program the FPGA
For programming the FPGA a vivado tcl script is written that searches for the
correct FPGA board and then downloads the bitstream. The tcl script is then
executed in Vivado's batch mode.
"""
def run_main(self):
if 'pnr' in self.tool_options:
if self.tool_options['pnr'] == 'vivado':
pass
elif self.tool_options['pnr'] == 'none':
return

self._run_tool('vivado', ['-mode', 'batch', '-source', self.name+"_pgm.tcl"])

5 changes: 5 additions & 0 deletions tests/test_vivado/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ $(NAME).xpr: $(NAME).tcl

build-gui: $(NAME).xpr
vivado $<

$(NAME).runs/synth_1: $(NAME)_synth.tcl $(NAME).xpr
vivado -mode batch -source $^

synth: $(NAME).runs/synth_1
5 changes: 5 additions & 0 deletions tests/test_vivado/minimal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ $(NAME).xpr: $(NAME).tcl

build-gui: $(NAME).xpr
vivado $<

$(NAME).runs/synth_1: $(NAME)_synth.tcl $(NAME).xpr
vivado -mode batch -source $^

synth: $(NAME).runs/synth_1

0 comments on commit f9f1bb9

Please sign in to comment.