# Creating SmartDesign "top"
set sd_name {top}
create_smartdesign -sd_name ${sd_name}

# Disable auto promotion of pins of type 'pad'
auto_promote_pad_pins -promote_all 0

# Create top level Scalar Ports
sd_create_scalar_port -sd_name ${sd_name} -port_name {LANE0_RXD_N} -port_direction {IN} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {LANE0_RXD_P} -port_direction {IN} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {REF_CLK_PAD_N} -port_direction {IN} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {REF_CLK_PAD_P} -port_direction {IN} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {RX} -port_direction {IN}

sd_create_scalar_port -sd_name ${sd_name} -port_name {EMPTY} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {FULL} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {LANE0_TXD_N} -port_direction {OUT} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {LANE0_TXD_P} -port_direction {OUT} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {TX} -port_direction {OUT}



# Add CCC_0_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {CCC_0} -instance_name {CCC_0_0}



# Add DFN1_0 instance
sd_instantiate_macro -sd_name ${sd_name} -macro_name {DFN1} -instance_name {DFN1_0}



# Add DFN1_1 instance
sd_instantiate_macro -sd_name ${sd_name} -macro_name {DFN1} -instance_name {DFN1_1}



# Add DFN1_2 instance
sd_instantiate_macro -sd_name ${sd_name} -macro_name {DFN1} -instance_name {DFN1_2}



# Add DFN1_3 instance
sd_instantiate_macro -sd_name ${sd_name} -macro_name {DFN1} -instance_name {DFN1_3}



# Add DFN1_4 instance
sd_instantiate_macro -sd_name ${sd_name} -macro_name {DFN1} -instance_name {DFN1_4}



# Add DFN1_5 instance
sd_instantiate_macro -sd_name ${sd_name} -macro_name {DFN1} -instance_name {DFN1_5}



# Add fifo_cdc_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {fifo_cdc} -instance_name {fifo_cdc_0}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {fifo_cdc_0:DATA} -pin_slices {[31:0]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {fifo_cdc_0:DATA} -pin_slices {[32:32]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {fifo_cdc_0:DATA} -pin_slices {[33:33]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {fifo_cdc_0:DATA} -pin_slices {[34:34]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {fifo_cdc_0:Q} -pin_slices {[31:0]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {fifo_cdc_0:Q} -pin_slices {[32:32]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {fifo_cdc_0:Q} -pin_slices {[33:33]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {fifo_cdc_0:Q} -pin_slices {[34:34]}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {fifo_cdc_0:WE} -value {VCC}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {fifo_cdc_0:RE} -value {VCC}



# Add INIT_comp_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {INIT_comp} -instance_name {INIT_comp_0}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {INIT_comp_0:PCIE_INIT_DONE}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {INIT_comp_0:USRAM_INIT_DONE}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {INIT_comp_0:SRAM_INIT_DONE}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {INIT_comp_0:USRAM_INIT_FROM_SNVM_DONE}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {INIT_comp_0:USRAM_INIT_FROM_UPROM_DONE}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {INIT_comp_0:USRAM_INIT_FROM_SPI_DONE}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {INIT_comp_0:SRAM_INIT_FROM_SNVM_DONE}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {INIT_comp_0:SRAM_INIT_FROM_UPROM_DONE}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {INIT_comp_0:SRAM_INIT_FROM_SPI_DONE}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {INIT_comp_0:AUTOCALIB_DONE}



# Add OSC_0_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {OSC_0} -instance_name {OSC_0_0}



# Add PRBS_chk_0 instance
sd_instantiate_hdl_module -sd_name ${sd_name} -hdl_module_name {PRBS_chk} -hdl_file {hdl\PRBS_chk.v} -instance_name {PRBS_chk_0}



# Add PRBS_gen_0 instance
sd_instantiate_hdl_module -sd_name ${sd_name} -hdl_module_name {PRBS_gen} -hdl_file {hdl\PRBS_gen.v} -instance_name {PRBS_gen_0}



# Add reset_block_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {reset_block} -instance_name {reset_block_0}



# Add transmit_pll_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {transmit_pll} -instance_name {transmit_pll_0}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {transmit_pll_0:PLL_LOCK}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {transmit_pll_0:CLK_125}



# Add uart_block_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {uart_block} -instance_name {uart_block_0}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {uart_block_0:connect_o}



# Add xcvr_ip_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {xcvr_ip} -instance_name {xcvr_ip_0}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {xcvr_ip_0:LANE0_RX_IDLE}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {xcvr_ip_0:LANE0_RX_BYPASS_DATA}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {xcvr_ip_0:LANE0_LOS} -value {GND}



# Add xcvr_ref_clock_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {xcvr_ref_clock} -instance_name {xcvr_ref_clock_0}



