2017-06-05 19:13:21 +00:00
|
|
|
|
2019-05-24 07:41:33 +00:00
|
|
|
## Initialize global variable
|
2017-06-05 19:13:21 +00:00
|
|
|
set family "none"
|
|
|
|
set device "none"
|
2021-09-28 15:58:28 +00:00
|
|
|
|
2019-05-24 07:41:33 +00:00
|
|
|
## Create a project.
|
|
|
|
#
|
|
|
|
# \param[project_name] - name of the project, must contain a valid carrier name
|
|
|
|
# \param[parameter_list] - a list of global parameters (parameters of the
|
|
|
|
# system_top module)
|
|
|
|
#
|
|
|
|
# Supported carrier names are: a10gx, a10soc, c5soc, de10nano, a5soc, a5gt.
|
|
|
|
#
|
2018-08-13 14:25:13 +00:00
|
|
|
proc adi_project {project_name {parameter_list {}}} {
|
2017-06-05 19:13:21 +00:00
|
|
|
|
|
|
|
global ad_hdl_dir
|
2019-07-12 07:24:48 +00:00
|
|
|
global ad_ghdl_dir
|
2017-06-05 19:13:21 +00:00
|
|
|
global family
|
|
|
|
global device
|
2021-09-28 15:58:28 +00:00
|
|
|
global REQUIRED_QUARTUS_VERSION
|
2017-06-05 19:13:21 +00:00
|
|
|
global quartus
|
2020-08-11 11:02:16 +00:00
|
|
|
global IGNORE_VERSION_CHECK
|
2021-09-28 15:58:28 +00:00
|
|
|
global QUARTUS_PRO_ISUSED
|
2017-06-05 19:13:21 +00:00
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
if {![info exists ::env(ADI_PROJECT_DIR)]} {
|
|
|
|
set actual_project_name $project_name
|
|
|
|
set ad_project_dir ""
|
|
|
|
} else {
|
|
|
|
set actual_project_name "$::env(ADI_PROJECT_DIR)${project_name}"
|
|
|
|
set ad_project_dir $::env(ADI_PROJECT_DIR)
|
|
|
|
}
|
|
|
|
|
2018-12-13 09:42:40 +00:00
|
|
|
# check $ALT_NIOS_MMU_ENABLED environment variables
|
|
|
|
|
|
|
|
set mmu_enabled 1
|
|
|
|
if [info exists ::env(ALT_NIOS_MMU_ENABLED)] {
|
|
|
|
set mmu_enabled $::env(ALT_NIOS_MMU_ENABLED)
|
|
|
|
}
|
|
|
|
|
|
|
|
# check $QUARTUS_PRO_ISUSED environment variables
|
|
|
|
set quartus_pro_isused 1
|
2021-09-28 15:58:28 +00:00
|
|
|
if {[info exists ::env(QUARTUS_PRO_ISUSED)]} {
|
2018-12-13 09:42:40 +00:00
|
|
|
set quartus_pro_isused $::env(QUARTUS_PRO_ISUSED)
|
2021-09-28 15:58:28 +00:00
|
|
|
} elseif {[info exists QUARTUS_PRO_ISUSED]} {
|
|
|
|
set quartus_pro_isused $QUARTUS_PRO_ISUSED
|
2018-12-13 09:42:40 +00:00
|
|
|
}
|
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
if [regexp "_a10gx" $project_name] {
|
2017-06-05 19:13:21 +00:00
|
|
|
set family "Arria 10"
|
2017-06-06 16:20:44 +00:00
|
|
|
set device 10AX115S2F45I1SG
|
|
|
|
}
|
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
if [regexp "_a10soc" $project_name] {
|
2017-06-06 16:20:44 +00:00
|
|
|
set family "Arria 10"
|
|
|
|
set device 10AS066N3F40E2SG
|
2017-06-08 19:02:24 +00:00
|
|
|
}
|
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
if [regexp "_s10soc" $project_name] {
|
2020-03-31 08:27:22 +00:00
|
|
|
set family "Stratix 10"
|
2021-07-02 12:10:09 +00:00
|
|
|
set device 1SX280HU2F50E1VGAS
|
2020-03-31 08:27:22 +00:00
|
|
|
}
|
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
if [regexp "_c5soc" $project_name] {
|
2017-06-08 19:02:24 +00:00
|
|
|
set family "Cyclone V"
|
|
|
|
set device 5CSXFC6D6F31C8ES
|
2022-09-23 09:28:22 +00:00
|
|
|
set system_qip_file ${ad_project_dir}system_bd/synthesis/system_bd.qip
|
2017-06-05 19:13:21 +00:00
|
|
|
}
|
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
if [regexp "_de10nano" $project_name] {
|
2017-10-25 14:44:01 +00:00
|
|
|
set family "Cyclone V"
|
2019-02-25 13:35:57 +00:00
|
|
|
set device 5CSEBA6U23I7DK
|
2022-09-23 09:28:22 +00:00
|
|
|
set system_qip_file ${ad_project_dir}system_bd/synthesis/system_bd.qip
|
2017-10-25 14:44:01 +00:00
|
|
|
}
|
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
if [regexp "_a5soc" $project_name] {
|
2017-06-09 20:19:29 +00:00
|
|
|
set family "Arria V"
|
2017-06-13 13:53:22 +00:00
|
|
|
set device 5ASTFD5K3F40I3ES
|
2022-09-23 09:28:22 +00:00
|
|
|
set system_qip_file ${ad_project_dir}system_bd/synthesis/system_bd.qip
|
2017-06-09 20:19:29 +00:00
|
|
|
}
|
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
if [regexp "_a5gt" $project_name] {
|
2017-06-09 20:19:29 +00:00
|
|
|
set family "Arria V"
|
|
|
|
set device 5AGTFD7K3F40I3
|
2022-09-23 09:28:22 +00:00
|
|
|
set system_qip_file ${ad_project_dir}system_bd/synthesis/system_bd.qip
|
2017-06-09 20:19:29 +00:00
|
|
|
}
|
|
|
|
|
2017-06-05 19:13:21 +00:00
|
|
|
# version check
|
|
|
|
|
|
|
|
set m_version [lindex $quartus(version) 1]
|
2020-08-11 11:02:16 +00:00
|
|
|
if {$IGNORE_VERSION_CHECK} {
|
2021-09-28 15:58:28 +00:00
|
|
|
if {[string compare $m_version $REQUIRED_QUARTUS_VERSION] != 0} {
|
2020-08-11 11:02:16 +00:00
|
|
|
puts -nonewline "CRITICAL WARNING: Quartus version mismatch; "
|
2021-09-28 15:58:28 +00:00
|
|
|
puts -nonewline "expected $REQUIRED_QUARTUS_VERSION, "
|
2020-08-11 11:02:16 +00:00
|
|
|
puts -nonewline "got $m_version.\n"
|
|
|
|
}
|
|
|
|
} else {
|
2021-09-28 15:58:28 +00:00
|
|
|
if {[string compare $m_version $REQUIRED_QUARTUS_VERSION] != 0} {
|
2020-08-11 11:02:16 +00:00
|
|
|
puts -nonewline "ERROR: Quartus version mismatch; "
|
2021-09-28 15:58:28 +00:00
|
|
|
puts -nonewline "expected $REQUIRED_QUARTUS_VERSION, "
|
2020-08-11 11:02:16 +00:00
|
|
|
puts -nonewline "got $m_version.\n"
|
|
|
|
puts -nonewline "This ERROR message can be down-graded to CRITICAL WARNING by setting ADI_IGNORE_VERSION_CHECK environment variable to 1. Be aware that ADI will not support you, if you are using a different tool version.\n"
|
|
|
|
exit 2
|
|
|
|
}
|
2017-06-05 19:13:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# packages used
|
2019-02-25 13:35:57 +00:00
|
|
|
|
2017-06-05 19:13:21 +00:00
|
|
|
load_package flow
|
|
|
|
|
|
|
|
# project
|
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
project_new $actual_project_name -overwrite
|
2017-06-05 19:13:21 +00:00
|
|
|
|
|
|
|
# library paths
|
2022-07-12 11:06:15 +00:00
|
|
|
if {[info exists ::env(ADI_GHDL_DIR)]} {
|
|
|
|
set ad_lib_folders "$ad_hdl_dir/library/**/*;$ad_ghdl_dir/library/**/*"
|
|
|
|
} else {
|
|
|
|
set ad_lib_folders "$ad_hdl_dir/library/**/*"
|
|
|
|
}
|
2017-06-05 19:13:21 +00:00
|
|
|
|
|
|
|
set_user_option -name USER_IP_SEARCH_PATHS $ad_lib_folders
|
|
|
|
set_global_assignment -name IP_SEARCH_PATHS $ad_lib_folders
|
|
|
|
|
|
|
|
# project & qsys
|
2019-02-25 13:35:57 +00:00
|
|
|
|
2017-06-05 19:13:21 +00:00
|
|
|
set_global_assignment -name FAMILY $family
|
|
|
|
set_global_assignment -name DEVICE $device
|
|
|
|
|
|
|
|
# qsys
|
|
|
|
|
|
|
|
set mmu_enabled 1
|
2018-08-14 14:40:42 +00:00
|
|
|
if [info exists ::env(NIOS_MMU_ENABLED)] {
|
|
|
|
set mmu_enabled $::env(NIOS_MMU_ENABLED)
|
2017-06-05 19:13:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set QFILE [open "system_qsys_script.tcl" "w"]
|
2020-08-18 20:51:01 +00:00
|
|
|
puts $QFILE "set project_name $project_name"
|
2017-06-05 19:13:21 +00:00
|
|
|
puts $QFILE "set mmu_enabled $mmu_enabled"
|
|
|
|
puts $QFILE "set ad_hdl_dir $ad_hdl_dir"
|
2022-07-12 11:06:15 +00:00
|
|
|
if {[info exists ::env(ADI_GHDL_DIR)]} {
|
|
|
|
puts $QFILE "set ad_ghdl_dir $ad_ghdl_dir"
|
|
|
|
}
|
2022-09-23 09:28:22 +00:00
|
|
|
if {[info exists ::env(ADI_PROJECT_DIR)]} {
|
|
|
|
puts $QFILE "set ad_project_dir $::env(ADI_PROJECT_DIR)"
|
|
|
|
}
|
2017-06-05 19:13:21 +00:00
|
|
|
puts $QFILE "package require qsys"
|
|
|
|
puts $QFILE "set_module_property NAME {system_bd}"
|
|
|
|
puts $QFILE "set_project_property DEVICE_FAMILY {$family}"
|
|
|
|
puts $QFILE "set_project_property DEVICE $device"
|
2019-01-29 08:32:38 +00:00
|
|
|
puts $QFILE "foreach {param value} {$parameter_list} { set ad_project_params(\$param) \$value }"
|
2022-09-23 09:28:22 +00:00
|
|
|
if {[info exists ::env(ADI_PROJECT_DIR)]} {
|
|
|
|
puts $QFILE "source ../system_qsys.tcl"
|
|
|
|
} else {
|
|
|
|
puts $QFILE "source system_qsys.tcl"
|
|
|
|
}
|
2020-08-13 14:12:24 +00:00
|
|
|
if {$quartus_pro_isused == 1} {
|
|
|
|
puts $QFILE "set_domain_assignment {\$system} {qsys_mm.maxAdditionalLatency} {4}"
|
|
|
|
puts $QFILE "set_domain_assignment {\$system} {qsys_mm.clockCrossingAdapter} {AUTO}"
|
|
|
|
puts $QFILE "set_domain_assignment {\$system} {qsys_mm.burstAdapterImplementation} {PER_BURST_TYPE_CONVERTER}"
|
|
|
|
} else {
|
|
|
|
puts $QFILE "set_interconnect_requirement {\$system} {qsys_mm.maxAdditionalLatency} {4}"
|
|
|
|
puts $QFILE "set_interconnect_requirement {\$system} {qsys_mm.clockCrossingAdapter} {AUTO}"
|
|
|
|
puts $QFILE "set_interconnect_requirement {\$system} {qsys_mm.burstAdapterImplementation} {PER_BURST_TYPE_CONVERTER}"
|
|
|
|
}
|
2017-06-05 19:13:21 +00:00
|
|
|
puts $QFILE "save_system {system_bd.qsys}"
|
|
|
|
close $QFILE
|
|
|
|
|
2018-12-13 09:42:40 +00:00
|
|
|
# check which type of Quartus is used, to call the qsys utilities with the
|
|
|
|
# correct attributes
|
|
|
|
if {$quartus_pro_isused == 1} {
|
|
|
|
|
|
|
|
exec -ignorestderr $quartus(quartus_rootpath)/sopc_builder/bin/qsys-script \
|
|
|
|
--quartus_project=$project_name --script=system_qsys_script.tcl
|
|
|
|
|
|
|
|
exec -ignorestderr $quartus(quartus_rootpath)/sopc_builder/bin/qsys-generate \
|
|
|
|
system_bd.qsys --synthesis=VERILOG --family=$family --part=$device \
|
|
|
|
--quartus-project=$project_name
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
exec -ignorestderr $quartus(quartus_rootpath)/sopc_builder/bin/qsys-script \
|
|
|
|
--script=system_qsys_script.tcl
|
|
|
|
|
|
|
|
exec -ignorestderr $quartus(quartus_rootpath)/sopc_builder/bin/qsys-generate \
|
|
|
|
system_bd.qsys --synthesis=VERILOG --family=$family --part=$device \
|
|
|
|
|
|
|
|
# I/O Timing Analysis is available just in Quartus Standard
|
|
|
|
set_global_assignment -name ENABLE_ADVANCED_IO_TIMING ON
|
|
|
|
|
|
|
|
}
|
2017-06-05 19:13:21 +00:00
|
|
|
|
2020-08-11 07:23:38 +00:00
|
|
|
# source MESSAGE-DISABLE definitions - to ignore invalid critical warnings
|
|
|
|
|
|
|
|
source $ad_hdl_dir/projects/scripts/adi_intel_msg.tcl
|
|
|
|
|
2017-06-05 19:13:21 +00:00
|
|
|
# default assignments
|
2019-02-25 13:35:57 +00:00
|
|
|
|
2022-08-24 14:01:06 +00:00
|
|
|
if {$quartus_pro_isused != 1} {
|
|
|
|
set_global_assignment -name QIP_FILE $system_qip_file
|
|
|
|
}
|
2022-09-23 09:28:22 +00:00
|
|
|
if {[info exists ::env(ADI_PROJECT_DIR)]} {
|
|
|
|
set_global_assignment -name VERILOG_FILE ../system_top.v
|
|
|
|
set_global_assignment -name SDC_FILE ../system_constr.sdc
|
|
|
|
} else {
|
|
|
|
set_global_assignment -name VERILOG_FILE system_top.v
|
|
|
|
set_global_assignment -name SDC_FILE system_constr.sdc
|
|
|
|
}
|
2017-06-05 19:13:21 +00:00
|
|
|
set_global_assignment -name TOP_LEVEL_ENTITY system_top
|
2019-08-26 08:42:47 +00:00
|
|
|
set_global_assignment -name ENABLE_HPS_INTERNAL_TIMING ON
|
2017-06-05 19:13:21 +00:00
|
|
|
|
|
|
|
# remove altshift_taps
|
|
|
|
|
|
|
|
set_instance_assignment -name AUTO_SHIFT_REGISTER_RECOGNITION OFF -to * -entity up_xfer_cntrl
|
|
|
|
set_instance_assignment -name AUTO_SHIFT_REGISTER_RECOGNITION OFF -to * -entity up_xfer_status
|
|
|
|
set_instance_assignment -name AUTO_SHIFT_REGISTER_RECOGNITION OFF -to * -entity up_clock_mon
|
|
|
|
set_instance_assignment -name AUTO_SHIFT_REGISTER_RECOGNITION OFF -to * -entity ad_rst
|
|
|
|
set_instance_assignment -name QII_AUTO_PACKED_REGISTERS OFF -to * -entity up_xfer_cntrl
|
|
|
|
set_instance_assignment -name QII_AUTO_PACKED_REGISTERS OFF -to * -entity up_xfer_status
|
|
|
|
set_instance_assignment -name QII_AUTO_PACKED_REGISTERS OFF -to * -entity up_clock_mon
|
|
|
|
set_instance_assignment -name QII_AUTO_PACKED_REGISTERS OFF -to * -entity ad_rst
|
|
|
|
|
|
|
|
# globals
|
|
|
|
|
|
|
|
set_global_assignment -name SYNCHRONIZER_IDENTIFICATION AUTO
|
|
|
|
set_global_assignment -name USE_TIMEQUEST_TIMING_ANALYZER ON
|
|
|
|
set_global_assignment -name TIMEQUEST_DO_REPORT_TIMING ON
|
|
|
|
set_global_assignment -name TIMEQUEST_DO_CCPP_REMOVAL ON
|
|
|
|
set_global_assignment -name TIMEQUEST_REPORT_SCRIPT $ad_hdl_dir/projects/scripts/adi_tquest.tcl
|
|
|
|
set_global_assignment -name ON_CHIP_BITSTREAM_DECOMPRESSION OFF
|
2019-01-29 08:32:38 +00:00
|
|
|
|
|
|
|
# set top level file parameters
|
|
|
|
foreach {param value} $parameter_list {
|
|
|
|
set_parameter -name $param $value
|
|
|
|
}
|
2017-06-05 19:13:21 +00:00
|
|
|
}
|
|
|
|
|