From a801d6b046743140e9a50c7788dd17dd71f5540a Mon Sep 17 00:00:00 2001 From: Sugandha Gupta Date: Tue, 15 Oct 2019 11:52:46 -0700 Subject: examples: Add example out-of-tree module for RFNoC modules This subdirectory is its own, self-contained project. It is supposed to work against the UHD version it is shipped with. Co-Authored-By: Martin Braun Co-Authored-By: Wade Fife --- .../cmake/Modules/run_testbench.sh.in | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 host/examples/rfnoc-example/cmake/Modules/run_testbench.sh.in (limited to 'host/examples/rfnoc-example/cmake/Modules') diff --git a/host/examples/rfnoc-example/cmake/Modules/run_testbench.sh.in b/host/examples/rfnoc-example/cmake/Modules/run_testbench.sh.in new file mode 100755 index 000000000..d1256cf97 --- /dev/null +++ b/host/examples/rfnoc-example/cmake/Modules/run_testbench.sh.in @@ -0,0 +1,69 @@ +#!@BASH@ + +if [[ ! $# -eq 4 ]]; then + echo "Usage: $0 uhd_fpga_dir test_device makefile_dir test_target" + echo "" + echo "Arguments:" + echo "- uhd_fpga_dir: Path to fpga repository (without usrp3/top)" + echo "- test_device: Device used for testing (e.g. x300, n3xx, e320)" + echo "- makefile_dir: Path to the directory with the testbench Makefile" + echo "- test_target: Test target (xsim, vsim)" + exit 0 +fi + +uhd_fpga_dir=$1 +uhd_fpga_dir_top=$uhd_fpga_dir/usrp3/top +test_device=$2 +test_target=$4 +makefile_dir=$3 +# Clear $# and pos args so setupenv.sh doesn't freak out +shift +shift +shift +shift + +# Need to convert device types to directory names +device_dir=$test_device +if [ $device_dir == "x310" ]; then + device_dir=x300 +fi +if [ $device_dir == "n300" ]; then + device_dir=n3xx +fi +if [ $device_dir == "n310" ]; then + device_dir=n3xx +fi +if [ $device_dir == "n320" ]; then + device_dir=n3xx +fi +if [ $device_dir == "e310" ]; then + device_dir=e31x +fi + +# Now check the paths are valid +if [ ! -r $uhd_fpga_dir_top/Makefile.common ]; then + echo "ERROR! '${uhd_fpga_dir_top}' is not a valid top-level FPGA directory." + exit 1 +fi +device_dir=$uhd_fpga_dir_top/$device_dir +if [ ! -r $device_dir/setupenv.sh ]; then + echo "ERROR! '${test_device}' is not a valid USRP device." + exit 1 +fi +echo "Using device directory: $device_dir" +if [ ! -r $makefile_dir/Makefile ]; then + echo "ERROR! '${makefile_dir}' does not point to an RFNoC block." + exit 1 +fi +# Check the Makefile actually contains a testbench target +if ! grep -q viv_simulator.mak $makefile_dir/Makefile; then + echo "ERROR! '${makefile_dir}/Makefile' does not contain a test target!." + exit 1 +fi + +# Load environment +echo "Loading environment from: '$device_dir/setupenv.sh'" +source $device_dir/setupenv.sh + +# And, go +make -C $makefile_dir $test_target UHD_FPGA_DIR=$uhd_fpga_dir || exit 1 -- cgit v1.2.3