generated from maddiebusig/vivado-template-hog
104 lines
2.7 KiB
Tcl
104 lines
2.7 KiB
Tcl
set gitroot [exec git rev-parse --show-toplevel]
|
|
set hogroot "$gitroot/Hog"
|
|
|
|
puts "Hog root: $hogroot"
|
|
|
|
puts "Sourcing hog.tcl"
|
|
|
|
# Using ReadConf
|
|
source -notrace "$hogroot/Tcl/hog.tcl"
|
|
|
|
if { $argc < 1 } {
|
|
puts "Usage: vivado -mode batch -source package_ip.tcl -tclargs PROJECT_NAME"
|
|
exit -1
|
|
}
|
|
|
|
set proj_name [lindex $argv 0]
|
|
set tmp_proj_name "tmp_$proj_name"
|
|
|
|
puts "Packaging $proj_name"
|
|
|
|
set proj_top_dir "$gitroot/Top/$proj_name"
|
|
set proj_dir "$gitroot/Projects/$proj_name"
|
|
set proj_file "$proj_dir/$proj_name.xpr"
|
|
|
|
set ip_conf_file "$proj_top_dir/ip.conf"
|
|
|
|
puts "Reading configuration file $ip_conf_file"
|
|
|
|
set ip_conf [ReadConf "$ip_conf_file"]
|
|
|
|
puts "IP Configuration: $ip_conf"
|
|
|
|
if { [dict exists $ip_conf main] == 0 } {
|
|
puts "No main section in IP configuration!"
|
|
exit -2
|
|
}
|
|
|
|
set ip_root "$gitroot/[dict get $ip_conf main ROOT]"
|
|
set ip_vendor [dict get $ip_conf main VENDOR]
|
|
set ip_library [dict get $ip_conf main LIBRARY]
|
|
set ip_taxonomy [dict get $ip_conf main TAXONOMY]
|
|
|
|
puts "Opening project $proj_file"
|
|
open_project "$proj_file"
|
|
|
|
puts "Packaging project"
|
|
|
|
ipx::package_project -root_dir "$ip_root" -vendor "$ip_vendor" -library "$ip_library" -taxonomy "$ip_taxonomy" -import_files -set_current false
|
|
|
|
set ip_component_file "$ip_root/component.xml"
|
|
|
|
puts "Unloading core"
|
|
|
|
ipx::unload_core "$ip_component_file"
|
|
ipx::edit_ip_in_project -name "$tmp_proj_name" -upgrade true -directory "$ip_root" "$ip_component_file"
|
|
update_compile_order -fileset sources_1
|
|
|
|
current_project "$tmp_proj_name"
|
|
|
|
# Remove inferred interfaces and memory maps. Start from a blank slate.
|
|
|
|
puts "Removing inferred interfaces"
|
|
|
|
foreach iface [ipx::get_bus_interfaces -of_objects [ipx::current_core]] {
|
|
set iface_name [lindex $iface 2]
|
|
puts "Removing inferred bus interface $iface_name"
|
|
ipx::remove_bus_interface $iface_name [ipx::current_core]
|
|
}
|
|
|
|
foreach memmap [ipx::get_memory_maps -of_objects [ipx::current_core]] {
|
|
set memmap_name [lindex $memmap 2]
|
|
puts "Removing inferred memory map $memmap_name"
|
|
ipx::remove_memory_map $memmap_name [ipx::current_core]
|
|
}
|
|
|
|
foreach param [ipx::get_user_parameters -of_objects [ipx::current_core]] {
|
|
set param_name [lindex $param 2]
|
|
|
|
if { $param_name == "Component_Name" } {
|
|
continue
|
|
}
|
|
|
|
puts "Removing inferred user parameter $param_name"
|
|
ipx::remove_user_parameter $param_name [ipx::current_core]
|
|
}
|
|
|
|
puts "Packaging IP"
|
|
|
|
# Increment revision
|
|
set rev [get_property core_revision [ipx::current_core]]
|
|
incr rev
|
|
set_property core_revision $rev [ipx::current_core]
|
|
|
|
ipx::update_source_project_archive -component [ipx::current_core]
|
|
ipx::create_xgui_files [ipx::current_core]
|
|
ipx::update_checksums [ipx::current_core]
|
|
ipx::check_integrity [ipx::current_core]
|
|
ipx::save_core [ipx::current_core]
|
|
|
|
close_project
|
|
|
|
puts "Done"
|
|
|