# Creating SmartDesign "Display_Controller_Block"
set sd_name {Display_Controller_Block}
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 {DC_H1p4_EXT_SYNC_SIGNAL_I} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H1p4_RESETN_I} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H1p4_SYS_CLK_I} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H2p0_ENABLE_I} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H2p0_RESETN_I} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H2p0_SYS_CLK_I} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {TVALID_I} -port_direction {IN}

sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H1p4_DATA_TRIGGER_O} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H1p4_DATA_VALID_O} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H1p4_FRAME_END_O} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H1p4_H_SYNC_O} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H1p4_V_SYNC_O} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H2p0_AXI4Stream_Initiator_IF_TLAST_O_0} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {DC_H2p0_AXI4Stream_Initiator_IF_TVALID_O_0} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {HDMI_TX_AXI4Stream_Initiator_IF_TLAST_O} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {HDMI_TX_AXI4Stream_Initiator_IF_TVALID_O} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {TREADY_O} -port_direction {OUT}


# Create top level Bus Ports
sd_create_bus_port -sd_name ${sd_name} -port_name {DC_H1p4_DATA_I} -port_direction {IN} -port_range {[23:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {DC_H2p0_AXI4Stream_Target_IF_TDATA_I} -port_direction {IN} -port_range {[95:0]}

sd_create_bus_port -sd_name ${sd_name} -port_name {DC_H1p4_DATA_O} -port_direction {OUT} -port_range {[23:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {DC_H1p4_H_RES_O} -port_direction {OUT} -port_range {[15:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {DC_H2p0_AXI4Stream_Initiator_IF_TDATA_O_0} -port_direction {OUT} -port_range {[95:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {DC_H2p0_AXI4Stream_Initiator_IF_TKEEP_O_0} -port_direction {OUT} -port_range {[11:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {DC_H2p0_AXI4Stream_Initiator_IF_TSTRB_O_0} -port_direction {OUT} -port_range {[11:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {DC_H2p0_AXI4Stream_Initiator_IF_TUSER_O_0} -port_direction {OUT} -port_range {[3:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {DC_H2p0_H_RES_O} -port_direction {OUT} -port_range {[15:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {HDMI_TX_AXI4Stream_Initiator_IF_TDATA_O} -port_direction {OUT} -port_range {[95:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {HDMI_TX_AXI4Stream_Initiator_IF_TKEEP_O} -port_direction {OUT} -port_range {[11:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {HDMI_TX_AXI4Stream_Initiator_IF_TSTRB_O} -port_direction {OUT} -port_range {[11:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {HDMI_TX_AXI4Stream_Initiator_IF_TUSER_O} -port_direction {OUT} -port_range {[3:0]}


# Create top level Bus interface Ports
sd_create_bif_port -sd_name ${sd_name} -port_name {DC_H2p0_AXI4Stream_Initiator_IF} -port_bif_vlnv {AMBA:AMBA4:AXI4Stream:r0p0_1} -port_bif_role {master} -port_bif_mapping {\
"TVALID:DC_H2p0_AXI4Stream_Initiator_IF_TVALID_O_0" \
"TDATA:DC_H2p0_AXI4Stream_Initiator_IF_TDATA_O_0" \
"TSTRB:DC_H2p0_AXI4Stream_Initiator_IF_TSTRB_O_0" \
"TKEEP:DC_H2p0_AXI4Stream_Initiator_IF_TKEEP_O_0" \
"TLAST:DC_H2p0_AXI4Stream_Initiator_IF_TLAST_O_0" \
"TUSER:DC_H2p0_AXI4Stream_Initiator_IF_TUSER_O_0" } 

sd_create_bif_port -sd_name ${sd_name} -port_name {HDMI_TX_AXI4Stream_Initiator_IF} -port_bif_vlnv {AMBA:AMBA4:AXI4Stream:r0p0_1} -port_bif_role {master} -port_bif_mapping {\
"TVALID:HDMI_TX_AXI4Stream_Initiator_IF_TVALID_O" \
"TDATA:HDMI_TX_AXI4Stream_Initiator_IF_TDATA_O" \
"TSTRB:HDMI_TX_AXI4Stream_Initiator_IF_TSTRB_O" \
"TKEEP:HDMI_TX_AXI4Stream_Initiator_IF_TKEEP_O" \
"TLAST:HDMI_TX_AXI4Stream_Initiator_IF_TLAST_O" \
"TUSER:HDMI_TX_AXI4Stream_Initiator_IF_TUSER_O" } 

sd_create_bif_port -sd_name ${sd_name} -port_name {DC_H2p0_AXI4Stream_Target_IF} -port_bif_vlnv {AMBA:AMBA4:AXI4Stream:r0p0_1} -port_bif_role {slave} -port_bif_mapping {\
"TVALID:TVALID_I" \
"TREADY:TREADY_O" \
"TDATA:DC_H2p0_AXI4Stream_Target_IF_TDATA_I" } 

# Add Broadcaster_0 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Broadcaster} -instance_name {Broadcaster_0}
# Exporting Parameters of instance Broadcaster_0
sd_configure_core_instance -sd_name ${sd_name} -instance_name {Broadcaster_0} -params {\
"G_DATA_WIDTH:96" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {Broadcaster_0}
sd_update_instance -sd_name ${sd_name} -instance_name {Broadcaster_0}



# Add Display_Controller_C0_HDMI1p4 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {Display_Controller_C3} -instance_name {Display_Controller_C0_HDMI1p4}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {Display_Controller_C0_HDMI1p4:ENABLE_I} -value {VCC}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {Display_Controller_C0_HDMI1p4:V_ACTIVE_O}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {Display_Controller_C0_HDMI1p4:V_RES_O}



# Add Display_Controller_C1_HDMI2p0 instance
sd_instantiate_component -sd_name ${sd_name} -component_name {Display_Controller_C2} -instance_name {Display_Controller_C1_HDMI2p0}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {Display_Controller_C1_HDMI2p0:V_RES_O}



# Add scalar net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"Broadcaster_0:RESETN_I" "DC_H2p0_RESETN_I" "Display_Controller_C1_HDMI2p0:RESETN_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Broadcaster_0:SYS_CLK_I" "DC_H2p0_SYS_CLK_I" "Display_Controller_C1_HDMI2p0:SYS_CLK_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_DATA_TRIGGER_O" "Display_Controller_C0_HDMI1p4:DATA_TRIGGER_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_DATA_VALID_O" "Display_Controller_C0_HDMI1p4:DATA_VALID_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_EXT_SYNC_SIGNAL_I" "Display_Controller_C0_HDMI1p4:EXT_SYNC_SIGNAL_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_FRAME_END_O" "Display_Controller_C0_HDMI1p4:FRAME_END_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_H_SYNC_O" "Display_Controller_C0_HDMI1p4:H_SYNC_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_RESETN_I" "Display_Controller_C0_HDMI1p4:RESETN_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_SYS_CLK_I" "Display_Controller_C0_HDMI1p4:SYS_CLK_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_V_SYNC_O" "Display_Controller_C0_HDMI1p4:V_SYNC_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H2p0_ENABLE_I" "Display_Controller_C1_HDMI2p0:ENABLE_I" }

# Add bus net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_DATA_I" "Display_Controller_C0_HDMI1p4:DATA_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_DATA_O" "Display_Controller_C0_HDMI1p4:DATA_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H1p4_H_RES_O" "Display_Controller_C0_HDMI1p4:H_RES_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H2p0_H_RES_O" "Display_Controller_C1_HDMI2p0:H_RES_O" }

# Add bus interface net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"Broadcaster_0:AXI4Stream_Initiator0_IF" "DC_H2p0_AXI4Stream_Initiator_IF" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Broadcaster_0:AXI4Stream_Initiator1_IF" "HDMI_TX_AXI4Stream_Initiator_IF" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Broadcaster_0:AXI4Stream_Target_IF" "Display_Controller_C1_HDMI2p0:AXI4Stream_Initiator_IF" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DC_H2p0_AXI4Stream_Target_IF" "Display_Controller_C1_HDMI2p0:AXI4Stream_Target_IF" }

# 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 "Display_Controller_Block"
generate_component -component_name ${sd_name}
