Repository navigation
Expand file tree
/
Copy pathbitstream.tcl
More file actions
55 lines (49 loc) · 2.1 KB
/
Copy pathbitstream.tcl
File metadata and controls
55 lines (49 loc) · 2.1 KB
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
#------------------------------------------------------------------------------
# Vivado Bitstream Generation Script
#------------------------------------------------------------------------------
set script_dir [file dirname [info script]]
set proj_root [file normalize "$script_dir/.."]
set build_dir "$proj_root/build"
if {[llength $argv] >= 1} {
set top_module [lindex $argv 0]
} else {
set top_module "top_spi"
}
if {[llength $argv] >= 2} {
set route_dcp [lindex $argv 1]
} else {
set route_dcp "post_route.dcp"
}
puts "Bitstream top module: $top_module"
#------------------------------------------------------------------------------
# Open Routed Checkpoint
#------------------------------------------------------------------------------
puts "Opening routed checkpoint..."
open_checkpoint "$build_dir/$route_dcp"
#------------------------------------------------------------------------------
# Generate Bitstream
#------------------------------------------------------------------------------
if {$top_module eq "top_uart_power"} {
if {[llength [get_clocks sys_clk]] != 1} {
error "Missing benchmark clock constraint"
}
foreach delay_type {max min} {
set worst_path [get_timing_paths -delay_type $delay_type -max_paths 1]
if {[llength $worst_path] == 0 || [get_property SLACK $worst_path] < 0} {
error "Power benchmark has failing or missing $delay_type timing; refusing bitstream"
}
}
}
puts "Generating bitstream..."
write_bitstream -force "$build_dir/${top_module}.bit"
#------------------------------------------------------------------------------
# Generate Flash Binary (SPI x4, 16MB flash)
#------------------------------------------------------------------------------
puts "Generating flash binary..."
write_cfgmem -format bin -interface spix4 -size 16 \
-loadbit "up 0x0 $build_dir/${top_module}.bit" \
-force -file "$build_dir/${top_module}.bin"
puts "========================================="
puts "Bitstream: $build_dir/${top_module}.bit"
puts "Flash bin: $build_dir/${top_module}.bin"
puts "========================================="