harv/script/project.tcl

310 lines
12 KiB
Tcl

#*****************************************************************************************
# Vivado (TM) v2020.2 (64-bit)
#
# project.tcl: Tcl script for re-creating project 'harv'
#
# Generated by Vivado on Tue Jun 15 18:52:54 CEST 2021
# IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
#
# This file contains the Vivado Tcl commands for re-creating the project to the state*
# when this script was generated. In order to re-create the project, please source this
# file in the Vivado Tcl Shell.
#
# * Note that the runs in the created project will be configured the same way as the
# original project, however they will not be launched automatically. To regenerate the
# run results please launch the synthesis/implementation runs as needed.
#
#*****************************************************************************************
# NOTE: In order to use this script for source control purposes, please make sure that the
# following files are added to the source control system:-
#
# 1. This project restoration tcl script (project.tcl) that was generated.
#
# 2. The following source(s) files that were local or imported into the original project.
# (Please see the '$orig_proj_dir' and '$origin_dir' variable setting below at the start of the script)
#
# "xilinx/sim_from_dump_behav.wcfg"
#
# 3. The following remote source files that were added to the original project:-
#
# "hdl/harv_pkg.vhd"
# "hdl/alu.vhd"
# "hdl/ft_components/alu_tmr.vhd"
# "hdl/control.vhd"
# "hdl/ft_components/control_tmr.vhd"
# "hdl/csr.vhd"
# "hdl/ft_components/hamming_pkg.vhd"
# "hdl/ft_components/hamming_decoder.vhd"
# "hdl/ft_components/hamming_encoder.vhd"
# "hdl/ft_components/hamming_register.vhd"
# "hdl/instr_fetch.vhd"
# "hdl/regfile.vhd"
# "hdl/harv.vhd"
# "sim/sim_from_dump.vhd"
#
#*****************************************************************************************
# Check file required for this script exists
proc checkRequiredFiles { origin_dir} {
set status true
set files [list \
"xilinx/sim_from_dump_behav.wcfg" \
]
foreach ifile $files {
if { ![file isfile $ifile] } {
puts " Could not find local file $ifile "
set status false
}
}
set files [list \
"hdl/harv_pkg.vhd" \
"hdl/alu.vhd" \
"hdl/ft_components/alu_tmr.vhd" \
"hdl/control.vhd" \
"hdl/ft_components/control_tmr.vhd" \
"hdl/csr.vhd" \
"hdl/ft_components/hamming_pkg.vhd" \
"hdl/ft_components/hamming_decoder.vhd" \
"hdl/ft_components/hamming_encoder.vhd" \
"hdl/ft_components/hamming_register.vhd" \
"hdl/instr_fetch.vhd" \
"hdl/regfile.vhd" \
"hdl/harv.vhd" \
"sim/sim_from_dump.vhd" \
]
foreach ifile $files {
if { ![file isfile $ifile] } {
puts " Could not find remote file $ifile "
set status false
}
}
return $status
}
# Set the reference directory for source file relative paths (by default the value is script directory path)
set origin_dir "."
# Use origin directory path location variable, if specified in the tcl shell
if { [info exists ::origin_dir_loc] } {
set origin_dir $::origin_dir_loc
}
# Set the project name
set _xil_proj_name_ "harv"
# Use project name variable, if specified in the tcl shell
if { [info exists ::user_project_name] } {
set _xil_proj_name_ $::user_project_name
}
variable script_file
set script_file "project.tcl"
# Help information for this script
proc print_help {} {
variable script_file
puts "\nDescription:"
puts "Recreate a Vivado project from this script. The created project will be"
puts "functionally equivalent to the original project for which this script was"
puts "generated. The script contains commands for creating a project, filesets,"
puts "runs, adding/importing sources and setting properties on various objects.\n"
puts "Syntax:"
puts "$script_file"
puts "$script_file -tclargs \[--origin_dir <path>\]"
puts "$script_file -tclargs \[--project_name <name>\]"
puts "$script_file -tclargs \[--help\]\n"
puts "Usage:"
puts "Name Description"
puts "-------------------------------------------------------------------------"
puts "\[--origin_dir <path>\] Determine source file paths wrt this path. Default"
puts " origin_dir path value is \".\", otherwise, the value"
puts " that was set with the \"-paths_relative_to\" switch"
puts " when this script was generated.\n"
puts "\[--project_name <name>\] Create project with the specified name. Default"
puts " name is the name of the project from where this"
puts " script was generated.\n"
puts "\[--help\] Print help information for this script"
puts "-------------------------------------------------------------------------\n"
exit 0
}
if { $::argc > 0 } {
for {set i 0} {$i < $::argc} {incr i} {
set option [string trim [lindex $::argv $i]]
switch -regexp -- $option {
"--origin_dir" { incr i; set origin_dir [lindex $::argv $i] }
"--project_name" { incr i; set _xil_proj_name_ [lindex $::argv $i] }
"--help" { print_help }
default {
if { [regexp {^-} $option] } {
puts "ERROR: Unknown option '$option' specified, please type '$script_file -tclargs --help' for usage info.\n"
return 1
}
}
}
}
}
# Set the directory path for the original project from where this script was exported
set orig_proj_dir "[file normalize "$origin_dir/xilinx"]"
# Check for paths and files needed for project creation
set validate_required 0
if { $validate_required } {
if { [checkRequiredFiles $origin_dir] } {
puts "Tcl file $script_file is valid. All files required for project creation is accesable. "
} else {
puts "Tcl file $script_file is not valid. Not all files required for project creation is accesable. "
return
}
}
# Create project
create_project ${_xil_proj_name_} "xilinx/" -part xc7z020clg484-1
# Set the directory path for the new project
set proj_dir [get_property directory [current_project]]
# Set project properties
set obj [current_project]
set_property -name "default_lib" -value "xil_defaultlib" -objects $obj
set_property -name "enable_vhdl_2008" -value "1" -objects $obj
set_property -name "ip_cache_permissions" -value "read write" -objects $obj
set_property -name "ip_output_repo" -value "$proj_dir/${_xil_proj_name_}.cache/ip" -objects $obj
set_property -name "mem.enable_memory_map_generation" -value "1" -objects $obj
set_property -name "platform.board_id" -value "zed" -objects $obj
set_property -name "sim.central_dir" -value "$proj_dir/${_xil_proj_name_}.ip_user_files" -objects $obj
set_property -name "sim.ip.auto_export_scripts" -value "1" -objects $obj
set_property -name "simulator_language" -value "VHDL" -objects $obj
set_property -name "target_language" -value "VHDL" -objects $obj
set_property -name "webtalk.xsim_launch_sim" -value "30" -objects $obj
# Create 'sources_1' fileset (if not found)
if {[string equal [get_filesets -quiet sources_1] ""]} {
create_fileset -srcset sources_1
}
# Set 'sources_1' fileset object
set obj [get_filesets sources_1]
set files [list \
[file normalize "${origin_dir}/hdl/harv_pkg.vhd"] \
[file normalize "${origin_dir}/hdl/alu.vhd"] \
[file normalize "${origin_dir}/hdl/ft_components/alu_tmr.vhd"] \
[file normalize "${origin_dir}/hdl/control.vhd"] \
[file normalize "${origin_dir}/hdl/ft_components/control_tmr.vhd"] \
[file normalize "${origin_dir}/hdl/csr.vhd"] \
[file normalize "${origin_dir}/hdl/ft_components/hamming_pkg.vhd"] \
[file normalize "${origin_dir}/hdl/ft_components/hamming_decoder.vhd"] \
[file normalize "${origin_dir}/hdl/ft_components/hamming_encoder.vhd"] \
[file normalize "${origin_dir}/hdl/ft_components/hamming_register.vhd"] \
[file normalize "${origin_dir}/hdl/instr_fetch.vhd"] \
[file normalize "${origin_dir}/hdl/regfile.vhd"] \
[file normalize "${origin_dir}/hdl/harv.vhd"] \
]
add_files -norecurse -fileset $obj $files
# Set 'sources_1' fileset file properties for remote files
set file "$origin_dir/hdl/harv_pkg.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/alu.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/ft_components/alu_tmr.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/control.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/ft_components/control_tmr.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/csr.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/ft_components/hamming_pkg.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/ft_components/hamming_decoder.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/ft_components/hamming_encoder.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/ft_components/hamming_register.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/instr_fetch.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/regfile.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
set file "$origin_dir/hdl/harv.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
# Set 'sources_1' fileset properties
set obj [get_filesets sources_1]
set_property -name "top" -value "harv" -objects $obj
# Create 'sim_1' fileset (if not found)
if {[string equal [get_filesets -quiet sim_1] ""]} {
create_fileset -simset sim_1
}
# Set 'sim_1' fileset object
set obj [get_filesets sim_1]
set files [list \
[file normalize "${origin_dir}/sim/sim_from_dump.vhd"] \
]
add_files -norecurse -fileset $obj $files
# Import local files from the original project
set files [list \
[file normalize "${origin_dir}/xilinx/sim_from_dump_behav.wcfg" ]\
]
add_files -norecurse -fileset sim_1 $files
# Set 'sim_1' fileset file properties for remote files
set file "$origin_dir/sim/sim_from_dump.vhd"
set file [file normalize $file]
set file_obj [get_files -of_objects [get_filesets sim_1] [list "*$file"]]
set_property -name "file_type" -value "VHDL 2008" -objects $file_obj
# Set 'sim_1' fileset properties
set obj [get_filesets sim_1]
set_property -name "hbs.configure_design_for_hier_access" -value "1" -objects $obj
set_property -name "top" -value "sim_from_dump" -objects $obj
set_property -name "top_lib" -value "xil_defaultlib" -objects $obj
puts "INFO: Project created: ${_xil_proj_name_}"
exit