design_1_bd.tcl 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. ################################################################
  2. # This is a generated script based on design: design_1
  3. #
  4. # Though there are limitations about the generated script,
  5. # the main purpose of this utility is to make learning
  6. # IP Integrator Tcl commands easier.
  7. ################################################################
  8. namespace eval _tcl {
  9. proc get_script_folder {} {
  10. set script_path [file normalize [info script]]
  11. set script_folder [file dirname $script_path]
  12. return $script_folder
  13. }
  14. }
  15. variable script_folder
  16. set script_folder [_tcl::get_script_folder]
  17. ################################################################
  18. # Check if script is running in correct Vivado version.
  19. ################################################################
  20. set scripts_vivado_version 2018.3
  21. set current_vivado_version [version -short]
  22. if { [string first $scripts_vivado_version $current_vivado_version] == -1 } {
  23. puts ""
  24. catch {common::send_msg_id "BD_TCL-109" "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."}
  25. return 1
  26. }
  27. ################################################################
  28. # START
  29. ################################################################
  30. # To test this script, run the following commands from Vivado Tcl console:
  31. # source design_1_script.tcl
  32. # If there is no project opened, this script will create a
  33. # project, but make sure you do not have an existing project
  34. # <./myproj/project_1.xpr> in the current working folder.
  35. set list_projs [get_projects -quiet]
  36. if { $list_projs eq "" } {
  37. create_project project_1 myproj -part xc7a100tcsg324-1
  38. }
  39. # CHANGE DESIGN NAME HERE
  40. variable design_name
  41. set design_name design_1
  42. # This script was generated for a remote BD. To create a non-remote design,
  43. # change the variable <run_remote_bd_flow> to <0>.
  44. set run_remote_bd_flow 1
  45. if { $run_remote_bd_flow == 1 } {
  46. # Set the reference directory for source file relative paths (by default
  47. # the value is script directory path)
  48. set origin_dir ./sources/complete-bd.bd
  49. # Use origin directory path location variable, if specified in the tcl shell
  50. if { [info exists ::origin_dir_loc] } {
  51. set origin_dir $::origin_dir_loc
  52. }
  53. set str_bd_folder [file normalize ${origin_dir}]
  54. set str_bd_filepath ${str_bd_folder}/${design_name}/${design_name}.bd
  55. # Check if remote design exists on disk
  56. if { [file exists $str_bd_filepath ] == 1 } {
  57. catch {common::send_msg_id "BD_TCL-110" "ERROR" "The remote BD file path <$str_bd_filepath> already exists!"}
  58. common::send_msg_id "BD_TCL-008" "INFO" "To create a non-remote BD, change the variable <run_remote_bd_flow> to <0>."
  59. common::send_msg_id "BD_TCL-009" "INFO" "Also make sure there is no design <$design_name> existing in your current project."
  60. return 1
  61. }
  62. # Check if design exists in memory
  63. set list_existing_designs [get_bd_designs -quiet $design_name]
  64. if { $list_existing_designs ne "" } {
  65. catch {common::send_msg_id "BD_TCL-111" "ERROR" "The design <$design_name> already exists in this project! Will not create the remote BD <$design_name> at the folder <$str_bd_folder>."}
  66. common::send_msg_id "BD_TCL-010" "INFO" "To create a non-remote BD, change the variable <run_remote_bd_flow> to <0> or please set a different value to variable <design_name>."
  67. return 1
  68. }
  69. # Check if design exists on disk within project
  70. set list_existing_designs [get_files -quiet */${design_name}.bd]
  71. if { $list_existing_designs ne "" } {
  72. catch {common::send_msg_id "BD_TCL-112" "ERROR" "The design <$design_name> already exists in this project at location:
  73. $list_existing_designs"}
  74. catch {common::send_msg_id "BD_TCL-113" "ERROR" "Will not create the remote BD <$design_name> at the folder <$str_bd_folder>."}
  75. common::send_msg_id "BD_TCL-011" "INFO" "To create a non-remote BD, change the variable <run_remote_bd_flow> to <0> or please set a different value to variable <design_name>."
  76. return 1
  77. }
  78. # Now can create the remote BD
  79. # NOTE - usage of <-dir> will create <$str_bd_folder/$design_name/$design_name.bd>
  80. create_bd_design -dir $str_bd_folder $design_name
  81. } else {
  82. # Create regular design
  83. if { [catch {create_bd_design $design_name} errmsg] } {
  84. common::send_msg_id "BD_TCL-012" "INFO" "Please set a different value to variable <design_name>."
  85. return 1
  86. }
  87. }
  88. current_bd_design $design_name
  89. ##################################################################
  90. # DESIGN PROCs
  91. ##################################################################
  92. # Procedure to create entire design; Provide argument to make
  93. # procedure reusable. If parentCell is "", will use root.
  94. proc create_root_design { parentCell } {
  95. variable script_folder
  96. variable design_name
  97. if { $parentCell eq "" } {
  98. set parentCell [get_bd_cells /]
  99. }
  100. # Get object for parentCell
  101. set parentObj [get_bd_cells $parentCell]
  102. if { $parentObj == "" } {
  103. catch {common::send_msg_id "BD_TCL-100" "ERROR" "Unable to find parent cell <$parentCell>!"}
  104. return
  105. }
  106. # Make sure parentObj is hier blk
  107. set parentType [get_property TYPE $parentObj]
  108. if { $parentType ne "hier" } {
  109. catch {common::send_msg_id "BD_TCL-101" "ERROR" "Parent <$parentObj> has TYPE = <$parentType>. Expected to be <hier>."}
  110. return
  111. }
  112. # Save current instance; Restore later
  113. set oldCurInst [current_bd_instance .]
  114. # Set parent object as current
  115. current_bd_instance $parentObj
  116. # Create interface ports
  117. # Create ports
  118. set anodes_0 [ create_bd_port -dir O -from 0 -to 7 anodes_0 ]
  119. set cathodes_0 [ create_bd_port -dir O -from 0 -to 7 cathodes_0 ]
  120. set clk_100MHz [ create_bd_port -dir I -type clk clk_100MHz ]
  121. set_property -dict [ list \
  122. CONFIG.FREQ_HZ {100000000} \
  123. ] $clk_100MHz
  124. set eth_crsdv_0 [ create_bd_port -dir IO eth_crsdv_0 ]
  125. set eth_mdc_0 [ create_bd_port -dir O eth_mdc_0 ]
  126. set eth_mdio_0 [ create_bd_port -dir IO eth_mdio_0 ]
  127. set eth_refclk_0 [ create_bd_port -dir O eth_refclk_0 ]
  128. set eth_rstn_0 [ create_bd_port -dir IO -type rst eth_rstn_0 ]
  129. set eth_rxd_0 [ create_bd_port -dir IO -from 1 -to 0 eth_rxd_0 ]
  130. set eth_rxerr_0 [ create_bd_port -dir IO eth_rxerr_0 ]
  131. set eth_txd_0 [ create_bd_port -dir IO -from 1 -to 0 eth_txd_0 ]
  132. set eth_txen_0 [ create_bd_port -dir IO eth_txen_0 ]
  133. set led16_b_0 [ create_bd_port -dir O led16_b_0 ]
  134. set led16_g_0 [ create_bd_port -dir O led16_g_0 ]
  135. set led16_r_0 [ create_bd_port -dir O led16_r_0 ]
  136. set led17_b_0 [ create_bd_port -dir O led17_b_0 ]
  137. set led17_g_0 [ create_bd_port -dir O led17_g_0 ]
  138. set led17_r_0 [ create_bd_port -dir O led17_r_0 ]
  139. set led_0 [ create_bd_port -dir O -from 15 -to 0 led_0 ]
  140. set reset_rtl_0 [ create_bd_port -dir I -type rst reset_rtl_0 ]
  141. set_property -dict [ list \
  142. CONFIG.POLARITY {ACTIVE_LOW} \
  143. ] $reset_rtl_0
  144. set sw_0 [ create_bd_port -dir I -from 4 -to 0 sw_0 ]
  145. # Create instance: c_counter_binary_0, and set properties
  146. set c_counter_binary_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:c_counter_binary:12.0 c_counter_binary_0 ]
  147. set_property -dict [ list \
  148. CONFIG.CE {true} \
  149. CONFIG.Fb_Latency_Configuration {Automatic} \
  150. CONFIG.Final_Count_Value {270F} \
  151. CONFIG.Latency_Configuration {Automatic} \
  152. CONFIG.Restrict_Count {true} \
  153. CONFIG.SCLR {true} \
  154. ] $c_counter_binary_0
  155. # Create instance: c_counter_binary_1, and set properties
  156. set c_counter_binary_1 [ create_bd_cell -type ip -vlnv xilinx.com:ip:c_counter_binary:12.0 c_counter_binary_1 ]
  157. set_property -dict [ list \
  158. CONFIG.CE {true} \
  159. CONFIG.Fb_Latency_Configuration {Automatic} \
  160. CONFIG.Final_Count_Value {270F} \
  161. CONFIG.Latency_Configuration {Automatic} \
  162. CONFIG.Restrict_Count {true} \
  163. CONFIG.SCLR {true} \
  164. ] $c_counter_binary_1
  165. # Create instance: ethernet_transceiver2_0, and set properties
  166. set ethernet_transceiver2_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:ethernet_transceiver2:1.0 ethernet_transceiver2_0 ]
  167. # Create instance: fifo_input, and set properties
  168. set fifo_input [ create_bd_cell -type ip -vlnv xilinx.com:ip:fifo_generator:13.2 fifo_input ]
  169. set_property -dict [ list \
  170. CONFIG.Almost_Empty_Flag {false} \
  171. CONFIG.Data_Count {false} \
  172. CONFIG.FIFO_Implementation_rach {Common_Clock_Distributed_RAM} \
  173. CONFIG.FIFO_Implementation_wach {Common_Clock_Distributed_RAM} \
  174. CONFIG.FIFO_Implementation_wrch {Common_Clock_Distributed_RAM} \
  175. CONFIG.Fifo_Implementation {Common_Clock_Distributed_RAM} \
  176. CONFIG.INTERFACE_TYPE {Native} \
  177. CONFIG.Input_Data_Width {32} \
  178. CONFIG.Input_Depth {64} \
  179. CONFIG.Overflow_Flag {true} \
  180. CONFIG.Performance_Options {Standard_FIFO} \
  181. CONFIG.Programmable_Empty_Type {No_Programmable_Empty_Threshold} \
  182. CONFIG.Programmable_Full_Type {No_Programmable_Full_Threshold} \
  183. CONFIG.Reset_Pin {true} \
  184. CONFIG.Reset_Type {Synchronous_Reset} \
  185. CONFIG.Underflow_Flag {false} \
  186. CONFIG.Use_Dout_Reset {true} \
  187. CONFIG.Valid_Flag {false} \
  188. ] $fifo_input
  189. # Create instance: fifo_output, and set properties
  190. set fifo_output [ create_bd_cell -type ip -vlnv xilinx.com:ip:fifo_generator:13.2 fifo_output ]
  191. set_property -dict [ list \
  192. CONFIG.Almost_Empty_Flag {false} \
  193. CONFIG.Almost_Full_Flag {false} \
  194. CONFIG.FIFO_Implementation_rach {Common_Clock_Distributed_RAM} \
  195. CONFIG.FIFO_Implementation_wach {Common_Clock_Distributed_RAM} \
  196. CONFIG.FIFO_Implementation_wrch {Common_Clock_Distributed_RAM} \
  197. CONFIG.Fifo_Implementation {Independent_Clocks_Distributed_RAM} \
  198. CONFIG.Full_Flags_Reset_Value {1} \
  199. CONFIG.INTERFACE_TYPE {Native} \
  200. CONFIG.Input_Data_Width {32} \
  201. CONFIG.Input_Depth {512} \
  202. CONFIG.Overflow_Flag {true} \
  203. CONFIG.Performance_Options {Standard_FIFO} \
  204. CONFIG.Programmable_Empty_Type {No_Programmable_Empty_Threshold} \
  205. CONFIG.Programmable_Full_Type {No_Programmable_Full_Threshold} \
  206. CONFIG.Read_Data_Count {true} \
  207. CONFIG.Read_Data_Count_Width {9} \
  208. CONFIG.Reset_Pin {true} \
  209. CONFIG.Underflow_Flag {false} \
  210. CONFIG.Use_Dout_Reset {true} \
  211. CONFIG.Valid_Flag {false} \
  212. CONFIG.Write_Data_Count {false} \
  213. ] $fifo_output
  214. # Create instance: negate_0, and set properties
  215. set negate_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:c_addsub:12.0 negate_0 ]
  216. set_property -dict [ list \
  217. CONFIG.A_Type {Unsigned} \
  218. CONFIG.A_Width {1} \
  219. CONFIG.Add_Mode {Add} \
  220. CONFIG.B_Constant {true} \
  221. CONFIG.B_Type {Unsigned} \
  222. CONFIG.B_Value {1} \
  223. CONFIG.B_Width {1} \
  224. CONFIG.CE {false} \
  225. CONFIG.Latency {1} \
  226. CONFIG.Latency_Configuration {Automatic} \
  227. CONFIG.Out_Width {1} \
  228. ] $negate_0
  229. # Create instance: packaging_1, and set properties
  230. set packaging_1 [ create_bd_cell -type ip -vlnv user.org:user:packaging:3.0 packaging_1 ]
  231. # Create instance: segment_0, and set properties
  232. set segment_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:segment:1.0 segment_0 ]
  233. # Create instance: xlconcat_4, and set properties
  234. set xlconcat_4 [ create_bd_cell -type ip -vlnv xilinx.com:ip:xlconcat:2.1 xlconcat_4 ]
  235. set_property -dict [ list \
  236. CONFIG.IN0_WIDTH {4} \
  237. CONFIG.IN1_WIDTH {4} \
  238. CONFIG.IN2_WIDTH {8} \
  239. CONFIG.IN3_WIDTH {2} \
  240. CONFIG.IN4_WIDTH {5} \
  241. CONFIG.NUM_PORTS {3} \
  242. ] $xlconcat_4
  243. # Create instance: xlconcat_5, and set properties
  244. set xlconcat_5 [ create_bd_cell -type ip -vlnv xilinx.com:ip:xlconcat:2.1 xlconcat_5 ]
  245. set_property -dict [ list \
  246. CONFIG.IN0_WIDTH {9} \
  247. CONFIG.IN1_WIDTH {7} \
  248. CONFIG.IN2_WIDTH {8} \
  249. CONFIG.IN3_WIDTH {2} \
  250. CONFIG.IN4_WIDTH {5} \
  251. CONFIG.NUM_PORTS {2} \
  252. ] $xlconcat_5
  253. # Create instance: xlconstant_0, and set properties
  254. set xlconstant_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:xlconstant:1.1 xlconstant_0 ]
  255. set_property -dict [ list \
  256. CONFIG.CONST_VAL {0} \
  257. CONFIG.CONST_WIDTH {16} \
  258. ] $xlconstant_0
  259. # Create instance: xlconstant_1, and set properties
  260. set xlconstant_1 [ create_bd_cell -type ip -vlnv xilinx.com:ip:xlconstant:1.1 xlconstant_1 ]
  261. set_property -dict [ list \
  262. CONFIG.CONST_VAL {0} \
  263. CONFIG.CONST_WIDTH {7} \
  264. ] $xlconstant_1
  265. # Create instance: xlslice_0, and set properties
  266. set xlslice_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:xlslice:1.0 xlslice_0 ]
  267. set_property -dict [ list \
  268. CONFIG.DIN_FROM {7} \
  269. CONFIG.DIN_TO {0} \
  270. CONFIG.DIN_WIDTH {16} \
  271. CONFIG.DOUT_WIDTH {8} \
  272. ] $xlslice_0
  273. # Create interface connections
  274. connect_bd_intf_net -intf_net ethernet_transceiver2_0_fifo_read [get_bd_intf_pins ethernet_transceiver2_0/fifo_read] [get_bd_intf_pins fifo_output/FIFO_READ]
  275. connect_bd_intf_net -intf_net ethernet_transceiver2_0_fifo_write [get_bd_intf_pins ethernet_transceiver2_0/fifo_write] [get_bd_intf_pins fifo_input/FIFO_WRITE]
  276. connect_bd_intf_net -intf_net packaging_1_fifo_read [get_bd_intf_pins fifo_input/FIFO_READ] [get_bd_intf_pins packaging_1/fifo_read]
  277. connect_bd_intf_net -intf_net packaging_1_fifo_write [get_bd_intf_pins fifo_output/FIFO_WRITE] [get_bd_intf_pins packaging_1/fifo_write]
  278. # Create port connections
  279. connect_bd_net -net Net [get_bd_ports eth_rxd_0] [get_bd_pins ethernet_transceiver2_0/eth_rxd]
  280. connect_bd_net -net Net1 [get_bd_ports eth_txd_0] [get_bd_pins ethernet_transceiver2_0/eth_txd]
  281. connect_bd_net -net Net2 [get_bd_ports eth_crsdv_0] [get_bd_pins ethernet_transceiver2_0/eth_crsdv]
  282. connect_bd_net -net Net3 [get_bd_ports eth_txen_0] [get_bd_pins ethernet_transceiver2_0/eth_txen]
  283. connect_bd_net -net Net4 [get_bd_ports eth_rxerr_0] [get_bd_pins ethernet_transceiver2_0/eth_rxerr]
  284. connect_bd_net -net Net5 [get_bd_ports eth_mdio_0] [get_bd_pins ethernet_transceiver2_0/eth_mdio]
  285. connect_bd_net -net Net6 [get_bd_ports eth_rstn_0] [get_bd_pins ethernet_transceiver2_0/eth_rstn]
  286. connect_bd_net -net c_counter_binary_0_Q [get_bd_pins c_counter_binary_0/Q] [get_bd_pins segment_0/num2]
  287. connect_bd_net -net c_counter_binary_1_Q [get_bd_pins c_counter_binary_1/Q] [get_bd_pins segment_0/num1]
  288. connect_bd_net -net clk_wiz_clk_out1 [get_bd_ports clk_100MHz] [get_bd_pins c_counter_binary_0/CLK] [get_bd_pins c_counter_binary_1/CLK] [get_bd_pins ethernet_transceiver2_0/clk100mhz] [get_bd_pins fifo_input/clk] [get_bd_pins fifo_output/wr_clk] [get_bd_pins negate_0/CLK] [get_bd_pins packaging_1/clk] [get_bd_pins segment_0/clk]
  289. connect_bd_net -net ethernet_transceiver2_0_eth_mdc [get_bd_ports eth_mdc_0] [get_bd_pins ethernet_transceiver2_0/eth_mdc]
  290. connect_bd_net -net ethernet_transceiver2_0_eth_refclk [get_bd_ports eth_refclk_0] [get_bd_pins ethernet_transceiver2_0/eth_refclk] [get_bd_pins fifo_output/rd_clk]
  291. connect_bd_net -net ethernet_transceiver2_0_led16_b [get_bd_ports led16_b_0] [get_bd_pins ethernet_transceiver2_0/led16_b]
  292. connect_bd_net -net ethernet_transceiver2_0_led16_g [get_bd_ports led16_g_0] [get_bd_pins ethernet_transceiver2_0/led16_g]
  293. connect_bd_net -net ethernet_transceiver2_0_led16_r [get_bd_ports led16_r_0] [get_bd_pins ethernet_transceiver2_0/led16_r]
  294. connect_bd_net -net ethernet_transceiver2_0_led17_b [get_bd_ports led17_b_0] [get_bd_pins ethernet_transceiver2_0/led17_b]
  295. connect_bd_net -net ethernet_transceiver2_0_led17_g [get_bd_ports led17_g_0] [get_bd_pins ethernet_transceiver2_0/led17_g]
  296. connect_bd_net -net ethernet_transceiver2_0_led17_r [get_bd_ports led17_r_0] [get_bd_pins ethernet_transceiver2_0/led17_r]
  297. connect_bd_net -net fifo_input_overflow [get_bd_pins c_counter_binary_1/CE] [get_bd_pins fifo_input/overflow]
  298. connect_bd_net -net fifo_output_overflow [get_bd_pins c_counter_binary_0/CE] [get_bd_pins fifo_output/overflow]
  299. connect_bd_net -net fifo_output_rd_data_count [get_bd_pins fifo_output/rd_data_count] [get_bd_pins xlconcat_5/In0]
  300. connect_bd_net -net packaging_1_errorCode [get_bd_pins packaging_1/errorCode] [get_bd_pins xlconcat_4/In0]
  301. connect_bd_net -net packaging_1_stateOut [get_bd_pins packaging_1/stateOut] [get_bd_pins xlconcat_4/In1]
  302. connect_bd_net -net rst_clk_wiz_100M_peripheral_aresetn [get_bd_ports reset_rtl_0] [get_bd_pins ethernet_transceiver2_0/btn_reset] [get_bd_pins negate_0/A] [get_bd_pins packaging_1/rst]
  303. connect_bd_net -net segment_0_anodes [get_bd_ports anodes_0] [get_bd_pins segment_0/anodes]
  304. connect_bd_net -net segment_0_cathodes [get_bd_ports cathodes_0] [get_bd_pins segment_0/cathodes]
  305. connect_bd_net -net sw_0_1 [get_bd_ports sw_0] [get_bd_pins ethernet_transceiver2_0/ip]
  306. connect_bd_net -net xlconcat_4_dout [get_bd_ports led_0] [get_bd_pins xlconcat_4/dout]
  307. connect_bd_net -net xlconcat_5_dout [get_bd_pins ethernet_transceiver2_0/fifo_read_length] [get_bd_pins xlconcat_5/dout] [get_bd_pins xlslice_0/Din]
  308. connect_bd_net -net xlconstant_0_dout [get_bd_pins ethernet_transceiver2_0/udp_packet_checksum] [get_bd_pins xlconstant_0/dout]
  309. connect_bd_net -net xlconstant_1_dout [get_bd_pins xlconcat_5/In1] [get_bd_pins xlconstant_1/dout]
  310. connect_bd_net -net xlslice_0_Dout [get_bd_pins xlconcat_4/In2] [get_bd_pins xlslice_0/Dout]
  311. connect_bd_net -net xlslice_1_Dout [get_bd_pins c_counter_binary_0/SCLR] [get_bd_pins c_counter_binary_1/SCLR] [get_bd_pins fifo_input/srst] [get_bd_pins fifo_output/rst] [get_bd_pins negate_0/S]
  312. # Create address segments
  313. # Restore current instance
  314. current_bd_instance $oldCurInst
  315. validate_bd_design
  316. save_bd_design
  317. }
  318. # End of create_root_design()
  319. ##################################################################
  320. # MAIN FLOW
  321. ##################################################################
  322. create_root_design ""