variable tcl_scope
variable tcl_ipinst
set tcl_scope xit
set tcl_ipinst [ current_inst ]
set InstName [get_property PARAM_VALUE.Component_Name]
set instDirPath [current_outdir]

source_ipfile xgui/utilities.tcl
if { [getuser No_Controller] == 0} {
          return
}
ipx::add_cpu ${InstName} [ current_ipbom ]

set memName [string tolower [ getuser C0.ControllerType ] ]

set memSubName [ getMemSubName $memName ]

copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_write.sv                rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_write.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_wr_byte.sv              rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_wr_byte.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation  ]   data/dlib/ultrascale/ddr4_sdram/rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_wr_bit.sv               rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_wr_bit.sv

copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation  ]   data/dlib/ultrascale/ddr4_sdram/rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_read.sv                 rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_read.sv

copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation  ]   data/dlib/ultrascale/ddr4_sdram/rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_rd_en.sv                rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_rd_en.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation  ]   data/dlib/ultrascale/ddr4_sdram/rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_pi.sv                   rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_pi.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation  ]   data/dlib/ultrascale/ddr4_sdram/rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_clk_rst.sv              rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_clk_rst.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation  ]   data/dlib/ultrascale/ddr4_sdram/rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_odt.sv                  rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_odt.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation  ]   data/dlib/ultrascale/ddr4_sdram/rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_cal.sv                  rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_cal.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation  ]   data/dlib/ultrascale/ddr4_sdram/rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_bfifo.sv                rtl/controller/mig_ddrx_phy_v1_1_ddr_mc_bfifo.sv

copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/phy/mig_ddrx_phy_v1_1_ddr_xsdb_bram.sv                      rtl/phy/mig_ddrx_phy_v1_1_ddr_xsdb_bram.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/phy/mig_ddrx_phy_v1_1_ddr_xiphy.sv                          rtl/phy/mig_ddrx_phy_v1_1_ddr_xiphy.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/phy/mig_ddrx_phy_v1_1_ddr_debug_microblaze.sv               rtl/phy/mig_ddrx_phy_v1_1_ddr_debug_microblaze.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/phy/mig_ddrx_phy_v1_1_ddr_config_rom.sv                     rtl/phy/mig_ddrx_phy_v1_1_ddr_config_rom.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/phy/mig_ddrx_phy_v1_1_ddr_cal_cplx_data.sv                  rtl/phy/mig_ddrx_phy_v1_1_ddr_cal_cplx_data.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/phy/mig_ddrx_phy_v1_1_ddr_cal_cplx.sv                       rtl/phy/mig_ddrx_phy_v1_1_ddr_cal_cplx.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/phy/mig_ddrx_phy_v1_1_ddr_cal_addr_decode.sv                rtl/phy/mig_ddrx_phy_v1_1_ddr_cal_addr_decode.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/phy/mig_ddrx_phy_v1_1_ddr_cal.sv                            rtl/phy/mig_ddrx_phy_v1_1_ddr_cal.sv

copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/common/xsdb_files/mig_ddrx_phy_v1_1_chipscope_xsdb_slave.sv                rtl/phy/mig_ddrx_phy_v1_1_chipscope_xsdb_slave.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/common/xsdb_files/mig_ddrx_phy_v1_1_dp_AB9.sv                              rtl/phy/mig_ddrx_phy_v1_1_dp_AB9.sv
copy_ipfile  -force -fileType verilogSource       -usedIn [ list synthesis implementation simulation ]   data/dlib/ultrascale/common/xsdb_files/mig_ddrx_phy_v1_1_chipscope_icon2xsdb_mstrbr_ver_inc.vh  [join [list rtl/phy/ mig_ddrx_phy_v1_1_4_chipscope_icon2xsdb_mstrbr_ver_inc .vh] ""]
copy_ipfile  -force -fileType verilogSource       -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/common/xsdb_files/mig_ddrx_phy_v1_1_cs_ver_inc.vh                          [join [list rtl/phy/ mig_ddrx_phy_v1_1_4_cs_ver_inc .vh] ""]

