Reputation: 27636
I've used write_project_tcl
to create a TCL script from a Vivado project which can then be used to re-create the project's structure. If I run the script via vivado -mode batch
, it creates a directory structure and copies source HDL files into these newly created directories. Here's the relevant part of the directory tree:
$ tree SpaceInvaders.srcs/sources_1/imports/
SpaceInvaders.srcs/sources_1/imports/
└── _build-vivado
├── clash-syn
│ └── verilog
│ └── SpaceInvaders
│ └── SpaceInvaders
│ ├── SpaceInvaders.v
│ ├── image.hex
│ ├── null-SpaceInvaders-0-1024x8.hex
│ └── null-SpaceInvaders-1-7168x8.hex
└── xilinx-vivado
└── src-hdl
└── Top.v
Now I would like to change the script so that the source files are not copied over; instead, I'd like the generated .xpr
project file to reference them in their original location.
The part of the TCL script that currently copies sources over is this bit:
# Set 'sources_1' fileset object
set obj [get_filesets sources_1]
# Import local files from the original project
set files [list \
[file normalize "${origin_dir}/src-hdl/Top.v" ]\
[file normalize "${origin_dir}/../clash-syn/verilog/SpaceInvaders/SpaceInvaders/SpaceInvaders.v" ]\
[file normalize "${origin_dir}/../clash-syn/verilog/SpaceInvaders/SpaceInvaders/image.hex" ]\
[file normalize "${origin_dir}/../clash-syn/verilog/SpaceInvaders/SpaceInvaders/null-SpaceInvaders-0-1024x8.hex" ]\
[file normalize "${origin_dir}/../clash-syn/verilog/SpaceInvaders/SpaceInvaders/null-SpaceInvaders-1-7168x8.hex" ]\
]
set imported_files [import_files -fileset sources_1 $files]
# Set 'sources_1' fileset file properties for remote files
# None
# Set 'sources_1' fileset file properties for local files
# None
# Set 'sources_1' fileset properties
set obj [get_filesets sources_1]
set_property -name "top" -value "Top" -objects $obj
# Set 'sources_1' fileset object
set obj [get_filesets sources_1]
# Import local files from the original project
set files [list \
[file normalize "${origin_dir}/ip/ClockWiz25.xci" ]\
]
set imported_files [import_files -fileset sources_1 $files]
# Set 'sources_1' fileset file properties for remote files
# None
# Set 'sources_1' fileset file properties for local files
set file "ClockWiz25/ClockWiz25.xci"
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "generate_files_for_reference" -value "0" -objects $file_obj
set_property -name "registered_with_manager" -value "1" -objects $file_obj
if { ![get_property "is_locked" $file_obj] } {
set_property -name "synth_checkpoint_mode" -value "Singular" -objects $file_obj
}
Just based on that comment in the file, I guess it would be a "remote source" that I'd like to use?
Upvotes: 0
Views: 3816
Reputation: 27636
I was able to do this by replacing lines like
set imported_files [import_files -fileset sources_1 $files]
with
add_files -norecurse -fileset $obj $files
With this, the files are referenced in the resulting project file by their original path.
Upvotes: 3