Initial Setup

If you do not wish to keep your work-in-progress core or test cores within the ReplaySVN/hw/replay/cores/[core-name] directory, but would rather keep your work in a separate path such as ~/FPGAProjects/[core-name], pick one of the following to ensure library files can be found:

  • Edit the build.bat/build.sh paths (see below for build.sh) to the absolute path of the lib and replay_lib directories.
  • Or, create two symbolic links within ~/FPGAProjects/ named “lib” and “replay_lib” to the ReplaySVN/hw/replay/cores/lib and ReplaySVN/hw/replay/cores/replay_lib directories.
  • Or, copy the ReplaySVN/hw/replay/cores/lib and ReplaySVN/hw/replay/cores/replay_lib directories into ~/FPGAProjects/

At time of writing, the public Replay SVN repository does not contain the getting-started core. Instead, download and extract this getting-started (zip) core into the ~/FPGAProjects/ directory or ReplaySVN/hw/replay/cores as appropriate and follow the below steps to setup a new copy called example_audio.

This version of the guide should be compatible with a checkout of the public Replay SVN repository “Revision: 132” or for those with access to the private repository, “Revision: 2106”.

As subsequent Framework updates may introduce incompatibilities with this guide, for an initial setup I recommend you use the exact revisions listed above. This will ensure you do not run into new issues that later commits may introduce before you have a complete picture of how everything fits together and a better chance of dealing with any problems that do arise.

Example Audio Core

Copy the getting_started/ folder and rename it example_audio then within example_audio

  1. rename the sdcard/replay.ini to sdcard/example_audio.ini
  2. Edit the example_audio.ini to set
    bin = example_audio.bin
  1. Rename the source/ files: - replay_example_core_pack to core_pack.vhd - replay_example_core_top to core_top.vhd - replay_example_top.vhd to example_audio_top.vhd
  2. In replay.prj rename the same source files as above.
  3. In example_audio_top.vhd rename the entity and architecture from Replay_Example_Top to Example_Audio_Top
  4. In core_top.vhd change the u_core instantiation to work.Example_Audio_Top

Windows users can skip to the Build Output section, as a build.bat already exists that you can use. Linux users will need a build.sh

Build Script

The getting_started core and hence our copy of it only includes a build script for Windows at this time. However, the “loader” core includes a Linux build script which with a few minor edits can be used to build the example_audio core. Copy the following into a build.sh file within your cores root directory (same folder as build.bat is contained within).

#!/bin/bash

if [ -d "/opt/Xilinx" ]; then
	XILINX_VERSIONS=(/opt/Xilinx/*)
	XILINX_PATH="${XILINX_VERSIONS[0]}"
	echo "Found $XILINX_PATH ..."
fi

if [ -z "$ISE_PATH" ]; then
	ISE_PATH="$XILINX_PATH/ISE_DS/" 
fi

if [ ! -d "$ISE_PATH" ]; then
  echo "ISE is not under $ISE_PATH ! Please adjust path in script or use ISE_PATH env!"
  exit 
fi

MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
  source "${ISE_PATH}settings64.sh"
else
  source "${ISE_PATH}settings32.sh"
fi

NAME="replay"
CORE="example_audio"
REPLAY_LIB_COMMON_PATH="./../../replay_lib/common"
REPLAY_LIB_PATH="./../../replay_lib/rtl"
LIB_PATH="./../../lib"

echo "---------------------------------------------------------"
echo "create build dir and copy files                          "
echo "---------------------------------------------------------"

mkdir -p build
cd build
pwd

cp $REPLAY_LIB_PATH/*.vhd ./

cp ./../source/*.vhd ./
#cp ./../source/*.edf ./

cp $REPLAY_LIB_COMMON_PATH/*.vhd ./
cp $REPLAY_LIB_COMMON_PATH/*.ut ./
cp $REPLAY_LIB_COMMON_PATH/replay_common.ucf ./

# chip scope
cp ./../cs/*.edn ./
cp ./../cs/*.ngc ./

# project files
cp ./../$NAME.ucf ./
cp ./../$NAME.scr ./
cp ./../$NAME.prj ./

echo "---------------------------------------------------------"
echo "xst                                                      "
echo "---------------------------------------------------------"

xst -ifn $NAME.scr -ofn $NAME.srp || exit $?

echo "---------------------------------------------------------"
echo "start ngdbuild                                           "
echo "---------------------------------------------------------"

ngdbuild -nt on -uc replay_common.ucf -uc $NAME.ucf $NAME.ngc $NAME.ngd || exit $?

echo "---------------------------------------------------------"
echo "start map                                                "
echo "---------------------------------------------------------"

map -pr b $NAME.ngd -o $NAME.ncd $NAME.pcf || exit $?

echo "---------------------------------------------------------"
echo "start par                                                "
echo "---------------------------------------------------------"

par -w -ol high $NAME.ncd $NAME.ncd $NAME.pcf || exit $?

echo "---------------------------------------------------------"
echo "start trce                                               "
echo "---------------------------------------------------------"

trce -v 10 -o $NAME.twr $NAME.ncd $NAME.pcf || exit $?

echo "---------------------------------------------------------"
echo "start bitgen                                             "
echo "---------------------------------------------------------"

bitgen $NAME.ncd $CORE.bit -w -f $NAME.ut || exit $?

cp $CORE.bin ../sdcard || exit $?

Build Output

Both the build.bat and build.sh are reasonably self explanatory. Command line builds make a “build/” directory within the core root and then copy all the vhdl, constraint and any other files needed to perform the build into that folder. Then each Xilinx tool is run in turn and the final “build/[core-name].bin” file will be copied into the sdcard/ folder.

The core name is the final change needed. In either build.bat or build.sh (whichever is suitable for your platform) edit the CORE = line and change it from “example” to “example_audio”. Finally in sdcard/ delete the existing example.bin and edit the replay.ini to change “bin = example.bin” to “bin = example_audio.bin”.

Assuming you’ve followed all the steps correctly, run build.bat or build.sh from within the ~/FPGAProjects/example_audio/ directory. If the build succeeds the sdcard/ directory will hold your resulting example_audio.bin file. That along with the replay.ini can now be transfered to an example_audio/ directory on your sd card and the target loaded. It should result in a black screen but with a working OSD (on screen display).

Next section Clock Frequency

Back to index