diff --git a/hdl/quartus/bladerf_micro.tcl b/hdl/quartus/bladerf_micro.tcl deleted file mode 100644 index cca6339b..00000000 --- a/hdl/quartus/bladerf_micro.tcl +++ /dev/null @@ -1,95 +0,0 @@ -load_package flow - -# Make a revision of the bladeRF FPGA based on a qip file in the platforms directory -proc make_revision { rev } { - if [revision_exists $rev] { - project_open -force -revision $rev bladerf - } else { - create_revision -based_on base -set_current $rev - } - set_global_assignment -name QIP_FILE [file normalize ../../fpga/platforms/bladerf-micro/bladerf-$rev.qip] - export_assignments -} - -# Create the base project -if [project_exists bladerf] { - project_open -force -revision base bladerf -} else { - project_new -family "Cyclone V" -revision base bladerf -} -set_global_assignment -name DEVICE 5CEBA2F23C8 -set_global_assignment -name VHDL_INPUT_VERSION VHDL_2008 -set_global_assignment -name TOP_LEVEL_ENTITY bladerf -set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files - -set_global_assignment -name DEVICE_MIGRATION_LIST "5CEBA2F23C8,5CEBA4F23C8,5CEBA9F23C8" - -# Configuration settings -set_global_assignment -name STRATIXV_CONFIGURATION_SCHEME "PASSIVE PARALLEL X8" -set_global_assignment -name USE_CONFIGURATION_DEVICE OFF -set_global_assignment -name GENERATE_TTF_FILE ON -set_global_assignment -name GENERATE_RBF_FILE ON -set_global_assignment -name CRC_ERROR_OPEN_DRAIN OFF -set_global_assignment -name FORCE_CONFIGURATION_VCCIO ON -set_global_assignment -name CONFIGURATION_VCCIO_LEVEL 1.8V -set_global_assignment -name ON_CHIP_BITSTREAM_DECOMPRESSION OFF -set_global_assignment -name RESERVE_DATA7_THROUGH_DATA5_AFTER_CONFIGURATION "USE AS REGULAR IO" -set_global_assignment -name CVP_CONFDONE_OPEN_DRAIN OFF -set_global_assignment -name RESERVE_FLASH_NCE_AFTER_CONFIGURATION "USE AS REGULAR IO" -set_global_assignment -name RESERVE_OTHER_AP_PINS_AFTER_CONFIGURATION "USE AS REGULAR IO" -set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS REGULAR IO" -set_global_assignment -name RESERVE_DCLK_AFTER_CONFIGURATION "USE AS REGULAR IO" -set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -rise -set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -fall -set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -rise -set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -fall -set_global_assignment -name CYCLONEII_OPTIMIZATION_TECHNIQUE SPEED -set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC ON -set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_DUPLICATION ON -set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_RETIMING ON -set_global_assignment -name ROUTER_LCELL_INSERTION_AND_LOGIC_DUPLICATION ON -set_global_assignment -name ROUTER_TIMING_OPTIMIZATION_LEVEL MAXIMUM -set_global_assignment -name AUTO_PACKED_REGISTERS_STRATIXII NORMAL -set_global_assignment -name FITTER_EFFORT "STANDARD FIT" -set_global_assignment -name ADV_NETLIST_OPT_SYNTH_WYSIWYG_REMAP ON -set_global_assignment -name ROUTER_CLOCKING_TOPOLOGY_ANALYSIS ON -set_global_assignment -name ENABLE_DRC_SETTINGS ON -#set_instance_assignment -name FAST_INPUT_REGISTER ON -to lms_rx_data[*] -#set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to fx3_gpif[*] -#set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to lms_tx_data[*] -#set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to fx3_ctl[*] -#set_instance_assignment -name FAST_OUTPUT_ENABLE_REGISTER ON -to fx3_gpif[*] -set_global_assignment -name OPTIMIZE_POWER_DURING_FITTING "EXTRA EFFORT" -set_global_assignment -name FITTER_AUTO_EFFORT_DESIRED_SLACK_MARGIN "1 ns" -#set_global_assignment -name RESERVE_ALL_UNUSED_PINS_WEAK_PULLUP "AS OUTPUT DRIVING GROUND" - -# Create an base revision -set_global_assignment -name QIP_FILE [file normalize ../../fpga/platforms/bladerf-micro/bladerf.qip] -source [file normalize ../../fpga/platforms/bladerf-micro/constraints/pins.tcl] -file copy -force ../ip.ipx ./ip.ipx -export_assignments - -# Create the hosted -make_revision hosted - -# Create headless -#make_revision headless - -# Create fsk_bridge -#make_revision fsk_bridge - -# Create QPSK transmitter -#make_revision qpsk_tx - -# Create ATSC transmitter -#make_revision atsc_tx - -# Projects created! -puts "bladeRF projects created. Please use the build.tcl script to build images.\n" -puts "Revisions:" -foreach rev [get_project_revisions] { - puts " $rev" -} - -project_close - diff --git a/hdl/quartus/build_bladerf_micro.sh b/hdl/quartus/build_bladerf_micro.sh deleted file mode 100755 index 7caa43b5..00000000 --- a/hdl/quartus/build_bladerf_micro.sh +++ /dev/null @@ -1,306 +0,0 @@ -#!/usr/bin/env bash -# -# Build a bladeRF ADI FPGA image -################################################################################ - -function usage() -{ - echo "" - echo "bladeRF-ADI FPGA build script" - echo "" - echo "Usage: `basename $0` -r -s " - echo "" - echo "Options:" - echo " -r FPGA revision" - echo " -s FPGA size" - echo " -a SignalTap STP file" - echo " -f Force STP insertion" - echo " -n Select NIOS II revision. Tiny is the" - echo " default and can be built with" - echo " Quartus Web Edition." - echo " -h Show this text" - echo "" - echo "Supported revisions:" - echo " hosted" - - # These revisions were for used for early prototyping and testing. They - # require some work to get building with the current design. As such, - # they have been removed for this list for the time being to avoid - # confusion. These can be re-added once they are updated and working. - #echo " headless" - #echo " fsk_bridge" - #echo " qpsk_tx" - - echo "" - echo "Supported sizes (kLE)" - echo " 25" - echo " 49" - echo " 301" - echo "" -} - -# Returns: -# 0 on compatible version -# 1 on incompatible version or unable to detemine version -check_quartus_version() -{ - local readonly VERSION_FILE="$QUARTUS_ROOTDIR/version.txt" - - if [ ! -f "$VERSION_FILE" ]; then - echo "Could not find Quartus version file." >&2 - return 1 - fi - - local readonly VERSION=$( \ - grep -m 1 Version $QUARTUS_ROOTDIR/version.txt | \ - sed -e 's/Version=//' \ - ) - - echo "Detected Quartus II $VERSION" - - local readonly VERSION_MAJOR=$( \ - echo "$VERSION" | \ - sed -e 's/\([[:digit:]]\+\).*/\1/g' \ - ) - - if [ -z "$VERSION_MAJOR" ]; then - echo "Failed to retrieve Quartus version number." >&2 - return 1 - fi - - if [ "$VERSION_MAJOR" -lt "15" ]; then - echo "The bladeRF FPGA design requires Quartus II version 15" >&2 - echo "The installed version is: $VERSION" >&2 - return 1 - fi - - return 0 -} - -if [ $# -eq 0 ]; then - usage - exit 0 -fi - -# Default to NIOS II E (Tiny) -nios_rev="Tiny" - -while getopts ":fa:s:r:n:h" opt; do - case $opt in - h) - usage - exit 0 - ;; - - r) - rev=$OPTARG - ;; - - s) - size=$OPTARG - ;; - - a) - echo "STP: $OPTARG" - stp=$(readlink -f $OPTARG) - ;; - - f) - echo "Forcing STP insertion" - force="-force" - ;; - - n) nios_rev=$OPTARG - ;; - - \?) - echo "Unrecognized option: -$OPTARG" >&2 - usage - exit 1 - ;; - esac -done - -if [ "$size" == "" ]; then - echo -e "\nError: size (-s) is required\n" >&2 - usage - exit 1 -fi - -if [ "$size" -ne 25 ] && [ "$size" -ne 49 ] && [ "$size" -ne 301 ]; then - echo -e "\nError: Invalid size (\"$size\")" >&2 - usage - exit 1 -fi - -if [ "$rev" == "" ]; then - echo -e "\nError: revision (-r) is required\n" >&2 - usage - exit 1 -fi - -if [ "$rev" != "hosted" ] && [ "$rev" != "atsc_tx" ]; then - echo -e "\nError: Invalid revision (\"$rev\")\n" >&2 - usage - exit 1 -fi - -if [ "$stp" != "" ] && [ ! -f "$stp" ]; then - echo -e "\nCould not find STP file: $stp\n" >&2 - exit 1 -fi - -if [ "$nios_rev" != "Tiny" ] && [ "$nios_rev" != "Small" ] && [ "$nios_rev" != "Fast" ]; then - echo -e "\nInvalid NIOS II revision: $nios_rev\n" >&2 - exit 1 -fi - -# quartus_sh script gives a reference point to the quartus bin dir -quartus_sh="`which quartus_sh`" -if [ $? -ne 0 ] || [ ! -f "$quartus_sh" ]; then - echo -e "\nError: quartus_sh (Quartus 'bin' directory) does not appear to be in your PATH\n" >&2 - exit 1 -fi - - -# Complain early about an unsupported version. Otherwise, the user -# may get some unintuitive error messages. -check_quartus_version -if [ $? -ne 0 ]; then - exit 1 -fi - -nios_system=../fpga/ip/altera/nios_system_micro - -device="5CEB" -if [ "$size" -eq 25 ]; then - device="${device}A2" -elif [ "$size" -eq 49 ]; then - device="${device}A4" -elif [ "$size" -eq 301 ]; then - device="${device}A9" -fi -device="${device}F23C8" - -# 9a484b436: Windows-specific workaround for Quartus bug -if [ "x$(uname)" != "xLinux" ]; then - QUARTUS_BINDIR=$QUARTUS_ROOTDIR/bin - export QUARTUS_BINDIR - echo "## Non-Linux OS Detected (Windows?)" - echo "## Forcing QUARTUS_BINDIR to ${QUARTUS_BINDIR}" -fi - -# Error out at the first sign of trouble -set -e - -echo "" -echo "##########################################################################" -echo " Generating NIOS II Qsys for bladeRF ..." -echo "##########################################################################" -echo "" - -# Switch out the NIOS II implementation in nios_system.qsys -echo "Selecting NIOS II implementation: $nios_rev" -sed -ri "s/name=\"impl\" value=\"(Tiny|Small|Fast)\"/name=\"impl\" value=\"$nios_rev\"/" $nios_system/nios_system.qsys - -ip-generate \ - --project-directory=$nios_system \ - --output-directory=$nios_system \ - --report-file=bsf:$nios_system/nios_system.bsf \ - --system-info=DEVICE_FAMILY=Cyclone\ V \ - --system-info=DEVICE=${device} \ - --system-info=DEVICE_SPEEDGRADE=8 \ - --component-file=$nios_system/nios_system.qsys - -ip-generate \ - --project-directory=$nios_system \ - --output-directory=$nios_system/synthesis \ - --file-set=QUARTUS_SYNTH \ - --report-file=sopcinfo:$nios_system/nios_system.sopcinfo \ - --report-file=html:$nios_system/nios_system.html \ - --report-file=qip:$nios_system/synthesis/nios_system.qip \ - --report-file=cmp:$nios_system/nios_system.cmp \ - --system-info=DEVICE_FAMILY=Cyclone\ V \ - --system-info=DEVICE=${device} \ - --system-info=DEVICE_SPEEDGRADE=8 \ - --component-file=$nios_system/nios_system.qsys - -echo "" -echo "##########################################################################" -echo " Building BSP and sample application..." -echo "##########################################################################" -echo "" - - -pushd $nios_system/software/bladeRF_nios_bsp -cp ../settings.bsp.in ./settings.bsp -nios2-bsp-generate-files --settings=settings.bsp --bsp-dir=. -make -cd ../bladeRF_nios -make clean all - -# Encountered issues on Ubuntu 13.04 with the SDK's scripts not resolving -# paths properly. In the end, some items wind up being defined as .jar's that -# should be in our PATH at this point, so we set these up here... - -#ELF2HEX=elf2hex.jar ELF2DAT=.jar make mem_init_generate -make mem_init_clean mem_init_generate -popd - -# Fix Quartus outputting '1' or '0' for ARST_LVL when it should be 1'b0 or 1'b1 -sed -i s/"'\([01]\)'"/"1'b\1"/ $nios_system/synthesis/nios_system.v - -echo "" -echo "##########################################################################" -echo " Building FPGA Image: $rev, $size kLE" -echo "##########################################################################" -echo "" - -mkdir -p work -pushd work -$quartus_sh -t ../bladerf_micro.tcl -if [ "$stp" == "" ]; then - $quartus_sh -t ../build_micro.tcl -rev $rev -size $size -else - $quartus_sh -t ../build_micro.tcl -rev $rev -size $size -stp $stp $force -fi -popd - -BUILD_TIME_DONE="$(cat work/output_files/$rev.done)" -BUILD_TIME_DONE=$(date -d"$BUILD_TIME_DONE" '+%F_%H.%M.%S') - -BUILD_NAME="$rev"x"$size" -BUILD_OUTPUT_DIR="$BUILD_NAME"-"$BUILD_TIME_DONE" -RBF=$BUILD_NAME.rbf - -mkdir -p "$BUILD_OUTPUT_DIR" -cp "work/output_files/$rev.rbf" "$BUILD_OUTPUT_DIR/$RBF" - -for file in work/output_files/*rpt work/output_files/*summary; do - new_file=$(basename $file | sed -e s/$rev/"$BUILD_NAME"/) - cp $file "$BUILD_OUTPUT_DIR/$new_file" -done - -pushd $BUILD_OUTPUT_DIR -md5sum $RBF > $RBF.md5sum -sha256sum $RBF > $RBF.sha256sum -MD5SUM=$(cat $RBF.md5sum | awk '{ print $1 }') -SHA256SUM=$(cat $RBF.sha256sum | awk '{ print $1 }') -popd - -# Restore NIOS II implementation to Tiny to avoid accidentally committing this change -echo "Restoring NIOS II implementation to Tiny..." -sed -ri "s/name=\"impl\" value=\"(Tiny|Small|Fast)\"/name=\"impl\" value=\"Tiny\"/" $nios_system/nios_system.qsys - -echo "" -echo "##########################################################################" -echo " Done! Image, reports, and checksums copied to:" -echo " $BUILD_OUTPUT_DIR" -echo "" -echo " $RBF checksums:" -echo " MD5: $MD5SUM" -echo " SHA256: $SHA256SUM" -echo "" -cat "$BUILD_OUTPUT_DIR/$BUILD_NAME.fit.summary" | sed -e 's/^\(.\)/ \1/g' -echo "##########################################################################" -echo "" diff --git a/hdl/quartus/build_micro.tcl b/hdl/quartus/build_micro.tcl deleted file mode 100644 index 3f9403f5..00000000 --- a/hdl/quartus/build_micro.tcl +++ /dev/null @@ -1,158 +0,0 @@ -load_package flow -package require cmdline - -set options {\ - { "size.arg" "25" "FPGA Size - 25, 49, or 301" } \ - { "rev.arg" "" "Revision name" } \ - { "stp.arg" "" "SignalTap II File to use" } \ - { "force" "" "Force using SignalTap II" } -} - -# Read the revision from the commandline -array set opts [::cmdline::getoptions quartus(args) $options] - -proc print_revisions { } { - project_open -force bladerf -revision base - puts stderr "Revisions" - puts stderr "---------" - foreach $rev [get_project_revisions] { - if { $rev == "base" } { - continue - } - puts stderr " $rev" - } - project_close -} - -# Check to make sure the project exists -if { ![project_exists bladerf] } { - puts stderr "ERROR: bladeRF project does not exist. Please run:" - puts stderr " $ quartus_sh -t ../bladerf_micro.tcl" - exit 1 -} - -# Check to make sure the revison was used on the commandline. -# If it wasn't, print out the revisions available. -if { $opts(rev) == "" } { - puts stderr "ERROR: Revision required to build\n" - print_revisions - exit 1 -} - -# Check to make sure the revision exists -if { ![revision_exists -project bladerf $opts(rev)] } { - puts stderr "ERROR: No revision named $opts(rev) in bladeRF project\n" - print_revisions - exit 1 -} - -# Open the project with the specific revision -project_open -revision $opts(rev) bladerf - -# Check the size of the FPGA -if { $opts(size) != 301 && $opts(size) != 49 && $opts(size) != 25 } { - puts stderr "ERROR: Size must be 25, 49, or 301. Size $opts(size) is invalid." - exit 1 -} - -# Add signaltap file -set forced_talkback 0 -set enable_stp 0 -if { $opts(stp) != "" } { - if { ([get_user_option -name TALKBACK_ENABLED] == off || [get_user_option -name TALKBACK_ENABLED] == "") && $opts(force) } { - puts "Enabling TalkBack to include SignalTap file" - set_user_option -name TALKBACK_ENABLED on - set forced_talkback 1 - } - # SignalTap requires either TalkBack to be enabled or a non-Web Edition of Quartus (e.g. Standard, Pro) - if { ([get_user_option -name TALKBACK_ENABLED] == on) || (![string match "*Web Edition*" $quartus(version)]) } { - puts "Adding SignalTap file: [file normalize $opts(stp)]" - set_global_assignment -name ENABLE_SIGNALTAP on - set_global_assignment -name USE_SIGNALTAP_FILE [file normalize $opts(stp)] - set_global_assignment -name SIGNALTAP_FILE [file normalize $opts(stp)] - set enable_stp 1 - } else { - puts stderr "\nERROR: Cannot add $opts(stp) to project without enabling TalkBack." - puts stderr " Use -force to enable and add SignalTap to project." - exit 1 - } -} else { - set_global_assignment -name ENABLE_SIGNALTAP off -} - -set device "5CEB" -if { $opts(size) == 25 } { - set device "${device}A2" -} elseif { $opts(size) == 49 } { - set device "${device}A4" -} elseif { $opts(size) == 301 } { - set device "${device}A9" -} -set device "${device}F23C8" - -set_global_assignment -name DEVICE ${device} -set failed 0 - -# Save all the options -export_assignments -project_close - -# The quartus_stp executable creates/edits a Quartus Setting File (.qsf) -# based on the SignalTap II File specified if enabled. It must be run -# successfully before running Analysis & Synthesis. -if { $enable_stp == 1 } { - if { $failed == 0 && [catch {qexec "quartus_stp --stp_file [file normalize $opts(stp)] --enable bladerf --rev $opts(rev)"} result] } { - puts "Result: $result" - puts stderr "ERROR: Adding SignalTap settings to QSF failed." - set failed 1 - } -} - -# Open the project with the specific revision -project_open -revision $opts(rev) bladerf - -# Run Analysis and Synthesis -if { $failed == 0 && [catch {execute_module -tool map} result] } { - puts "Result: $result" - puts stderr "ERROR: Analysis & Synthesis Failed" - set failed 1 -} - -# Run Fitter -if { $failed == 0 && [catch {execute_module -tool fit} result ] } { - puts "Result: $result" - puts stderr "ERROR: Fitter failed" - set failed 1 -} - -# Run Static Timing Analysis -if { $failed == 0 && [catch {execute_module -tool sta} result] } { - puts "Result: $result" - puts stderr "ERROR: Timing Analysis Failed!" - set failed 1 -} - -# Run Assembler -if { $failed == 0 && [catch {execute_module -tool asm} result] } { - puts "Result: $result" - puts stderr "ERROR: Assembler Failed!" - set failed 1 -} - -# Run EDA Output -#if { $failed == 0 && [catch {execute_module -tool eda} result] } { -# puts "Result: $result" -# puts stderr "ERROR: EDA failed!" -# set failed 1 -#} elseif { $failed == 0 } { -# puts "INFO: EDA OK!" -#} - -# If we were forced to turn on TALKBACK .. turn it back off -if { $forced_talkback == 1 } { - puts "Disabling TalkBack back to original state" - set_user_option -name TALKBACK_ENABLED off -} - -project_close - diff --git a/hdl/quartus/ip.ipx b/hdl/quartus/ip.ipx deleted file mode 100644 index 71add0d7..00000000 --- a/hdl/quartus/ip.ipx +++ /dev/null @@ -1,3 +0,0 @@ - - -