roi_harness utility scripts Signed-off-by: John McMaster <johndmcmaster@gmail.com>
diff --git a/minitests/partial_reconfig_flow/v2bit.sh b/minitests/partial_reconfig_flow/v2bit.sh new file mode 100755 index 0000000..c331cbf --- /dev/null +++ b/minitests/partial_reconfig_flow/v2bit.sh
@@ -0,0 +1,39 @@ +set -ex + +fin=$1 +if [ -z "$fin" ] ; then + echo "need fin arg" + exit +fi +# fin=roi_blinky.v +prefix=$(echo $fin |sed "s/\.v//") +if [ "$fin" = "$prefix" ] ; then + echo "bad prefix" + exit +fi +echo "$fin => $prefix" + +make +mkdir -p $prefix + +vivado -mode batch -source /dev/stdin <<EOF +read_verilog $prefix.v +synth_design -mode out_of_context -top roi -part \$::env(XRAY_PART) +write_checkpoint -force $prefix.dcp + +open_checkpoint harness_routed.dcp +read_checkpoint -cell roi $prefix.dcp +opt_design +place_design +route_design +write_checkpoint -force ${prefix}_routed.dcp +write_bitstream -force ${prefix}_routed.bit +EOF + +make ${prefix}_routed.fasm +make ${prefix}_routed.hand_crafted.bit + +# Program +bit_fn=${prefix}_routed.hand_crafted.bit +openocd -f $XRAY_DIR/minitests/roi_harness/openocd-basys3.cfg -c "init; pld load 0 $bit_fn; exit" +
diff --git a/minitests/roi_harness/fasm2bit.sh b/minitests/roi_harness/fasm2bit.sh new file mode 100755 index 0000000..0f06466 --- /dev/null +++ b/minitests/roi_harness/fasm2bit.sh
@@ -0,0 +1,48 @@ +# Example pre-req +# ./runme.sh +# XRAY_ROIV=roi_inv.v XRAY_FIXED_XDC=out_xc7a35tcpg236-1_BASYS3-SWBUT_roi_basev/fixed_noclk.xdc ./runme.sh + +set -ex + +fasm_in=$1 +if [ -z "$fasm_in" ] ; then + echo "need .fasm arg" + exit +fi +bit_in=$2 +if [ -z "$bit_in" ] ; then + echo "need .bit arg" + exit +fi + +echo "Design .fasm: $fasm_in" +echo "Harness .bit: $bit_in" + +${XRAY_DIR}/tools/fasm2frame.py $fasm_in roi_partial.frm + +${XRAY_TOOLS_DIR}/xc7patch \ + --part_file ${XRAY_PART_YAML} \ + --bitstream_file $bit_in \ + --frm_file roi_partial.frm \ + --output_file patched.bin + +# WARNING: these values need to be tweaked if anything about the +# Vivado-generated design changes. +xxd -p -l 0x147 $bit_in | xxd -r -p - init_sequence.bit + +# WARNING: these values need to be tweaked if anything about the +# Vivado-generated design changes. +xxd -p -s 0x18 patched.bin | xxd -r -p - no_headers.bin + +# WARNING: these values need to be tweaked if anything about the +# Vivado-generated design changes. +xxd -p -s 0x216abf $bit_in | \ + tr -d '\n' | \ + sed -e 's/30000001.\{8\}/3000800100000007/g' | \ + fold -w 40 | \ + xxd -r -p - final_sequence.bin + +cat init_sequence.bit no_headers.bin final_sequence.bin >hand_crafted.bit + +openocd -f openocd-basys3.cfg -c "init; pld load 0 hand_crafted.bit; exit" +