| 1 |
15 |
qaztronic |
|
| 2 |
|
|
################################################################
|
| 3 |
|
|
# This is a generated script based on design: zync
|
| 4 |
|
|
#
|
| 5 |
|
|
# Though there are limitations about the generated script,
|
| 6 |
|
|
# the main purpose of this utility is to make learning
|
| 7 |
|
|
# IP Integrator Tcl commands easier.
|
| 8 |
|
|
################################################################
|
| 9 |
|
|
|
| 10 |
|
|
################################################################
|
| 11 |
|
|
# Check if script is running in correct Vivado version.
|
| 12 |
|
|
################################################################
|
| 13 |
|
|
set scripts_vivado_version 2014.4
|
| 14 |
|
|
set current_vivado_version [version -short]
|
| 15 |
|
|
|
| 16 |
|
|
if { [string first $scripts_vivado_version $current_vivado_version] == -1 } {
|
| 17 |
|
|
puts ""
|
| 18 |
|
|
puts "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."
|
| 19 |
|
|
|
| 20 |
|
|
return 1
|
| 21 |
|
|
}
|
| 22 |
|
|
|
| 23 |
|
|
################################################################
|
| 24 |
|
|
# START
|
| 25 |
|
|
################################################################
|
| 26 |
|
|
|
| 27 |
|
|
# To test this script, run the following commands from Vivado Tcl console:
|
| 28 |
|
|
# source zync_script.tcl
|
| 29 |
|
|
|
| 30 |
|
|
# If you do not already have a project created,
|
| 31 |
|
|
# you can create a project using the following command:
|
| 32 |
|
|
# create_project project_1 myproj -part xc7z020clg484-1
|
| 33 |
|
|
# set_property BOARD_PART em.avnet.com:zed:part0:1.2 [current_project]
|
| 34 |
|
|
|
| 35 |
|
|
|
| 36 |
|
|
# CHANGE DESIGN NAME HERE
|
| 37 |
|
|
set design_name zync
|
| 38 |
|
|
|
| 39 |
|
|
# If you do not already have an existing IP Integrator design open,
|
| 40 |
|
|
# you can create a design using the following command:
|
| 41 |
|
|
# create_bd_design $design_name
|
| 42 |
|
|
|
| 43 |
|
|
# CHECKING IF PROJECT EXISTS
|
| 44 |
|
|
if { [get_projects -quiet] eq "" } {
|
| 45 |
|
|
puts "ERROR: Please open or create a project!"
|
| 46 |
|
|
return 1
|
| 47 |
|
|
}
|
| 48 |
|
|
|
| 49 |
|
|
|
| 50 |
|
|
# Creating design if needed
|
| 51 |
|
|
set errMsg ""
|
| 52 |
|
|
set nRet 0
|
| 53 |
|
|
|
| 54 |
|
|
set cur_design [current_bd_design -quiet]
|
| 55 |
|
|
set list_cells [get_bd_cells -quiet]
|
| 56 |
|
|
|
| 57 |
|
|
if { ${design_name} eq "" } {
|
| 58 |
|
|
# USE CASES:
|
| 59 |
|
|
# 1) Design_name not set
|
| 60 |
|
|
|
| 61 |
|
|
set errMsg "ERROR: Please set the variable <design_name> to a non-empty value."
|
| 62 |
|
|
set nRet 1
|
| 63 |
|
|
|
| 64 |
|
|
} elseif { ${cur_design} ne "" && ${list_cells} eq "" } {
|
| 65 |
|
|
# USE CASES:
|
| 66 |
|
|
# 2): Current design opened AND is empty AND names same.
|
| 67 |
|
|
# 3): Current design opened AND is empty AND names diff; design_name NOT in project.
|
| 68 |
|
|
# 4): Current design opened AND is empty AND names diff; design_name exists in project.
|
| 69 |
|
|
|
| 70 |
|
|
if { $cur_design ne $design_name } {
|
| 71 |
|
|
puts "INFO: Changing value of <design_name> from <$design_name> to <$cur_design> since current design is empty."
|
| 72 |
|
|
set design_name [get_property NAME $cur_design]
|
| 73 |
|
|
}
|
| 74 |
|
|
puts "INFO: Constructing design in IPI design <$cur_design>..."
|
| 75 |
|
|
|
| 76 |
|
|
} elseif { ${cur_design} ne "" && $list_cells ne "" && $cur_design eq $design_name } {
|
| 77 |
|
|
# USE CASES:
|
| 78 |
|
|
# 5) Current design opened AND has components AND same names.
|
| 79 |
|
|
|
| 80 |
|
|
set errMsg "ERROR: Design <$design_name> already exists in your project, please set the variable <design_name> to another value."
|
| 81 |
|
|
set nRet 1
|
| 82 |
|
|
} elseif { [get_files -quiet ${design_name}.bd] ne "" } {
|
| 83 |
|
|
# USE CASES:
|
| 84 |
|
|
# 6) Current opened design, has components, but diff names, design_name exists in project.
|
| 85 |
|
|
# 7) No opened design, design_name exists in project.
|
| 86 |
|
|
|
| 87 |
|
|
set errMsg "ERROR: Design <$design_name> already exists in your project, please set the variable <design_name> to another value."
|
| 88 |
|
|
set nRet 2
|
| 89 |
|
|
|
| 90 |
|
|
} else {
|
| 91 |
|
|
# USE CASES:
|
| 92 |
|
|
# 8) No opened design, design_name not in project.
|
| 93 |
|
|
# 9) Current opened design, has components, but diff names, design_name not in project.
|
| 94 |
|
|
|
| 95 |
|
|
puts "INFO: Currently there is no design <$design_name> in project, so creating one..."
|
| 96 |
|
|
|
| 97 |
|
|
create_bd_design $design_name
|
| 98 |
|
|
|
| 99 |
|
|
puts "INFO: Making design <$design_name> as current_bd_design."
|
| 100 |
|
|
current_bd_design $design_name
|
| 101 |
|
|
|
| 102 |
|
|
}
|
| 103 |
|
|
|
| 104 |
|
|
puts "INFO: Currently the variable <design_name> is equal to \"$design_name\"."
|
| 105 |
|
|
|
| 106 |
|
|
if { $nRet != 0 } {
|
| 107 |
|
|
puts $errMsg
|
| 108 |
|
|
return $nRet
|
| 109 |
|
|
}
|
| 110 |
|
|
|
| 111 |
|
|
##################################################################
|
| 112 |
|
|
# DESIGN PROCs
|
| 113 |
|
|
##################################################################
|
| 114 |
|
|
|
| 115 |
|
|
|
| 116 |
|
|
|
| 117 |
|
|
# Procedure to create entire design; Provide argument to make
|
| 118 |
|
|
# procedure reusable. If parentCell is "", will use root.
|
| 119 |
|
|
proc create_root_design { parentCell } {
|
| 120 |
|
|
|
| 121 |
|
|
if { $parentCell eq "" } {
|
| 122 |
|
|
set parentCell [get_bd_cells /]
|
| 123 |
|
|
}
|
| 124 |
|
|
|
| 125 |
|
|
# Get object for parentCell
|
| 126 |
|
|
set parentObj [get_bd_cells $parentCell]
|
| 127 |
|
|
if { $parentObj == "" } {
|
| 128 |
|
|
puts "ERROR: Unable to find parent cell <$parentCell>!"
|
| 129 |
|
|
return
|
| 130 |
|
|
}
|
| 131 |
|
|
|
| 132 |
|
|
# Make sure parentObj is hier blk
|
| 133 |
|
|
set parentType [get_property TYPE $parentObj]
|
| 134 |
|
|
if { $parentType ne "hier" } {
|
| 135 |
|
|
puts "ERROR: Parent <$parentObj> has TYPE = <$parentType>. Expected to be <hier>."
|
| 136 |
|
|
return
|
| 137 |
|
|
}
|
| 138 |
|
|
|
| 139 |
|
|
# Save current instance; Restore later
|
| 140 |
|
|
set oldCurInst [current_bd_instance .]
|
| 141 |
|
|
|
| 142 |
|
|
# Set parent object as current
|
| 143 |
|
|
current_bd_instance $parentObj
|
| 144 |
|
|
|
| 145 |
|
|
|
| 146 |
|
|
# Create interface ports
|
| 147 |
|
|
set DDR [ create_bd_intf_port -mode Master -vlnv xilinx.com:interface:ddrx_rtl:1.0 DDR ]
|
| 148 |
|
|
set FIXED_IO [ create_bd_intf_port -mode Master -vlnv xilinx.com:display_processing_system7:fixedio_rtl:1.0 FIXED_IO ]
|
| 149 |
|
|
set M00_AXI [ create_bd_intf_port -mode Master -vlnv xilinx.com:interface:aximm_rtl:1.0 M00_AXI ]
|
| 150 |
|
|
set_property -dict [ list CONFIG.ADDR_WIDTH {32} CONFIG.DATA_WIDTH {32} CONFIG.NUM_READ_OUTSTANDING {8} CONFIG.NUM_WRITE_OUTSTANDING {8} CONFIG.PROTOCOL {AXI4LITE} ] $M00_AXI
|
| 151 |
|
|
|
| 152 |
|
|
# Create ports
|
| 153 |
|
|
set FCLK_CLK0 [ create_bd_port -dir O -type clk FCLK_CLK0 ]
|
| 154 |
|
|
set_property -dict [ list CONFIG.ASSOCIATED_BUSIF {M00_AXI} ] $FCLK_CLK0
|
| 155 |
|
|
set peripheral_aresetn [ create_bd_port -dir O -from 0 -to 0 -type rst peripheral_aresetn ]
|
| 156 |
|
|
|
| 157 |
|
|
# Create instance: axi_interconnect_0, and set properties
|
| 158 |
|
|
set axi_interconnect_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:axi_interconnect:2.1 axi_interconnect_0 ]
|
| 159 |
|
|
set_property -dict [ list CONFIG.NUM_MI {1} ] $axi_interconnect_0
|
| 160 |
|
|
|
| 161 |
|
|
# Create instance: proc_sys_reset_0, and set properties
|
| 162 |
|
|
set proc_sys_reset_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:proc_sys_reset:5.0 proc_sys_reset_0 ]
|
| 163 |
|
|
|
| 164 |
|
|
# Create instance: processing_system7_0, and set properties
|
| 165 |
|
|
set processing_system7_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:processing_system7:5.5 processing_system7_0 ]
|
| 166 |
|
|
set_property -dict [ list CONFIG.PCW_ENET0_PERIPHERAL_ENABLE {0} CONFIG.PCW_USB0_PERIPHERAL_ENABLE {0} CONFIG.preset {ZedBoard*} ] $processing_system7_0
|
| 167 |
|
|
|
| 168 |
|
|
# Create interface connections
|
| 169 |
|
|
connect_bd_intf_net -intf_net axi_interconnect_0_M00_AXI [get_bd_intf_ports M00_AXI] [get_bd_intf_pins axi_interconnect_0/M00_AXI]
|
| 170 |
|
|
connect_bd_intf_net -intf_net processing_system7_0_DDR [get_bd_intf_ports DDR] [get_bd_intf_pins processing_system7_0/DDR]
|
| 171 |
|
|
connect_bd_intf_net -intf_net processing_system7_0_FIXED_IO [get_bd_intf_ports FIXED_IO] [get_bd_intf_pins processing_system7_0/FIXED_IO]
|
| 172 |
|
|
connect_bd_intf_net -intf_net processing_system7_0_M_AXI_GP0 [get_bd_intf_pins axi_interconnect_0/S00_AXI] [get_bd_intf_pins processing_system7_0/M_AXI_GP0]
|
| 173 |
|
|
|
| 174 |
|
|
# Create port connections
|
| 175 |
|
|
connect_bd_net -net ARESETN_1 [get_bd_pins axi_interconnect_0/ARESETN] [get_bd_pins proc_sys_reset_0/interconnect_aresetn]
|
| 176 |
|
|
connect_bd_net -net proc_sys_reset_0_peripheral_aresetn [get_bd_ports peripheral_aresetn] [get_bd_pins axi_interconnect_0/M00_ARESETN] [get_bd_pins axi_interconnect_0/S00_ARESETN] [get_bd_pins proc_sys_reset_0/peripheral_aresetn]
|
| 177 |
|
|
connect_bd_net -net processing_system7_0_FCLK_CLK0 [get_bd_ports FCLK_CLK0] [get_bd_pins axi_interconnect_0/ACLK] [get_bd_pins axi_interconnect_0/M00_ACLK] [get_bd_pins axi_interconnect_0/S00_ACLK] [get_bd_pins proc_sys_reset_0/slowest_sync_clk] [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins processing_system7_0/M_AXI_GP0_ACLK]
|
| 178 |
|
|
connect_bd_net -net processing_system7_0_FCLK_RESET0_N [get_bd_pins proc_sys_reset_0/ext_reset_in] [get_bd_pins processing_system7_0/FCLK_RESET0_N]
|
| 179 |
|
|
|
| 180 |
|
|
# Create address segments
|
| 181 |
|
|
create_bd_addr_seg -range 0x10000 -offset 0x43C00000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs M00_AXI/Reg] SEG_M00_AXI_Reg
|
| 182 |
|
|
|
| 183 |
|
|
|
| 184 |
|
|
# Restore current instance
|
| 185 |
|
|
current_bd_instance $oldCurInst
|
| 186 |
|
|
|
| 187 |
|
|
save_bd_design
|
| 188 |
|
|
}
|
| 189 |
|
|
# End of create_root_design()
|
| 190 |
|
|
|
| 191 |
|
|
|
| 192 |
|
|
##################################################################
|
| 193 |
|
|
# MAIN FLOW
|
| 194 |
|
|
##################################################################
|
| 195 |
|
|
|
| 196 |
|
|
create_root_design ""
|
| 197 |
|
|
|
| 198 |
|
|
|