aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples/rfnoc-example/cmake/Modules
diff options
context:
space:
mode:
authorSugandha Gupta <sugandha.gupta@ettus.com>2019-10-15 11:52:46 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 12:21:32 -0800
commita801d6b046743140e9a50c7788dd17dd71f5540a (patch)
tree58d164e1b4cb2a8d871ca532287699f3912ae3d8 /host/examples/rfnoc-example/cmake/Modules
parent2a7e69d862f661075b98bab19e58d958c28a9af8 (diff)
downloaduhd-a801d6b046743140e9a50c7788dd17dd71f5540a.tar.gz
uhd-a801d6b046743140e9a50c7788dd17dd71f5540a.tar.bz2
uhd-a801d6b046743140e9a50c7788dd17dd71f5540a.zip
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 <martin.braun@ettus.com> Co-Authored-By: Wade Fife <wade.fife@ni.com>
Diffstat (limited to 'host/examples/rfnoc-example/cmake/Modules')
-rwxr-xr-xhost/examples/rfnoc-example/cmake/Modules/run_testbench.sh.in69
1 files changed, 69 insertions, 0 deletions
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