Skip to content

Commit

Permalink
Upgrade 2020.1-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ibraim committed Jul 28, 2020
1 parent 13195ef commit 61af7f8
Show file tree
Hide file tree
Showing 68 changed files with 4,789 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "digilent-vivado-scripts"]
path = digilent-vivado-scripts
url = https://github.com/digilent/digilent-vivado-scripts.git
[submodule "scripts"]
path = scripts
url = https://github.com/Digilent/digilent-vitis-scripts
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Whenever the demo is started from Vivado SDK, the board will go through a memory
Requirements
------------
* **Cmod A7-35T**: To purchase a Cmod A7-35T, see the [Digilent Store](https://store.digilentinc.com/cmod-a7-breadboardable-artix-7-fpga-module/).
* **Vivado 2018.2 Installation with Xilinx SDK**: To set up Vivado, see the [Installing Vivado and Digilent Board Files Tutorial](https://reference.digilentinc.com/vivado/installing-vivado/start).
* **Vivado 2020.1 Installation with Xilinx SDK**: To set up Vivado, see the [Installing Vivado and Digilent Board Files Tutorial](https://reference.digilentinc.com/vivado/installing-vivado/start).
* **Serial Terminal Emulator**:
* **MicroUSB Cable**

Expand All @@ -22,7 +22,7 @@ Demo Setup

1. Download the most recent release ZIP archive ("Cmod-A7-35T-OOB-2018.2-*.zip") from the repo's [releases page](https://github.com/Digilent/Cmod-A7-35T-OOB/releases).
2. Extract the downloaded ZIP.
3. Open the XPR project file, found at \<archive extracted location\>/vivado_proj/Cmod-A7-35T-OOB.xpr, included in the extracted release archive in Vivado 2018.2.
3. Open the XPR project file, found at \<archive extracted location\>/vivado_proj/Cmod-A7-35T-OOB.xpr, included in the extracted release archive in Vivado 2020.1.
4. In the toolbar at the top of the Vivado window, select **File -> Export -> Export Hardware**. Select **\<Local to Project\>** as the Exported Location and make sure that the **Include bitstream** box is checked, then click **OK**.
5. In the toolbar at the top of the Vivado window, select **File -> Launch SDK**. Select **\<Local to Project\>** as both the workspace location and exported location, then click **OK**.
6. With Vivado SDK opened, wait for the hardware platform exported by Vivado to be imported.
Expand Down
12 changes: 12 additions & 0 deletions hw/digilent-vivado-scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Blacklist everything
/*

# Whitelist this stuff
!License.txt
!config.ini
!*.tcl
!*.py
!*README.md
!*.gitignore
!templates
!templates/*
21 changes: 21 additions & 0 deletions hw/digilent-vivado-scripts/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Digilent

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
247 changes: 247 additions & 0 deletions hw/digilent-vivado-scripts/README.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions hw/digilent-vivado-scripts/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Windows]
VivadoInstallPath = C:/Xilinx/Vivado
VivadoVersion = 2020.1
[Linux]
VivadoInstallPath = /opt/Xilinx/Vivado
VivadoVersion = 2020.1
220 changes: 220 additions & 0 deletions hw/digilent-vivado-scripts/digilent_vivado_checkin.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# Note: argument order does not matter when setting argv; all arguments are optional
# Usage (No Defaults):
# set argv "-r <repo_path> -x <xpr_path> -v <vivado_version>"
# source digilent_vivado_checkin.tcl
# Usage (All Defaults):
# set argv ""
# source digilent_vivado_checkin.tcl
# TODO: add debug flag for argument checking

set script_dir [file normalize [file dirname [info script]]]

foreach arg $argv {
puts $arg
}

# Collect local sources, move them to ../src/<category>

# Handle repo_path argument
set idx [lsearch ${argv} "-r"]
if {${idx} != -1} {
set repo_path [glob -nocomplain [file normalize [lindex ${argv} [expr {${idx}+1}]]]]
} else {
# Default
set repo_path [file normalize [file join [file dirname [info script]] ..]]
}

# Handle xpr_path argument
set idx [lsearch ${argv} "-x"]
if {${idx} != -1} {
set xpr_path [glob -nocomplain [file normalize [lindex ${argv} [expr {${idx}+1}]]]]
} else {
# Default
set xpr_path [glob -nocomplain "${repo_path}/proj/*.xpr"]
}
if {[llength ${xpr_path}] != 1} {
puts "ERROR: XPR not found"
} else {
set xpr_path [lindex ${xpr_path} 0]
}

# Handle vivado_version argument
set idx [lsearch ${argv} "-v"]
if {${idx} != -1} {
set vivado_version [lindex ${argv}]
} else {
set vivado_version [version -short]
}

set vivado_version [lindex $argv 2]; # unused

# Other variables
set force_overwrite_info_script 0; # included for possible argument support in future
set proj_file [file tail $xpr_path]
set proj_dir [file dirname $xpr_path]
set proj_name [file rootname [file tail $proj_file]]

puts "INFO: Checking project \"$proj_file\" into version control."
set already_opened [get_projects -filter "DIRECTORY==$proj_dir && NAME==$proj_name"]
if {[llength $already_opened] == 0} {
open_project $xpr_path
} else {
current_project [lindex $already_opened 0]
}



set required_dirs [list \
$repo_path/proj \
$repo_path/hw_handoff \
$repo_path/src \
$repo_path/src/bd \
$repo_path/src/constraints \
$repo_path/src/ip \
$repo_path/src/hdl \
$repo_path/src/other \
$repo_path/repo \
$repo_path/repo/local \
]
set required_files [list \
$repo_path/proj/.keep \
$repo_path/hw_handoff/.keep \
$repo_path/src/bd/.keep \
$repo_path/src/constraints/.keep \
$repo_path/src/ip/.keep \
$repo_path/src/hdl/.keep \
$repo_path/src/other/.keep \
$repo_path/repo/local/.keep \
]
set files [list]

# Create any missing required directories and files
foreach d $required_dirs {
if {[file exists $d] == 0} {
file mkdir $d
}
}
foreach f $required_files {
if {[file exists $f] == 0} {
close [open $f "w"]
}
}

# Save source files, including block design tcl script
# WARNING: This script does not capture any non-xdc files for block-design projects
set bd_files [get_files -of_objects [get_filesets sources_1] -filter "NAME=~*.bd"]
if {[llength $bd_files] > 1} {
puts "ERROR: This script cannot handle projects containing more than one block design!"
} elseif {[llength $bd_files] == 1} {
set bd_file [lindex $bd_files 0]
open_bd_design $bd_file
set bd_name [file tail [file rootname [get_property NAME $bd_file]]]
set script_name "$repo_path/src/bd/${bd_name}.tcl"
puts "INFO: Checking in ${script_name} to version control."
write_bd_tcl -force -make_local $script_name
# TODO: Add support for "Add Module" IPI features (check in hdl files included in sources_1, but not any ip fileset)
} else {
foreach source_file [get_files -of_objects [get_filesets sources_1]] {
set origin [get_property name $source_file]
set skip 0
if {[file extension $origin] == ".vhd"} {
set subdir hdl
} elseif {[file extension $origin] == ".v"} {
set subdir hdl
} elseif {[file extension $origin] == ".sv"} {
set subdir hdl
} elseif {[file extension $origin] != ".bd" && [file extension $origin] != ".xci"} {
set subdir other
} else {
set skip 1
}

foreach ip [get_ips] {
set ip_dir [get_property IP_DIR $ip]
set source_length [string length $source_file]
set dir_length [string length $ip_dir]
if {$source_length >= $dir_length && [string range $source_file 0 $dir_length-1] == $ip_dir} {
set skip 1
}
}

if {$skip == 0} {
puts "INFO: Checking in [file tail $origin] to version control."
set target $repo_path/src/$subdir/[file tail $origin]
if {[file exists $target] == 0} { # TODO: this may not be safe; remind users to make sure to delete any unused files from version control
file copy -force $origin $target
}
}
}
foreach ip [get_ips] {
set origin [get_property ip_file $ip]
set ipname [get_property name $ip]
set dir "$repo_path/src/ip/$ipname"
if {[file exists $dir] == 0} {
file mkdir $dir
}
set target $dir/[file tail $origin]
puts "INFO: Checking in [file tail $origin] to version control."
if {[file exists $target] == 0} {
# TODO: this may not be safe; remind users to make sure to delete any unused files from version control
file copy -force $origin $target
}
}
# TODO: foreach file in /src/ip, if it wasn't just checked in, delete it
}
foreach constraint_file [get_files -of_objects [get_filesets constrs_1]] {
set origin [get_property name $constraint_file]
set target $repo_path/src/constraints/[file tail $origin]
puts "INFO: Checking in [file tail $origin] to version control."
if {[file exists $target] == 0} { # TODO: this may not be safe; remind users to make sure to delete any unused files from version control
file copy -force $origin $target
}
}
# TODO: foreach file in /src/constraints, if it wasn't just checked in, delete it

# Save project-specific settings into project_info.tcl
# TODO: will break if multiple projects are open
# project_info.tcl will only be created if it doesn't exist - if it has been manually deleted by the user, or if this is the first time this repo is checked in
if {[file exists $repo_path/project_info.tcl] == 0 || $force_overwrite_info_script != 0} {
set proj_obj [get_projects [file rootname $proj_file]]

set board_part [current_board_part -quiet]
set part [get_property part $proj_obj]
set default_lib [get_property default_lib $proj_obj]
set simulator_language [get_property simulator_language $proj_obj]
set target_language [get_property target_language $proj_obj]

puts "INFO: Checking in project_info.tcl to version control."

set var_map [list <part> $part \
<default_lib> $default_lib \
<simulator_language> $simulator_language \
<target_language> $target_language \
]

if {$board_part ne ""} {
lappend var_map <board_part> $board_part
}

set file_name $repo_path/project_info.tcl
set dfid [open $file_name "w"]
set sfid [open $script_dir/templates/project_info.tcl "r"]

while { [gets $sfid line] >= 0 } {
puts $dfid [string map $var_map $line]
}

close $dfid
close $sfid
}

# if .gitignore does not exist, create it
set master_gitignore [file join $repo_path .gitignore]
if {[file exists $master_gitignore] == 0} {
puts "WARNING: This repository does not contain a master gitignore. creating one now."
set target $master_gitignore
set origin $script_dir/templates/hw.gitignore
file copy -force $origin $target
}

puts "INFO: Project $proj_file has been checked into version control"
Loading

0 comments on commit 61af7f8

Please sign in to comment.