-
-
Notifications
You must be signed in to change notification settings - Fork 53
/
create_project.tcl
135 lines (111 loc) · 4.47 KB
/
create_project.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Project F: Animated Shapes - Create Vivado Project (VGA)
# (C)2023 Will Green, open source hardware released under the MIT License
# Learn more at https://projectf.io/posts/animated-shapes/
puts "INFO: Project F - Animated Shapes Project Creation Script"
# render module version
set render_mods "320x180"
# If the FPGA board/part isn't set use Arty
if {! [info exists fpga_part]} {
set projf_fpga_part "xc7a35ticsg324-1L"
} else {
set projf_fpga_part ${fpga_part}
}
if {! [info exists board_name]} {
set projf_board_name "arty"
} else {
set projf_board_name ${board_name}
}
# Set the project name
set _xil_proj_name_ "animated-shapes-vga"
# Set the reference directories for source file relative paths
set lib_dir [file normalize "./../../../../lib"]
set origin_dir [file normalize "./../../"]
puts "INFO: Library directory: ${lib_dir}"
puts "INFO: Origin directory: ${origin_dir}"
# Set the directory path for the project
set orig_proj_dir "[file normalize "${origin_dir}/xc7/vivado"]"
# Create Vivado project
create_project ${_xil_proj_name_} ${orig_proj_dir} -part ${projf_fpga_part}
#
# Design sources
#
if {[string equal [get_filesets -quiet sources_1] ""]} {
create_fileset -srcset sources_1
}
set fs_design_obj [get_filesets sources_1]
# Top design sources (not used in simulation)
set top_sources [list \
[file normalize "${origin_dir}/xc7/top_demo.sv"] \
[file normalize "${origin_dir}/xc7/top_demo_sb.sv"] \
[file normalize "${origin_dir}/${render_mods}/render_cube_shatter.sv"] \
[file normalize "${origin_dir}/${render_mods}/render_square_colr.sv"] \
[file normalize "${origin_dir}/${render_mods}/render_teleport.sv"] \
]
add_files -norecurse -fileset $fs_design_obj $top_sources
set design_top_obj [get_files -of_objects [get_filesets sources_1]]
set_property -name "used_in_simulation" -value "0" -objects $design_top_obj
# Set top module for design sources
set_property -name "top" -value "top_demo" -objects $fs_design_obj
set_property -name "top_auto_set" -value "0" -objects $fs_design_obj
# Design sources (used in simulation)
set design_sources [list \
[file normalize "${lib_dir}/clock/xc7/clock_480p.sv"] \
[file normalize "${lib_dir}/clock/xc7/clock_sys.sv"] \
[file normalize "${lib_dir}/clock/xd.sv"] \
[file normalize "${lib_dir}/display/bitmap_addr.sv"] \
[file normalize "${lib_dir}/display/clut_simple.sv"] \
[file normalize "${lib_dir}/display/display_480p.sv"] \
[file normalize "${lib_dir}/display/linebuffer_simple.sv"] \
[file normalize "${lib_dir}/graphics/draw_line.sv"] \
[file normalize "${lib_dir}/graphics/draw_line_1d.sv"] \
[file normalize "${lib_dir}/graphics/draw_rectangle_fill.sv"] \
[file normalize "${lib_dir}/graphics/draw_triangle_fill.sv"] \
[file normalize "${lib_dir}/memory/bram_sdp.sv"] \
]
add_files -norecurse -fileset $fs_design_obj $design_sources
# Memory design sources
set mem_design_sources [list \
[file normalize "${lib_dir}/res/palettes/sweetie16_4b.mem"] \
]
add_files -norecurse -fileset $fs_design_obj $mem_design_sources
set design_mem_obj [get_files -of_objects [get_filesets sources_1] [list "*mem"]]
set_property -name "file_type" -value "Memory File" -objects $design_mem_obj
#
# Simulation Sources
#
# Create 'sim_1' fileset (if not found)
if {[string equal [get_filesets -quiet sim_1] ""]} {
create_fileset -simset sim_1
}
set fs_sim_obj [get_filesets sim_1]
# Generic simulation sources (to be updated with double-buffer tests)
set sim_sources [list \
[file normalize "${lib_dir}/display/display_24x18.sv"] \
[file normalize "${lib_dir}/display/xc7/display_480p_tb.sv"] \
[file normalize "${lib_dir}/display/xc7/vivado/display_480p_tb_behav.wcfg"] \
]
add_files -norecurse -fileset $fs_sim_obj $sim_sources
# Set 'sim_1' fileset properties
set_property -name "top" -value "display_480p_tb" -objects $fs_sim_obj
set_property -name "top_lib" -value "xil_defaultlib" -objects $fs_sim_obj
#
# Constraints
#
# Create 'constrs_1' fileset (if not found)
if {[string equal [get_filesets -quiet constrs_1] ""]} {
create_fileset -constrset constrs_1
}
set fs_constr_obj [get_filesets constrs_1]
set constr_sources [list \
[file normalize "$origin_dir/xc7/${projf_board_name}.xdc"] \
]
add_files -norecurse -fileset $fs_constr_obj $constr_sources
set constr_file_obj [get_files -of_objects [get_filesets constrs_1]]
set_property -name "file_type" -value "XDC" -objects $constr_file_obj
# unset Project F variables
unset projf_board_name
unset projf_fpga_part
#
# Done
#
puts "INFO: Project created: ${_xil_proj_name_}"