349 lines
14 KiB
Tcl
349 lines
14 KiB
Tcl
|
|
################################################################
|
|
# This is a generated script based on design: m6_sim
|
|
#
|
|
# Though there are limitations about the generated script,
|
|
# the main purpose of this utility is to make learning
|
|
# IP Integrator Tcl commands easier.
|
|
################################################################
|
|
|
|
namespace eval _tcl {
|
|
proc get_script_folder {} {
|
|
set script_path [file normalize [info script]]
|
|
set script_folder [file dirname $script_path]
|
|
return $script_folder
|
|
}
|
|
}
|
|
variable script_folder
|
|
set script_folder [_tcl::get_script_folder]
|
|
|
|
################################################################
|
|
# Check if script is running in correct Vivado version.
|
|
################################################################
|
|
set scripts_vivado_version 2023.1
|
|
set current_vivado_version [version -short]
|
|
|
|
if { [string first $scripts_vivado_version $current_vivado_version] == -1 } {
|
|
puts ""
|
|
catch {common::send_gid_msg -ssname BD::TCL -id 2041 -severity "ERROR" "This script was generated using Vivado <$scripts_vivado_version> and is being run in <$current_vivado_version> of Vivado. Please run the script in Vivado <$scripts_vivado_version> then open the design in Vivado <$current_vivado_version>. Upgrade the design by running \"Tools => Report => Report IP Status...\", then run write_bd_tcl to create an updated script."}
|
|
|
|
return 1
|
|
}
|
|
|
|
################################################################
|
|
# START
|
|
################################################################
|
|
|
|
# To test this script, run the following commands from Vivado Tcl console:
|
|
# source m6_sim_script.tcl
|
|
|
|
# If there is no project opened, this script will create a
|
|
# project, but make sure you do not have an existing project
|
|
# <./myproj/project_1.xpr> in the current working folder.
|
|
|
|
set list_projs [get_projects -quiet]
|
|
if { $list_projs eq "" } {
|
|
create_project project_1 myproj -part xc7z020clg400-1
|
|
set_property BOARD_PART digilentinc.com:zybo-z7-20:part0:1.1 [current_project]
|
|
}
|
|
|
|
|
|
# CHANGE DESIGN NAME HERE
|
|
variable design_name
|
|
set design_name m6_sim
|
|
|
|
# If you do not already have an existing IP Integrator design open,
|
|
# you can create a design using the following command:
|
|
# create_bd_design $design_name
|
|
|
|
# Creating design if needed
|
|
set errMsg ""
|
|
set nRet 0
|
|
|
|
set cur_design [current_bd_design -quiet]
|
|
set list_cells [get_bd_cells -quiet]
|
|
|
|
if { ${design_name} eq "" } {
|
|
# USE CASES:
|
|
# 1) Design_name not set
|
|
|
|
set errMsg "Please set the variable <design_name> to a non-empty value."
|
|
set nRet 1
|
|
|
|
} elseif { ${cur_design} ne "" && ${list_cells} eq "" } {
|
|
# USE CASES:
|
|
# 2): Current design opened AND is empty AND names same.
|
|
# 3): Current design opened AND is empty AND names diff; design_name NOT in project.
|
|
# 4): Current design opened AND is empty AND names diff; design_name exists in project.
|
|
|
|
if { $cur_design ne $design_name } {
|
|
common::send_gid_msg -ssname BD::TCL -id 2001 -severity "INFO" "Changing value of <design_name> from <$design_name> to <$cur_design> since current design is empty."
|
|
set design_name [get_property NAME $cur_design]
|
|
}
|
|
common::send_gid_msg -ssname BD::TCL -id 2002 -severity "INFO" "Constructing design in IPI design <$cur_design>..."
|
|
|
|
} elseif { ${cur_design} ne "" && $list_cells ne "" && $cur_design eq $design_name } {
|
|
# USE CASES:
|
|
# 5) Current design opened AND has components AND same names.
|
|
|
|
set errMsg "Design <$design_name> already exists in your project, please set the variable <design_name> to another value."
|
|
set nRet 1
|
|
} elseif { [get_files -quiet ${design_name}.bd] ne "" } {
|
|
# USE CASES:
|
|
# 6) Current opened design, has components, but diff names, design_name exists in project.
|
|
# 7) No opened design, design_name exists in project.
|
|
|
|
set errMsg "Design <$design_name> already exists in your project, please set the variable <design_name> to another value."
|
|
set nRet 2
|
|
|
|
} else {
|
|
# USE CASES:
|
|
# 8) No opened design, design_name not in project.
|
|
# 9) Current opened design, has components, but diff names, design_name not in project.
|
|
|
|
common::send_gid_msg -ssname BD::TCL -id 2003 -severity "INFO" "Currently there is no design <$design_name> in project, so creating one..."
|
|
|
|
create_bd_design $design_name
|
|
|
|
common::send_gid_msg -ssname BD::TCL -id 2004 -severity "INFO" "Making design <$design_name> as current_bd_design."
|
|
current_bd_design $design_name
|
|
|
|
}
|
|
|
|
common::send_gid_msg -ssname BD::TCL -id 2005 -severity "INFO" "Currently the variable <design_name> is equal to \"$design_name\"."
|
|
|
|
if { $nRet != 0 } {
|
|
catch {common::send_gid_msg -ssname BD::TCL -id 2006 -severity "ERROR" $errMsg}
|
|
return $nRet
|
|
}
|
|
|
|
set bCheckIPsPassed 1
|
|
##################################################################
|
|
# CHECK IPs
|
|
##################################################################
|
|
set bCheckIPs 1
|
|
if { $bCheckIPs == 1 } {
|
|
set list_check_ips "\
|
|
xilinx.com:user:axis_downsizer:1.0\
|
|
xilinx.com:user:axis_linemem_single_master:1.0\
|
|
xilinx.com:user:axis_filter_dummy:1.0\
|
|
xilinx.com:user:axis_upsizer:1.0\
|
|
wg:user:clk_rst_generator:1.0\
|
|
Gehrke:user:axis_master_simmodel:1.0\
|
|
Gehrke:user:axis_slave_simmodel:1.0\
|
|
wg:user:axil_master_with_rom:1.0\
|
|
"
|
|
|
|
set list_ips_missing ""
|
|
common::send_gid_msg -ssname BD::TCL -id 2011 -severity "INFO" "Checking if the following IPs exist in the project's IP catalog: $list_check_ips ."
|
|
|
|
foreach ip_vlnv $list_check_ips {
|
|
set ip_obj [get_ipdefs -all $ip_vlnv]
|
|
if { $ip_obj eq "" } {
|
|
lappend list_ips_missing $ip_vlnv
|
|
}
|
|
}
|
|
|
|
if { $list_ips_missing ne "" } {
|
|
catch {common::send_gid_msg -ssname BD::TCL -id 2012 -severity "ERROR" "The following IPs are not found in the IP Catalog:\n $list_ips_missing\n\nResolution: Please add the repository containing the IP(s) to the project." }
|
|
set bCheckIPsPassed 0
|
|
}
|
|
|
|
}
|
|
|
|
if { $bCheckIPsPassed != 1 } {
|
|
common::send_gid_msg -ssname BD::TCL -id 2023 -severity "WARNING" "Will not continue with creation of design due to the error(s) above."
|
|
return 3
|
|
}
|
|
|
|
##################################################################
|
|
# DESIGN PROCs
|
|
##################################################################
|
|
|
|
|
|
# Hierarchical cell: SIM_Environment
|
|
proc create_hier_cell_SIM_Environment { parentCell nameHier } {
|
|
|
|
variable script_folder
|
|
|
|
if { $parentCell eq "" || $nameHier eq "" } {
|
|
catch {common::send_gid_msg -ssname BD::TCL -id 2092 -severity "ERROR" "create_hier_cell_SIM_Environment() - Empty argument(s)!"}
|
|
return
|
|
}
|
|
|
|
# Get object for parentCell
|
|
set parentObj [get_bd_cells $parentCell]
|
|
if { $parentObj == "" } {
|
|
catch {common::send_gid_msg -ssname BD::TCL -id 2090 -severity "ERROR" "Unable to find parent cell <$parentCell>!"}
|
|
return
|
|
}
|
|
|
|
# Make sure parentObj is hier blk
|
|
set parentType [get_property TYPE $parentObj]
|
|
if { $parentType ne "hier" } {
|
|
catch {common::send_gid_msg -ssname BD::TCL -id 2091 -severity "ERROR" "Parent <$parentObj> has TYPE = <$parentType>. Expected to be <hier>."}
|
|
return
|
|
}
|
|
|
|
# Save current instance; Restore later
|
|
set oldCurInst [current_bd_instance .]
|
|
|
|
# Set parent object as current
|
|
current_bd_instance $parentObj
|
|
|
|
# Create cell and set as current instance
|
|
set hier_obj [create_bd_cell -type hier $nameHier]
|
|
current_bd_instance $hier_obj
|
|
|
|
# Create interface pins
|
|
create_bd_intf_pin -mode Master -vlnv xilinx.com:interface:axis_rtl:1.0 M_AXIS
|
|
|
|
create_bd_intf_pin -mode Slave -vlnv xilinx.com:interface:axis_rtl:1.0 S_AXIS
|
|
|
|
create_bd_intf_pin -mode Master -vlnv xilinx.com:interface:aximm_rtl:1.0 M_AXIL
|
|
|
|
|
|
# Create pins
|
|
create_bd_pin -dir O -type clk M_AXIL_ACLK
|
|
create_bd_pin -dir O -type rst M_AXIL_ARESETN
|
|
|
|
# Create instance: clk_rst_generator_0, and set properties
|
|
set clk_rst_generator_0 [ create_bd_cell -type ip -vlnv wg:user:clk_rst_generator:1.0 clk_rst_generator_0 ]
|
|
set_property -dict [list \
|
|
CONFIG.HAS_CLK_INPUT {false} \
|
|
CONFIG.HAS_RESET_INPUT {false} \
|
|
CONFIG.HAS_STOP_INPUT {true} \
|
|
] $clk_rst_generator_0
|
|
|
|
|
|
# Create instance: axis_master_simmodel_0, and set properties
|
|
set axis_master_simmodel_0 [ create_bd_cell -type ip -vlnv Gehrke:user:axis_master_simmodel:1.0 axis_master_simmodel_0 ]
|
|
set_property -dict [list \
|
|
CONFIG.FILE_NAME {../../../../Moewe-192x192} \
|
|
CONFIG.NUM_LINES {192} \
|
|
CONFIG.NUM_PIX_PER_LINE {192} \
|
|
CONFIG.PIXEL_FORMAT {13} \
|
|
] $axis_master_simmodel_0
|
|
|
|
|
|
# Create instance: axis_slave_simmodel_0, and set properties
|
|
set axis_slave_simmodel_0 [ create_bd_cell -type ip -vlnv Gehrke:user:axis_slave_simmodel:1.0 axis_slave_simmodel_0 ]
|
|
set_property -dict [list \
|
|
CONFIG.FILE_NAME {../../../../tst_out} \
|
|
CONFIG.NUM_LINES {192} \
|
|
CONFIG.NUM_PIX_PER_LINE {192} \
|
|
CONFIG.PIXEL_FORMAT {13} \
|
|
] $axis_slave_simmodel_0
|
|
|
|
|
|
# Create instance: axil_master_with_rom_0, and set properties
|
|
set axil_master_with_rom_0 [ create_bd_cell -type ip -vlnv wg:user:axil_master_with_rom:1.0 axil_master_with_rom_0 ]
|
|
set_property -dict [list \
|
|
CONFIG.HAS_FINISHED_OUT {false} \
|
|
CONFIG.HAS_INTERRUPT_IN {false} \
|
|
] $axil_master_with_rom_0
|
|
|
|
|
|
# Create interface connections
|
|
connect_bd_intf_net -intf_net Conn1 [get_bd_intf_pins axil_master_with_rom_0/M_AXIL] [get_bd_intf_pins M_AXIL]
|
|
connect_bd_intf_net -intf_net axis_master_simmodel_0_M_AXIS [get_bd_intf_pins M_AXIS] [get_bd_intf_pins axis_master_simmodel_0/M_AXIS]
|
|
connect_bd_intf_net -intf_net axis_upsizer_0_M_AXIS [get_bd_intf_pins S_AXIS] [get_bd_intf_pins axis_slave_simmodel_0/S_AXIS]
|
|
|
|
# Create port connections
|
|
connect_bd_net -net axis_slave_simmodel_0_FINISHED [get_bd_pins axis_slave_simmodel_0/FINISHED] [get_bd_pins clk_rst_generator_0/stop_simulation]
|
|
connect_bd_net -net clk_rst_generator_0_clk [get_bd_pins clk_rst_generator_0/clk] [get_bd_pins M_AXIL_ACLK] [get_bd_pins axil_master_with_rom_0/M_AXIL_ACLK] [get_bd_pins axis_slave_simmodel_0/S_AXIS_ACLK] [get_bd_pins axis_master_simmodel_0/ACLK]
|
|
connect_bd_net -net clk_rst_generator_0_rst_n [get_bd_pins clk_rst_generator_0/rst_n] [get_bd_pins M_AXIL_ARESETN] [get_bd_pins axil_master_with_rom_0/M_AXIL_ARESETN] [get_bd_pins axis_slave_simmodel_0/S_AXIS_ARESETN] [get_bd_pins axis_master_simmodel_0/ARESETN]
|
|
|
|
# Restore current instance
|
|
current_bd_instance $oldCurInst
|
|
}
|
|
|
|
|
|
# Procedure to create entire design; Provide argument to make
|
|
# procedure reusable. If parentCell is "", will use root.
|
|
proc create_root_design { parentCell } {
|
|
|
|
variable script_folder
|
|
variable design_name
|
|
|
|
if { $parentCell eq "" } {
|
|
set parentCell [get_bd_cells /]
|
|
}
|
|
|
|
# Get object for parentCell
|
|
set parentObj [get_bd_cells $parentCell]
|
|
if { $parentObj == "" } {
|
|
catch {common::send_gid_msg -ssname BD::TCL -id 2090 -severity "ERROR" "Unable to find parent cell <$parentCell>!"}
|
|
return
|
|
}
|
|
|
|
# Make sure parentObj is hier blk
|
|
set parentType [get_property TYPE $parentObj]
|
|
if { $parentType ne "hier" } {
|
|
catch {common::send_gid_msg -ssname BD::TCL -id 2091 -severity "ERROR" "Parent <$parentObj> has TYPE = <$parentType>. Expected to be <hier>."}
|
|
return
|
|
}
|
|
|
|
# Save current instance; Restore later
|
|
set oldCurInst [current_bd_instance .]
|
|
|
|
# Set parent object as current
|
|
current_bd_instance $parentObj
|
|
|
|
|
|
# Create interface ports
|
|
|
|
# Create ports
|
|
|
|
# Create instance: axis_downsizer_0, and set properties
|
|
set axis_downsizer_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:axis_downsizer:1.0 axis_downsizer_0 ]
|
|
set_property CONFIG.SIZE_FACTOR {4} $axis_downsizer_0
|
|
|
|
|
|
# Create instance: axis_linemem_single_0, and set properties
|
|
set axis_linemem_single_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:axis_linemem_single_master:1.0 axis_linemem_single_0 ]
|
|
set_property CONFIG.DATA_WIDTH {8} $axis_linemem_single_0
|
|
|
|
|
|
# Create instance: axis_filter_dummy_0, and set properties
|
|
set axis_filter_dummy_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:axis_filter_dummy:1.0 axis_filter_dummy_0 ]
|
|
|
|
# Create instance: axis_upsizer_0, and set properties
|
|
set axis_upsizer_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:axis_upsizer:1.0 axis_upsizer_0 ]
|
|
set_property CONFIG.SIZE_FACTOR {4} $axis_upsizer_0
|
|
|
|
|
|
# Create instance: SIM_Environment
|
|
create_hier_cell_SIM_Environment [current_bd_instance .] SIM_Environment
|
|
|
|
# Create interface connections
|
|
connect_bd_intf_net -intf_net axis_downsizer_0_M_AXIS [get_bd_intf_pins axis_downsizer_0/M_AXIS] [get_bd_intf_pins axis_linemem_single_0/s_axis]
|
|
connect_bd_intf_net -intf_net axis_filter_dummy_0_M_AXIS [get_bd_intf_pins axis_filter_dummy_0/M_AXIS] [get_bd_intf_pins axis_upsizer_0/S_AXIS]
|
|
connect_bd_intf_net -intf_net axis_linemem_single_0_m_axis [get_bd_intf_pins axis_linemem_single_0/m_axis] [get_bd_intf_pins axis_filter_dummy_0/S_AXIS]
|
|
connect_bd_intf_net -intf_net axis_master_simmodel_0_M_AXIS [get_bd_intf_pins axis_downsizer_0/S_AXIS] [get_bd_intf_pins SIM_Environment/M_AXIS]
|
|
connect_bd_intf_net -intf_net axis_upsizer_0_M_AXIS [get_bd_intf_pins axis_upsizer_0/M_AXIS] [get_bd_intf_pins SIM_Environment/S_AXIS]
|
|
|
|
# Create port connections
|
|
connect_bd_net -net clk_rst_generator_0_clk [get_bd_pins SIM_Environment/M_AXIL_ACLK] [get_bd_pins axis_filter_dummy_0/AXIS_ACLK] [get_bd_pins axis_linemem_single_0/aclk] [get_bd_pins axis_upsizer_0/AXIS_ACLK] [get_bd_pins axis_downsizer_0/AXIS_ACLK]
|
|
connect_bd_net -net clk_rst_generator_0_rst_n [get_bd_pins SIM_Environment/M_AXIL_ARESETN] [get_bd_pins axis_filter_dummy_0/AXIS_ARESETN] [get_bd_pins axis_linemem_single_0/aresetn] [get_bd_pins axis_upsizer_0/AXIS_ARESETN] [get_bd_pins axis_downsizer_0/AXIS_ARESETN]
|
|
|
|
# Create address segments
|
|
|
|
|
|
# Restore current instance
|
|
current_bd_instance $oldCurInst
|
|
|
|
validate_bd_design
|
|
save_bd_design
|
|
}
|
|
# End of create_root_design()
|
|
|
|
|
|
##################################################################
|
|
# MAIN FLOW
|
|
##################################################################
|
|
|
|
create_root_design ""
|
|
|
|
|