File: xilinx.rst

package info (click to toggle)
openfpgaloader 0.10.0%2Bgit20230202-edea24f-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 31,124 kB
  • sloc: cpp: 19,681; python: 338; tcl: 84; vhdl: 58; makefile: 42
file content (98 lines) | stat: -rw-r--r-- 3,196 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.. _xilinx:

Xilinx notes
############

To simplify further explanations, we consider the project is generated in the current directory.

.. NOTE::
  1. Spartan Edge Accelerator Board has only pinheader, so the cable must be provided

  2. A *JTAG* <-> *SPI* bridge (used to write bitstream in FLASH) is available for some device, see
     :ghsrc:`spiOverJtag <spiOverJtag>` to check if your model is supported.

  3. Board provides the device/package model, but if the targeted board is not officially supported but the FPGA yes,
     you can use ``--fpga-part`` to provide the model.

  4. With spartan3, the flash is an independent JTAG device.
     User has to use ``--index-chain`` to access FPGA (RAM only) or flash (write/read only).

.. WARNING::
  ``*.bin`` may be loaded in memory or in flash, but this extension is a classic extension for CPU firmware and, by
  default, *openFPGALoader* loads file in memory.
  Double check ``-m`` / ``-f`` when you want to use a firmware for a softcore (or anything, other than a bitstream) to
  write somewhere in the FLASH device).

``.bit`` file is the default format generated by *vivado*, so nothing special task must be done to generate this
bitstream.

``.bin`` is not, by default, produced.
To have access to this file you need to configure the tool:

- GUI: *Tools* -> *Settings* -> *Bitstreams* -> check ``-bin_file``.
- TCL: append your *TCL* file with ``set_property STEPS.WRITE_BITSTREAM.ARGS.BIN_FILE true [get_runs impl_1]``.

.. WARNING::
  For alchitry board the bitstream must be configured with a buswidth of 1 or 2.
  Quad mode can't be used with alchitry's FLASH.

Loading a bitstream
===================

``.bit`` and ``.bin`` are allowed to be loaded in memory.

File load:

.. code-block:: bash

    openFPGALoader [-m] -b arty *.runs/impl_1/*.bit (or *.bin)

or

.. code-block:: bash

    openFPGALoader [-m] -b spartanEdgeAccelBoard -c digilent_hs2 *.runs/impl_1/*.bit (or *.bin)


SPI flash
---------

.. NOTE::
  ``.bit``, ``.bin``, and ``.mcs`` are supported for FLASH.

``.mcs`` must be generated through Vivado with a tcl script like:

.. code-block:: tcl

   set project [lindex $argv 0]

   set bitfile "${project}.runs/impl_1/${project}.bit"
   set mcsfile "${project}.runs/impl_1/${project}.mcs"

   write_cfgmem -format mcs -interface spix4 -size 16 \
      -loadbit "up 0x0 $bitfile" -loaddata "" \
      -file $mcsfile -force

.. NOTE::
  ``-interface spix4`` and ``-size 16`` depends on SPI flash capability and size.

The tcl script is used with:

.. code-block:: bash

    vivado -nolog -nojournal -mode batch -source script.tcl -tclargs myproject

File load:

.. code-block:: bash

    openFPGALoader [--fpga-part xxxx] -f -b arty *.runs/impl_1/*.mcs (or .bit / .bin)

.. NOTE::
  ``-f`` is required to write bitstream (without them ``.bit`` and ``.bin`` are loaded in memory).

.. NOTE::
  ``--fpga-part`` is only required if this information is not provided at ``board.hpp`` level or if the board is not
  officially supported.
  device/package format is something like xc7a35tcsg324 (arty model).
  See :ghsrc:`src/board.hpp <src/board.hpp>`, or :ghsrc:`spiOverJtag <spiOverJtag>` directory for examples.