Files
Jungfraujoch/fpga/scripts/setup_action.sh
leonarski_f d315506633 * Enhancements for XFEL
* Enhancements for EIGER
* Writer is more flexible and capable of handling DECTRIS data
2024-03-05 20:41:47 +01:00

67 lines
1.9 KiB
Bash

#!/bin/bash
HLS_IP_DIR=$PWD/action/ip
rm -rf action
# Create directories
mkdir -p action/hw/tcl
mkdir -p action/hw/hdl
mkdir -p action/ip
mkdir -p action/scripts
for i in hls/psi_ch*.zip
do
x=${i##hls/psi_ch_}
y=${x%%.zip}
unzip -qq -d action/ip/$y $i
done
# Create (empty) Makefile
cat <<EOF > action/Makefile
hw:
echo -n ""
clean:
echo -n ""
EOF
cp ${SRC_DIR}/hdl/*.v action/hw/hdl
# Update action type and release level based on jfjoch_fpga.h
ACTION_TYPE=`grep "#define JFJOCH_FPGA_MAGIC" ${SRC_DIR}/include/jfjoch_fpga.h | awk -F"0x" '{print $2}'`
RELEASE_LEVEL=`grep "#define JFJOCH_FPGA_RELEASE" ${SRC_DIR}/include/jfjoch_fpga.h | awk -F"0x" '{print $2}'`
MAX_MODULES_FPGA=`grep "#define MAX_MODULES_FPGA" ${SRC_DIR}/include/jfjoch_fpga.h |tr -s " " |cut -f3 -d" "`
GIT_SHA1=`git describe --match=NeVeRmAtCh --always --abbrev=8`
SRC="define JFJOCH_MAGIC 32'h.*"
DST="define JFJOCH_MAGIC 32'h${ACTION_TYPE}"
sed -i "s/$SRC/$DST/" action/hw/hdl/action_config.v
SRC="define JFJOCH_RELEASE 32'h.*"
DST="define JFJOCH_RELEASE 32'h${RELEASE_LEVEL}"
sed -i "s/$SRC/$DST/" action/hw/hdl/action_config.v
SRC="define JFJOCH_VARIANT 32'h.*"
DST="define JFJOCH_VARIANT 32'h${VARIANT}"
sed -i "s/$SRC/$DST/" action/hw/hdl/action_config.v
SRC="define GIT_SHA1 32'h.*"
DST="define GIT_SHA1 32'h${GIT_SHA1}"
sed -i "s/$SRC/$DST/" action/hw/hdl/action_config.v
TIME_EPOCH=`date +%s`
SRC="define JFJOCH_SYNTH_TIME 32'd*"
DST="define JFJOCH_SYNTH_TIME 32'd${TIME_EPOCH}"
sed -i "s/$SRC/$DST/" action/hw/hdl/action_config.v
SRC="define MAX_MODULES_FPGA 32'd.*"
DST="define MAX_MODULES_FPGA 32'd${MAX_MODULES_FPGA}"
sed -i "s/$SRC/$DST/" action/hw/hdl/action_config.v
cp ${SRC_DIR}/scripts/synth_and_impl.tcl action/scripts/synth_and_impl.tcl
sed -i "s,@GIT_SHA1@,${GIT_SHA1}," action/scripts/synth_and_impl.tcl
sed -i "s,@RELEASE_LEVEL@,${RELEASE_LEVEL}," action/scripts/synth_and_impl.tcl