diff --git a/proj/cleanup.cmd b/proj/cleanup.cmd new file mode 100644 index 0000000000000000000000000000000000000000..ab966b0953745a30f9da679ea9675e1d43b7fcf8 --- /dev/null +++ b/proj/cleanup.cmd @@ -0,0 +1,21 @@ +@echo off +rem delete all files from subfolders +for /d /r %%i in (*) do del /f /q %%i\* +rem delete all subfolders +for /d %%i in (*) do rd /S /Q %%i + +rem unmark read only from all files +attrib -R .\* /S + +rem mark read only those we wish to keep +attrib +R .\create_project.tcl +attrib +R .\cleanup.sh +attrib +R .\cleanup.cmd +attrib +R .\.gitignore +attrib +R .\_READ_ME_.txt + +rem delete all non read-only +del /Q /A:-R .\* + +rem unmark read-only +attrib -R .\* diff --git a/proj/cleanup.sh b/proj/cleanup.sh new file mode 100644 index 0000000000000000000000000000000000000000..ea903c20aa9bb6085d369e236a7855c6fa202227 --- /dev/null +++ b/proj/cleanup.sh @@ -0,0 +1,15 @@ +# This script is useful for cleaning up the 'project' +# directory of a Digilent Vivado-project git repository +### +# Run the following command to change permissions of +# this 'cleanup' file if needed: +# chmod u+x cleanup.sh +### +# Remove directories/subdirectories +find . -mindepth 1 -type d -exec rm -rf {} + +# Remove any other files than: +find . -type f ! -name 'cleanup.sh' \ + ! -name 'cleanup.cmd' \ + ! -name 'create_project.tcl' \ + ! -name '.gitignore' \ + -exec rm -rf {} + diff --git a/proj/create_project.tcl b/proj/create_project.tcl new file mode 100644 index 0000000000000000000000000000000000000000..ee90c0a24e478c716c52035df5091d5fb91818d1 --- /dev/null +++ b/proj/create_project.tcl @@ -0,0 +1,121 @@ +# Run this script to create the Vivado project files in the WORKING DIRECTORY +# If ::create_path global variable is set, the project is created under that path instead of the working dir + +if {[info exists ::create_path]} { + set dest_dir $::create_path +} else { + set dest_dir [pwd] +} +puts "INFO: Creating new project in $dest_dir" + +# Set the reference directory for source file relative paths (by default the value is script directory path) +set proj_name "Sobel" + +# Set the reference directory for source file relative paths (by default the value is script directory path) +set origin_dir ".." + +# Set the directory path for the original project from where this script was exported +set orig_proj_dir "[file normalize "$origin_dir/proj"]" + +set src_dir $origin_dir/src +set repo_dir $origin_dir/repo + +# Set the board part number +set part_num "xc7a100tcsg324-1" + +# Create project +create_project $proj_name $dest_dir + +# Set the directory path for the new project +set proj_dir [get_property directory [current_project]] + +# Set project properties +set obj [get_projects $proj_name] +set_property "default_lib" "xil_defaultlib" $obj +set_property "part" "$part_num" $obj +set_property "simulator_language" "Mixed" $obj +set_property "target_language" "VHDL" $obj + +# Create 'sources_1' fileset (if not found) +if {[string equal [get_filesets -quiet sources_1] ""]} { + create_fileset -srcset sources_1 +} + +# Create 'constrs_1' fileset (if not found) +if {[string equal [get_filesets -quiet constrs_1] ""]} { + create_fileset -constrset constrs_1 +} + +# Set IP repository paths +set obj [get_filesets sources_1] +set_property "ip_repo_paths" "[file normalize $repo_dir]" $obj + +# Add conventional sources +add_files -quiet $src_dir/hdl + +# Add IPs +add_files -quiet [glob -nocomplain ../src/ip/*/*.xci] + +# Add constraints +add_files -fileset constrs_1 -quiet $src_dir/constraints + +# Refresh IP Repositories +#update_ip_catalog + +# Create 'synth_1' run (if not found) +if {[string equal [get_runs -quiet synth_1] ""]} { + create_run -name synth_1 -part $part_num -flow {Vivado Synthesis 2014} -strategy "Flow_PerfOptimized_High" -constrset constrs_1 +} else { + set_property strategy "Flow_PerfOptimized_High" [get_runs synth_1] + set_property flow "Vivado Synthesis 2014" [get_runs synth_1] +} +set obj [get_runs synth_1] +set_property "part" "$part_num" $obj +set_property "steps.synth_design.args.fanout_limit" "400" $obj +set_property "steps.synth_design.args.fsm_extraction" "one_hot" $obj +set_property "steps.synth_design.args.keep_equivalent_registers" "1" $obj +set_property "steps.synth_design.args.resource_sharing" "off" $obj +set_property "steps.synth_design.args.no_lc" "1" $obj +set_property "steps.synth_design.args.shreg_min_size" "5" $obj + +# set the current synth run +current_run -synthesis [get_runs synth_1] + +# Create 'impl_1' run (if not found) +if {[string equal [get_runs -quiet impl_1] ""]} { + create_run -name impl_1 -part $part_num -flow {Vivado Implementation 2014} -strategy "Vivado Implementation Defaults" -constrset constrs_1 -parent_run synth_1 +} else { + set_property strategy "Vivado Implementation Defaults" [get_runs impl_1] + set_property flow "Vivado Implementation 2014" [get_runs impl_1] +} +set obj [get_runs impl_1] +set_property "part" "$part_num" $obj +set_property "steps.write_bitstream.args.bin_file" "1" $obj + +# set the current impl run +current_run -implementation [get_runs impl_1] + +## Set testbench file only for simulation + +set_property used_in_synthesis false [get_files ../src/hdl/tb_adrgenUnit.vhd] +set_property used_in_synthesis false [get_files ../src/hdl/tb_automate.vhd] +set_property used_in_synthesis false [get_files ../src/hdl/tb_gradientUnit.vhd] +set_property used_in_synthesis false [get_files ../src/hdl/tb_operativeUnit.vhd] +set_property used_in_synthesis false [get_files ../src/hdl/tb_regUnit.vhd] +set_property used_in_synthesis false [get_files ../src/hdl/tb_sobelProc.vhd] +set_property used_in_synthesis false [get_files ../src/hdl/tb_sobelSys.vhd] + +#puts "INFO: Project created:$proj_name" + +# Comment the following section, if there is no block design +# Create block design +#source $origin_dir/src/bd/bt_gpio.tcl + +# Generate the wrapper +#set design_name [get_bd_designs] +#make_wrapper -files [get_files $design_name.bd] -top -import + +#set obj [get_filesets sources_1] +#set_property "top" "bt_gpio_top" $obj + +#puts "INFO: Block design created: $design_name.bd"