# Creating SmartDesign "HDMI_2P0_FHD_TX"
set sd_name {HDMI_2P0_FHD_TX}
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 {H_SYNC_I} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {REF_CLK} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {RESET_N_I} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {VIDEO_DATA_VALID_I} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {V_SYNC_I} -port_direction {IN}

sd_create_scalar_port -sd_name ${sd_name} -port_name {HDMI_CLK} -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 {LANE1_TXD_N} -port_direction {OUT} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {LANE1_TXD_P} -port_direction {OUT} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {LANE2_TXD_N} -port_direction {OUT} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {LANE2_TXD_P} -port_direction {OUT} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {LANE3_TXD_N} -port_direction {OUT} -port_is_pad {1}
sd_create_scalar_port -sd_name ${sd_name} -port_name {LANE3_TXD_P} -port_direction {OUT} -port_is_pad {1}


# Create top level Bus Ports
sd_create_bus_port -sd_name ${sd_name} -port_name {DATA_B_I} -port_direction {IN} -port_range {[7:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {DATA_G_I} -port_direction {IN} -port_range {[7:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {DATA_R_I} -port_direction {IN} -port_range {[7:0]}


# Add HDMI_TX_C0_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {HDMI_TX_C0} -instance_name {HDMI_TX_C0_0}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {HDMI_TX_C0_0:PIXEL_DATA_I} -pin_slices {[15:8]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {HDMI_TX_C0_0:PIXEL_DATA_I} -pin_slices {[23:16]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {HDMI_TX_C0_0:PIXEL_DATA_I} -pin_slices {[7:0]}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:HDMI_TX_RESET_O}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:CLEAR_AV_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:SET_AV_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:DEFAULT_PH_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:ITC_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:HDR_EN_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:VIC_I} -value {00010000}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:COLOR_FORMAT_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:CD_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:PP_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:C1C0_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:E2E1E0_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:PR_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:EOTF_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:STATIC_META_DESCRIPTOR_ID_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:DISP_X0_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:DISP_Y0_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:DISP_X1_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:DISP_Y1_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:DISP_X2_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:DISP_Y2_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:WHITEPOINT_X_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:WHITEPOINT_Y_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:MAX_LUM_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:MIN_LUM_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:MCLL_I} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {HDMI_TX_C0_0:MFALL_I} -value {GND}



# Add PF_TX_PLL_C0_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {PF_TX_PLL_C0} -instance_name {PF_TX_PLL_C0_0}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {PF_TX_PLL_C0_0:PLL_LOCK}



# Add PF_XCVR_ERM_C0_0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {PF_XCVR_ERM_C0} -instance_name {PF_XCVR_ERM_C0_0}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {PF_XCVR_ERM_C0_0:LANE0_TX_CLK_R}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {PF_XCVR_ERM_C0_0:LANE0_TX_CLK_STABLE}



# Add scalar net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_CLK" "HDMI_TX_C0_0:B_CLK_I" "HDMI_TX_C0_0:SYS_CLK_I" "PF_XCVR_ERM_C0_0:LANE1_TX_CLK_R" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:B_CLK_LOCK" "PF_XCVR_ERM_C0_0:LANE1_TX_CLK_STABLE" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:G_CLK_I" "PF_XCVR_ERM_C0_0:LANE2_TX_CLK_R" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:G_CLK_LOCK" "PF_XCVR_ERM_C0_0:LANE2_TX_CLK_STABLE" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:H_SYNC_I" "H_SYNC_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:RESET_N_I" "PF_XCVR_ERM_C0_0:LANE0_PCS_ARST_N" "PF_XCVR_ERM_C0_0:LANE0_PMA_ARST_N" "PF_XCVR_ERM_C0_0:LANE1_PCS_ARST_N" "PF_XCVR_ERM_C0_0:LANE1_PMA_ARST_N" "PF_XCVR_ERM_C0_0:LANE2_PCS_ARST_N" "PF_XCVR_ERM_C0_0:LANE2_PMA_ARST_N" "PF_XCVR_ERM_C0_0:LANE3_PCS_ARST_N" "PF_XCVR_ERM_C0_0:LANE3_PMA_ARST_N" "RESET_N_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:R_CLK_I" "PF_XCVR_ERM_C0_0:LANE3_TX_CLK_R" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:R_CLK_LOCK" "PF_XCVR_ERM_C0_0:LANE3_TX_CLK_STABLE" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:VIDEO_DATA_VALID_I" "VIDEO_DATA_VALID_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:V_SYNC_I" "V_SYNC_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE0_TXD_N" "PF_XCVR_ERM_C0_0:LANE0_TXD_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE0_TXD_P" "PF_XCVR_ERM_C0_0:LANE0_TXD_P" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE1_TXD_N" "PF_XCVR_ERM_C0_0:LANE1_TXD_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE1_TXD_P" "PF_XCVR_ERM_C0_0:LANE1_TXD_P" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE2_TXD_N" "PF_XCVR_ERM_C0_0:LANE2_TXD_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE2_TXD_P" "PF_XCVR_ERM_C0_0:LANE2_TXD_P" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE3_TXD_N" "PF_XCVR_ERM_C0_0:LANE3_TXD_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"LANE3_TXD_P" "PF_XCVR_ERM_C0_0:LANE3_TXD_P" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"PF_TX_PLL_C0_0:REF_CLK" "REF_CLK" }

# Add bus net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"DATA_B_I" "HDMI_TX_C0_0:PIXEL_DATA_I[7:0]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DATA_G_I" "HDMI_TX_C0_0:PIXEL_DATA_I[15:8]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DATA_R_I" "HDMI_TX_C0_0:PIXEL_DATA_I[23:16]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:TMDS_B_O" "PF_XCVR_ERM_C0_0:LANE1_TX_DATA" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:TMDS_G_O" "PF_XCVR_ERM_C0_0:LANE2_TX_DATA" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:TMDS_R_O" "PF_XCVR_ERM_C0_0:LANE3_TX_DATA" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"HDMI_TX_C0_0:XCVR_LANE_0_DATA_O" "PF_XCVR_ERM_C0_0:LANE0_TX_DATA" }

# Add bus interface net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"PF_TX_PLL_C0_0:CLKS_TO_XCVR" "PF_XCVR_ERM_C0_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 "HDMI_2P0_FHD_TX"
generate_component -component_name ${sd_name}
