Skip to content
Snippets Groups Projects
Unverified Commit c0f5cfe0 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

init

parents
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
_tmp=`mktemp`
vivado_exec="/home/recolic/extraDisk/xilinx/Vivado/2018.1/bin/vivado"
`dirname $0`/gen_tcl.sh burn-file $1 > $_tmp
$vivado_exec -mode batch -source $_tmp
rm -f $_tmp
vivado_exec="/home/recolic/extraDisk/xilinx/Vivado/2018.1/bin/vivado"
sources=(main.sv lib/*)
constrain=(*.xdc)
top_module=test_main
thread_num=4
\ No newline at end of file
`include "macro.vh"
`ifdef TEST_MACRO
module test_lib(
input i,
output wire j
);
assign j = i * i;
endmodule // test_lib
`else
`endif
\ No newline at end of file
`define TEST_MACRO 427
\ No newline at end of file
`include "macro.vh"
module test_main (
output wire _j
);
wire _j_tmp = `TEST_MACRO;
test_lib _0(_j_tmp, _j);
endmodule
#!/bin/bash
function burn_file () {
bit_file="$1"
dev_name="$2" # Optional
echo "# Generated by Vivado wrapper, licensed under GPL 3.0
# Copyright (C) Recolic Keghart <root@recolic.net>
open_hw
connect_hw_server
open_hw_target
current_hw_device [get_hw_devices ${dev_name}]
refresh_hw_device -update_hw_probes false [lindex [get_hw_devices ${dev_name}] 0]
set_property PROBES.FILE {} [get_hw_devices ${dev_name}]
set_property FULL_PROBES.FILE {} [get_hw_devices ${dev_name}]
set_property PROGRAM.FILE {${bit_file}} [get_hw_devices ${dev_name}]
program_hw_devices [get_hw_devices ${dev_name}]
"
}
if [[ $1 == build ]]; then
xpr="$2"
run_name_synth="$3"
run_name_impl="$4"
to_step="$5"
top_mod="$6"
thread="$7"
proj_dir=`dirname ${xpr}`
echo "# Generated by Vivado wrapper, licensed under GPL 3.0
# Copyright (C) Recolic Keghart <root@recolic.net>
open_project ${xpr}
`find ${proj_dir}/*.srcs -regex '^.*\.s?v$' -exec echo add_files ./\{\} \;`
set_property top ${top_mod} [current_fileset]
reset_run ${run_name_synth}
reset_run ${run_name_impl}
launch_runs ${run_name_synth} -jobs ${thread}
wait_on_run ${run_name_synth}
launch_runs ${run_name_impl} -to_step ${to_step} -jobs ${thread}
wait_on_run ${run_name_impl}
"
elif [[ $1 == burn ]]; then
xpr="$2"
run_name_impl="$3"
top_mod="$4"
dev_name="$5" #Optional
proj_dir=`dirname ${xpr}`
bit_file=`ls ${proj_dir}/*.runs/${run_name_impl}/${top_mod}.bit`
[[ $bit_file == '' ]] && echo "bit_file not found in project. terminating..." && exit 3
burn_file $bit_file $dev_name
elif [[ $1 == burn-file ]]; then
burn_file $2 $3
elif [[ $1 == gui ]]; then
xpr="$2"
echo "open_project ${xpr}
start_gui"
else
echo "Usage: $0 build <xpr path> <run_name_synth> <run_name_impl> <to_step> <top module name> <threads_num>
$0 burn <xpr path> <run_name_impl> <top_module_name> <dev_name(Ex:xc7a100t_0)>"
exit 1
fi
main.sh 0 → 100644
#!/bin/bash
_vw_version_major="0"
_vw_version_minor="1"
_vw_version="${_vw_version_major}.${_vw_version_minor}"
[[ ${_vw_version_major} == 0 ]] && echo "Vivado wrapper is unfinished, and unable to work." && exit 11
function show_help () {
echo "Vivado wrapper ${_vw_version}
Usage:
$1 <SubCommand> [Args ...]
Run SubCommand.
$1 --help
Show this help message.
SubCommands:
build
Build current project, using ./Vivadofile as configuration file.
--top <top_module_name>
Override top module appointed in Vivadofile.
burn
Burn compiled top_module bit file to hardware board.
--top <top_module_name>
Override top module appointed in Vivadofile.
burn-file <file_name>
"
}
[[ $1 == '' ]] || [[ $1 == '--help' ]] &&
vivado_exec = /home/recolic/extraDisk/xilinx/Vivado/2018.1/bin/vivado
_tmp := $(shell mktemp)
build: clean
./gen_tcl.sh build $(xpr_path) synth_1 impl_1 write_bitstream $(top_module) 4 > $(_tmp)
$(vivado_exec) -mode batch -source $(_tmp)
rm -f $(_tmp)
burn: clean
./gen_tcl.sh burn $(xpr_path) impl_1 $(top_module) > $(_tmp)
$(vivado_exec) -mode batch -source $(_tmp)
rm -f $(_tmp)
gui: clean
./gen_tcl.sh gui $(xpr_path) > $(_tmp)
$(vivado_exec) -mode batch -source $(_tmp)
rm -f $(_tmp)
clean:
rm -f *.jou *.log *.str
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment