You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Xilinx Zynq, the task of loading bitstreams into the programmable logic part
of the device is typically handled by the Linux kernel, via the FPGA Manager
framework.
The bitstreams that nMigen generates (via Vivado) fail to load through FPGA
Manager, with an error message like this:
fpga_manager fpga0: writing zynq_image.bin to Xilinx Zynq FPGA Manager
fpga_manager fpga0: Invalid bitstream, could not find a sync word. Bitstream must be a byte swapped .bin file
fpga_manager fpga0: Error preparing FPGA for writing
As the error message says, that is due to the fact that FPGA Manager
expects a byte swapped .bin file, but the file produced by Vivados write_bitstream -bin_file command is not byte swapped. The (obsolete) xdevcfg
interface in ancient Xilinx kernels seems to have detected this (via the sync
word) and corrected it if required, but this feature does not seem to have made
it into FPGA Manager. (See https://lore.kernel.org/patchwork/patch/605909/ for
the discussion.)
There is a tool called fpga-bit-to-bin.py floating around on the Internet
that people use to generate the correct .bin files; however, it can also be
done directly from Vivado.
My suggested fix would be to not generate the .bin file via the -bin_file
option to write_bitstream (in nmigen/vendor/xilinx_7series.py), but instead
issue a separate command to generate it,
This would give a .bin file that works with FPGA Manager.
If there are uses that require a non byte swapped .bin file, one could also
generate two different .bin files, but I don't think that is required (the
xdevcfg interface works with both variants).
If this solution is deemed acceptable, I can submit a PR.
The text was updated successfully, but these errors were encountered:
nfbraun
changed the title
Xilinx Zynq: generated bitstreams do not work with (recent?) FPGA manager
Xilinx Zynq: generated bitstreams do not work with (recent?) FPGA Manager
Nov 2, 2020
The Zynq driver in the FPGA Manager framework on Linux expects bitstreams that
are byte swapped with respect to what the Vivado command `write_bitstream
-bin_file` produces. Thus, use the `write_cfgmem` command with appropriate
options to generate the bitstream (.bin file).
Fixesamaranth-lang#519.
nfbraun
added a commit
to nfbraun/nmigen
that referenced
this issue
Nov 2, 2020
The Zynq driver in the FPGA Manager framework on Linux expects bitstreams that
are byte swapped with respect to what the Vivado command
`write_bitstream -bin_file` produces. Thus, use the `write_cfgmem` command with
appropriate options to generate the bitstream (.bin file).
Fixesamaranth-lang#519.
The Zynq driver in the FPGA Manager framework on Linux expects bitstreams that
are byte swapped with respect to what the Vivado command
`write_bitstream -bin_file` produces. Thus, use the `write_cfgmem` command with
appropriate options to generate the bitstream (.bin file).
Fixes#519.
On Xilinx Zynq, the task of loading bitstreams into the programmable logic part
of the device is typically handled by the Linux kernel, via the FPGA Manager
framework.
The bitstreams that nMigen generates (via Vivado) fail to load through FPGA
Manager, with an error message like this:
As the error message says, that is due to the fact that FPGA Manager
expects a byte swapped .bin file, but the file produced by Vivados
write_bitstream -bin_file
command is not byte swapped. The (obsolete) xdevcfginterface in ancient Xilinx kernels seems to have detected this (via the sync
word) and corrected it if required, but this feature does not seem to have made
it into FPGA Manager. (See https://lore.kernel.org/patchwork/patch/605909/ for
the discussion.)
There is a tool called
fpga-bit-to-bin.py
floating around on the Internetthat people use to generate the correct .bin files; however, it can also be
done directly from Vivado.
My suggested fix would be to not generate the .bin file via the
-bin_file
option to
write_bitstream
(innmigen/vendor/xilinx_7series.py
), but insteadissue a separate command to generate it,
This would give a .bin file that works with FPGA Manager.
If there are uses that require a non byte swapped .bin file, one could also
generate two different .bin files, but I don't think that is required (the
xdevcfg interface works with both variants).
If this solution is deemed acceptable, I can submit a PR.
The text was updated successfully, but these errors were encountered: