Skip to content

Commit

Permalink
Merge pull request #132 from slaclab/pre-release
Browse files Browse the repository at this point in the history
v2.0.3 release candidate
  • Loading branch information
ruck314 authored Dec 10, 2019
2 parents 84d04ea + e64d09e commit c6702ab
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 99 deletions.
8 changes: 8 additions & 0 deletions system_vivado.mk
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,14 @@ xsim : $(SOURCE_DEPEND)
vcs : $(SOURCE_DEPEND)
$(call ACTION_HEADER,"Generating the VCS Simulation scripts")
@cd $(OUT_DIR); vivado -mode batch -source $(RUCKUS_DIR)/vivado_vcs.tcl

###############################################################
#### Vivado Batch Mode within the Project Environment ########
###############################################################
.PHONY : batch
batch : $(SOURCE_DEPEND)
$(call ACTION_HEADER,"Vivado Project Batch")
@cd $(OUT_DIR); vivado -mode batch -source $(RUCKUS_DIR)/vivado_batch.tcl $(VIVADO_PROJECT).xpr

###############################################################
#### Makefile Targets #########################################
Expand Down
23 changes: 23 additions & 0 deletions vivado_batch.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
##############################################################################
## This file is part of 'SLAC Firmware Standard Library'.
## It is subject to the license terms in the LICENSE.txt file found in the
## top-level directory of this distribution and at:
## https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
## No part of 'SLAC Firmware Standard Library', including this file,
## may be copied, modified, propagated, or distributed except according to
## the terms contained in the LICENSE.txt file.
##############################################################################

## \file vivado_batch.tcl
# \brief This script launches the Vivado project then runs User batch.tcl script
# with all the ruckus procedures and environmental variables included

# Get variables and Custom Procedures and common properties
source -quiet $::env(RUCKUS_DIR)/vivado_env_var.tcl
source -quiet $::env(RUCKUS_DIR)/vivado_proc.tcl
source -quiet $::env(RUCKUS_DIR)/vivado_properties.tcl
source -quiet $::env(RUCKUS_DIR)/vivado_messages.tcl
set_property STEPS.WRITE_BITSTREAM.TCL.POST ${RUCKUS_DIR}/vivado_post_route_run.tcl [get_runs impl_1]

# Run user's batch script
SourceTclFile ${VIVADO_DIR}/batch.tcl
2 changes: 1 addition & 1 deletion vivado_gui.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
##############################################################################

## \file vivado_gui.tcl
# \brief This script launches the Vivado HLS interface GUI mode with all the
# \brief This script launches the Vivado interface GUI mode with all the
# ruckus procedures and environmental variables included

# Get variables and Custom Procedures and common properties
Expand Down
168 changes: 76 additions & 92 deletions vivado_proc.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ proc BuildIpCores { } {
}

## Copies all IP cores from the build tree to source tree
proc CopyIpCores { } {
proc CopyIpCores { {copyDcp true} {copySourceCode false} } {
# Get variables
source -quiet $::env(RUCKUS_DIR)/vivado_env_var.tcl
source -quiet $::env(RUCKUS_DIR)/vivado_messages.tcl
source -quiet $::env(RUCKUS_DIR)/vivado_messages.tcl

# Make sure the IP Cores have been built
BuildIpCores
Expand All @@ -197,62 +197,43 @@ proc CopyIpCores { } {
foreach corePntr [get_ips] {
# Create a copy of the IP Core in the source tree
foreach coreFilePntr ${ipList} {
if { [ string match *${corePntr}* ${coreFilePntr} ] } {
if { [ string match *${corePntr}* ${coreFilePntr} ] } {
# Overwrite the existing .xci file in the source tree
set SRC [get_files ${corePntr}.xci]
set DST ${coreFilePntr}
exec cp ${SRC} ${DST}
puts "exec cp ${SRC} ${DST}"
# Overwrite the existing .dcp file in the source tree
set SRC [string map {.xci .dcp} ${SRC}]
set DST [string map {.xci .dcp} ${DST}]
exec cp ${SRC} ${DST}
puts "exec cp ${SRC} ${DST}"
puts "exec cp ${SRC} ${DST}"
# Check if copying .DCP output
if { ${copyDcp} } {
# Overwrite the existing .dcp file in the source tree
set SRC [string map {.xci .dcp} ${SRC}]
set DST [string map {.xci .dcp} ${DST}]
exec cp ${SRC} ${DST}
puts "exec cp ${SRC} ${DST}"
}
# Check if copying IP Core's the source code
if { ${copySourceCode} } {
set SRC [get_files ${corePntr}.xci]
set DST ${coreFilePntr}
set SRC [string trim ${SRC} ${corePntr}.xci]
set DST [string trim ${DST} ${corePntr}.xci]
exec cp -rf ${SRC} ${DST}
puts "exec cp -rf ${SRC} ${DST}"
}
}
}
}
}
}
}

## Copies all IP cores from the build tree to source tree (with source code)
proc CopyIpCoresDebug { } {
# Get variables
source -quiet $::env(RUCKUS_DIR)/vivado_env_var.tcl
source -quiet $::env(RUCKUS_DIR)/vivado_messages.tcl

# Make sure the IP Cores have been built
BuildIpCores

# Get the IP list
set ipList [read [open ${OUT_DIR}/ipList.txt]]

# Check if the target project has IP cores
if { ${ipList} != "" } {
# Loop through the IP cores
foreach corePntr [get_ips] {
# Create a copy of the IP Core in the source tree
foreach coreFilePntr ${ipList} {
if { [ string match *${corePntr}* ${coreFilePntr} ] } {
set SRC [get_files ${corePntr}.xci]
set DST ${coreFilePntr}
set SRC [string trim ${SRC} ${corePntr}.xci]
set DST [string trim ${DST} ${corePntr}.xci]
exec cp -rf ${SRC} ${DST}
puts "exec cp -rf ${SRC} ${DST}"
}
}
}
}
}

## Copies all block designs from the build tree to source tree
proc CopyBdCores { } {
proc CopyBdCores { {createTcl true} {copySourceCode false} } {
# Get variables
source -quiet $::env(RUCKUS_DIR)/vivado_env_var.tcl
source -quiet $::env(RUCKUS_DIR)/vivado_messages.tcl
source -quiet $::env(RUCKUS_DIR)/vivado_messages.tcl

# Get the BD list
set bdList [read [open ${OUT_DIR}/bdList.txt]]
set bdList [read [open ${OUT_DIR}/bdList.txt]]

# Check if the target project has block designs
if { ${bdList} != "" } {
Expand All @@ -261,43 +242,28 @@ proc CopyBdCores { } {
# Create a copy of the IP Core in the source tree
foreach bdFilePntr ${bdList} {
set strip [file rootname [file tail ${bdPntr}]]
if { [ string match *${strip}.bd ${bdFilePntr} ] } {
if { [ string match *${strip}.bd ${bdFilePntr} ] } {
# Overwrite the existing .bd file in the source tree
set SRC ${bdPntr}
set DST ${bdFilePntr}
exec cp ${SRC} ${DST}
puts "exec cp ${SRC} ${DST}"
}
}
}
}
}

## Copies all block designs from the build tree to source tree (with source code)
proc CopyBdCoresDebug { } {
# Get variables
source -quiet $::env(RUCKUS_DIR)/vivado_env_var.tcl
source -quiet $::env(RUCKUS_DIR)/vivado_messages.tcl

# Get the BD list
set bdList [read [open ${OUT_DIR}/bdList.txt]]

# Check if the target project has block designs
if { ${bdList} != "" } {
# Loop through the has block designs
foreach bdPntr [get_files {*.bd}] {
# Create a copy of the IP Core in the source tree
foreach bdFilePntr ${bdList} {
set strip [file rootname [file tail ${bdPntr}]]
if { [ string match *${strip}.bd ${bdFilePntr} ] } {
set SRC ${bdPntr}
set DST ${bdFilePntr}
set SRC [string trim ${SRC} ${strip}.bd]
set DST [string trim ${DST} ${strip}.bd]
exec cp -rf ${SRC} ${DST}
puts "exec cp -rf ${SRC} ${DST}"
puts "exec cp ${SRC} ${DST}"
# Check if creating a .TCL file for the source tree
if { ${createTcl} } {
set fbasename [file rootname ${bdFilePntr}]
write_bd_tcl -force ${fbasename}.tcl
}
# Check if copying block design's the source code
if { ${copySourceCode} } {
set SRC ${bdPntr}
set DST ${bdFilePntr}
set SRC [string trim ${SRC} ${strip}.bd]
set DST [string trim ${DST} ${strip}.bd]
exec cp -rf ${SRC} ${DST}
puts "exec cp -rf ${SRC} ${DST}"
}
}
}
}
}
}
}
Expand Down Expand Up @@ -1512,18 +1478,27 @@ proc loadBlockDesign args {
} else {
# Check the file extension
set fileExt [file extension $params(path)]
if { ${fileExt} eq {.bd} } {
if { ${fileExt} eq {.bd} ||
${fileExt} eq {.tcl} } {
# Update the global list
set ::BD_FILES "$::BD_FILES $params(path)"
# Check if the block design file has already been loaded
if { [get_files -quiet [file tail $params(path)]] == ""} {
# Add block design file
set locPath [import_files -force -norecurse $params(path)]
export_ip_user_files -of_objects [get_files ${locPath}] -force -quiet
set fbasename [file rootname $params(path)]
set ::BD_FILES "$::BD_FILES ${fbasename}.bd"
# Check for .bd extension
if { ${fileExt} eq {.bd} } {
# Check if the block design file has already been loaded
if { [get_files -quiet [file tail $params(path)]] == ""} {
# Add block design file
set locPath [import_files -force -norecurse $params(path)]
export_ip_user_files -of_objects [get_files ${locPath}] -force -quiet
}
# Else it's a .TCL extension
} else {
# Always load the block design TCL file
source $params(path)
}
} else {
puts "\n\n\n\n\n********************************************************"
puts "loadBlockDesign: $params(path) does not have a \[.bd\] file extension"
puts "loadBlockDesign: $params(path) does not have a \[.bd,.tcl\] file extension"
puts "********************************************************\n\n\n\n\n"
exit -1
}
Expand All @@ -1540,23 +1515,32 @@ proc loadBlockDesign args {
# Get a list of all block design files
set list ""
set list_rc [catch {
set list [glob -directory $params(dir) *.bd]
set list [glob -directory $params(dir) *.bd *.tcl]
} _RESULT]
# Load all the block design files
if { ${list} != "" } {
foreach pntr ${list} {
# Update the global list
set ::BD_FILES "$::BD_FILES ${pntr}"
# Check if the block design file has already been loaded
if { [get_files -quiet [file tail ${pntr}]] == ""} {
# Add block design file
set locPath [import_files -force -norecurse ${pntr}]
export_ip_user_files -of_objects [get_files ${locPath}] -force -quiet
set fbasename [file rootname ${pntr}]
set ::BD_FILES "$::BD_FILES ${fbasename}.bd"
# Check for .bd extension
set fileExt [file extension ${pntr}]
if { ${fileExt} eq {.bd} } {
# Check if the block design file has already been loaded
if { [get_files -quiet [file tail ${pntr}]] == ""} {
# Add block design file
set locPath [import_files -force -norecurse ${pntr}]
export_ip_user_files -of_objects [get_files ${locPath}] -force -quiet
}
# Else it's a .TCL extension
} else {
# Always load the block design TCL file
source ${pntr}
}
}
} else {
puts "\n\n\n\n\n********************************************************"
puts "loadBlockDesign: $params(dir) directory does not have any \[.bd\] files"
puts "loadBlockDesign: $params(dir) directory does not have any \[.bd,.tcl\] file extension"
puts "********************************************************\n\n\n\n\n"
exit -1
}
Expand Down
2 changes: 1 addition & 1 deletion vivado_vcs.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

## \file vivado_vcs.tcl
# \brief This script generates the VCS build scripts using Vivado to determine the
# build ordering and other dependencies.
# build ordering and other dependencies. This script does NOT run the VCS scripts that it generates

# Get variables and procedures
source -quiet $::env(RUCKUS_DIR)/vivado_env_var.tcl
Expand Down
14 changes: 9 additions & 5 deletions vivado_wis.tcl
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
##############################################################################
# This file is part of 'SLAC Firmware Standard Library'.
# It is subject to the license terms in the LICENSE.txt file found in the
# top-level directory of this distribution and at:
# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of 'SLAC Firmware Standard Library', including this file,
# may be copied, modified, propagated, or distributed except according to
# the terms contained in the LICENSE.txt file.
##############################################################################

## \file vivado_wis.tcl
# \brief Creates a tcl script that copies the current values of the KotoDpm project's
# Linux OS environment variables. The purpose of the init.tcl output script is to
# properly establish the environment variables within the Windows version of Vivado without the need
# to first load Cygwin. This is useful because while using Vivado with Cygwin, Vivado runs roughly 2x slower.
## Dependencies: system_vivado.mk
## Author: Joshua Robinson
## Author Email: [email protected]
## Last Updated: 12/22/2017
###############################################################################

# Get variables and procedures
source -quiet $::env(RUCKUS_DIR)/vivado_env_var.tcl
Expand Down

0 comments on commit c6702ab

Please sign in to comment.