

# -------------------------------------------------------------------------------------------
# Link Netlist optimization constraints (FDC/NDC) and associate constraints to Synthesis tool
#   - FDC contains SynplifyPro attribute / constraints
#   - NDC contains Libero netlist optimization attributes / constraints
# Below is an example
#create_links \
    -net_fdc {./src/src_constraints/net_fdc_constraints.fdc}
#organize_tool_files -tool {SYNTHESIZE} \
    -file {./src/src_constraints/net_fdc_constraints.fdc} \
    -module {top::work} \
    -input_type {constraint}
#create_links \
    -ndc {./src/src_constraints/ndc_constraints.ndc}
#organize_tool_files -tool {SYNTHESIZE} \
    -file ${PrjLocation}/constraints/ndc_constraints.ndc \
    -module {top::work} \
    -input_type {constraint}

 

# -------------------------------------------------------------------------------------------
# Link I/O constraints (PDC) and associate constraints to Place and route tool
    
# import_files -io_pdc {./src/src_constraints/io_constraints.pdc}

 if { $FHB_ENABLE == 0 } {

# Link I/O constraints (PDC) and associate constraints to Place and route tool
    
import_files -io_pdc {./src/constraints/io_constraints_FHB_DIS.pdc}
 
# -------------------------------------------------------------------------------------------
# Link Floorplanning constraints (PDC) and associate constraints to Place and route tool
# Below is an example
import_files -fp_pdc {./src/constraints/fp_constraints_FHB_DIS.pdc}

# -------------------------------------------------------------------------------------------
# Derive SDC constraints from the design and the configured cores generated constraints
derive_constraints_sdc

# -------------------------------------------------------------------------------------------
# Link user SDC constraints (not expressed by the derived constraints)
# and optionally associate to Synthesis, Place and Route and Timing Verification as needed
# Below is an example
import_files -sdc {./src/constraints/timing_user_constraints_FHB_DIS.sdc}
organize_tool_files -tool {SYNTHESIZE} \
    -file ${PrjLocation}/constraint/top_derived_constraints.sdc \
    -module {top::work} \
    -input_type {constraint}
organize_tool_files -tool {PLACEROUTE} \
    -file ${PrjLocation}/constraint/top_derived_constraints.sdc \
    -file ${PrjLocation}/constraint/timing_user_constraints_FHB_DIS.sdc \
    -file ${PrjLocation}/constraint/io/io_constraints_FHB_DIS.pdc \
    -file ${PrjLocation}/constraint/fp/fp_constraints_FHB_DIS.pdc \
    -module {top::work} \
    -input_type {constraint}
organize_tool_files -tool {VERIFYTIMING} \
    -file ${PrjLocation}/constraint/top_derived_constraints.sdc \
    -file ${PrjLocation}/constraint/timing_user_constraints_FHB_DIS.sdc \
    -module {top::work} \
    -input_type {constraint}
# #-file ${PrjLocation}/constraint/top_fhb_auto_generated.sdc \
## run_tool -name {CONSTRAINT_MANAGEMENT} 
run_tool_wrapper "run_tool -name {CONSTRAINT_MANAGEMENT} 
"

save_project
puts "Imported and derived constraints successfully\n"
  

 } else {

# Link I/O constraints (PDC) and associate constraints to Place and route tool
    
import_files -io_pdc {./src/constraints/io_constraints_FHB_EN.pdc}
 
# -------------------------------------------------------------------------------------------
# Link Floorplanning constraints (PDC) and associate constraints to Place and route tool
# Below is an example
import_files -fp_pdc {./src/constraints/fp_constraints_FHB_EN.pdc}

# -------------------------------------------------------------------------------------------
# Derive SDC constraints from the design and the configured cores generated constraints
derive_constraints_sdc

# -------------------------------------------------------------------------------------------
# Link user SDC constraints (not expressed by the derived constraints)
# and optionally associate to Synthesis, Place and Route and Timing Verification as needed
# Below is an example
import_files -sdc {./src/constraints/timing_user_constraints_FHB_EN.sdc}
#Importing ndc constraint file
import_files -ndc {./src/constraints/ndc_constraints.ndc}

organize_tool_files -tool {SYNTHESIZE} \
    -file ${PrjLocation}/constraint/top_derived_constraints.sdc \
	-file ${PrjLocation}/constraint/ndc_constraints.ndc \
    -module {top::work} \
    -input_type {constraint}
organize_tool_files -tool {PLACEROUTE} \
    -file ${PrjLocation}/constraint/top_derived_constraints.sdc \
    -file ${PrjLocation}/constraint/timing_user_constraints_FHB_EN.sdc \
    -file ${PrjLocation}/constraint/io/io_constraints_FHB_EN.pdc \
    -file ${PrjLocation}/constraint/fp/fp_constraints_FHB_EN.pdc \
    -module {top::work} \
    -input_type {constraint}
organize_tool_files -tool {VERIFYTIMING} \
    -file ${PrjLocation}/constraint/top_derived_constraints.sdc \
    -file ${PrjLocation}/constraint/timing_user_constraints_FHB_EN.sdc \
    -module {top::work} \
    -input_type {constraint}
#-file ${PrjLocation}/constraint/top_fhb_auto_generated.sdc \
## run_tool -name {CONSTRAINT_MANAGEMENT} 
run_tool_wrapper "run_tool -name {CONSTRAINT_MANAGEMENT} 
"

save_project
puts "Imported and derived constraints successfully\n"


}
 



