
################################################################
# This is a generated script based on design: Motor_Control
#
# Though there are limitations about the generated script,
# the main purpose of this utility is to make learning
# IP Integrator Tcl commands easier.
################################################################

################################################################
# Check if script is running in correct Vivado version.
################################################################
set scripts_vivado_version 2015.4
set current_vivado_version [version -short]

if { [string first $scripts_vivado_version $current_vivado_version] == -1 } {
   puts ""
   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."

   return 1
}

################################################################
# START
################################################################

# To test this script, run the following commands from Vivado Tcl console:
# source Motor_Control_script.tcl

# If you do not already have a project created,
# you can create a project using the following command:
#    create_project project_1 myproj -part xc7z020clg484-1
#    set_property BOARD_PART em.avnet.com:zed:part0:1.3 [current_project]

# CHECKING IF PROJECT EXISTS
if { [get_projects -quiet] eq "" } {
   puts "ERROR: Please open or create a project!"
   return 1
}



# CHANGE DESIGN NAME HERE
set design_name Motor_Control

# 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 "ERROR: 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 } {
      puts "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]
   }
   puts "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 "ERROR: 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 "ERROR: 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.

   puts "INFO: Currently there is no design <$design_name> in project, so creating one..."

   create_bd_design $design_name

   puts "INFO: Making design <$design_name> as current_bd_design."
   current_bd_design $design_name

}

puts "INFO: Currently the variable <design_name> is equal to \"$design_name\"."

if { $nRet != 0 } {
   puts $errMsg
   return $nRet
}

##################################################################
# DESIGN PROCs
##################################################################



