]> rtime.felk.cvut.cz Git - fpga/zynq/canbench-sw.git/blob - system/script/recreate.tcl
added system and petalinux configuration, scripts, makefiles
[fpga/zynq/canbench-sw.git] / system / script / recreate.tcl
1 #
2 # Vivado (TM) v2015.4 (64-bit)
3 #
4 # recreate.tcl: Tcl script for re-creating project 'canbench'
5 #
6 # Generated by Vivado on Fri Mar 25 10:03:14 CET 2016
7 # IP Build 1412160 on Tue Nov 17 13:47:24 MST 2015
8 #
9 # This file contains the Vivado Tcl commands for re-creating the project to the state*
10 # when this script was generated. In order to re-create the project, please source this
11 # file in the Vivado Tcl Shell.
12 #
13 # * Note that the runs in the created project will be configured the same way as the
14 #   original project, however they will not be launched automatically. To regenerate the
15 #   run results please launch the synthesis/implementation runs as needed.
16 #
17 #*****************************************************************************************
18 # NOTE: In order to use this script for source control purposes, please make sure that the
19 #       following files are added to the source control system:-
20 #
21 # 1. This project restoration tcl script (recreate.tcl) that was generated.
22 #
23 # 2. The following source(s) files that were local or imported into the original project.
24 #    (Please see the '$orig_proj_dir' and '$origin_dir' variable setting below at the start of the script)
25 #
26 #    <none>
27 #
28 # 3. The following remote source files that were added to the original project:-
29 #
30 #    "/home/martin/projects/cvut/bakalarka/canbench-sw/system/src/top/top.bd"
31 #    "/home/martin/projects/cvut/bakalarka/canbench-sw/system/src/top/hdl/top_wrapper.vhd"
32 #    "/home/martin/projects/cvut/bakalarka/canbench-sw/system/project/canbench.srcs/constrs_1/new/top_wrapper.xdc"
33 #
34 #*****************************************************************************************
35
36 # Set the reference directory for source file relative paths (by default the value is script directory path)
37 set origin_dir "."
38
39 # Use origin directory path location variable, if specified in the tcl shell
40 if { [info exists ::origin_dir_loc] } {
41   set origin_dir $::origin_dir_loc
42 }
43
44 variable script_file
45 set script_file "recreate.tcl"
46
47 # Help information for this script
48 proc help {} {
49   variable script_file
50   puts "\nDescription:"
51   puts "Recreate a Vivado project from this script. The created project will be"
52   puts "functionally equivalent to the original project for which this script was"
53   puts "generated. The script contains commands for creating a project, filesets,"
54   puts "runs, adding/importing sources and setting properties on various objects.\n"
55   puts "Syntax:"
56   puts "$script_file"
57   puts "$script_file -tclargs \[--origin_dir <path>\]"
58   puts "$script_file -tclargs \[--help\]\n"
59   puts "Usage:"
60   puts "Name                   Description"
61   puts "-------------------------------------------------------------------------"
62   puts "\[--origin_dir <path>\]  Determine source file paths wrt this path. Default"
63   puts "                       origin_dir path value is \".\", otherwise, the value"
64   puts "                       that was set with the \"-paths_relative_to\" switch"
65   puts "                       when this script was generated.\n"
66   puts "\[--help\]               Print help information for this script"
67   puts "-------------------------------------------------------------------------\n"
68   exit 0
69 }
70
71 if { $::argc > 0 } {
72   for {set i 0} {$i < [llength $::argc]} {incr i} {
73     set option [string trim [lindex $::argv $i]]
74     switch -regexp -- $option {
75       "--origin_dir" { incr i; set origin_dir [lindex $::argv $i] }
76       "--help"       { help }
77       default {
78         if { [regexp {^-} $option] } {
79           puts "ERROR: Unknown option '$option' specified, please type '$script_file -tclargs --help' for usage info.\n"
80           return 1
81         }
82       }
83     }
84   }
85 }
86
87 # Set the directory path for the original project from where this script was exported
88 set orig_proj_dir "[file normalize "$origin_dir/../project"]"
89
90 # Create project
91 create_project canbench ../project
92
93 # Set the directory path for the new project
94 set proj_dir [get_property directory [current_project]]
95
96 # Set project properties
97 set obj [get_projects canbench]
98 set_property "board_part" "em.avnet.com:microzed_7010:part0:1.0" $obj
99 set_property "default_lib" "xil_defaultlib" $obj
100 set_property "sim.ip.auto_export_scripts" "1" $obj
101 set_property "simulator_language" "Mixed" $obj
102
103 # Create 'sources_1' fileset (if not found)
104 if {[string equal [get_filesets -quiet sources_1] ""]} {
105   create_fileset -srcset sources_1
106 }
107
108 # Set IP repository paths
109 set obj [get_filesets sources_1]
110 set_property "ip_repo_paths" "[file normalize "$origin_dir/../ip/can_merge"]" $obj
111
112 # Rebuild user ip_repo's index before adding any source files
113 update_ip_catalog -rebuild
114
115 # Set 'sources_1' fileset object
116 set obj [get_filesets sources_1]
117 set files [list \
118  "[file normalize "$origin_dir/../src/top/top.bd"]"\
119  "[file normalize "$origin_dir/../src/top/hdl/top_wrapper.vhd"]"\
120 ]
121 add_files -norecurse -fileset $obj $files
122
123 # Set 'sources_1' fileset file properties for remote files
124 set file "$origin_dir/../src/top/top.bd"
125 set file [file normalize $file]
126 set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
127 if { ![get_property "is_locked" $file_obj] } {
128   set_property "generate_synth_checkpoint" "0" $file_obj
129 }
130
131 set file "$origin_dir/../src/top/hdl/top_wrapper.vhd"
132 set file [file normalize $file]
133 set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
134 set_property "file_type" "VHDL" $file_obj
135
136
137 # Set 'sources_1' fileset file properties for local files
138 # None
139
140 # Set 'sources_1' fileset properties
141 set obj [get_filesets sources_1]
142 set_property "top" "top_wrapper" $obj
143 set_property elab_link_dcps false $obj
144
145 # Create 'constrs_1' fileset (if not found)
146 if {[string equal [get_filesets -quiet constrs_1] ""]} {
147   create_fileset -constrset constrs_1
148 }
149
150 # Set 'constrs_1' fileset object
151 set obj [get_filesets constrs_1]
152
153 # Add/Import constrs file and set constrs file properties
154
155 # Set 'constrs_1' fileset properties
156
157 # Create 'sim_1' fileset (if not found)
158 if {[string equal [get_filesets -quiet sim_1] ""]} {
159   create_fileset -simset sim_1
160 }
161
162 # Set 'sim_1' fileset object
163 set obj [get_filesets sim_1]
164 # Empty (no sources present)
165
166 # Set 'sim_1' fileset properties
167 set obj [get_filesets sim_1]
168 set_property "top" "top_wrapper" $obj
169 set_property "xelab.nosort" "1" $obj
170 set_property "xelab.unifast" "" $obj
171
172 # Create 'synth_1' run (if not found)
173 if {[string equal [get_runs -quiet synth_1] ""]} {
174   create_run -name synth_1 -part xc7z010clg400-1 -flow {Vivado Synthesis 2015} -strategy "Vivado Synthesis Defaults" -constrset constrs_1
175 } else {
176   set_property strategy "Vivado Synthesis Defaults" [get_runs synth_1]
177   set_property flow "Vivado Synthesis 2015" [get_runs synth_1]
178 }
179 set obj [get_runs synth_1]
180
181 # set the current synth run
182 current_run -synthesis [get_runs synth_1]
183
184 # Create 'impl_1' run (if not found)
185 if {[string equal [get_runs -quiet impl_1] ""]} {
186   create_run -name impl_1 -part xc7z010clg400-1 -flow {Vivado Implementation 2015} -strategy "Vivado Implementation Defaults" -constrset constrs_1 -parent_run synth_1
187 } else {
188   set_property strategy "Vivado Implementation Defaults" [get_runs impl_1]
189   set_property flow "Vivado Implementation 2015" [get_runs impl_1]
190 }
191 set obj [get_runs impl_1]
192 set_property "steps.write_bitstream.args.readback_file" "0" $obj
193 set_property "steps.write_bitstream.args.verbose" "0" $obj
194
195 # set the current impl run
196 current_run -implementation [get_runs impl_1]
197
198 puts "INFO: Project created:canbench"