EDK backend compilation

One of the most time consuming process is the compilation of the system. As an introduction, the compilation takes roughly the following steps:

  1. The simulink model gets updated (equivalent to issue ctrl+D in the simulink diagram)

  2. The system search for the yellow blocks. To do that every yellow block has a xps: tag in its mask, so the script go over each block searching for that tag.

  3. There is a Design Rules Check (DRC). Here we search for invalid parameters in the blocks, like for example an invalid number of address in a BRAM or name with spaces, etc.

  4. The script runs the System Generator compilation. In this stage you transform the simulink design into HDL that would be instantiated by the next parts. (If you open the Xilinx System Generator token in simulink you should see that the compilation process produce NGC files, that would be included in the final design).

  5. The script copies the XPS_base files into the project folder. In the mlib_devel/xps_base you have a base model for the EDK. The idea is to add the correspondent cores that you use in your simulink design, thats the reason that in step 2 we search for the yellow blocks.

  6. The scripts create some EDK files, for example the memories and registers speaks with the PowerPC using a memory mapped bus, so each one needs an address, in this stage we create that file.

  7. Run the EDK compilation. This is the longest one,because have to join the system generator files that we generate in stage 4 and the yellow blocks HDL.

.If you want to see it in more detail, look at xps_library/gen_xps_file.m

Also if you want to look at the yellow block files, in the XPS_base/pcores you are going to found the HDL of the blocks, In the xps_library there are folders starting with @ those are the configuration files of the yellow blocks (for example the gen_mhs set the address of the module in the bus)

The good news are that you don't need to use matlab for the whole process so we could in theory run the EDK compilation in a terminal and free matlab. For the new toolflow with vivado the mlib_devel comes with that option, here we show our script to run in the good old ISE.

#!bin/bash


OPTIND=0

opt=0

i=0

while getopts ":f:" opt; do

case $opt in

f)filename="$OPTARG" ;;

\?) echo "not allowed parameters"; exit 1 ;;

esac

done

echo $filename

shift $((OPTIND-1))

if [ -z "$filename" ]

then

echo "missing filename"; exit 1;

fi

xps_dir=${filename}/XPS_ROACH2_base

source /opt/Xilinx/14.7/ISE_DS/settings64.sh

if [ -a "${xps_dir}/implementation/system.bit" ]

then

rm ${xps_dir}/implementation/system.bit

fi

if [ -a "${xps_dir}/implementation/download.bit" ]

then

rm ${xps_dir}/implementation/download.bit

fi

cd ${xps_dir}

echo "xload xmp system.xmp" > run_xps.tcl

echo "run bits" >> run_xps.tcl

echo "exit">> run_xps.tcl

xps -nw -scr run_xps.tcl

echo "EDK finish"

chmod +x gen_prog_files

./gen_prog_files

echo "finish compilation!!"