# Add scalar net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"CCC_0_0:OUT0_FABCLK_0" "fifo_cdc_0:RCLOCK" "reset_block_0:uart_clk" "uart_block_0:CLK" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"CCC_0_0:OUT1_FABCLK_0" "xcvr_ip_0:CTRL_CLK" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"CCC_0_0:PLL_LOCK_0" "reset_block_0:PLL_LOCK" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"CCC_0_0:REF_CLK_0" "OSC_0_0:RCOSC_160MHZ_GL" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_0:CLK" "DFN1_1:CLK" "DFN1_2:CLK" "DFN1_3:CLK" "PRBS_chk_0:clk" "fifo_cdc_0:WCLOCK" "reset_block_0:rx_clk" "xcvr_ip_0:LANE0_RX_CLK_R" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_0:D" "reset_block_0:start" "uart_block_0:start" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_0:Q" "DFN1_1:D" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_1:Q" "PRBS_chk_0:start" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_2:D" "uart_block_0:clear" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_2:Q" "DFN1_3:D" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_3:Q" "PRBS_chk_0:clr_err_counter" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_4:CLK" "DFN1_5:CLK" "PRBS_gen_0:clk" "reset_block_0:tx_clk" "xcvr_ip_0:LANE0_TX_CLK_R" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_4:D" "uart_block_0:genrate_err" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_4:Q" "DFN1_5:D" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DFN1_5:Q" "PRBS_gen_0:generate_error_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"EMPTY" "fifo_cdc_0:EMPTY" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"FULL" "fifo_cdc_0:FULL" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"INIT_comp_0:BANK_6_VDDI_STATUS" "reset_block_0:BANK_x_VDDI_STATUS" "reset_block_0:BANK_y_VDDI_STATUS" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"INIT_comp_0:DEVICE_INIT_DONE" "reset_block_0:INIT_DONE" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"INIT_comp_0:FABRIC_POR_N" "reset_block_0:FPGA_POR_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"INIT_comp_0:XCVR_INIT_DONE" "xcvr_ip_0:CTRL_ARST_N" "xcvr_ip_0:LANE0_PCS_ARST_N" "xcvr_ip_0:LANE0_PMA_ARST_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE0_RXD_N" "xcvr_ip_0:LANE0_RXD_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE0_RXD_P" "xcvr_ip_0:LANE0_RXD_P" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE0_TXD_N" "xcvr_ip_0:LANE0_TXD_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE0_TXD_P" "xcvr_ip_0:LANE0_TXD_P" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"PRBS_chk_0:error_out" "fifo_cdc_0:DATA[34:34]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"PRBS_chk_0:lock" "fifo_cdc_0:DATA[33:33]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"PRBS_chk_0:reset" "fifo_cdc_0:WRESET_N" "reset_block_0:pattern_chk_rst_n" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"PRBS_chk_0:rx_val" "xcvr_ip_0:LANE0_RX_VAL" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"PRBS_chk_0:rx_val_o" "fifo_cdc_0:DATA[32:32]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"PRBS_gen_0:reset" "reset_block_0:pattern_gen_rst_n" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"REF_CLK_PAD_N" "xcvr_ref_clock_0:REF_CLK_PAD_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"REF_CLK_PAD_P" "xcvr_ref_clock_0:REF_CLK_PAD_P" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"RX" "uart_block_0:RX" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"TX" "uart_block_0:TX" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"fifo_cdc_0:Q[32:32]" "uart_block_0:EPCS_RX_VAL" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"fifo_cdc_0:Q[33:33]" "uart_block_0:rx_lock" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"fifo_cdc_0:Q[34:34]" "uart_block_0:rx_error" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"fifo_cdc_0:RRESET_N" "reset_block_0:uart_rst_n" "uart_block_0:RESET_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"reset_block_0:rx_ready" "xcvr_ip_0:LANE0_RX_READY" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"reset_block_0:tx_clk_stable" "xcvr_ip_0:LANE0_TX_CLK_STABLE" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"transmit_pll_0:REF_CLK" "xcvr_ip_0:LANE0_CDR_REF_CLK_0" "xcvr_ref_clock_0:REF_CLK" }

# Add bus net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"PRBS_chk_0:data_in" "xcvr_ip_0:LANE0_RX_DATA" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"PRBS_chk_0:error_count" "fifo_cdc_0:DATA[31:0]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"PRBS_gen_0:data_out" "xcvr_ip_0:LANE0_TX_DATA" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"fifo_cdc_0:Q[31:0]" "uart_block_0:error_count" }

# Add bus interface net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"transmit_pll_0:CLKS_TO_XCVR" "xcvr_ip_0:CLKS_FROM_TXPLL_0" }

# Re-enable auto promotion of pins of type 'pad'
auto_promote_pad_pins -promote_all 1
# Save the SmartDesign 
save_smartdesign -sd_name ${sd_name}
# Generate SmartDesign "top"
generate_component -component_name ${sd_name}
