-
Notifications
You must be signed in to change notification settings - Fork 0
/
vivado.tcl
122 lines (121 loc) · 5.42 KB
/
vivado.tcl
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
proc dump_statistics { } {
set util_rpt [report_utilization -return_string]
set LUTFFPairs 0
set SliceRegisters 0
set Slice 0
set SliceLUTs 0
set SliceLUTs1 0
set BRAMFIFO36 0
set BRAMFIFO18 0
set BRAMFIFO36_star 0
set BRAMFIFO18_star 0
set BRAM18 0
set BRAMFIFO 0
set BIOB 0
set DSPs 0
set TotPower 0
set design_slack 0
set design_req 0
set design_delay 0
regexp -- {\s*LUT Flip Flop Pairs\s*\|\s*([^[:blank:]]+)} $util_rpt ignore LUTFFPairs
regexp -- {\s*Slice Registers\s*\|\s*([^[:blank:]]+)} $util_rpt ignore SliceRegisters
regexp -- {\s*Slice\s*\|\s*([^[:blank:]]+)} $util_rpt ignore Slice
regexp -- {\s*Slice LUTs\s*\|\s*([^[:blank:]]+)} $util_rpt ignore SliceLUTs
regexp -- {\s*Slice LUTs\*\s*\|\s*([^[:blank:]]+)} $util_rpt ignore SliceLUTs1
if { [expr {$LUTFFPairs == 0}] } {
set LUTFFPairs $SliceLUTs1
puts $SliceLUTs1
}
if { [expr {$SliceLUTs == 0}] } {
set SliceLUTs $SliceLUTs1
}
regexp -- {\s*RAMB36/FIFO36\s*\|\s*([^[:blank:]]+)} $util_rpt ignore BRAMFIFO36
regexp -- {\s*RAMB18/FIFO18\s*\|\s*([^[:blank:]]+)} $util_rpt ignore BRAMFIFO18
regexp -- {\s*RAMB36/FIFO\*\s*\|\s*([^[:blank:]]+)} $util_rpt ignore BRAMFIFO36_star
regexp -- {\s*RAMB18/FIFO\*\s*\|\s*([^[:blank:]]+)} $util_rpt ignore BRAMFIFO18_star
regexp -- {\s*RAMB18\s*\|\s*([^[:blank:]]+)} $util_rpt ignore BRAM18
set BRAMFIFO [expr {(2 *$BRAMFIFO36) + $BRAMFIFO18 + (2*$BRAMFIFO36_star) + $BRAMFIFO18_star + $BRAM18}]
regexp -- {\s*Bonded IOB\s*\|\s*([^[:blank:]]+)} $util_rpt ignore BIOB
regexp -- {\s*DSPs\s*\|\s*([^[:blank:]]+)} $util_rpt ignore DSPs
set power_rpt [report_power -return_string]
regexp -- {\s*Total On-Chip Power \(W\)\s*\|\s*([^[:blank:]]+)} $power_rpt ignore TotPower
set Timing_Paths [get_timing_paths -max_paths 1 -nworst 1 -setup]
if { [expr {$Timing_Paths == ""}] } {
set design_slack 0
set design_req 0
} else {
set design_slack [get_property SLACK $Timing_Paths]
set design_req [get_property REQUIREMENT $Timing_Paths]
}
if { [expr {$design_slack == ""}] } {
set design_slack 0
}
if { [expr {$design_req == ""}] } {
set design_req 0
}
set design_delay [expr {$design_req - $design_slack}]
file delete -force HLS_output//Synthesis/vivado_flow/kernel_report.xml
set ofile_report [open HLS_output//Synthesis/vivado_flow/kernel_report.xml w]
puts $ofile_report "<?xml version=\"1.0\"?>"
puts $ofile_report "<document>"
puts $ofile_report " <application>"
puts $ofile_report " <section stringID=\"XILINX_SYNTHESIS_SUMMARY\">"
puts $ofile_report " <item stringID=\"XILINX_LUT_FLIP_FLOP_PAIRS_USED\" value=\"$LUTFFPairs\"/>"
puts $ofile_report " <item stringID=\"XILINX_SLICE\" value=\"$Slice\"/>"
puts $ofile_report " <item stringID=\"XILINX_SLICE_REGISTERS\" value=\"$SliceRegisters\"/>"
puts $ofile_report " <item stringID=\"XILINX_SLICE_LUTS\" value=\"$SliceLUTs\"/>"
puts $ofile_report " <item stringID=\"XILINX_BLOCK_RAMFIFO\" value=\"$BRAMFIFO\"/>"
puts $ofile_report " <item stringID=\"XILINX_IOPIN\" value=\"$BIOB\"/>"
puts $ofile_report " <item stringID=\"XILINX_DSPS\" value=\"$DSPs\"/>"
puts $ofile_report " <item stringID=\"XILINX_POWER\" value=\"$TotPower\"/>"
puts $ofile_report " <item stringID=\"XILINX_DESIGN_DELAY\" value=\"$design_delay\"/>"
puts $ofile_report " </section>"
puts $ofile_report " </application>"
puts $ofile_report "</document>"
close $ofile_report
}; #END PROC
set_param general.maxThreads 1
set outputDir HLS_output//Synthesis/vivado_flow
file mkdir $outputDir
create_project kernel -part xc7z020clg484-1 -force
read_verilog top.v
read_vhdl fp_mult_expr_FU_32_32_400.vhdl
read_vhdl fp_plus_expr_FU_32_32_300.vhdl
read_vhdl top.vhd
set rfile_sdc [open HLS_output//Synthesis/vivado_flow/kernel.sdc r]
set clk_constraint [regexp -all -- CLK_SRC [read $rfile_sdc [file size HLS_output//Synthesis/vivado_flow/kernel.sdc]]]
if { [expr {$clk_constraint == 0}] } {
set ofile_sdc [open HLS_output//Synthesis/vivado_flow/kernel.sdc a]
puts $ofile_sdc "set_property HD.CLK_SRC BUFGCTRL_X0Y0 \[get_ports clock\]"
close $ofile_sdc
}
read_xdc HLS_output//Synthesis/vivado_flow/kernel.sdc
synth_design -mode out_of_context -no_iobuf -top kernel -part xc7z020clg484-1
write_checkpoint -force $outputDir/post_synth.dcp
report_timing_summary -file $outputDir/post_synth_timing_summary.rpt
report_utilization -file $outputDir/post_synth_util.rpt
dump_statistics
opt_design
dump_statistics
report_utilization -file $outputDir/post_opt_design_util.rpt
place_design -directive Explore
report_clock_utilization -file $outputDir/clock_util.rpt
# Optionally run optimization if there are timing violations after placement
if {[get_property SLACK [get_timing_paths -max_paths 1 -nworst 1 -setup]] < 0.5} {
puts "Found setup timing violations => running physical optimization"
phys_opt_design
}
write_checkpoint -force $outputDir/post_place.dcp
report_utilization -file $outputDir/post_place_util.rpt
report_timing_summary -file $outputDir/post_place_timing_summary.rpt
dump_statistics
route_design -directive Explore
write_checkpoint -force $outputDir/post_route.dcp
report_route_status -file $outputDir/post_route_status.rpt
report_timing_summary -file $outputDir/post_route_timing_summary.rpt
report_power -file $outputDir/post_route_power.rpt
report_drc -file $outputDir/post_imp_drc.rpt
report_utilization -file $outputDir/post_route_util.rpt
dump_statistics
close_design
close_project