diff --git a/hdl/fpga/ip/nuand/fx3_gpif_tb.do b/hdl/fpga/ip/nuand/fx3_gpif_tb.do index 1b3cc47b..5b70254d 100644 --- a/hdl/fpga/ip/nuand/fx3_gpif_tb.do +++ b/hdl/fpga/ip/nuand/fx3_gpif_tb.do @@ -4,6 +4,7 @@ proc compile_fx3_gpif { root } { vlib work vcom -2008 -work work [file join $root ./synthesis/set_clear_ff.vhd] + vcom -2008 -work work [file join $root ../../platforms/common/bladerf/vhdl/fx3_gpif_p.vhd] vcom -2008 -work work [file join $root ../../platforms/common/bladerf/vhdl/fx3_gpif.vhd] vcom -2008 -work work [file join $root ./simulation/util.vhd] vcom -2008 -work work [file join $root ./simulation/fx3_model.vhd] diff --git a/hdl/fpga/ip/nuand/nuand.do b/hdl/fpga/ip/nuand/nuand.do index c1475459..1d530437 100644 --- a/hdl/fpga/ip/nuand/nuand.do +++ b/hdl/fpga/ip/nuand/nuand.do @@ -42,6 +42,7 @@ proc compile_nuand { root platform } { vcom -work nuand -2008 [file join $root ./synthesis/tb/atsc_tx_tb.vhd] + vcom -work nuand -2008 [file join $root ../../platforms/common/bladerf/vhdl/fx3_gpif_p.vhd] vcom -work nuand -2008 [file join $root ./simulation/fx3_model.vhd] vcom -work nuand -2008 [file join $root ./simulation/lms6002d_model.vhd] diff --git a/hdl/fpga/ip/nuand/synthesis/fifo_reader.vhd b/hdl/fpga/ip/nuand/synthesis/fifo_reader.vhd index a8c5ddb7..848155ea 100644 --- a/hdl/fpga/ip/nuand/synthesis/fifo_reader.vhd +++ b/hdl/fpga/ip/nuand/synthesis/fifo_reader.vhd @@ -24,6 +24,7 @@ library ieee; library work; use work.fifo_readwrite_p.all; + use work.fx3_gpif_p.all; entity fifo_reader is generic ( @@ -71,8 +72,8 @@ end entity; architecture simple of fifo_reader is - constant DMA_BUF_SIZE_SS : natural := 512; - constant DMA_BUF_SIZE_HS : natural := 256; + constant DMA_BUF_SIZE_SS : natural := GPIF_BUF_SIZE_SS; + constant DMA_BUF_SIZE_HS : natural := GPIF_BUF_SIZE_HS; signal dma_buf_size : natural range DMA_BUF_SIZE_HS to DMA_BUF_SIZE_SS := DMA_BUF_SIZE_SS; signal underflow_detected : std_logic := '0'; diff --git a/hdl/fpga/ip/nuand/synthesis/fifo_writer.vhd b/hdl/fpga/ip/nuand/synthesis/fifo_writer.vhd index f4667b34..36fa0098 100644 --- a/hdl/fpga/ip/nuand/synthesis/fifo_writer.vhd +++ b/hdl/fpga/ip/nuand/synthesis/fifo_writer.vhd @@ -24,6 +24,7 @@ library ieee; library work; use work.fifo_readwrite_p.all; + use work.fx3_gpif_p.all; entity fifo_writer is generic ( @@ -70,8 +71,8 @@ end entity; architecture simple of fifo_writer is - constant DMA_BUF_SIZE_SS : natural := 512; - constant DMA_BUF_SIZE_HS : natural := 256; + constant DMA_BUF_SIZE_SS : natural := GPIF_BUF_SIZE_SS; + constant DMA_BUF_SIZE_HS : natural := GPIF_BUF_SIZE_HS; signal dma_buf_size : natural range DMA_BUF_SIZE_HS to DMA_BUF_SIZE_SS := DMA_BUF_SIZE_SS; diff --git a/hdl/fpga/platforms/bladerf-micro/bladerf-adsb.qip b/hdl/fpga/platforms/bladerf-micro/bladerf-adsb.qip index 51720fcf..f6ac9da8 100644 --- a/hdl/fpga/platforms/bladerf-micro/bladerf-adsb.qip +++ b/hdl/fpga/platforms/bladerf-micro/bladerf-adsb.qip @@ -36,6 +36,7 @@ set_global_assignment -name QIP_FILE [file normalize [file join $nuand_ip pll_r set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip ps_sync/vhdl/ps_sync.vhd]] # Implementation Details +set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif_p.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/tx.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/rx-adsb.vhd]] diff --git a/hdl/fpga/platforms/bladerf-micro/bladerf-foxhunt.qip b/hdl/fpga/platforms/bladerf-micro/bladerf-foxhunt.qip index 80b16c4a..380c3eea 100644 --- a/hdl/fpga/platforms/bladerf-micro/bladerf-foxhunt.qip +++ b/hdl/fpga/platforms/bladerf-micro/bladerf-foxhunt.qip @@ -33,6 +33,7 @@ set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip ps_sy set_global_assignment -name QIP_FILE [file normalize [file join $nuand_ip tone_generator/tone_generator.qip]] # Implementation Details +set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif_p.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/tx.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/rx.vhd]] diff --git a/hdl/fpga/platforms/bladerf-micro/bladerf-hosted.qip b/hdl/fpga/platforms/bladerf-micro/bladerf-hosted.qip index 42f5e944..2a97c1c9 100644 --- a/hdl/fpga/platforms/bladerf-micro/bladerf-hosted.qip +++ b/hdl/fpga/platforms/bladerf-micro/bladerf-hosted.qip @@ -34,6 +34,7 @@ set_global_assignment -name QIP_FILE [file normalize [file join $nuand_ip pll_r set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip ps_sync/vhdl/ps_sync.vhd]] # Implementation Details +set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif_p.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/tx.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/rx.vhd]] diff --git a/hdl/fpga/platforms/bladerf-micro/bladerf-wlan.qip b/hdl/fpga/platforms/bladerf-micro/bladerf-wlan.qip index 4504b78a..d30315e2 100644 --- a/hdl/fpga/platforms/bladerf-micro/bladerf-wlan.qip +++ b/hdl/fpga/platforms/bladerf-micro/bladerf-wlan.qip @@ -36,6 +36,7 @@ set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip synth set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip rfic_spi_controller/vhdl/rfic_spi_controller.vhd]] # Implementation Details +set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif_p.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/tx.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/rx.vhd]] diff --git a/hdl/fpga/platforms/bladerf-micro/modelsim/compile.do b/hdl/fpga/platforms/bladerf-micro/modelsim/compile.do index 61ada131..1c44b08b 100644 --- a/hdl/fpga/platforms/bladerf-micro/modelsim/compile.do +++ b/hdl/fpga/platforms/bladerf-micro/modelsim/compile.do @@ -3,6 +3,7 @@ compile_nuand ../../../ip/nuand bladerf-micro vcom -work nuand -2008 ../vhdl/tb/nios_system.vhd +vcom -work nuand -2008 ../../../platforms/common/bladerf/vhdl/fx3_gpif_p.vhd vcom -work nuand -2008 ../../../platforms/common/bladerf/vhdl/fx3_gpif.vhd vcom -work nuand -2008 ../vhdl/bladerf_p.vhd diff --git a/hdl/fpga/platforms/bladerf/bladerf-adsb.qip b/hdl/fpga/platforms/bladerf/bladerf-adsb.qip index 1fa86c44..02d157c0 100644 --- a/hdl/fpga/platforms/bladerf/bladerf-adsb.qip +++ b/hdl/fpga/platforms/bladerf/bladerf-adsb.qip @@ -33,6 +33,7 @@ set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip syn set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip synthesis/fifo_writer.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip synthesis/lms6002d/vhdl/lms6002d.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip synthesis/set_clear_ff.vhd]] +set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif_p.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/bladerf-adsb.vhd]] diff --git a/hdl/fpga/platforms/bladerf/bladerf-atsc_tx.qip b/hdl/fpga/platforms/bladerf/bladerf-atsc_tx.qip index a53653fb..15865fe0 100644 --- a/hdl/fpga/platforms/bladerf/bladerf-atsc_tx.qip +++ b/hdl/fpga/platforms/bladerf/bladerf-atsc_tx.qip @@ -33,6 +33,7 @@ set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip syn set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip synthesis/fifo_writer.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip synthesis/lms6002d/vhdl/lms6002d.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip synthesis/set_clear_ff.vhd]] +set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif_p.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/bladerf-atsc_tx.vhd]] set_global_assignment -name QIP_FILE [file normalize nios_system/synthesis/nios_system.qip] diff --git a/hdl/fpga/platforms/bladerf/bladerf-hosted.qip b/hdl/fpga/platforms/bladerf/bladerf-hosted.qip index 93cb2b28..0604d825 100644 --- a/hdl/fpga/platforms/bladerf/bladerf-hosted.qip +++ b/hdl/fpga/platforms/bladerf/bladerf-hosted.qip @@ -35,6 +35,7 @@ set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip syn set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip synthesis/lms6002d/vhdl/bladerf_agc.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip trigger/trigger.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip synthesis/set_clear_ff.vhd]] +set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif_p.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $common_dir vhdl/fx3_gpif.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $nuand_ip synthesis/rx_packet_generator.vhd]] set_global_assignment -name VHDL_FILE [file normalize [file join $here vhdl/bladerf-hosted.vhd]] diff --git a/hdl/fpga/platforms/common/bladerf/vhdl/fx3_gpif.vhd b/hdl/fpga/platforms/common/bladerf/vhdl/fx3_gpif.vhd index 67380194..bfdad067 100644 --- a/hdl/fpga/platforms/common/bladerf/vhdl/fx3_gpif.vhd +++ b/hdl/fpga/platforms/common/bladerf/vhdl/fx3_gpif.vhd @@ -22,6 +22,9 @@ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; +library nuand; + use nuand.fx3_gpif_p.all; + entity fx3_gpif is port ( -- FX3 control signals @@ -117,10 +120,6 @@ architecture sample_shuffler of fx3_gpif is constant META_DOWNCOUNT_RESET : natural := 4; constant FINI_DOWNCOUNT_RESET : natural := 10; - -- GPIF buf sizes for USB high-speed and super-speed - constant GPIF_BUF_SIZE_HS : natural := 256; - constant GPIF_BUF_SIZE_SS : natural := 512; - type dma_handshake_t is record rx0 : std_logic; rx1 : std_logic; diff --git a/hdl/fpga/platforms/common/bladerf/vhdl/fx3_gpif_p.vhd b/hdl/fpga/platforms/common/bladerf/vhdl/fx3_gpif_p.vhd new file mode 100644 index 00000000..43d7673c --- /dev/null +++ b/hdl/fpga/platforms/common/bladerf/vhdl/fx3_gpif_p.vhd @@ -0,0 +1,27 @@ +-- Copyright (c) 2024 Nuand LLC +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentation files (the "Software"), to deal +-- in the Software without restriction, including without limitation the rights +-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +-- THE SOFTWARE. +library ieee; +use ieee.std_logic_1164.all; + +package fx3_gpif_p is + -- GPIF buf sizes for USB high-speed and super-speed + constant GPIF_BUF_SIZE_HS : natural := 256; + constant GPIF_BUF_SIZE_SS : natural := 512; +end package fx3_gpif_p;