# Creating SmartDesign "DDC_Antenna"
set sd_name {DDC_Antenna}
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 {clock_i} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {data_vld_i} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {nreset_i} -port_direction {IN}

sd_create_scalar_port -sd_name ${sd_name} -port_name {data_vld_o} -port_direction {OUT}


# Create top level Bus Ports
sd_create_bus_port -sd_name ${sd_name} -port_name {I0_data_i} -port_direction {IN} -port_range {[15:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {I1_data_i} -port_direction {IN} -port_range {[15:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {Q0_data_i} -port_direction {IN} -port_range {[15:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {Q1_data_i} -port_direction {IN} -port_range {[15:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {chan_i} -port_direction {IN} -port_range {[1:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {cos_i} -port_direction {IN} -port_range {[15:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {sin_i} -port_direction {IN} -port_range {[15:0]}

sd_create_bus_port -sd_name ${sd_name} -port_name {chan_out_o} -port_direction {OUT} -port_range {[2:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {data_o} -port_direction {OUT} -port_range {[15:0]}


# Add Channel_Mux_0 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Channel_Mux} -instance_name {Channel_Mux_0}
# Exporting Parameters of instance Channel_Mux_0
sd_configure_core_instance -sd_name ${sd_name} -instance_name {Channel_Mux_0} -params {\
"g_CHAN_WIDTH:2" \
"g_DATA_WIDTH:16" \
"g_NUMCHANNELS:1" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {Channel_Mux_0}
sd_update_instance -sd_name ${sd_name} -instance_name {Channel_Mux_0}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {Channel_Mux_0:chan_in_i} -pin_slices {[0:0]}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {Channel_Mux_0:chan_in_i[0:0]} -value {GND}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {Channel_Mux_0:chan_in_i} -pin_slices {[1:1]}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {Channel_Mux_0:chan_in_i[1:1]} -value {GND}



# Add Channel_Mux_1 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Channel_Mux} -instance_name {Channel_Mux_1}
# Exporting Parameters of instance Channel_Mux_1
sd_configure_core_instance -sd_name ${sd_name} -instance_name {Channel_Mux_1} -params {\
"g_CHAN_WIDTH:2" \
"g_DATA_WIDTH:16" \
"g_NUMCHANNELS:1" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {Channel_Mux_1}
sd_update_instance -sd_name ${sd_name} -instance_name {Channel_Mux_1}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {Channel_Mux_1:chan_in_i} -pin_slices {[0:0]}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {Channel_Mux_1:chan_in_i[0:0]} -value {GND}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {Channel_Mux_1:chan_in_i} -pin_slices {[1:1]}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {Channel_Mux_1:chan_in_i[1:1]} -value {GND}



# Add Channel_Mux_2 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Channel_Mux} -instance_name {Channel_Mux_2}
# Exporting Parameters of instance Channel_Mux_2
sd_configure_core_instance -sd_name ${sd_name} -instance_name {Channel_Mux_2} -params {\
"g_CHAN_WIDTH:3" \
"g_DATA_WIDTH:16" \
"g_NUMCHANNELS:4" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {Channel_Mux_2}
sd_update_instance -sd_name ${sd_name} -instance_name {Channel_Mux_2}



# Add Channel_Mux_3 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Channel_Mux} -instance_name {Channel_Mux_3}
# Exporting Parameters of instance Channel_Mux_3
sd_configure_core_instance -sd_name ${sd_name} -instance_name {Channel_Mux_3} -params {\
"g_CHAN_WIDTH:2" \
"g_DATA_WIDTH:16" \
"g_NUMCHANNELS:2" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {Channel_Mux_3}
sd_update_instance -sd_name ${sd_name} -instance_name {Channel_Mux_3}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {Channel_Mux_3:chan_out_o} -pin_slices {[0:0]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {Channel_Mux_3:chan_out_o} -pin_slices {[1:1]}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {Channel_Mux_3:data2_i} -value {GND}



# Add Channel_Mux_4 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Channel_Mux} -instance_name {Channel_Mux_4}
# Exporting Parameters of instance Channel_Mux_4
sd_configure_core_instance -sd_name ${sd_name} -instance_name {Channel_Mux_4} -params {\
"g_CHAN_WIDTH:2" \
"g_DATA_WIDTH:16" \
"g_NUMCHANNELS:2" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {Channel_Mux_4}
sd_update_instance -sd_name ${sd_name} -instance_name {Channel_Mux_4}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {Channel_Mux_4:chan_out_o} -pin_slices {[0:0]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {Channel_Mux_4:chan_out_o} -pin_slices {[1:1]}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {Channel_Mux_4:data2_i} -value {GND}



# Add complex_mult_0 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {complex_MULT} -instance_name {complex_mult_0}
# Exporting Parameters of instance complex_mult_0
sd_configure_core_instance -sd_name ${sd_name} -instance_name {complex_mult_0} -params {\
"g_awidth:16" \
"G_BWIDTH:16" \
"g_cwidth:16" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {complex_mult_0}
sd_update_instance -sd_name ${sd_name} -instance_name {complex_mult_0}



# Add DDC_hb2_dec_0 instance
sd_instantiate_hdl_module -sd_name ${sd_name} -hdl_module_name {ddc_hb2_dec} -hdl_file {hdl\DDC_hb2_dec.vhd} -instance_name {DDC_hb2_dec_0}



# Add DDC_hb2_dec_1 instance
sd_instantiate_hdl_module -sd_name ${sd_name} -hdl_module_name {ddc_hb2_dec} -hdl_file {hdl\DDC_hb2_dec.vhd} -instance_name {DDC_hb2_dec_1}



# Add DDC_hb3_dec_0 instance
sd_instantiate_hdl_module -sd_name ${sd_name} -hdl_module_name {DDC_HB3_DEC} -hdl_file {hdl\DDC_hb3_dec.vhd} -instance_name {DDC_hb3_dec_0}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {DDC_hb3_dec_0:CHan_i} -pin_slices {[0:0]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {DDC_hb3_dec_0:CHan_i} -pin_slices {[1:1]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {DDC_hb3_dec_0:CHan_i} -pin_slices {[2:2]}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {DDC_hb3_dec_0:CHan_i[2:2]} -value {GND}



# Add DDC_hb3_dec_1 instance
sd_instantiate_hdl_module -sd_name ${sd_name} -hdl_module_name {DDC_HB3_DEC} -hdl_file {hdl\DDC_hb3_dec.vhd} -instance_name {DDC_hb3_dec_1}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {DDC_hb3_dec_1:CHan_i} -pin_slices {[0:0]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {DDC_hb3_dec_1:CHan_i} -pin_slices {[1:1]}
sd_create_pin_slices -sd_name ${sd_name} -pin_name {DDC_hb3_dec_1:CHan_i} -pin_slices {[2:2]}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {DDC_hb3_dec_1:CHan_i[2:2]} -value {GND}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {DDC_hb3_dec_1:DATA_VLD_O}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {DDC_hb3_dec_1:CHAN_O}



# Add DDC_Multi_channel_FIR_0 instance
sd_instantiate_hdl_module -sd_name ${sd_name} -hdl_module_name {DDC_MULTI_CHANNEL_fir} -hdl_file {hdl\DDC_Multi_channel_FIR.vhd} -instance_name {DDC_Multi_channel_FIR_0}



# Add dds_chan_delay_0 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Channel_Delay} -instance_name {dds_chan_delay_0}
# Exporting Parameters of instance dds_chan_delay_0
sd_configure_core_instance -sd_name ${sd_name} -instance_name {dds_chan_delay_0} -params {\
"g_DATA_WIDTH:2" \
"g_DELAYS:2" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {dds_chan_delay_0}
sd_update_instance -sd_name ${sd_name} -instance_name {dds_chan_delay_0}



# Add dds_demux_0 instance
sd_instantiate_hdl_module -sd_name ${sd_name} -hdl_module_name {dds_demux} -hdl_file {hdl\dds_demux.vhd} -instance_name {dds_demux_0}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {dds_demux_0:cos1_o}
sd_mark_pins_unused -sd_name ${sd_name} -pin_names {dds_demux_0:sin1_o}



# Add mix_chan_delay_0 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Channel_Delay} -instance_name {mix_chan_delay_0}
# Exporting Parameters of instance mix_chan_delay_0
sd_configure_core_instance -sd_name ${sd_name} -instance_name {mix_chan_delay_0} -params {\
"g_DATA_WIDTH:2" \
"g_DELAYS:5" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {mix_chan_delay_0}
sd_update_instance -sd_name ${sd_name} -instance_name {mix_chan_delay_0}



# Add mix_chan_delay_1 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Channel_Delay} -instance_name {mix_chan_delay_1}
# Exporting Parameters of instance mix_chan_delay_1
sd_configure_core_instance -sd_name ${sd_name} -instance_name {mix_chan_delay_1} -params {\
"g_DATA_WIDTH:2" \
"g_DELAYS:5" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {mix_chan_delay_1}
sd_update_instance -sd_name ${sd_name} -instance_name {mix_chan_delay_1}



# Add mix_valid_delay_0 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Channel_Delay} -instance_name {mix_valid_delay_0}
# Exporting Parameters of instance mix_valid_delay_0
sd_configure_core_instance -sd_name ${sd_name} -instance_name {mix_valid_delay_0} -params {\
"g_DATA_WIDTH:1" \
"g_DELAYS:5" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {mix_valid_delay_0}
sd_update_instance -sd_name ${sd_name} -instance_name {mix_valid_delay_0}



# Add mix_valid_delay_1 instance
sd_instantiate_hdl_core -sd_name ${sd_name} -hdl_core_name {Channel_Delay} -instance_name {mix_valid_delay_1}
# Exporting Parameters of instance mix_valid_delay_1
sd_configure_core_instance -sd_name ${sd_name} -instance_name {mix_valid_delay_1} -params {\
"g_DATA_WIDTH:1" \
"g_DELAYS:5" }\
-validate_rules 0
sd_save_core_instance_config -sd_name ${sd_name} -instance_name {mix_valid_delay_1}
sd_update_instance -sd_name ${sd_name} -instance_name {mix_valid_delay_1}



# Add scalar net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_0:clock_i" "Channel_Mux_1:clock_i" "Channel_Mux_2:clock_i" "Channel_Mux_3:clock_i" "Channel_Mux_4:clock_i" "DDC_Multi_channel_FIR_0:clock_i" "DDC_hb2_dec_0:CLOCK_I" "DDC_hb2_dec_1:CLOCK_I" "DDC_hb3_dec_0:CLOCK_I" "DDC_hb3_dec_1:CLOCK_I" "clock_i" "complex_mult_0:clock_i" "dds_chan_delay_0:clock_i" "dds_demux_0:clock_i" "mix_chan_delay_0:clock_i" "mix_chan_delay_1:clock_i" "mix_valid_delay_0:clock_i" "mix_valid_delay_1:clock_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_0:data_vld_i" "Channel_Mux_1:data_vld_i" "data_vld_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_0:data_vld_o" "DDC_hb2_dec_0:data_vld_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_0:nreset_i" "Channel_Mux_1:nreset_i" "Channel_Mux_2:nreset_i" "Channel_Mux_3:nreset_i" "Channel_Mux_4:nreset_i" "DDC_Multi_channel_FIR_0:nreset_i" "DDC_hb2_dec_0:NRESET_I" "DDC_hb2_dec_1:NRESET_I" "DDC_hb3_dec_0:NRESET_i" "DDC_hb3_dec_1:NRESET_i" "complex_mult_0:nreset_i" "dds_chan_delay_0:nreset_i" "dds_demux_0:nreset_i" "mix_chan_delay_0:nreset_i" "mix_chan_delay_1:nreset_i" "mix_valid_delay_0:nreset_i" "mix_valid_delay_1:nreset_i" "nreset_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_1:data_vld_o" "DDC_hb2_dec_1:data_vld_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_2:data_vld_i" "DDC_hb3_dec_0:DATA_VLD_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_2:data_vld_o" "DDC_Multi_channel_FIR_0:data_vld_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_3:chan_out_o[0:0]" "DDC_hb3_dec_0:CHan_i[0:0]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_3:chan_out_o[1:1]" "DDC_hb3_dec_0:CHan_i[1:1]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_3:data_vld_i" "mix_valid_delay_0:data_o" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_3:data_vld_o" "DDC_hb3_dec_0:DATA_vld_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_4:chan_out_o[0:0]" "DDC_hb3_dec_1:CHan_i[0:0]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_4:chan_out_o[1:1]" "DDC_hb3_dec_1:CHan_i[1:1]" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_4:data_vld_i" "mix_valid_delay_1:data_o" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_4:data_vld_o" "DDC_hb3_dec_1:DATA_vld_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DDC_Multi_channel_FIR_0:data_vld_o" "data_vld_o" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DDC_hb2_dec_0:DATA_VLD_O" "mix_valid_delay_0:data_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DDC_hb2_dec_1:DATA_VLD_O" "mix_valid_delay_1:data_i" }

# Add bus net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_0:chan_out_o" "DDC_hb2_dec_0:chan_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_0:data1_i" "I0_data_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_0:data2_i" "I1_data_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_0:data_o" "DDC_hb2_dec_0:DATA_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_1:chan_out_o" "DDC_hb2_dec_1:chan_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_1:data1_i" "Q0_data_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_1:data2_i" "Q1_data_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_1:data_o" "DDC_hb2_dec_1:DATA_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_2:chan_in_i" "DDC_hb3_dec_0:CHAN_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_2:chan_out_o" "DDC_Multi_channel_FIR_0:chan_in_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_2:data1_i" "DDC_hb3_dec_0:DATA_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_2:data2_i" "DDC_hb3_dec_1:DATA_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_2:data_o" "DDC_Multi_channel_FIR_0:data_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_3:chan_in_i" "mix_chan_delay_0:data_o" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_3:chan_out_o" "dds_chan_delay_0:data_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_3:data1_i" "complex_mult_0:creal_o" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_3:data_o" "DDC_hb3_dec_0:DATA_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_4:chan_in_i" "mix_chan_delay_1:data_o" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_4:data1_i" "complex_mult_0:CIMAG_O" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"Channel_Mux_4:data_o" "DDC_hb3_dec_1:DATA_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DDC_Multi_channel_FIR_0:CHan_out_o" "chan_out_o" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DDC_Multi_channel_FIR_0:DATA_o" "data_o" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DDC_hb2_dec_0:Chan_o" "mix_chan_delay_0:data_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DDC_hb2_dec_0:DATA_O" "complex_mult_0:areal_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DDC_hb2_dec_1:Chan_o" "mix_chan_delay_1:data_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"DDC_hb2_dec_1:DATA_O" "complex_mult_0:AIMAG_I" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"chan_i" "dds_demux_0:chan_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"complex_mult_0:BREal_i" "dds_demux_0:cos0_o" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"complex_mult_0:bimag_i" "dds_demux_0:sin0_o" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"cos_i" "dds_demux_0:cos_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"dds_chan_delay_0:data_o" "dds_demux_0:data_chan_i" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"dds_demux_0:sin_i" "sin_i" }


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