#!/bin/bash

# Assume vivado 2018.2

# usage: ./ci-scripts/rebuild_nonIQModInterp2FIR.sh

set -e

# clone
mkdir update-nonIQModInterp2FIR
cd update-nonIQModInterp2FIR
git clone https://gitlab.cern.ch/BE-RF-PLDesign/Libraries/xilinx/nonIQModInterp2FIR.git

cd nonIQModInterp2FIR/Vivado/

rm -rf Work

# Adjust part_name
sed -i -e 's/set part_name xc.*/set part_name xc7k160tfbg676-2/' Options/build.tcl

vivado -mode tcl -source ../../../ci-scripts/rebuild_nonIQModInterp2FIR.tcl

# TODO: copy result (synth verilog file and vhdl wrapper)
# rename the wrapper module in the verilog file
