SPEC7
-------------------
This Readme is a work in progress it currently containts the following topics:

- Building a bitfile 

- Building a tandem loaded BOOT.bin for QSPI flash memory.

Building a bitfile
--------------
1. First make sure you have the Vivado executable in your $PATH. This can be easily done by sourcing the settings64.sh file in your Vivado installation directory.

       /opt/Xilinx/Vivado/2019.2/settings64.sh
2. After that make sure your submodules are up to date (and that you are in the repo's top directory called "spec7")

       git submodule update --init --recursive --remote
3. After that navigate to the "syn" directory of the project you wish to build, currently the repo supports three designs: 

       cd hdl/syn/spec7_ref_design/
      or
      
       cd hdl/syn/spec7_tandem_boot/ 
      or
      
       cd hdl/syn/spec7_blink/
       
4. Now source the build script by running:

       vivado -mode tcl -source ../../../sw/scripts/viv_do_all.tcl
5. Now go get a cup of coffee. If al went well there is a bitfile in the syn directory

If you wish to build the other projects simply source the viv_do_all.tcl script from a different directory.

Building a tandem loaded BOOT.bin for flash memory.
--------------
In order to build a PCIe design that is capable of booting from flash in a reasonable time. You'll need 3 files

- A spec7_tandem_boot bitfile see "Building a bitfile". In this tutorial its called "spec7_tandem_boot_top.bit".
- The .xsa file of the spec7_tandem_boot design. In this tutorial its called "spec7_tandem_boot_top.xsa".
- The bitfile of the design you wish to upload. In this tutorial its called "spec7_ref_top.bit".

Note that the your design must have the same Pcie BAR layout as the spec7_tandem_boot design.

After checking that we can start:

1.  First make sure you have the Vitis executable in your $PATH. This can be easily done by sourcing the settings64.sh file in your vitis installation directory. 
      
        /opt/Xilinx/Vitis/2019.2/settings64.sh
    
    Note it says VITIS not VIVADO.
  
2. Now navigate to the sw/boot directory

       cd sw/boot

3. Now run the Build_boot script. It will automaticly detects .bit and .xsa files in the /syn directory.
       
       ./Build_boot.sh 

4. In the newly created output dir there now is a BOOT.bin. This file can now be flashed in QSPI memory (mt25ql256-qspi-x8-dual_parallel) with this script. The script assumes a local JTAG connection is made with the spec7.

       vivado -mode tcl -source ./Flash_QSPI_JTAG.tcl
