Skip to content

Commit

Permalink
Add to check if the bitstream exists
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomelo9 committed Nov 24, 2024
1 parent c4340ab commit aa24928
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyfpga/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def prog(self, bitstream=None, position=1):
:param position: position of the device in the JTAG chain
:type position: str, optional
:raises ValueError: for missing or wrong values
:raises FileNotFoundError: when bitstream is not found
:raises RuntimeError: error running the needed underlying tool
"""
self.logger.debug('Executing prog')
Expand All @@ -255,6 +256,8 @@ def prog(self, bitstream=None, position=1):
bitstream = f'{self.data["project"]}.{self.conf["prog_bit"]}'
else:
bitstream = Path(bitstream).resolve().as_posix()
if not os.path.exists(bitstream):
raise FileNotFoundError(bitstream)
self.data['bitstream'] = bitstream
self._prog_custom()
self._create_file(f'{self.conf["tool"]}-prog', self.conf['prog_ext'])
Expand Down

0 comments on commit aa24928

Please sign in to comment.