# Procedure to create entire design; Provide argument to make
# procedure reusable. If parentCell is "", will use root.
proc create_root_design { parentCell } {

  if { $parentCell eq "" } {
     set parentCell [get_bd_cells /]
  }

  # Get object for parentCell
  set parentObj [get_bd_cells $parentCell]
  if { $parentObj == "" } {
     puts "ERROR: Unable to find parent cell <$parentCell>!"
     return
  }

  # Make sure parentObj is hier blk
  set parentType [get_property TYPE $parentObj]
  if { $parentType ne "hier" } {
     puts "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
  set DDR [ create_bd_intf_port -mode Master -vlnv xilinx.com:interface:ddrx_rtl:1.0 DDR ]
  set FIXED_IO [ create_bd_intf_port -mode Master -vlnv xilinx.com:display_processing_system7:fixedio_rtl:1.0 FIXED_IO ]

  # Create ports
  set ADC_clk_A [ create_bd_port -dir O ADC_clk_A ]
  set ADC_clk_B [ create_bd_port -dir O ADC_clk_B ]
  set ADC_clk_VBUS [ create_bd_port -dir O ADC_clk_VBUS ]
  set ADC_data_A [ create_bd_port -dir I ADC_data_A ]
  set ADC_data_B [ create_bd_port -dir I ADC_data_B ]
  set ADC_data_VBUS [ create_bd_port -dir I ADC_data_VBUS ]
  set PWM_AH [ create_bd_port -dir O PWM_AH ]
  set PWM_AL [ create_bd_port -dir O PWM_AL ]
  set PWM_BH [ create_bd_port -dir O PWM_BH ]
  set PWM_BL [ create_bd_port -dir O PWM_BL ]
  set PWM_CH [ create_bd_port -dir O PWM_CH ]
  set PWM_CL [ create_bd_port -dir O PWM_CL ]
  set SENS_A [ create_bd_port -dir I SENS_A ]
  set SENS_B [ create_bd_port -dir I SENS_B ]
  set SENS_INDEX [ create_bd_port -dir I SENS_INDEX ]
  set btnc [ create_bd_port -dir I btnc ]
  set btnd [ create_bd_port -dir I btnd ]
  set btnl [ create_bd_port -dir I btnl ]
  set btnr [ create_bd_port -dir I btnr ]
  set btnu [ create_bd_port -dir I btnu ]
  set leds [ create_bd_port -dir O -from 7 -to 0 leds ]
  set stop [ create_bd_port -dir I stop ]
  set stop_inv [ create_bd_port -dir I stop_inv ]

  # Create instance: ABC_to_dq_0, and set properties
  set ABC_to_dq_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:ABC_to_dq:1.0 ABC_to_dq_0 ]

  # Create instance: ADC_read_0, and set properties
  set ADC_read_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:ADC_read:1.0 ADC_read_0 ]

  # Create instance: Control_signals_0, and set properties
  set Control_signals_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:Control_signals:1.0 Control_signals_0 ]

  # Create instance: Current_controller_0, and set properties
  set Current_controller_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:Current_controller:1.0 Current_controller_0 ]
  set_property -dict [ list \
CONFIG.Ki_d {666667} \
CONFIG.Ki_q {666667} \
CONFIG.Kp_d {1500} \
CONFIG.Kp_q {1500} \
 ] $Current_controller_0

  # Create instance: Encoder_0, and set properties
  set Encoder_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:Encoder:1.0 Encoder_0 ]

  # Create instance: PI_controller_0, and set properties
  set PI_controller_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:PI_controller:1.0 PI_controller_0 ]
  set_property -dict [ list \
CONFIG.Ki {12500} \
CONFIG.Kp {1500} \
 ] $PI_controller_0

  # Create instance: PWM_generator_0, and set properties
  set PWM_generator_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:PWM_generator:1.0 PWM_generator_0 ]

  # Create instance: Safe_mode_0, and set properties
  set Safe_mode_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:Safe_mode:1.0 Safe_mode_0 ]

  # Create instance: User_Interface_0, and set properties
  set User_Interface_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:User_Interface:1.0 User_Interface_0 ]

  # Create instance: dq_to_ABC_0, and set properties
  set dq_to_ABC_0 [ create_bd_cell -type ip -vlnv xilinx.com:user:dq_to_ABC:1.0 dq_to_ABC_0 ]

  # Create instance: processing_system7_0, and set properties
  set processing_system7_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:processing_system7:5.5 processing_system7_0 ]
  set_property -dict [ list \
CONFIG.PCW_EN_CLK1_PORT {1} \
CONFIG.PCW_EN_CLK2_PORT {1} \
CONFIG.PCW_FPGA1_PERIPHERAL_FREQMHZ {50} \
CONFIG.PCW_FPGA2_PERIPHERAL_FREQMHZ {20} \
CONFIG.preset {ZedBoard} \
 ] $processing_system7_0

  # Create instance: processing_system7_0_axi_periph, and set properties
  set processing_system7_0_axi_periph [ create_bd_cell -type ip -vlnv xilinx.com:ip:axi_interconnect:2.1 processing_system7_0_axi_periph ]
  set_property -dict [ list \
CONFIG.NUM_MI {10} \
 ] $processing_system7_0_axi_periph

  # Create instance: rst_processing_system7_0_100M, and set properties
  set rst_processing_system7_0_100M [ create_bd_cell -type ip -vlnv xilinx.com:ip:proc_sys_reset:5.0 rst_processing_system7_0_100M ]

  # Create instance: xlconstant_0, and set properties
  set xlconstant_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:xlconstant:1.1 xlconstant_0 ]
  set_property -dict [ list \
CONFIG.CONST_VAL {0} \
CONFIG.CONST_WIDTH {16} \
 ] $xlconstant_0

  # Create interface connections
  connect_bd_intf_net -intf_net processing_system7_0_DDR [get_bd_intf_ports DDR] [get_bd_intf_pins processing_system7_0/DDR]
  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]
  connect_bd_intf_net -intf_net processing_system7_0_M_AXI_GP0 [get_bd_intf_pins processing_system7_0/M_AXI_GP0] [get_bd_intf_pins processing_system7_0_axi_periph/S00_AXI]
  connect_bd_intf_net -intf_net processing_system7_0_axi_periph_M00_AXI [get_bd_intf_pins PWM_generator_0/S00_AXI] [get_bd_intf_pins processing_system7_0_axi_periph/M00_AXI]
  connect_bd_intf_net -intf_net processing_system7_0_axi_periph_M01_AXI [get_bd_intf_pins Safe_mode_0/S00_AXI] [get_bd_intf_pins processing_system7_0_axi_periph/M01_AXI]
  connect_bd_intf_net -intf_net processing_system7_0_axi_periph_M02_AXI [get_bd_intf_pins ADC_read_0/S00_AXI] [get_bd_intf_pins processing_system7_0_axi_periph/M02_AXI]
  connect_bd_intf_net -intf_net processing_system7_0_axi_periph_M03_AXI [get_bd_intf_pins Encoder_0/S00_AXI] [get_bd_intf_pins processing_system7_0_axi_periph/M03_AXI]
  connect_bd_intf_net -intf_net processing_system7_0_axi_periph_M04_AXI [get_bd_intf_pins Control_signals_0/S00_AXI] [get_bd_intf_pins processing_system7_0_axi_periph/M04_AXI]
  connect_bd_intf_net -intf_net processing_system7_0_axi_periph_M05_AXI [get_bd_intf_pins ABC_to_dq_0/S00_AXI] [get_bd_intf_pins processing_system7_0_axi_periph/M05_AXI]
  connect_bd_intf_net -intf_net processing_system7_0_axi_periph_M06_AXI [get_bd_intf_pins Current_controller_0/S00_AXI] [get_bd_intf_pins processing_system7_0_axi_periph/M06_AXI]
  connect_bd_intf_net -intf_net processing_system7_0_axi_periph_M07_AXI [get_bd_intf_pins PI_controller_0/S00_AXI] [get_bd_intf_pins processing_system7_0_axi_periph/M07_AXI]
  connect_bd_intf_net -intf_net processing_system7_0_axi_periph_M08_AXI [get_bd_intf_pins dq_to_ABC_0/S00_AXI] [get_bd_intf_pins processing_system7_0_axi_periph/M08_AXI]
  connect_bd_intf_net -intf_net processing_system7_0_axi_periph_M09_AXI [get_bd_intf_pins User_Interface_0/S00_AXI] [get_bd_intf_pins processing_system7_0_axi_periph/M09_AXI]

  # Create port connections
  connect_bd_net -net ABC_to_dq_0_cos [get_bd_pins ABC_to_dq_0/cos] [get_bd_pins dq_to_ABC_0/cos]
  connect_bd_net -net ABC_to_dq_0_d [get_bd_pins ABC_to_dq_0/d] [get_bd_pins Current_controller_0/y_d]
  connect_bd_net -net ABC_to_dq_0_q [get_bd_pins ABC_to_dq_0/q] [get_bd_pins Current_controller_0/y_q]
  connect_bd_net -net ABC_to_dq_0_sin [get_bd_pins ABC_to_dq_0/sin] [get_bd_pins dq_to_ABC_0/sin]
  connect_bd_net -net ABC_to_dq_0_sync_out [get_bd_pins ABC_to_dq_0/sync_out] [get_bd_pins Current_controller_0/sync_in]
  connect_bd_net -net ADC_data_A_1 [get_bd_ports ADC_data_A] [get_bd_pins ADC_read_0/ADC_data_A]
  connect_bd_net -net ADC_data_B_1 [get_bd_ports ADC_data_B] [get_bd_pins ADC_read_0/ADC_data_B]
  connect_bd_net -net ADC_data_VBUS_1 [get_bd_ports ADC_data_VBUS] [get_bd_pins ADC_read_0/ADC_data_VBUS]
  connect_bd_net -net ADC_read_0_ADC_clk_A [get_bd_ports ADC_clk_A] [get_bd_pins ADC_read_0/ADC_clk_A]
  connect_bd_net -net ADC_read_0_ADC_clk_B [get_bd_ports ADC_clk_B] [get_bd_pins ADC_read_0/ADC_clk_B]
  connect_bd_net -net ADC_read_0_ADC_clk_VBUS [get_bd_ports ADC_clk_VBUS] [get_bd_pins ADC_read_0/ADC_clk_VBUS]
  connect_bd_net -net ADC_read_0_Current_A [get_bd_pins ABC_to_dq_0/a] [get_bd_pins ADC_read_0/Current_A]
  connect_bd_net -net ADC_read_0_Current_B [get_bd_pins ABC_to_dq_0/b] [get_bd_pins ADC_read_0/Current_B]
  connect_bd_net -net Control_signals_0_zero_align [get_bd_pins Control_signals_0/zero_align] [get_bd_pins PWM_generator_0/zero_align]
  connect_bd_net -net Control_signals_0_zero_calib [get_bd_pins Control_signals_0/zero_calib] [get_bd_pins Encoder_0/zero_calib]
  connect_bd_net -net Current_controller_0_sync_out [get_bd_pins Current_controller_0/sync_out] [get_bd_pins dq_to_ABC_0/sync_in]
  connect_bd_net -net Current_controller_0_x_d [get_bd_pins Current_controller_0/x_d] [get_bd_pins dq_to_ABC_0/d]
  connect_bd_net -net Current_controller_0_x_q [get_bd_pins Current_controller_0/x_q] [get_bd_pins dq_to_ABC_0/q]
  connect_bd_net -net Encoder_0_angle [get_bd_pins ABC_to_dq_0/angle] [get_bd_pins Encoder_0/angle]
  connect_bd_net -net Encoder_0_speed [get_bd_pins Encoder_0/speed] [get_bd_pins PI_controller_0/y]
  connect_bd_net -net Encoder_0_sync_out [get_bd_pins ABC_to_dq_0/sync_in] [get_bd_pins Encoder_0/sync_out] [get_bd_pins PI_controller_0/sync_in]
  connect_bd_net -net Encoder_0_zero_calib_done [get_bd_pins Control_signals_0/zero_calib_done] [get_bd_pins Encoder_0/zero_calib_done]
  connect_bd_net -net PI_controller_0_x [get_bd_pins Current_controller_0/w_q] [get_bd_pins PI_controller_0/x]
  connect_bd_net -net PWM_generator_0_PWM_AH [get_bd_ports PWM_AH] [get_bd_pins PWM_generator_0/PWM_AH]
  connect_bd_net -net PWM_generator_0_PWM_AL [get_bd_ports PWM_AL] [get_bd_pins PWM_generator_0/PWM_AL]
  connect_bd_net -net PWM_generator_0_PWM_BH [get_bd_ports PWM_BH] [get_bd_pins PWM_generator_0/PWM_BH]
  connect_bd_net -net PWM_generator_0_PWM_BL [get_bd_ports PWM_BL] [get_bd_pins PWM_generator_0/PWM_BL]
  connect_bd_net -net PWM_generator_0_PWM_CH [get_bd_ports PWM_CH] [get_bd_pins PWM_generator_0/PWM_CH]
  connect_bd_net -net PWM_generator_0_PWM_CL [get_bd_ports PWM_CL] [get_bd_pins PWM_generator_0/PWM_CL]
  connect_bd_net -net PWM_generator_0_sync_out [get_bd_pins ADC_read_0/sync_in] [get_bd_pins Encoder_0/sync_in] [get_bd_pins PWM_generator_0/sync_out]
  connect_bd_net -net SENS_A_1 [get_bd_ports SENS_A] [get_bd_pins Encoder_0/SENS_A]
  connect_bd_net -net SENS_B_1 [get_bd_ports SENS_B] [get_bd_pins Encoder_0/SENS_B]
  connect_bd_net -net SENS_INDEX_1 [get_bd_ports SENS_INDEX] [get_bd_pins Encoder_0/SENS_INDEX]
  connect_bd_net -net Safe_mode_0_run_out [get_bd_pins ADC_read_0/run] [get_bd_pins Control_signals_0/run] [get_bd_pins Current_controller_0/run] [get_bd_pins PI_controller_0/run] [get_bd_pins PWM_generator_0/run] [get_bd_pins Safe_mode_0/run_out]
  connect_bd_net -net Safe_mode_0_run_out_inv [get_bd_pins PWM_generator_0/run_neg] [get_bd_pins Safe_mode_0/run_out_inv]
  connect_bd_net -net User_Interface_0_leds [get_bd_ports leds] [get_bd_pins User_Interface_0/leds]
  connect_bd_net -net User_Interface_0_requested_speed [get_bd_pins PI_controller_0/w] [get_bd_pins User_Interface_0/requested_speed]
  connect_bd_net -net User_Interface_0_run [get_bd_pins Safe_mode_0/run_in] [get_bd_pins User_Interface_0/run]
  connect_bd_net -net btnc_1 [get_bd_ports btnc] [get_bd_pins User_Interface_0/btnc]
  connect_bd_net -net btnd_1 [get_bd_ports btnd] [get_bd_pins User_Interface_0/btnd]
  connect_bd_net -net btnl_1 [get_bd_ports btnl] [get_bd_pins User_Interface_0/btnl]
  connect_bd_net -net btnr_1 [get_bd_ports btnr] [get_bd_pins User_Interface_0/btnr]
  connect_bd_net -net btnu_1 [get_bd_ports btnu] [get_bd_pins User_Interface_0/btnu]
  connect_bd_net -net dq_to_ABC_0_a [get_bd_pins PWM_generator_0/duty_A] [get_bd_pins dq_to_ABC_0/a]
  connect_bd_net -net dq_to_ABC_0_b [get_bd_pins PWM_generator_0/duty_B] [get_bd_pins dq_to_ABC_0/b]
  connect_bd_net -net dq_to_ABC_0_c [get_bd_pins PWM_generator_0/duty_C] [get_bd_pins dq_to_ABC_0/c]
  connect_bd_net -net processing_system7_0_FCLK_CLK0 [get_bd_pins ABC_to_dq_0/s00_axi_aclk] [get_bd_pins ADC_read_0/s00_axi_aclk] [get_bd_pins Control_signals_0/s00_axi_aclk] [get_bd_pins Current_controller_0/s00_axi_aclk] [get_bd_pins Encoder_0/s00_axi_aclk] [get_bd_pins PI_controller_0/s00_axi_aclk] [get_bd_pins PWM_generator_0/s00_axi_aclk] [get_bd_pins Safe_mode_0/s00_axi_aclk] [get_bd_pins User_Interface_0/s00_axi_aclk] [get_bd_pins dq_to_ABC_0/s00_axi_aclk] [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins processing_system7_0/M_AXI_GP0_ACLK] [get_bd_pins processing_system7_0_axi_periph/ACLK] [get_bd_pins processing_system7_0_axi_periph/M00_ACLK] [get_bd_pins processing_system7_0_axi_periph/M01_ACLK] [get_bd_pins processing_system7_0_axi_periph/M02_ACLK] [get_bd_pins processing_system7_0_axi_periph/M03_ACLK] [get_bd_pins processing_system7_0_axi_periph/M04_ACLK] [get_bd_pins processing_system7_0_axi_periph/M05_ACLK] [get_bd_pins processing_system7_0_axi_periph/M06_ACLK] [get_bd_pins processing_system7_0_axi_periph/M07_ACLK] [get_bd_pins processing_system7_0_axi_periph/M08_ACLK] [get_bd_pins processing_system7_0_axi_periph/M09_ACLK] [get_bd_pins processing_system7_0_axi_periph/S00_ACLK] [get_bd_pins rst_processing_system7_0_100M/slowest_sync_clk]
  connect_bd_net -net processing_system7_0_FCLK_CLK1 [get_bd_pins ABC_to_dq_0/clk] [get_bd_pins ADC_read_0/clk] [get_bd_pins Control_signals_0/clk] [get_bd_pins Current_controller_0/clk] [get_bd_pins Encoder_0/clk] [get_bd_pins PI_controller_0/clk] [get_bd_pins PWM_generator_0/clk] [get_bd_pins User_Interface_0/clk] [get_bd_pins dq_to_ABC_0/clk] [get_bd_pins processing_system7_0/FCLK_CLK1]
  connect_bd_net -net processing_system7_0_FCLK_CLK2 [get_bd_pins ADC_read_0/ADC_clk_in] [get_bd_pins processing_system7_0/FCLK_CLK2]
  connect_bd_net -net processing_system7_0_FCLK_RESET0_N [get_bd_pins processing_system7_0/FCLK_RESET0_N] [get_bd_pins rst_processing_system7_0_100M/ext_reset_in]
  connect_bd_net -net rst_processing_system7_0_100M_interconnect_aresetn [get_bd_pins processing_system7_0_axi_periph/ARESETN] [get_bd_pins rst_processing_system7_0_100M/interconnect_aresetn]
  connect_bd_net -net rst_processing_system7_0_100M_peripheral_aresetn [get_bd_pins ABC_to_dq_0/s00_axi_aresetn] [get_bd_pins ADC_read_0/s00_axi_aresetn] [get_bd_pins Control_signals_0/s00_axi_aresetn] [get_bd_pins Current_controller_0/s00_axi_aresetn] [get_bd_pins Encoder_0/s00_axi_aresetn] [get_bd_pins PI_controller_0/s00_axi_aresetn] [get_bd_pins PWM_generator_0/s00_axi_aresetn] [get_bd_pins Safe_mode_0/s00_axi_aresetn] [get_bd_pins User_Interface_0/s00_axi_aresetn] [get_bd_pins dq_to_ABC_0/s00_axi_aresetn] [get_bd_pins processing_system7_0_axi_periph/M00_ARESETN] [get_bd_pins processing_system7_0_axi_periph/M01_ARESETN] [get_bd_pins processing_system7_0_axi_periph/M02_ARESETN] [get_bd_pins processing_system7_0_axi_periph/M03_ARESETN] [get_bd_pins processing_system7_0_axi_periph/M04_ARESETN] [get_bd_pins processing_system7_0_axi_periph/M05_ARESETN] [get_bd_pins processing_system7_0_axi_periph/M06_ARESETN] [get_bd_pins processing_system7_0_axi_periph/M07_ARESETN] [get_bd_pins processing_system7_0_axi_periph/M08_ARESETN] [get_bd_pins processing_system7_0_axi_periph/M09_ARESETN] [get_bd_pins processing_system7_0_axi_periph/S00_ARESETN] [get_bd_pins rst_processing_system7_0_100M/peripheral_aresetn]
  connect_bd_net -net stop_1 [get_bd_ports stop] [get_bd_pins Safe_mode_0/stop]
  connect_bd_net -net stop_inv_1 [get_bd_ports stop_inv] [get_bd_pins Safe_mode_0/stop_inv]
  connect_bd_net -net xlconstant_0_dout [get_bd_pins Current_controller_0/w_d] [get_bd_pins xlconstant_0/dout]

  # Create address segments
  create_bd_addr_seg -range 0x10000 -offset 0x43C50000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs ABC_to_dq_0/S00_AXI/S00_AXI_reg] SEG_ABC_to_dq_0_S00_AXI_reg
  create_bd_addr_seg -range 0x10000 -offset 0x43C20000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs ADC_read_0/S00_AXI/S00_AXI_reg] SEG_ADC_read_0_S00_AXI_reg
  create_bd_addr_seg -range 0x10000 -offset 0x43C40000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs Control_signals_0/S00_AXI/S00_AXI_reg] SEG_Control_signals_0_S00_AXI_reg
  create_bd_addr_seg -range 0x10000 -offset 0x43C60000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs Current_controller_0/S00_AXI/S00_AXI_reg] SEG_Current_controller_0_S00_AXI_reg
  create_bd_addr_seg -range 0x10000 -offset 0x43C30000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs Encoder_0/S00_AXI/S00_AXI_reg] SEG_Encoder_0_S00_AXI_reg
  create_bd_addr_seg -range 0x10000 -offset 0x43C70000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs PI_controller_0/S00_AXI/S00_AXI_reg] SEG_PI_controller_0_S00_AXI_reg
  create_bd_addr_seg -range 0x10000 -offset 0x43C00000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs PWM_generator_0/S00_AXI/S00_AXI_reg] SEG_PWM_generator_0_S00_AXI_reg
  create_bd_addr_seg -range 0x10000 -offset 0x43C10000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs Safe_mode_0/S00_AXI/S00_AXI_reg] SEG_Safe_mode_0_S00_AXI_reg
  create_bd_addr_seg -range 0x10000 -offset 0x43C90000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs User_Interface_0/S00_AXI/S00_AXI_reg] SEG_User_Interface_0_S00_AXI_reg
  create_bd_addr_seg -range 0x10000 -offset 0x43C80000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs dq_to_ABC_0/S00_AXI/S00_AXI_reg] SEG_dq_to_ABC_0_S00_AXI_reg

  # Perform GUI Layout
  regenerate_bd_layout -layout_string {
   guistr: "# # String gsaved with Nlview 6.5.5  2015-06-26 bk=1.3371 VDI=38 GEI=35 GUI=JA:1.6
#  -string -flagsOSRD
preplace port btnr -pg 1 -y 2530 -defaultsOSRD
preplace port PWM_BH -pg 1 -y 2070 -defaultsOSRD
preplace port DDR -pg 1 -y 1590 -defaultsOSRD
preplace port ADC_clk_A -pg 1 -y 1690 -defaultsOSRD
preplace port ADC_clk_B -pg 1 -y 1710 -defaultsOSRD
preplace port PWM_CL -pg 1 -y 2130 -defaultsOSRD
preplace port PWM_AH -pg 1 -y 2030 -defaultsOSRD
preplace port btnu -pg 1 -y 2550 -defaultsOSRD
preplace port ADC_data_A -pg 1 -y 1540 -defaultsOSRD
preplace port ADC_data_B -pg 1 -y 1840 -defaultsOSRD
preplace port stop -pg 1 -y 2310 -defaultsOSRD
preplace port PWM_BL -pg 1 -y 2090 -defaultsOSRD
preplace port stop_inv -pg 1 -y 2330 -defaultsOSRD
preplace port ADC_clk_VBUS -pg 1 -y 1730 -defaultsOSRD
preplace port PWM_AL -pg 1 -y 2050 -defaultsOSRD
preplace port btnl -pg 1 -y 2510 -defaultsOSRD
preplace port FIXED_IO -pg 1 -y 1610 -defaultsOSRD
preplace port SENS_INDEX -pg 1 -y 1820 -defaultsOSRD
preplace port ADC_data_VBUS -pg 1 -y 1860 -defaultsOSRD
preplace port btnc -pg 1 -y 2590 -defaultsOSRD
preplace port SENS_A -pg 1 -y 1500 -defaultsOSRD
preplace port PWM_CH -pg 1 -y 2110 -defaultsOSRD
preplace port btnd -pg 1 -y 2570 -defaultsOSRD
preplace port SENS_B -pg 1 -y 1520 -defaultsOSRD
preplace portBus leds -pg 1 -y 2570 -defaultsOSRD
preplace inst Safe_mode_0 -pg 1 -lvl 3 -y 2320 -defaultsOSRD
preplace inst ADC_read_0 -pg 1 -lvl 3 -y 1740 -defaultsOSRD
preplace inst PWM_generator_0 -pg 1 -lvl 3 -y 2070 -defaultsOSRD
preplace inst xlconstant_0 -pg 1 -lvl 2 -y 190 -defaultsOSRD
preplace inst Current_controller_0 -pg 1 -lvl 3 -y 200 -defaultsOSRD
preplace inst rst_processing_system7_0_100M -pg 1 -lvl 1 -y 1960 -defaultsOSRD
preplace inst Control_signals_0 -pg 1 -lvl 3 -y 1490 -defaultsOSRD
preplace inst dq_to_ABC_0 -pg 1 -lvl 3 -y 470 -defaultsOSRD
preplace inst User_Interface_0 -pg 1 -lvl 3 -y 2550 -defaultsOSRD
preplace inst Encoder_0 -pg 1 -lvl 3 -y 1260 -defaultsOSRD
preplace inst PI_controller_0 -pg 1 -lvl 3 -y 980 -defaultsOSRD
preplace inst ABC_to_dq_0 -pg 1 -lvl 3 -y 730 -defaultsOSRD
preplace inst processing_system7_0_axi_periph -pg 1 -lvl 2 -y 1210 -defaultsOSRD
preplace inst processing_system7_0 -pg 1 -lvl 1 -y 1680 -defaultsOSRD
preplace netloc PWM_generator_0_PWM_AH 1 3 1 NJ
preplace netloc processing_system7_0_axi_periph_M08_AXI 1 2 1 900
preplace netloc processing_system7_0_FIXED_IO 1 1 3 NJ 1600 NJ 1600 NJ
preplace netloc PWM_generator_0_PWM_AL 1 3 1 NJ
preplace netloc SENS_INDEX_1 1 0 3 NJ 870 NJ 870 NJ
preplace netloc SENS_A_1 1 0 3 NJ 850 NJ 850 NJ
preplace netloc stop_1 1 0 3 NJ 2310 NJ 2310 NJ
preplace netloc ABC_to_dq_0_d 1 2 2 960 10 1370
preplace netloc processing_system7_0_axi_periph_M06_AXI 1 2 1 790
preplace netloc processing_system7_0_DDR 1 1 3 NJ 1580 NJ 1590 NJ
preplace netloc btnr_1 1 0 3 NJ 2530 NJ 2530 NJ
preplace netloc btnu_1 1 0 3 NJ 2550 NJ 2550 NJ
preplace netloc PWM_generator_0_sync_out 1 2 2 1000 1890 1310
preplace netloc PWM_generator_0_PWM_CH 1 3 1 NJ
preplace netloc btnl_1 1 0 3 NJ 2510 NJ 2510 NJ
preplace netloc processing_system7_0_axi_periph_M05_AXI 1 2 1 850
preplace netloc PWM_generator_0_PWM_CL 1 3 1 NJ
preplace netloc processing_system7_0_FCLK_RESET0_N 1 0 2 40 1870 420
preplace netloc Current_controller_0_x_d 1 2 2 980 40 1320
preplace netloc stop_inv_1 1 0 3 NJ 2330 NJ 2330 NJ
preplace netloc Safe_mode_0_run_out_inv 1 2 2 970 2220 1290
preplace netloc processing_system7_0_axi_periph_M02_AXI 1 2 1 830
preplace netloc ADC_data_VBUS_1 1 0 3 NJ 1860 NJ 1790 NJ
preplace netloc processing_system7_0_axi_periph_M03_AXI 1 2 1 N
preplace netloc processing_system7_0_axi_periph_M07_AXI 1 2 1 910
preplace netloc processing_system7_0_axi_periph_M09_AXI 1 2 1 790
preplace netloc Control_signals_0_zero_align 1 2 2 980 1880 1290
preplace netloc ABC_to_dq_0_q 1 2 2 970 20 1360
preplace netloc dq_to_ABC_0_a 1 2 2 990 1900 1400
preplace netloc Encoder_0_speed 1 2 2 1010 1110 1300
preplace netloc ABC_to_dq_0_cos 1 2 2 1010 600 1320
preplace netloc dq_to_ABC_0_b 1 2 2 1010 2210 1410
preplace netloc processing_system7_0_axi_periph_M01_AXI 1 2 1 820
preplace netloc dq_to_ABC_0_c 1 2 2 1000 1910 1390
preplace netloc btnc_1 1 0 3 NJ 2590 NJ 2590 NJ
preplace netloc processing_system7_0_FCLK_CLK0 1 0 3 30 1830 430 910 880
preplace netloc Safe_mode_0_run_out 1 2 2 950 1930 1300
preplace netloc processing_system7_0_FCLK_CLK1 1 1 2 NJ 1740 870
preplace netloc PWM_generator_0_PWM_BH 1 3 1 NJ
preplace netloc processing_system7_0_FCLK_CLK2 1 1 2 NJ 1730 N
preplace netloc rst_processing_system7_0_100M_interconnect_aresetn 1 1 1 460
preplace netloc processing_system7_0_axi_periph_M00_AXI 1 2 1 840
preplace netloc Current_controller_0_x_q 1 2 2 990 50 1290
preplace netloc PWM_generator_0_PWM_BL 1 3 1 NJ
preplace netloc Encoder_0_sync_out 1 2 2 980 860 1320
preplace netloc btnd_1 1 0 3 NJ 2570 NJ 2570 NJ
preplace netloc ADC_data_A_1 1 0 3 NJ 1530 NJ 1530 NJ
preplace netloc Encoder_0_zero_calib_done 1 2 2 1010 1390 1290
preplace netloc ADC_data_B_1 1 0 3 NJ 1840 NJ 1770 NJ
preplace netloc ADC_read_0_Current_A 1 2 2 990 1100 1330
preplace netloc Control_signals_0_zero_calib 1 2 2 1010 1130 1310
preplace netloc User_Interface_0_leds 1 3 1 NJ
preplace netloc ADC_read_0_ADC_clk_A 1 3 1 NJ
preplace netloc ADC_read_0_Current_B 1 2 2 1010 850 1340
preplace netloc PI_controller_0_x 1 2 2 1010 60 1350
preplace netloc ADC_read_0_ADC_clk_B 1 3 1 NJ
preplace netloc ABC_to_dq_0_sync_out 1 2 2 1000 30 1380
preplace netloc processing_system7_0_M_AXI_GP0 1 1 1 420
preplace netloc xlconstant_0_dout 1 2 1 N
preplace netloc ABC_to_dq_0_sin 1 2 2 1000 610 1290
preplace netloc SENS_B_1 1 0 3 NJ 890 NJ 890 NJ
preplace netloc Encoder_0_angle 1 2 2 1000 1120 1290
preplace netloc Current_controller_0_sync_out 1 2 2 1010 340 1290
preplace netloc User_Interface_0_run 1 2 2 1010 2420 1290
preplace netloc processing_system7_0_axi_periph_M04_AXI 1 2 1 860
preplace netloc ADC_read_0_ADC_clk_VBUS 1 3 1 NJ
preplace netloc rst_processing_system7_0_100M_peripheral_aresetn 1 1 2 450 880 890
preplace netloc User_Interface_0_requested_speed 1 2 2 970 1920 1320
levelinfo -pg 1 -20 230 640 1150 1450 -top 0 -bot 2680
",
}

  # Restore current instance
  current_bd_instance $oldCurInst

  save_bd_design
}
# End of create_root_design()


##################################################################
# MAIN FLOW
##################################################################

create_root_design ""


