-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgen_tcl.sh
executable file
·86 lines (76 loc) · 2.89 KB
/
gen_tcl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/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}]
"
}
function list_sources () {
find ${proj_dir}/*.srcs -regex '^.*\.s?vh?$' -exec echo add_files \{\} \;
find ${proj_dir}/*.srcs -regex '^.*\.o?cc?p?p?x?x?$' -exec echo add_files \{\} \;
find ${proj_dir}/*.srcs -regex '^.*\.hh?p?p?x?x?$' -exec echo add_files \{\} \;
}
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}
`list_sources`
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"
proj_dir=`dirname ${xpr}`
echo "open_project ${xpr}
`list_sources`
start_gui"
elif [[ $1 == init-project ]]; then
proj_name="$2"
proj_dir="$3"
part_name="$4" # xc7a100tcsg324-1
echo "# Generated by Vivado wrapper, licensed under GPL 3.0
# Copyright (C) Recolic Keghart <root@recolic.net>
create_project ${proj_name} ${proj_dir} -part ${part_name}
file mkdir ${proj_dir}/${proj_name}.srcs/constrs_1/new
close [ open ${proj_dir}/${proj_name}.srcs/constrs_1/new/constraint.xdc w ]
add_files -fileset constrs_1 ${proj_dir}/${proj_name}.srcs/constrs_1/new/constraint.xdc"
rm -f ${proj_dir}/${proj_name}.srcs/constrs_1/new/constraint.xdc
rm -rf ${proj_dir}/${proj_name}.cache/*
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