-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvivado_run.sh
executable file
·102 lines (83 loc) · 3.14 KB
/
vivado_run.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
DESIGN="fir_filter"
TOP_LEVEL="top_level"
export XILINX_VIVADO=/home/bcheng/workspace/tools/Xilinx/Vivado/2023.2
export PATH="$PATH:$XILINX_VIVADO/bin"
export JAVA_HOME=/home/bcheng/workspace/tools/Xilinx/Vivado/2023.2/tps/lnx64/jre17.0.7_7
export PATH="$JAVA_HOME/bin:$PATH"
export RAPIDWRIGHT_PATH=/home/bcheng/workspace/tools/RapidWright
export PATH="$PATH:$RAPIDWRIGHT_PATH/bin"
export CLASSPATH=$RAPIDWRIGHT_PATH/bin:$RAPIDWRIGHT_PATH/jars/*
export _JAVA_OPTIONS=-Xmx32736m
PROJ_DIR="/home/bcheng/workspace/dev/place-and-route"
SYNTH_TCL="$PROJ_DIR/tcl/synth.tcl"
PLACE_TCL="$PROJ_DIR/tcl/vivado_place.tcl"
ROUTE_TCL="$PROJ_DIR/tcl/vivado_route.tcl"
SIM_TCL="$PROJ_DIR/tcl/vivado_sim.tcl"
DESIGN_DIR="$PROJ_DIR/hdl/verilog/${DESIGN}"
start_stage=${1:-all} # Use first argument or defaults to all
check_exit_status() {
if [ $? -ne 0 ]; then
echo "$1 failed."
exit 1
fi
}
# Vivado Placement Stage
if [ "$start_stage" == "place" ] || [ "$start_stage" == "all" ]; then
echo "Running Vivado place..."
vivado -mode batch -source $PLACE_TCL -nolog -nojournal
check_exit_status "Vivado place"
echo "Vivado place completed. Check 'vivado_placed.dcp'."
fi
# Vivado Route Stage
if [ "$start_stage" == "route" ] || [ "$start_stage" == "all" ]; then
echo "Running Vivado route..."
vivado -mode batch -source $ROUTE_TCL -nolog -nojournal
check_exit_status "Vivado route"
echo "Vivado route completed. Check 'vivado_routed.dcp'."
fi
# Post-Implementation Timing Simulation
if [ "$start_stage" == "sim_postroute" ] || [ "$start_stage" == "all" ]; then
# cd "$DESIGN_DIR/sim_postroute"
# rm -r *
# cd $PROJ_DIR
echo "Running Post-Implementation Timing Simulation..."
vivado -mode batch -source $SIM_TCL -nolog -nojournal -tclargs $DESIGN $TOP_LEVEL
check_exit_status "Vivado sim"
cd "$DESIGN_DIR/python"
python3 sine.py
python3 weights.py
cd "$DESIGN_DIR/sim_postroute"
# xsim config tcl
cat <<EOL >xsim_cfg.tcl
log_wave -recursive *
run all
exit
EOL
# waveform tcl
cat <<EOL >waveform.tcl
create_wave_config; add_wave /; set_property needs_save false [current_wave_config]
EOL
echo "Beginning xvlog..."
xvlog "${TOP_LEVEL}_time_impl.v"
xvlog "$XILINX_VIVADO/data/verilog/src/glbl.v"
xvlog -sv "$DESIGN_DIR/verif/tb_${TOP_LEVEL}.sv"
# xvlog -sv "$PROJ_DIR/hdl/vhdl/counter/counter.srcs/sim_1/new/tb_postroute.sv"
echo "Beginning xelab..."
xelab \
-debug typical -relax -mt 8 -maxdelay \
-transport_int_delays \
-pulse_r 0 -pulse_int_r 0 -pulse_int_e 0 \
-timescale 1ns/1ps \
-snapshot "${TOP_LEVEL}_time_impl" -top "tb_${TOP_LEVEL}" \
-sdfroot "$DESIGN_DIR/sim_postroute/${TOP_LEVEL}_time_impl.sdf" \
-log elaborate.log \
-verbose 0 \
glbl
# -L xpm -L xil_defaultlib -L uvm -L secureip -L unisims_ver -L simprims_ver \
echo "Beginning xsim..."
xsim ${TOP_LEVEL}_time_impl -tclbatch xsim_cfg.tcl
xsim ${TOP_LEVEL}_time_impl.wdb -gui -tclbatch waveform.tcl
# source /home/bcheng/workspace/tools/oss-cad-suite/environment
# gtkwave waveform.vcd
fi