| 1 |
load_package flow |
| 2 |
package require cmdline |
| 3 |
|
| 4 |
# Define the command argument structure as specified here: |
| 5 |
# https://www.altera.com/support/support-resources/design-examples/design-software/tcl/open_project.html |
| 6 |
set options { \ |
| 7 |
{ "projname.arg" "bladerf" "Project name" } \ |
| 8 |
{ "part.arg" "" "FPGA part number" } \ |
| 9 |
{ "platdir.arg" "0" "Platform directory" } \ |
| 10 |
{ "outdir.arg" "output_files" "Directory to place generated outputs (.sof, .rbf, .rpt, etc.)" } \ |
| 11 |
} |
| 12 |
|
| 13 |
# Parse the command arguments, store them into 'opts' |
| 14 |
array set opts [::cmdline::getoptions quartus(args) $options] |
| 15 |
|
| 16 |
set PROJECT_NAME $opts(projname) |
| 17 |
set TOP_LEVEL "bladerf" |
| 18 |
set BASE_REV "base" |
| 19 |
|
| 20 |
# Make a revision of the bladeRF FPGA based on a qip file in the platforms directory |
| 21 |
proc make_revision { rev } { |
| 22 |
global PROJECT_NAME |
| 23 |
global BASE_REV |
| 24 |
global opts |
| 25 |
|
| 26 |
if [revision_exists ${rev}] { |
| 27 |
project_open -revision ${rev} ${PROJECT_NAME} |
| 28 |
} else { |
| 29 |
create_revision -based_on ${BASE_REV} -set_current ${rev} |
| 30 |
} |
| 31 |
set_global_assignment -name QIP_FILE [file normalize $opts(platdir)/${PROJECT_NAME}-$rev.qip] |
| 32 |
export_assignments |
| 33 |
} |
| 34 |
|
| 35 |
# Create the base project revision |
| 36 |
if [project_exists ${PROJECT_NAME}] { |
| 37 |
project_open -revision ${BASE_REV} ${PROJECT_NAME} |
| 38 |
} else { |
| 39 |
project_new -part $opts(part) -revision ${BASE_REV} ${PROJECT_NAME} |
| 40 |
} |
| 41 |
set_global_assignment -name DEVICE $opts(part) |
| 42 |
set_global_assignment -name VHDL_INPUT_VERSION VHDL_2008 |
| 43 |
set_global_assignment -name TOP_LEVEL_ENTITY ${TOP_LEVEL} |
| 44 |
set_global_assignment -name PROJECT_OUTPUT_DIRECTORY $opts(outdir) |
| 45 |
set_global_assignment -name NUM_PARALLEL_PROCESSORS ALL |
| 46 |
|
| 47 |
# Configuration and I/O settings |
| 48 |
set_global_assignment -name STRATIXV_CONFIGURATION_SCHEME "PASSIVE PARALLEL X8" |
| 49 |
set_global_assignment -name USE_CONFIGURATION_DEVICE OFF |
| 50 |
set_global_assignment -name CRC_ERROR_OPEN_DRAIN OFF |
| 51 |
set_global_assignment -name GENERATE_TTF_FILE OFF |
| 52 |
set_global_assignment -name GENERATE_RBF_FILE OFF |
| 53 |
set_global_assignment -name ON_CHIP_BITSTREAM_DECOMPRESSION OFF |
| 54 |
set_global_assignment -name CVP_CONFDONE_OPEN_DRAIN OFF |
| 55 |
set_global_assignment -name RESERVE_DATA7_THROUGH_DATA5_AFTER_CONFIGURATION "USE AS REGULAR IO" |
| 56 |
set_global_assignment -name RESERVE_FLASH_NCE_AFTER_CONFIGURATION "USE AS REGULAR IO" |
| 57 |
set_global_assignment -name RESERVE_OTHER_AP_PINS_AFTER_CONFIGURATION "USE AS REGULAR IO" |
| 58 |
set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS REGULAR IO" |
| 59 |
set_global_assignment -name RESERVE_DCLK_AFTER_CONFIGURATION "USE AS REGULAR IO" |
| 60 |
#set_global_assignment -name RESERVE_ALL_UNUSED_PINS_WEAK_PULLUP "AS OUTPUT DRIVING GROUND" |
| 61 |
|
| 62 |
# Voltages |
| 63 |
set_global_assignment -name FORCE_CONFIGURATION_VCCIO "ON" |
| 64 |
set_global_assignment -name CONFIGURATION_VCCIO_LEVEL "1.8V" |
| 65 |
|
| 66 |
# Timing |
| 67 |
set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -rise |
| 68 |
set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -fall |
| 69 |
set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -rise |
| 70 |
set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -fall |
| 71 |
|
| 72 |
# Synthesis |
| 73 |
set_global_assignment -name OPTIMIZATION_TECHNIQUE SPEED |
| 74 |
set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC ON |
| 75 |
set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_DUPLICATION ON |
| 76 |
set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_RETIMING ON |
| 77 |
set_global_assignment -name SYNTH_PROTECT_SDC_CONSTRAINT ON |
| 78 |
set_global_assignment -name QII_AUTO_PACKED_REGISTERS "SPARSE AUTO" |
| 79 |
set_global_assignment -name PHYSICAL_SYNTHESIS_EFFORT NORMAL |
| 80 |
set_global_assignment -name SYNTHESIS_EFFORT AUTO |
| 81 |
|
| 82 |
|
| 83 |
# Fitting |
| 84 |
set_global_assignment -name FITTER_EFFORT "AUTO FIT" |
| 85 |
set_global_assignment -name OPTIMIZE_POWER_DURING_FITTING "EXTRA EFFORT" |
| 86 |
set_global_assignment -name FITTER_AUTO_EFFORT_DESIRED_SLACK_MARGIN "1 ns" |
| 87 |
set_global_assignment -name ADV_NETLIST_OPT_SYNTH_WYSIWYG_REMAP ON |
| 88 |
set_global_assignment -name ROUTER_CLOCKING_TOPOLOGY_ANALYSIS ON |
| 89 |
set_global_assignment -name ENABLE_DRC_SETTINGS ON |
| 90 |
set_global_assignment -name ROUTER_LCELL_INSERTION_AND_LOGIC_DUPLICATION ON |
| 91 |
set_global_assignment -name ROUTER_TIMING_OPTIMIZATION_LEVEL MAXIMUM |
| 92 |
set_global_assignment -name AUTO_PACKED_REGISTERS_STRATIXII NORMAL |
| 93 |
set_global_assignment -name OPTIMIZE_TIMING "NORMAL COMPILATION" |
| 94 |
|
| 95 |
set_instance_assignment -name FAST_INPUT_REGISTER ON -to fx3_gpif[*] |
| 96 |
set_instance_assignment -name FAST_INPUT_REGISTER ON -to fx3_ctl[4] |
| 97 |
set_instance_assignment -name FAST_INPUT_REGISTER ON -to fx3_ctl[6] |
| 98 |
|
| 99 |
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to fx3_gpif[*] |
| 100 |
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to fx3_ctl[0] |
| 101 |
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to fx3_ctl[3] |
| 102 |
|
| 103 |
set_instance_assignment -name FAST_OUTPUT_ENABLE_REGISTER ON -to fx3_gpif[*] |
| 104 |
|
| 105 |
# Add IP files and pin assignments |
| 106 |
set_global_assignment -name QIP_FILE [file normalize $opts(platdir)/${PROJECT_NAME}.qip] |
| 107 |
source [file normalize $opts(platdir)/constraints/pins.tcl] |
| 108 |
if {[file exists "./ip.ipx"] == 0} { |
| 109 |
file copy -force $opts(platdir)/build/ip.ipx ./ip.ipx |
| 110 |
} |
| 111 |
export_assignments |
| 112 |
|
| 113 |
# At this point, we can add custom revisions |
| 114 |
|
| 115 |
# Create the hosted |
| 116 |
make_revision hosted |
| 117 |
|
| 118 |
# Create the adsb |
| 119 |
make_revision adsb |
| 120 |
|
| 121 |
# Create the foxhunt |
| 122 |
make_revision foxhunt |
| 123 |
|
| 124 |
# Create the wlan |
| 125 |
make_revision wlan |
| 126 |
|
| 127 |
|
| 128 |
# Projects created! |
| 129 |
puts "${PROJECT_NAME} projects created!" |
| 130 |
puts "Please use the build.tcl script to build images.\n" |
| 131 |
puts "Revisions:" |
| 132 |
foreach rev [get_project_revisions] { |
| 133 |
puts " $rev" |
| 134 |
} |
| 135 |
|
| 136 |
project_close |