if { $memName == "ddr4_sdram" } {

    copy_ipfile  -force -usedIn [ list synthesis implementation ] -scopedToRef "${InstName}" -scopedToCells {inst/u_ddr_mc_cal/u_ddr_cal/mcs0/microblaze_I}  data/dlib/ultrascale/ddr4_sdram/sw/calibration_0/Debug/calibration_ddr.elf         sw/calibration_0/Debug/calibration_ddr.elf
    copy_ipfile  -force -usedIn [ list synthesis implementation ] -scopedToRef "${InstName}" -scopedToCells {inst/u_ddr_mc_cal/u_ddr_cal/mcs0}               data/dlib/ultrascale/ddr4_sdram/sw/microblaze_mcs_ddr.bmm                       sw/microblaze_mcs_ddr.bmm
   
    
} elseif { $memName == "ddr3_sdram" } {

    copy_ipfile  -force -usedIn [ list synthesis implementation ] -scopedToRef "${InstName}" -scopedToCells {inst/u_ddr_mc_cal/u_ddr_cal/mcs0/microblaze_I}  data/dlib/ultrascale/ddr4_sdram/sw/calibration_0/Debug/calibration_ddr.elf         sw/calibration_0/Debug/calibration_ddr.elf
    copy_ipfile  -force -usedIn [ list synthesis implementation  ] -scopedToRef "${InstName}" -scopedToCells {inst/u_ddr_mc_cal/u_ddr_cal/mcs0}               data/dlib/ultrascale/ddr4_sdram/sw/microblaze_mcs_ddr.bmm                       sw/microblaze_mcs_ddr.bmm
    
}

copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/iob/mig_ddrx_phy_v1_1_ddr_iob_byte.sv                       rtl/iob/mig_ddrx_phy_v1_1_ddr_iob_byte.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/ddr4_sdram/rtl/iob/mig_ddrx_phy_v1_1_ddr_iob.sv                            rtl/iob/mig_ddrx_phy_v1_1_ddr_iob.sv

copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/common/clocking/mig_ddrx_phy_v1_1_infrastructure.sv                            rtl/clocking/mig_ddrx_phy_v1_1_infrastructure.sv
                                                                                                                                                                                                    
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/common/xiphy_files/mig_ddrx_phy_v1_1_xiphy_tristate_wrapper.sv                 rtl/xiphy_files/mig_ddrx_phy_v1_1_xiphy_tristate_wrapper.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/common/xiphy_files/mig_ddrx_phy_v1_1_xiphy_riuor_wrapper.sv                    rtl/xiphy_files/mig_ddrx_phy_v1_1_xiphy_riuor_wrapper.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/common/xiphy_files/mig_ddrx_phy_v1_1_xiphy_control_wrapper.sv                  rtl/xiphy_files/mig_ddrx_phy_v1_1_xiphy_control_wrapper.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/common/xiphy_files/mig_ddrx_phy_v1_1_xiphy_byte_wrapper.sv                     rtl/xiphy_files/mig_ddrx_phy_v1_1_xiphy_byte_wrapper.sv
copy_ipfile  -force -fileType systemVerilogSource -usedIn [ list synthesis implementation ]   data/dlib/ultrascale/common/xiphy_files/mig_ddrx_phy_v1_1_xiphy_bitslice_wrapper.sv                 rtl/xiphy_files/mig_ddrx_phy_v1_1_xiphy_bitslice_wrapper.sv

if { $memName == "ddr4_sdram" } {
set_property instance_path "inst/u_ddr_mc_cal/u_ddr_cal/mcs0/microblaze_I" [ ipx::get_cpus ${InstName} -of_objects [ current_ipbom ] ]
} elseif { $memName == "ddr3_sdram" } {
set_property instance_path "inst/u_ddr_mc_cal/u_ddr_cal/mcs0/microblaze_I" [ ipx::get_cpus ${InstName} -of_objects [ current_ipbom ] ]
}
set_property bootloop_file "sw/calibration_0/Debug/calibration_ddr.elf" [ ipx::get_cpus ${InstName} -of_objects [ current_ipbom ] ]
set_property endian little [ipx::get_cpus ${InstName} -of_objects [ current_ipbom ] ]
set_property processor_type "MICROBLAZE-LE" [ ipx::get_cpus ${InstName} -of_objects [ current_ipbom ] ]
set_property is_visible false [ ipx::get_cpus ${InstName} -of_objects [ current_ipbom ] ]
