Added extra XDC PCF SDC info

Signed-off-by: Joshua Fife <jpfife17@gmail.com>
This commit is contained in:
Joshua Fife 2021-06-08 20:49:58 -06:00
parent b6932ed300
commit c451dae1ac
2 changed files with 86 additions and 25 deletions

View File

@ -4,7 +4,7 @@ A key steep in creating your own designs is understanding how to use the Makefil
Example
-------
To understand how the Makfiles within symbiflow are setup lets take a look at a more simple Makefile that will run the symbiflow counter test on the basys3 board. Highlighted lines within the code bellow are of particular interest and will change depending on your design and hardware.
To understand how the Makfiles within symbiflow are setup, lets take a look at a more simple Makefile that will run the symbiflow counter test on the basys3 board. Highlighted lines within the code below are of particular interest and will change depending on your design and hardware.
.. code-block:: bash
:name: makefile-example
@ -61,16 +61,16 @@ Line 4 in the Makefile shows how to add HDL files to the design. The general syn
.. code-block:: bash
:name: multi-file-example
<HDL language> := ${current_dir}/<HDL file> \
<HDL language> := ${current_dir}/<HDL file 1> \
${current_dir}/<HDL file>\
${current_dir}/<HDL file 2>\
${current_dir}/<HDL file> \
${current_dir}/<HDL file 3> \
${current_dir}/<HDL file> \
${current_dir}/<HDL file 4> \
...
You could also use wildcards to collect all HDL file types of a specific extension and add them to your design. For example, if you wanted to add all verilog files within the current directory to your design you should replace line 4 in the makefile with:
You could also use wildcards to collect all HDL file types of a specific extension and add them to your design. For example, if you wanted to add all verilog files within the current directory to your design you could replace line 4 in the Makefile with:
.. code-block:: bash
:name: wildcard-example
@ -78,9 +78,13 @@ You could also use wildcards to collect all HDL file types of a specific extensi
VERILOG := ${current_dir}/*.v
As of this writing symbiflow only supports Verilog and SystemVerilog HDL.
To include SystemVerilog in your design simply change the ``*.v`` above to a ``*.sv``. You might also want to change the ``VERILOG`` bash variables throughout the Makefile to ``SYSTEM_VERILOG`` to improve readability.
Setting the device constraints
.. note::
As of this writing symbiflow only supports Verilog and SystemVerilog HDL by default.
Setting the device properties
------------------------------
Line 5 in the example sets the device type for the project. Several different board types are supported and a listing of the commands for each board type follows:
@ -179,7 +183,7 @@ As shown on line 9 of the example makefile you will also need to define the part
Constraint files
----------------
Line 10 shows how you can specify what the constraint files are for your design. The general syntax depends on wether you are using XDC files or a SDC+PCF pair:
Line 10 shows how you can specify what the constraint files are being used for your design. The general syntax depends on wether you are using XDC files or a SDC+PCF pair:
.. tabs::
@ -196,4 +200,60 @@ Line 10 shows how you can specify what the constraint files are for your design.
PCF := ${current_dir}/<name of PCF file>
SDC := ${current_dir}/<name of SDC file>
Note that the lines 22, 25, 28, and 31 (.eblif, net, place, and route) may will need to change depending on if you use an XDC file or some combination of SDC, PCF and XDC.
Note that the lines 22, 25, 28, and 31 (.eblif, net, place, and route) will also need to change depending on if you use an XDC file or some combination of SDC, PCF and XDC files. The following snippets show the differences and the areas that will need to change:
.. tabs::
.. group-tab:: XDC
.. code-block:: bash
:emphasize-lines: 2
${BOARD_BUILDDIR}/${TOP}.eblif: | ${BOARD_BUILDDIR}
cd ${BOARD_BUILDDIR} && symbiflow_synth -t ${TOP} -v ${VERILOG} -d ${BITSTREAM_DEVICE} -p ${PARTNAME} -x ${XDC} 2>&1 > /dev/null
${BOARD_BUILDDIR}/${TOP}.net: ${BOARD_BUILDDIR}/${TOP}.eblif
cd ${BOARD_BUILDDIR} && symbiflow_pack -e ${TOP}.eblif -d ${DEVICE} 2>&1 > /dev/null
${BOARD_BUILDDIR}/${TOP}.place: ${BOARD_BUILDDIR}/${TOP}.net
cd ${BOARD_BUILDDIR} && symbiflow_place -e ${TOP}.eblif -d ${DEVICE} -n ${TOP}.net -P ${PARTNAME} 2>&1 > /dev/null
${BOARD_BUILDDIR}/${TOP}.route: ${BOARD_BUILDDIR}/${TOP}.place
cd ${BOARD_BUILDDIR} && symbiflow_route -e ${TOP}.eblif -d ${DEVICE} 2>&1 > /dev/null
.. group-tab:: SDC+PCF
.. code-block:: bash
:emphasize-lines: 5, 8, 11
${BOARD_BUILDDIR}/${TOP}.eblif: | ${BOARD_BUILDDIR}
cd ${BOARD_BUILDDIR} && symbiflow_synth -t ${TOP} -v ${VERILOG} -d ${BITSTREAM_DEVICE} -p ${PARTNAME}
${BOARD_BUILDDIR}/${TOP}.net: ${BOARD_BUILDDIR}/${TOP}.eblif
cd ${BOARD_BUILDDIR} && symbiflow_pack -e ${TOP}.eblif -d ${DEVICE} -s ${SDC}
${BOARD_BUILDDIR}/${TOP}.place: ${BOARD_BUILDDIR}/${TOP}.net
cd ${BOARD_BUILDDIR} && symbiflow_place -e ${TOP}.eblif -d ${DEVICE} -p ${PCF} -n ${TOP}.net -P ${PARTNAME} -s ${SDC} 2>&1 > /dev/null
${BOARD_BUILDDIR}/${TOP}.route: ${BOARD_BUILDDIR}/${TOP}.place
cd ${BOARD_BUILDDIR} && symbiflow_route -e ${TOP}.eblif -d ${DEVICE} -s ${SDC} 2>&1 > /dev/null
.. group-tab:: SDC+PCF+XDC
.. code-block:: bash
:emphasize-lines: 2, 5, 8, 11
${BOARD_BUILDDIR}/${TOP}.eblif: | ${BOARD_BUILDDIR}
cd ${BOARD_BUILDDIR} && symbiflow_synth -t ${TOP} -v ${VERILOG} -d ${BITSTREAM_DEVICE} -p ${PARTNAME} -x ${XDC} 2>&1 > /dev/null
${BOARD_BUILDDIR}/${TOP}.net: ${BOARD_BUILDDIR}/${TOP}.eblif
cd ${BOARD_BUILDDIR} && symbiflow_pack -e ${TOP}.eblif -d ${DEVICE} -s ${SDC} 2>&1 > /dev/null
${BOARD_BUILDDIR}/${TOP}.place: ${BOARD_BUILDDIR}/${TOP}.net
cd ${BOARD_BUILDDIR} && symbiflow_place -e ${TOP}.eblif -d ${DEVICE} -p ${PCF} -n ${TOP}.net -P ${PARTNAME} -s ${SDC} 2>&1 > /dev/null
${BOARD_BUILDDIR}/${TOP}.route: ${BOARD_BUILDDIR}/${TOP}.place
cd ${BOARD_BUILDDIR} && symbiflow_route -e ${TOP}.eblif -d ${DEVICE} -s ${SDC} 2>&1 > /dev/null
Lines 33-37 (running ``symbiflow_write_fasm`` and ``symbiflow_write_bitstream``) typically do not change from design to design.

View File

@ -1,9 +1,9 @@
Using Symbiflow to upload your own designs
===========================================
This section describes how you can upload you're own designs to an FPGA from start to finish using only open source tools.
This section describes how to upload you're own designs to an FPGA from start to finish using only open source tools.
Prepareing your environment
Preparing your environment
----------------------------
Before building any example, set the installation directory to match what you
set it to earlier, for example:
@ -47,6 +47,9 @@ Finally, enter your working Conda environment:
conda activate $FPGA_FAM
.. note::
You will need to run the commands for preparing your conda environment each time you open a new terminal. You will also need to activate the Conda environment for your hardware before you attempt to build your designs. It might be a good idea to add the above commands to your ``.bashrc`` either as functions or aliases to save yourself some repetitive typing.
Preparing Your Design
@ -55,27 +58,25 @@ Building a design in symbiflow requires three simple parts, the HDL files for yo
HDL files
++++++++++
Symbiflow provides support for both Verilog and SystemVerilog HDL code. Use whichever method you prefer and add your design files to the directory of choice. If you are using the provided Makefiles to build your design, your top level module should be declared as ``module top (...``.
Symbiflow provides support for both Verilog and SystemVerilog HDL code. Use whichever method you prefer and add your design files to the directory of choice. If you are using the provided Makefiles to build your design, your top level module should be declared as ``module top (...``. Failure to do so will result in an error during the build process stating something to the effect of ``ERROR: Module 'top' not found!``
Constraint file
++++++++++++++++
The Symbiflow tool chain supports both .XDC and .PCF+.SDC formats for constraint files. Use whichever method you prefer and add your constraint file(s) to the design directory.
.. warning::
In its current state, symbiflow-examples does not provide support for dictionaries within XDC files by default. To support this functionality you will need to use the `XDC-plugin <https://github.com/SymbiFlow/yosys-symbiflow-plugins/tree/master/xdc-plugin>`_ from ``symbiflow-yosys-plugins.`` Failure to install the plugin before attempting to use dictionaries within your XDC file may result in a faulty bitstream.
Makefile
+++++++++
To learn about how the Makefiles in symbiflow work see the `Understanding the Makefile in Symbiflow <Understanding-Makefile.html>`_ page.
To learn about how Makefiles in symbiflow work, see the `Understanding the Makefile in Symbiflow <Understanding-Makefile.html>`_ page.
If you have used verilog as your HDL and an XDC as your constraint, you can add this :download:`Makefile <master_makefile/Makefile>` to your design directory instead of building your own.
Building your personal projects
-------------------------------
Before you begin building your design navigate to the directory where you have stored your Makefile, HDL, and constraint files:
Before you begin building your design, navigate to the directory where you have stored your Makefile, HDL, and constraint files:
.. code-block:: bash
:name: your-directory
@ -98,7 +99,7 @@ Then, depending on your board type run:
.. code-block:: bash
:name: example-counter-a100t-group
TARGET="arty_100" make -C .
TARGET="arty_100" make -C .
.. group-tab:: Nexus4
@ -122,7 +123,7 @@ If your design builds without error, the bitstream can be found in the following
cd build/<board>
Finally, for **Arty and Basys3**, you can upload the design with:
Once you navigate to the directory containing the bitstream, use the following commands on the **Arty and Basys3** to upload the design to your board:
.. code-block:: bash
@ -130,16 +131,16 @@ Finally, for **Arty and Basys3**, you can upload the design with:
.. tip::
Many of the commands needed to build a project are run many times. You might consider adding a few aliases or even a few bash functions to your .bashrc file to save yourself some typing or repeated copy/paste.
For example, instead of using the somewhat cumbersome command used to upload the bitstream to arty or basys3 every time, you could just add the following lines to your bashrc file:
Many of the commands needed to build a project are run multiple times with little to no variation. You might consider adding a few aliases or even a few bash functions to your .bashrc file to save yourself some typing or repeated copy/paste.
For example, instead of using the somewhat cumbersome command used to upload the bitstream to Xilinx 7 series FPGA every time, you could just add the following lines to your bashrc file:
.. code-block:: bash
:name: bash-functions
symbi_bit() {
#Creates and downloads the bitstream to Basys 3 or Arty boards:
openocd -f /home/chem3000/opt/symbiflow/xc7/conda/envs/xc7/share/openocd/scripts/board/digilent_arty.cfg -c "init; pld load 0 top.bit; exit"
#Creates and downloads the bitstream to Xilinx 7 series FPGA:
openocd -f <Your install directory>/xc7/conda/envs/xc7/share/openocd/scripts/board/digilent_arty.cfg -c "init; pld load 0 top.bit; exit"
}
Now whenever you need to download a bitstream to the arty or basys you can simply type ``symbi_bit`` into the terminal and hit enter.
Now whenever you need to download a bitstream to the Xilinx-7 series you can simply type ``symbi_bit`` into the terminal and hit enter.