| 1 |
-- Copyright (c) 2017 Nuand LLC |
| 2 |
-- |
| 3 |
-- Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 |
-- of this software and associated documentation files (the "Software"), to deal |
| 5 |
-- in the Software without restriction, including without limitation the rights |
| 6 |
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 |
-- copies of the Software, and to permit persons to whom the Software is |
| 8 |
-- furnished to do so, subject to the following conditions: |
| 9 |
-- |
| 10 |
-- The above copyright notice and this permission notice shall be included in |
| 11 |
-- all copies or substantial portions of the Software. |
| 12 |
-- |
| 13 |
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 |
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 |
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 |
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 |
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 |
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 19 |
-- THE SOFTWARE. |
| 20 |
|
| 21 |
library ieee; |
| 22 |
use ieee.std_logic_1164.all; |
| 23 |
use ieee.numeric_std.all; |
| 24 |
use ieee.math_real.all; |
| 25 |
use ieee.math_complex.all; |
| 26 |
|
| 27 |
library work; |
| 28 |
use work.bladerf; |
| 29 |
use work.bladerf_p.all; |
| 30 |
use work.fifo_readwrite_p.all; |
| 31 |
|
| 32 |
architecture foxhunt_bladerf of bladerf is |
| 33 |
|
| 34 |
attribute noprune : boolean; |
| 35 |
attribute keep : boolean; |
| 36 |
|
| 37 |
alias sys_reset_async : std_logic is fx3_ctl(7); |
| 38 |
signal sys_reset_pclk : std_logic; |
| 39 |
signal sys_reset : std_logic; |
| 40 |
|
| 41 |
signal sys_clock : std_logic; |
| 42 |
signal sys_pll_locked : std_logic; |
| 43 |
signal sys_pll_reset : std_logic; |
| 44 |
|
| 45 |
signal fx3_pclk_pll : std_logic; |
| 46 |
signal fx3_pclk_pll_locked : std_logic; |
| 47 |
signal fx3_pclk_pll_reset : std_logic; |
| 48 |
|
| 49 |
signal rx_mux_sel : unsigned(2 downto 0); |
| 50 |
|
| 51 |
signal nios_xb_gpio_in : std_logic_vector(31 downto 0) := (others => '0'); |
| 52 |
signal nios_xb_gpio_out : std_logic_vector(31 downto 0) := (others => '0'); |
| 53 |
signal nios_xb_gpio_oe : std_logic_vector(31 downto 0) := (others => '0'); |
| 54 |
|
| 55 |
signal nios_gpio : nios_gpio_t; |
| 56 |
signal nios_gpo_slv : std_logic_vector(31 downto 0); |
| 57 |
|
| 58 |
signal i2c_scl_in : std_logic; |
| 59 |
signal i2c_scl_out : std_logic; |
| 60 |
signal i2c_scl_oen : std_logic; |
| 61 |
|
| 62 |
signal i2c_sda_in : std_logic; |
| 63 |
signal i2c_sda_out : std_logic; |
| 64 |
signal i2c_sda_oen : std_logic; |
| 65 |
|
| 66 |
signal tx_sample_fifo : tx_fifo_t := TX_FIFO_T_DEFAULT; |
| 67 |
signal rx_sample_fifo : rx_fifo_t := RX_FIFO_T_DEFAULT; |
| 68 |
signal tx_loopback_fifo : loopback_fifo_t := LOOPBACK_FIFO_T_DEFAULT; |
| 69 |
|
| 70 |
signal tx_meta_fifo : meta_fifo_tx_t := META_FIFO_TX_T_DEFAULT; |
| 71 |
signal rx_meta_fifo : meta_fifo_rx_t := META_FIFO_RX_T_DEFAULT; |
| 72 |
|
| 73 |
signal usb_speed_pclk : std_logic; |
| 74 |
signal usb_speed_rx : std_logic; |
| 75 |
signal usb_speed_tx : std_logic; |
| 76 |
|
| 77 |
signal tx_reset : std_logic; |
| 78 |
signal rx_reset : std_logic; |
| 79 |
|
| 80 |
signal tx_enable_pclk : std_logic; |
| 81 |
signal rx_enable_pclk : std_logic; |
| 82 |
|
| 83 |
signal tx_enable : std_logic; |
| 84 |
signal rx_enable : std_logic; |
| 85 |
|
| 86 |
signal meta_en_pclk : std_logic; |
| 87 |
signal meta_en_tx : std_logic; |
| 88 |
signal meta_en_rx : std_logic; |
| 89 |
|
| 90 |
signal tx_timestamp : unsigned(63 downto 0); |
| 91 |
signal rx_timestamp : unsigned(63 downto 0); |
| 92 |
signal timestamp_sync : std_logic; |
| 93 |
|
| 94 |
signal tx_loopback_enabled : std_logic := '0'; |
| 95 |
|
| 96 |
signal fx3_gpif_in : std_logic_vector(31 downto 0); |
| 97 |
signal fx3_gpif_out : std_logic_vector(31 downto 0); |
| 98 |
signal fx3_gpif_oe : std_logic; |
| 99 |
|
| 100 |
signal fx3_ctl_in : std_logic_vector(12 downto 0); |
| 101 |
signal fx3_ctl_out : std_logic_vector(12 downto 0); |
| 102 |
signal fx3_ctl_oe : std_logic_vector(12 downto 0); |
| 103 |
|
| 104 |
signal rx_overflow_led : std_logic := '1'; |
| 105 |
|
| 106 |
signal led1_blink : std_logic; |
| 107 |
|
| 108 |
signal nios_sdo : std_logic; |
| 109 |
signal nios_sdio : std_logic; |
| 110 |
signal nios_sclk : std_logic; |
| 111 |
signal nios_ss_n : std_logic_vector(1 downto 0); |
| 112 |
|
| 113 |
signal command_serial_in : std_logic; |
| 114 |
signal command_serial_out : std_logic; |
| 115 |
|
| 116 |
signal timestamp_req : std_logic; |
| 117 |
signal timestamp_ack : std_logic; |
| 118 |
signal fx3_timestamp : unsigned(63 downto 0); |
| 119 |
|
| 120 |
signal rx_ts_reset : std_logic; |
| 121 |
signal tx_ts_reset : std_logic; |
| 122 |
|
| 123 |
signal rx_trigger_ctl_i : std_logic_vector(7 downto 0); |
| 124 |
signal rx_trigger_ctl : trigger_t := TRIGGER_T_DEFAULT; |
| 125 |
alias rx_trigger_line : std_logic is mini_exp1; |
| 126 |
|
| 127 |
signal tx_trigger_ctl_i : std_logic_vector(7 downto 0); |
| 128 |
signal tx_trigger_ctl : trigger_t := TRIGGER_T_DEFAULT; |
| 129 |
alias tx_trigger_line : std_logic is mini_exp1; |
| 130 |
|
| 131 |
signal rffe_gpio : rffe_gpio_t := ( |
| 132 |
i => RFFE_GPI_DEFAULT, |
| 133 |
o => pack(RFFE_GPO_DEFAULT) |
| 134 |
); |
| 135 |
|
| 136 |
signal ad9361 : mimo_2r2t_t := MIMO_2R2T_T_DEFAULT; |
| 137 |
alias tx_clock is ad9361.clock; |
| 138 |
alias rx_clock is ad9361.clock; |
| 139 |
|
| 140 |
signal mimo_rx_enables : std_logic_vector(RFFE_GPO_DEFAULT.mimo_rx_en'range) := RFFE_GPO_DEFAULT.mimo_rx_en; |
| 141 |
signal mimo_tx_enables : std_logic_vector(RFFE_GPO_DEFAULT.mimo_tx_en'range) := RFFE_GPO_DEFAULT.mimo_tx_en; |
| 142 |
|
| 143 |
signal dac_controls : sample_controls_t(ad9361.ch'range) := (others => SAMPLE_CONTROL_DISABLE); |
| 144 |
signal dac_streams : sample_streams_t(dac_controls'range) := (others => ZERO_SAMPLE); |
| 145 |
signal adc_controls : sample_controls_t(ad9361.ch'range) := (others => SAMPLE_CONTROL_DISABLE); |
| 146 |
signal adc_streams : sample_streams_t(adc_controls'range) := (others => ZERO_SAMPLE); |
| 147 |
|
| 148 |
signal ps_sync : std_logic_vector(0 downto 0) := (others => '0'); |
| 149 |
|
| 150 |
signal tonegen_streams : sample_streams_t(dac_controls'range) := (others => ZERO_SAMPLE); |
| 151 |
signal tonegen_sample_i : std_logic_vector(15 downto 0); |
| 152 |
signal tonegen_sample_q : std_logic_vector(15 downto 0); |
| 153 |
signal tonegen_sample_v : std_logic; |
| 154 |
signal tonegen_running : std_logic; |
| 155 |
|
| 156 |
-- override nios_system from bladerf_p |
| 157 |
component nios_system is |
| 158 |
port ( |
| 159 |
clk_clk : in std_logic := 'X'; |
| 160 |
reset_reset_n : in std_logic := 'X'; |
| 161 |
dac_MISO : in std_logic := 'X'; |
| 162 |
dac_MOSI : out std_logic; |
| 163 |
dac_SCLK : out std_logic; |
| 164 |
dac_SS_n : out std_logic_vector(1 downto 0); |
| 165 |
spi_MISO : in std_logic := 'X'; |
| 166 |
spi_MOSI : out std_logic; |
| 167 |
spi_SCLK : out std_logic; |
| 168 |
spi_SS_n : out std_logic; |
| 169 |
gpio_in_port : in std_logic_vector(31 downto 0); |
| 170 |
gpio_out_port : out std_logic_vector(31 downto 0); |
| 171 |
gpio_rffe_0_in_port : in std_logic_vector(31 downto 0); |
| 172 |
gpio_rffe_0_out_port : out std_logic_vector(31 downto 0); |
| 173 |
ad9361_dac_sync_in_sync : in std_logic; |
| 174 |
ad9361_dac_sync_out_sync : out std_logic; |
| 175 |
ad9361_data_clock_clk : out std_logic; |
| 176 |
ad9361_data_reset_reset : out std_logic; |
| 177 |
ad9361_device_if_rx_clk_in_p : in std_logic; |
| 178 |
ad9361_device_if_rx_clk_in_n : in std_logic; |
| 179 |
ad9361_device_if_rx_frame_in_p : in std_logic; |
| 180 |
ad9361_device_if_rx_frame_in_n : in std_logic; |
| 181 |
ad9361_device_if_rx_data_in_p : in std_logic_vector(5 downto 0); |
| 182 |
ad9361_device_if_rx_data_in_n : in std_logic_vector(5 downto 0); |
| 183 |
ad9361_device_if_tx_clk_out_p : out std_logic; |
| 184 |
ad9361_device_if_tx_clk_out_n : out std_logic; |
| 185 |
ad9361_device_if_tx_frame_out_p : out std_logic; |
| 186 |
ad9361_device_if_tx_frame_out_n : out std_logic; |
| 187 |
ad9361_device_if_tx_data_out_p : out std_logic_vector(5 downto 0); |
| 188 |
ad9361_device_if_tx_data_out_n : out std_logic_vector(5 downto 0); |
| 189 |
ad9361_adc_i0_enable : out std_logic; |
| 190 |
ad9361_adc_i0_valid : out std_logic; |
| 191 |
ad9361_adc_i0_data : out std_logic_vector(15 downto 0); |
| 192 |
ad9361_adc_i1_enable : out std_logic; |
| 193 |
ad9361_adc_i1_valid : out std_logic; |
| 194 |
ad9361_adc_i1_data : out std_logic_vector(15 downto 0); |
| 195 |
ad9361_adc_overflow_ovf : in std_logic; |
| 196 |
ad9361_adc_q0_enable : out std_logic; |
| 197 |
ad9361_adc_q0_valid : out std_logic; |
| 198 |
ad9361_adc_q0_data : out std_logic_vector(15 downto 0); |
| 199 |
ad9361_adc_q1_enable : out std_logic; |
| 200 |
ad9361_adc_q1_valid : out std_logic; |
| 201 |
ad9361_adc_q1_data : out std_logic_vector(15 downto 0); |
| 202 |
ad9361_adc_underflow_unf : in std_logic; |
| 203 |
ad9361_dac_i0_enable : out std_logic; |
| 204 |
ad9361_dac_i0_valid : out std_logic; |
| 205 |
ad9361_dac_i0_data : in std_logic_vector(15 downto 0); |
| 206 |
ad9361_dac_i1_enable : out std_logic; |
| 207 |
ad9361_dac_i1_valid : out std_logic; |
| 208 |
ad9361_dac_i1_data : in std_logic_vector(15 downto 0); |
| 209 |
ad9361_dac_overflow_ovf : in std_logic; |
| 210 |
ad9361_dac_q0_enable : out std_logic; |
| 211 |
ad9361_dac_q0_valid : out std_logic; |
| 212 |
ad9361_dac_q0_data : in std_logic_vector(15 downto 0); |
| 213 |
ad9361_dac_q1_enable : out std_logic; |
| 214 |
ad9361_dac_q1_valid : out std_logic; |
| 215 |
ad9361_dac_q1_data : in std_logic_vector(15 downto 0); |
| 216 |
ad9361_dac_underflow_unf : in std_logic; |
| 217 |
oc_i2c_arst_i : in std_logic; |
| 218 |
oc_i2c_scl_pad_i : in std_logic; |
| 219 |
oc_i2c_scl_pad_o : out std_logic; |
| 220 |
oc_i2c_scl_padoen_o : out std_logic; |
| 221 |
oc_i2c_sda_pad_i : in std_logic; |
| 222 |
oc_i2c_sda_pad_o : out std_logic; |
| 223 |
oc_i2c_sda_padoen_o : out std_logic; |
| 224 |
xb_gpio_in_port : in std_logic_vector(31 downto 0) := (others => 'X'); |
| 225 |
xb_gpio_out_port : out std_logic_vector(31 downto 0); |
| 226 |
xb_gpio_dir_export : out std_logic_vector(31 downto 0); |
| 227 |
command_serial_in : in std_logic; |
| 228 |
command_serial_out : out std_logic; |
| 229 |
rx_tamer_ts_sync_in : in std_logic; |
| 230 |
rx_tamer_ts_sync_out : out std_logic; |
| 231 |
rx_tamer_ts_pps : in std_logic; |
| 232 |
rx_tamer_ts_clock : in std_logic; |
| 233 |
rx_tamer_ts_reset : in std_logic; |
| 234 |
rx_tamer_ts_time : out std_logic_vector(63 downto 0); |
| 235 |
tx_tamer_ts_sync_in : in std_logic; |
| 236 |
tx_tamer_ts_sync_out : out std_logic; |
| 237 |
tx_tamer_ts_pps : in std_logic; |
| 238 |
tx_tamer_ts_clock : in std_logic; |
| 239 |
tx_tamer_ts_reset : in std_logic; |
| 240 |
tx_tamer_ts_time : out std_logic_vector(63 downto 0); |
| 241 |
tx_trigger_ctl_in_port : in std_logic_vector(7 downto 0); |
| 242 |
tx_trigger_ctl_out_port : out std_logic_vector(7 downto 0); |
| 243 |
rx_trigger_ctl_in_port : in std_logic_vector(7 downto 0); |
| 244 |
rx_trigger_ctl_out_port : out std_logic_vector(7 downto 0); |
| 245 |
tonegen_sample_valid : out std_logic; |
| 246 |
tonegen_sample_i : out std_logic_vector(15 downto 0); |
| 247 |
tonegen_sample_q : out std_logic_vector(15 downto 0); |
| 248 |
tonegen_sample_clk : in std_logic := 'X'; |
| 249 |
tonegen_status_empty : out std_logic; |
| 250 |
tonegen_status_full : out std_logic; |
| 251 |
tonegen_status_running : out std_logic |
| 252 |
); |
| 253 |
end component; |
| 254 |
|
| 255 |
signal tx_packet_control : packet_control_t ; |
| 256 |
signal rx_packet_control : packet_control_t := PACKET_CONTROL_DEFAULT ; |
| 257 |
|
| 258 |
signal rx_packet_ready : std_logic; |
| 259 |
|
| 260 |
signal tx_packet_ready : std_logic; |
| 261 |
signal tx_packet_empty : std_logic; |
| 262 |
begin |
| 263 |
|
| 264 |
-- ======================================================================== |
| 265 |
-- PLLs |
| 266 |
-- ======================================================================== |
| 267 |
|
| 268 |
-- Create 80 MHz system clock from 38.4 MHz |
| 269 |
U_system_pll : component system_pll |
| 270 |
port map ( |
| 271 |
refclk => c5_clock2, |
| 272 |
rst => sys_pll_reset, |
| 273 |
outclk_0 => sys_clock, |
| 274 |
locked => sys_pll_locked |
| 275 |
); |
| 276 |
|
| 277 |
U_pll_reset_pll : entity work.pll_reset |
| 278 |
generic map ( |
| 279 |
SYS_CLOCK_FREQ_HZ => 38_400_000, |
| 280 |
DEVICE_FAMILY => "Cyclone V" |
| 281 |
) |
| 282 |
port map ( |
| 283 |
sys_clock => c5_clock2, |
| 284 |
pll_locked => sys_pll_locked, |
| 285 |
pll_reset => sys_pll_reset |
| 286 |
); |
| 287 |
|
| 288 |
-- Use PLL to adjust the phase of the FX3 PCLK to |
| 289 |
-- retime the FX3 GPIF interface for timing closure. |
| 290 |
U_fx3_pll : component fx3_pll |
| 291 |
port map ( |
| 292 |
refclk => fx3_pclk, |
| 293 |
rst => fx3_pclk_pll_reset, |
| 294 |
outclk_0 => fx3_pclk_pll, |
| 295 |
locked => fx3_pclk_pll_locked |
| 296 |
); |
| 297 |
|
| 298 |
U_pll_reset_fx3_pll : entity work.pll_reset |
| 299 |
generic map ( |
| 300 |
SYS_CLOCK_FREQ_HZ => 100_000_000, |
| 301 |
DEVICE_FAMILY => "Cyclone V" |
| 302 |
) |
| 303 |
port map ( |
| 304 |
sys_clock => fx3_pclk, |
| 305 |
pll_locked => fx3_pclk_pll_locked, |
| 306 |
pll_reset => fx3_pclk_pll_reset |
| 307 |
); |
| 308 |
|
| 309 |
|
| 310 |
-- ======================================================================== |
| 311 |
-- POWER SUPPLY SYNCHRONIZATION |
| 312 |
-- ======================================================================== |
| 313 |
|
| 314 |
U_ps_sync : entity work.ps_sync |
| 315 |
generic map ( |
| 316 |
OUTPUTS => 1, |
| 317 |
USE_LFSR => true, |
| 318 |
HOP_LIST => adp2384_sync_divisors( REFCLK_HZ => 38.4e6, |
| 319 |
n_divisors => 7 ), |
| 320 |
HOP_RATE => 100 |
| 321 |
) |
| 322 |
port map ( |
| 323 |
refclk => c5_clock2, |
| 324 |
sync => ps_sync |
| 325 |
); |
| 326 |
|
| 327 |
ps_sync_1p1 <= ps_sync(0); |
| 328 |
ps_sync_1p8 <= ps_sync(0); |
| 329 |
|
| 330 |
-- ======================================================================== |
| 331 |
-- FX3 GPIF |
| 332 |
-- ======================================================================== |
| 333 |
|
| 334 |
-- FX3 GPIF |
| 335 |
U_fx3_gpif : entity work.fx3_gpif |
| 336 |
port map ( |
| 337 |
pclk => fx3_pclk_pll, |
| 338 |
reset => sys_reset_pclk, |
| 339 |
|
| 340 |
usb_speed => usb_speed_pclk, |
| 341 |
|
| 342 |
meta_enable => meta_en_pclk, |
| 343 |
packet_enable => '0', |
| 344 |
rx_enable => rx_enable_pclk, |
| 345 |
tx_enable => tx_enable_pclk, |
| 346 |
|
| 347 |
gpif_in => fx3_gpif_in, |
| 348 |
gpif_out => fx3_gpif_out, |
| 349 |
gpif_oe => fx3_gpif_oe, |
| 350 |
ctl_in => fx3_ctl_in, |
| 351 |
ctl_out => fx3_ctl_out, |
| 352 |
ctl_oe => fx3_ctl_oe, |
| 353 |
|
| 354 |
tx_fifo_write => open, |
| 355 |
tx_fifo_full => '0', |
| 356 |
tx_fifo_empty => '0', |
| 357 |
tx_fifo_usedw => tx_sample_fifo.wused, |
| 358 |
tx_fifo_data => open, |
| 359 |
|
| 360 |
tx_timestamp => fx3_timestamp, |
| 361 |
tx_meta_fifo_write => open, |
| 362 |
tx_meta_fifo_full => '0', |
| 363 |
tx_meta_fifo_empty => '0', |
| 364 |
tx_meta_fifo_usedw => tx_meta_fifo.wused, |
| 365 |
tx_meta_fifo_data => open, |
| 366 |
|
| 367 |
rx_fifo_read => open, |
| 368 |
rx_fifo_full => '0', |
| 369 |
rx_fifo_empty => '0', |
| 370 |
rx_fifo_usedw => rx_sample_fifo.rused, |
| 371 |
rx_fifo_data => (others => '0'), |
| 372 |
|
| 373 |
rx_meta_fifo_read => open, |
| 374 |
rx_meta_fifo_full => '0', |
| 375 |
rx_meta_fifo_empty => '0', |
| 376 |
rx_meta_fifo_usedr => rx_meta_fifo.rused, |
| 377 |
rx_meta_fifo_data => (others => '0') |
| 378 |
); |
| 379 |
|
| 380 |
-- FX3 GPIF bidirectional signal control |
| 381 |
register_gpif : process(sys_reset_pclk, fx3_pclk_pll) |
| 382 |
begin |
| 383 |
if( sys_reset_pclk = '1' ) then |
| 384 |
fx3_gpif <= (others =>'Z'); |
| 385 |
fx3_gpif_in <= (others =>'0'); |
| 386 |
elsif( rising_edge(fx3_pclk_pll) ) then |
| 387 |
fx3_gpif_in <= fx3_gpif; |
| 388 |
if( fx3_gpif_oe = '1' ) then |
| 389 |
fx3_gpif <= fx3_gpif_out; |
| 390 |
else |
| 391 |
fx3_gpif <= (others =>'Z'); |
| 392 |
end if; |
| 393 |
end if; |
| 394 |
end process; |
| 395 |
|
| 396 |
-- FX3 CTL bidirectional signal control |
| 397 |
generate_ctl : for i in fx3_ctl'range generate |
| 398 |
fx3_ctl(i) <= fx3_ctl_out(i) when fx3_ctl_oe(i) = '1' else 'Z'; |
| 399 |
end generate; |
| 400 |
|
| 401 |
fx3_ctl_in <= fx3_ctl; |
| 402 |
|
| 403 |
toggle_led1 : process(fx3_pclk_pll) |
| 404 |
variable count : natural range 0 to 10_000_000 := 10_000_000; |
| 405 |
begin |
| 406 |
if( rising_edge(fx3_pclk_pll) ) then |
| 407 |
count := count - 1; |
| 408 |
if( count = 0 ) then |
| 409 |
count := 10_000_000; |
| 410 |
led1_blink <= not led1_blink; |
| 411 |
end if; |
| 412 |
end if; |
| 413 |
end process; |
| 414 |
|
| 415 |
|
| 416 |
-- ======================================================================== |
| 417 |
-- NIOS SYSTEM |
| 418 |
-- ======================================================================== |
| 419 |
|
| 420 |
U_nios_system : component nios_system |
| 421 |
port map ( |
| 422 |
clk_clk => sys_clock, |
| 423 |
reset_reset_n => '1', |
| 424 |
dac_MISO => nios_sdo, |
| 425 |
dac_MOSI => nios_sdio, |
| 426 |
dac_SCLK => nios_sclk, |
| 427 |
dac_SS_n => nios_ss_n, |
| 428 |
spi_MISO => adi_spi_sdo, |
| 429 |
spi_MOSI => adi_spi_sdi, |
| 430 |
spi_SCLK => adi_spi_sclk, |
| 431 |
spi_SS_n => adi_spi_csn, |
| 432 |
gpio_in_port => pack(nios_gpio.i, '0'), |
| 433 |
gpio_out_port => nios_gpo_slv, |
| 434 |
gpio_rffe_0_in_port => pack(rffe_gpio), |
| 435 |
gpio_rffe_0_out_port => rffe_gpio.o, |
| 436 |
ad9361_dac_sync_in_sync => '0', |
| 437 |
ad9361_dac_sync_out_sync => adi_sync_in, |
| 438 |
ad9361_data_clock_clk => ad9361.clock, -- out std_logic; |
| 439 |
ad9361_data_reset_reset => ad9361.reset, -- out std_logic; |
| 440 |
ad9361_device_if_rx_clk_in_p => adi_rx_clock, |
| 441 |
ad9361_device_if_rx_clk_in_n => '0', |
| 442 |
ad9361_device_if_rx_frame_in_p => adi_rx_frame, |
| 443 |
ad9361_device_if_rx_frame_in_n => '0', |
| 444 |
ad9361_device_if_rx_data_in_p => adi_rx_data, |
| 445 |
ad9361_device_if_rx_data_in_n => (others => '0'), |
| 446 |
ad9361_device_if_tx_clk_out_p => adi_tx_clock, |
| 447 |
ad9361_device_if_tx_clk_out_n => open, |
| 448 |
ad9361_device_if_tx_frame_out_p => adi_tx_frame, |
| 449 |
ad9361_device_if_tx_frame_out_n => open, |
| 450 |
ad9361_device_if_tx_data_out_p => adi_tx_data, |
| 451 |
ad9361_device_if_tx_data_out_n => open, |
| 452 |
ad9361_adc_i0_enable => ad9361.ch(0).adc.i.enable, -- out sl |
| 453 |
ad9361_adc_i0_valid => ad9361.ch(0).adc.i.valid, -- out sl |
| 454 |
ad9361_adc_i0_data => ad9361.ch(0).adc.i.data, -- out slv(15:0) |
| 455 |
ad9361_adc_i1_enable => ad9361.ch(1).adc.i.enable, -- out sl |
| 456 |
ad9361_adc_i1_valid => ad9361.ch(1).adc.i.valid, -- out sl |
| 457 |
ad9361_adc_i1_data => ad9361.ch(1).adc.i.data, -- out slv(15:0) |
| 458 |
ad9361_adc_overflow_ovf => ad9361.adc_overflow, -- in sl |
| 459 |
ad9361_adc_q0_enable => ad9361.ch(0).adc.q.enable, -- out sl |
| 460 |
ad9361_adc_q0_valid => ad9361.ch(0).adc.q.valid, -- out sl |
| 461 |
ad9361_adc_q0_data => ad9361.ch(0).adc.q.data, -- out slv(15:0) |
| 462 |
ad9361_adc_q1_enable => ad9361.ch(1).adc.q.enable, -- out sl |
| 463 |
ad9361_adc_q1_valid => ad9361.ch(1).adc.q.valid, -- out sl |
| 464 |
ad9361_adc_q1_data => ad9361.ch(1).adc.q.data, -- out slv(15:0) |
| 465 |
ad9361_adc_underflow_unf => ad9361.adc_underflow, -- in sl |
| 466 |
ad9361_dac_i0_enable => ad9361.ch(0).dac.i.enable, -- out sl |
| 467 |
ad9361_dac_i0_valid => ad9361.ch(0).dac.i.valid, -- out sl |
| 468 |
ad9361_dac_i0_data => ad9361.ch(0).dac.i.data, -- in slv(15:0) |
| 469 |
ad9361_dac_i1_enable => ad9361.ch(1).dac.i.enable, -- out sl |
| 470 |
ad9361_dac_i1_valid => ad9361.ch(1).dac.i.valid, -- out sl |
| 471 |
ad9361_dac_i1_data => ad9361.ch(1).dac.i.data, -- in slv(15:0) |
| 472 |
ad9361_dac_overflow_ovf => ad9361.dac_overflow, -- in sl |
| 473 |
ad9361_dac_q0_enable => ad9361.ch(0).dac.q.enable, -- out sl |
| 474 |
ad9361_dac_q0_valid => ad9361.ch(0).dac.q.valid, -- out sl |
| 475 |
ad9361_dac_q0_data => ad9361.ch(0).dac.q.data, -- in slv(15:0) |
| 476 |
ad9361_dac_q1_enable => ad9361.ch(1).dac.q.enable, -- out sl |
| 477 |
ad9361_dac_q1_valid => ad9361.ch(1).dac.q.valid, -- out sl |
| 478 |
ad9361_dac_q1_data => ad9361.ch(1).dac.q.data, -- in slv(15:0) |
| 479 |
ad9361_dac_underflow_unf => ad9361.dac_underflow, -- in sl |
| 480 |
xb_gpio_in_port => nios_xb_gpio_in, |
| 481 |
xb_gpio_out_port => nios_xb_gpio_out, |
| 482 |
xb_gpio_dir_export => nios_xb_gpio_oe, |
| 483 |
command_serial_in => command_serial_in, |
| 484 |
command_serial_out => command_serial_out, |
| 485 |
oc_i2c_arst_i => '0', |
| 486 |
oc_i2c_scl_pad_i => i2c_scl_in, |
| 487 |
oc_i2c_scl_pad_o => i2c_scl_out, |
| 488 |
oc_i2c_scl_padoen_o => i2c_scl_oen, |
| 489 |
oc_i2c_sda_pad_i => i2c_sda_in, |
| 490 |
oc_i2c_sda_pad_o => i2c_sda_out, |
| 491 |
oc_i2c_sda_padoen_o => i2c_sda_oen, |
| 492 |
rx_tamer_ts_sync_in => '0', |
| 493 |
rx_tamer_ts_sync_out => open, |
| 494 |
rx_tamer_ts_pps => '0', |
| 495 |
rx_tamer_ts_clock => rx_clock, |
| 496 |
rx_tamer_ts_reset => rx_ts_reset, |
| 497 |
unsigned(rx_tamer_ts_time) => rx_timestamp, |
| 498 |
tx_tamer_ts_sync_in => '0', |
| 499 |
tx_tamer_ts_sync_out => open, |
| 500 |
tx_tamer_ts_pps => '0', |
| 501 |
tx_tamer_ts_clock => tx_clock, |
| 502 |
tx_tamer_ts_reset => tx_ts_reset, |
| 503 |
unsigned(tx_tamer_ts_time) => tx_timestamp, |
| 504 |
rx_trigger_ctl_out_port => rx_trigger_ctl_i, |
| 505 |
tx_trigger_ctl_out_port => tx_trigger_ctl_i, |
| 506 |
rx_trigger_ctl_in_port => pack(rx_trigger_ctl), |
| 507 |
tx_trigger_ctl_in_port => pack(tx_trigger_ctl), |
| 508 |
|
| 509 |
tonegen_sample_clk => tx_clock, |
| 510 |
tonegen_sample_valid => tonegen_sample_v, |
| 511 |
tonegen_sample_i => tonegen_sample_i, |
| 512 |
tonegen_sample_q => tonegen_sample_q, |
| 513 |
tonegen_status_empty => open, |
| 514 |
tonegen_status_full => open, |
| 515 |
tonegen_status_running => tonegen_running |
| 516 |
); |
| 517 |
|
| 518 |
tonegen_streams(0).data_i <= signed(tonegen_sample_i); |
| 519 |
tonegen_streams(0).data_q <= signed(tonegen_sample_q); |
| 520 |
tonegen_streams(0).data_v <= tonegen_sample_v; |
| 521 |
|
| 522 |
-- FX3 UART |
| 523 |
command_serial_in <= fx3_uart_txd when sys_reset = '0' else '1'; |
| 524 |
fx3_uart_rxd <= command_serial_out when sys_reset = '0' else 'Z'; |
| 525 |
|
| 526 |
-- FX3 UART CTS and Flash SPI CSx are tied to the same signal. |
| 527 |
-- Allow SPI accesses when FPGA is in reset |
| 528 |
fx3_uart_cts <= '1' when sys_reset_pclk = '0' else 'Z'; |
| 529 |
|
| 530 |
-- Unpack the Nios general-purpose outputs into a record |
| 531 |
nios_gpio.o <= unpack(nios_gpo_slv); |
| 532 |
|
| 533 |
-- Readback of Nios general-purpose outputs |
| 534 |
nios_gpio.i.gpo_readback <= nios_gpio.o; |
| 535 |
|
| 536 |
-- RFFE GPIO outputs |
| 537 |
adi_ctrl_in <= unpack(rffe_gpio.o).ctrl_in; |
| 538 |
adi_tx_spdt2_v <= unpack(rffe_gpio.o).tx_spdt2; |
| 539 |
adi_tx_spdt1_v <= unpack(rffe_gpio.o).tx_spdt1; |
| 540 |
tx_bias_en <= unpack(rffe_gpio.o).tx_bias_en; |
| 541 |
adi_rx_spdt2_v <= unpack(rffe_gpio.o).rx_spdt2; |
| 542 |
adi_rx_spdt1_v <= unpack(rffe_gpio.o).rx_spdt1; |
| 543 |
rx_bias_en <= unpack(rffe_gpio.o).rx_bias_en; |
| 544 |
--adi_sync_in <= unpack(rffe_gpio.o).sync_in; |
| 545 |
adi_en_agc <= unpack(rffe_gpio.o).en_agc; |
| 546 |
adi_txnrx <= unpack(rffe_gpio.o).txnrx; |
| 547 |
adi_enable <= unpack(rffe_gpio.o).enable; |
| 548 |
adi_reset_n <= unpack(rffe_gpio.o).reset_n; |
| 549 |
|
| 550 |
-- Unpack trigger GPIO bits into records |
| 551 |
rx_trigger_ctl <= unpack(rx_trigger_ctl_i, rx_trigger_line); |
| 552 |
tx_trigger_ctl <= unpack(tx_trigger_ctl_i, tx_trigger_line); |
| 553 |
|
| 554 |
-- LEDs |
| 555 |
led(1) <= led1_blink when nios_gpio.o.led_mode = '0' else not nios_gpio.o.leds(1); |
| 556 |
led(2) <= not tonegen_running when nios_gpio.o.led_mode = '0' else not nios_gpio.o.leds(2); |
| 557 |
led(3) <= rx_overflow_led when nios_gpio.o.led_mode = '0' else not nios_gpio.o.leds(3); |
| 558 |
|
| 559 |
-- DAC SPI (data latched on falling edge) |
| 560 |
dac_sclk <= not nios_sclk when nios_gpio.o.adf_chip_enable = '0' else '0'; |
| 561 |
dac_sdi <= nios_sdio when nios_gpio.o.adf_chip_enable = '0' else '0'; |
| 562 |
dac_csn <= nios_ss_n(0) when nios_gpio.o.adf_chip_enable = '0' else '1'; |
| 563 |
|
| 564 |
-- ADF SPI (data latched on rising edge) |
| 565 |
adf_sclk <= nios_sclk when nios_gpio.o.adf_chip_enable = '1' else '0'; |
| 566 |
adf_sdi <= nios_sdio when nios_gpio.o.adf_chip_enable = '1' else '0'; |
| 567 |
adf_csn <= nios_ss_n(1) when nios_gpio.o.adf_chip_enable = '1' else '1'; |
| 568 |
adf_ce <= nios_gpio.o.adf_chip_enable; |
| 569 |
|
| 570 |
nios_sdo <= adf_muxout when ((nios_ss_n(1) = '0') and (nios_gpio.o.adf_chip_enable = '1')) |
| 571 |
else '0'; |
| 572 |
|
| 573 |
-- Power monitor I2C |
| 574 |
pwr_scl <= i2c_scl_out when i2c_scl_oen = '0' else 'Z'; |
| 575 |
pwr_sda <= i2c_sda_out when i2c_sda_oen = '0' else 'Z'; |
| 576 |
|
| 577 |
i2c_scl_in <= pwr_scl; |
| 578 |
i2c_sda_in <= pwr_sda; |
| 579 |
|
| 580 |
-- TPS2115A status |
| 581 |
nios_gpio.i.pwr_status <= pwr_status; |
| 582 |
|
| 583 |
-- SI53304 controls / clock output enables |
| 584 |
si_clock_sel <= nios_gpio.o.si_clock_sel; |
| 585 |
c5_clock2_oe <= '1'; |
| 586 |
exp_clock_oe <= exp_present and exp_clock_req; |
| 587 |
ufl_clock_oe <= nios_gpio.o.ufl_clock_oe; |
| 588 |
|
| 589 |
-- Expansion I2C |
| 590 |
exp_i2c_scl <= 'Z'; |
| 591 |
exp_i2c_sda <= 'Z'; |
| 592 |
|
| 593 |
-- Expansion GPIO outputs |
| 594 |
generate_xb_gpio_out : for i in exp_gpio'range generate |
| 595 |
exp_gpio(i) <= nios_xb_gpio_out(i) when nios_xb_gpio_oe(i) = '1' else 'Z'; |
| 596 |
end generate; |
| 597 |
|
| 598 |
|
| 599 |
-- TX Submodule |
| 600 |
U_tx : entity work.tx |
| 601 |
generic map ( |
| 602 |
NUM_STREAMS => dac_controls'length |
| 603 |
) |
| 604 |
port map ( |
| 605 |
tx_reset => tx_reset, |
| 606 |
tx_clock => tx_clock, |
| 607 |
tx_enable => tx_enable, |
| 608 |
|
| 609 |
meta_en => meta_en_tx, |
| 610 |
timestamp_reset => tx_ts_reset, |
| 611 |
usb_speed => usb_speed_tx, |
| 612 |
tx_underflow_led => open, |
| 613 |
tx_timestamp => tx_timestamp, |
| 614 |
|
| 615 |
-- Triggering |
| 616 |
trigger_arm => tx_trigger_ctl.arm, |
| 617 |
trigger_fire => tx_trigger_ctl.fire, |
| 618 |
trigger_master => tx_trigger_ctl.master, |
| 619 |
trigger_line => tx_trigger_line, |
| 620 |
|
| 621 |
-- Eightbit mode |
| 622 |
eight_bit_mode_en => '0', |
| 623 |
|
| 624 |
-- Packet FIFO |
| 625 |
packet_en => '0', |
| 626 |
packet_empty => tx_packet_empty, |
| 627 |
packet_control => tx_packet_control, |
| 628 |
packet_ready => tx_packet_ready, |
| 629 |
|
| 630 |
-- Samples from host via FX3 |
| 631 |
sample_fifo_wclock => fx3_pclk_pll, |
| 632 |
sample_fifo_wreq => '0', |
| 633 |
sample_fifo_wdata => (others => '0'), |
| 634 |
sample_fifo_wempty => open, |
| 635 |
sample_fifo_wfull => open, |
| 636 |
sample_fifo_wused => open, |
| 637 |
|
| 638 |
-- Metadata from host via FX3 |
| 639 |
meta_fifo_wclock => fx3_pclk_pll, |
| 640 |
meta_fifo_wreq => '0', |
| 641 |
meta_fifo_wdata => (others => '0'), |
| 642 |
meta_fifo_wempty => open, |
| 643 |
meta_fifo_wfull => open, |
| 644 |
meta_fifo_wused => open, |
| 645 |
|
| 646 |
-- Digital Loopback Interface |
| 647 |
loopback_enabled => '0', |
| 648 |
loopback_fifo_wclock => tx_loopback_fifo.wclock, |
| 649 |
loopback_fifo_wdata => open, |
| 650 |
loopback_fifo_wreq => open, |
| 651 |
loopback_fifo_wfull => '0', |
| 652 |
loopback_fifo_wused => (others => '0'), |
| 653 |
|
| 654 |
-- RFFE Interface |
| 655 |
dac_controls => dac_controls, |
| 656 |
dac_streams => open |
| 657 |
); |
| 658 |
|
| 659 |
dac_streams(0) <= tonegen_streams(0); |
| 660 |
dac_streams(1) <= tonegen_streams(0); |
| 661 |
|
| 662 |
dac_assignment_proc : process( all ) |
| 663 |
begin |
| 664 |
for i in dac_controls'range loop |
| 665 |
dac_controls(i).enable <= (ad9361.ch(i).dac.i.enable or ad9361.ch(i).dac.q.enable or tx_loopback_enabled) and |
| 666 |
mimo_tx_enables(i); |
| 667 |
dac_controls(i).data_req <= (ad9361.ch(i).dac.i.valid or ad9361.ch(i).dac.q.valid or tx_loopback_enabled) and |
| 668 |
mimo_tx_enables(i); |
| 669 |
|
| 670 |
if (rising_edge(tx_clock) and dac_streams(i).data_v = '1') then |
| 671 |
ad9361.ch(i).dac.i.data <= std_logic_vector(dac_streams(i).data_i(11 downto 0)) & "0000"; |
| 672 |
ad9361.ch(i).dac.q.data <= std_logic_vector(dac_streams(i).data_q(11 downto 0)) & "0000"; |
| 673 |
end if; |
| 674 |
end loop; |
| 675 |
end process; |
| 676 |
|
| 677 |
-- RX Submodule |
| 678 |
U_rx : entity work.rx |
| 679 |
generic map ( |
| 680 |
NUM_STREAMS => adc_controls'length |
| 681 |
) |
| 682 |
port map ( |
| 683 |
rx_reset => rx_reset, |
| 684 |
rx_clock => rx_clock, |
| 685 |
rx_enable => rx_enable, |
| 686 |
|
| 687 |
meta_en => meta_en_rx, |
| 688 |
timestamp_reset => rx_ts_reset, |
| 689 |
usb_speed => usb_speed_rx, |
| 690 |
rx_mux_sel => rx_mux_sel, |
| 691 |
rx_overflow_led => rx_overflow_led, |
| 692 |
rx_timestamp => rx_timestamp, |
| 693 |
|
| 694 |
-- Triggering |
| 695 |
trigger_arm => rx_trigger_ctl.arm, |
| 696 |
trigger_fire => rx_trigger_ctl.fire, |
| 697 |
trigger_master => rx_trigger_ctl.master, |
| 698 |
trigger_line => rx_trigger_line, |
| 699 |
|
| 700 |
-- Eightbit mode |
| 701 |
eight_bit_mode_en => '0', |
| 702 |
|
| 703 |
-- Packet FIFO |
| 704 |
packet_en => '0', |
| 705 |
packet_control => rx_packet_control, |
| 706 |
packet_ready => rx_packet_ready, |
| 707 |
|
| 708 |
-- Samples to host via FX3 |
| 709 |
sample_fifo_rclock => fx3_pclk_pll, |
| 710 |
sample_fifo_raclr => '1', |
| 711 |
sample_fifo_rreq => '0', |
| 712 |
sample_fifo_rdata => open, |
| 713 |
sample_fifo_rempty => open, |
| 714 |
sample_fifo_rfull => open, |
| 715 |
sample_fifo_rused => open, |
| 716 |
|
| 717 |
-- Mini expansion signals |
| 718 |
mini_exp => mini_exp2 & mini_exp1, |
| 719 |
|
| 720 |
-- Metadata to host via FX3 |
| 721 |
meta_fifo_rclock => fx3_pclk_pll, |
| 722 |
meta_fifo_raclr => '1', |
| 723 |
meta_fifo_rreq => '0', |
| 724 |
meta_fifo_rdata => open, |
| 725 |
meta_fifo_rempty => open, |
| 726 |
meta_fifo_rfull => open, |
| 727 |
meta_fifo_rused => open, |
| 728 |
|
| 729 |
-- Digital Loopback Interface |
| 730 |
loopback_fifo_wenabled => tx_loopback_enabled, |
| 731 |
loopback_fifo_wreset => tx_reset, |
| 732 |
loopback_fifo_wclock => tx_loopback_fifo.wclock, |
| 733 |
loopback_fifo_wdata => (others => '0'), |
| 734 |
loopback_fifo_wreq => '0', |
| 735 |
loopback_fifo_wfull => open, |
| 736 |
loopback_fifo_wused => open, |
| 737 |
|
| 738 |
-- RFFE Interface |
| 739 |
adc_controls => adc_controls, |
| 740 |
adc_streams => adc_streams |
| 741 |
); |
| 742 |
|
| 743 |
adc_assignment_proc : process( all ) |
| 744 |
begin |
| 745 |
for i in adc_controls'range loop |
| 746 |
adc_controls(i).enable <= '0'; |
| 747 |
adc_controls(i).data_req <= '0'; |
| 748 |
adc_streams(i).data_i <= (others => '0'); |
| 749 |
adc_streams(i).data_q <= (others => '0'); |
| 750 |
adc_streams(i).data_v <= '0'; |
| 751 |
end loop; |
| 752 |
end process; |
| 753 |
|
| 754 |
-- ======================================================================== |
| 755 |
-- RESET SYNCHRONIZERS |
| 756 |
-- ======================================================================== |
| 757 |
|
| 758 |
U_reset_sync_pclk : entity work.reset_synchronizer |
| 759 |
generic map ( |
| 760 |
INPUT_LEVEL => '1', |
| 761 |
OUTPUT_LEVEL => '1' |
| 762 |
) |
| 763 |
port map ( |
| 764 |
clock => fx3_pclk_pll, |
| 765 |
async => sys_reset_async, |
| 766 |
sync => sys_reset_pclk |
| 767 |
); |
| 768 |
|
| 769 |
U_reset_sync_sys : entity work.reset_synchronizer |
| 770 |
generic map ( |
| 771 |
INPUT_LEVEL => '1', |
| 772 |
OUTPUT_LEVEL => '1' |
| 773 |
) |
| 774 |
port map ( |
| 775 |
clock => sys_clock, |
| 776 |
async => sys_reset_async, |
| 777 |
sync => sys_reset |
| 778 |
); |
| 779 |
|
| 780 |
U_reset_sync_rx : entity work.reset_synchronizer |
| 781 |
generic map ( |
| 782 |
INPUT_LEVEL => '1', |
| 783 |
OUTPUT_LEVEL => '1' |
| 784 |
) |
| 785 |
port map ( |
| 786 |
clock => rx_clock, |
| 787 |
async => sys_reset_pclk, |
| 788 |
sync => rx_reset |
| 789 |
); |
| 790 |
|
| 791 |
U_reset_sync_tx : entity work.reset_synchronizer |
| 792 |
generic map ( |
| 793 |
INPUT_LEVEL => '1', |
| 794 |
OUTPUT_LEVEL => '1' |
| 795 |
) |
| 796 |
port map ( |
| 797 |
clock => tx_clock, |
| 798 |
async => sys_reset_pclk, |
| 799 |
sync => tx_reset |
| 800 |
); |
| 801 |
|
| 802 |
|
| 803 |
-- ======================================================================== |
| 804 |
-- SYNCHRONIZERS |
| 805 |
-- ======================================================================== |
| 806 |
|
| 807 |
U_sync_usb_speed_pclk : entity work.synchronizer |
| 808 |
generic map ( |
| 809 |
RESET_LEVEL => '0' |
| 810 |
) |
| 811 |
port map ( |
| 812 |
reset => '0', |
| 813 |
clock => fx3_pclk_pll, |
| 814 |
async => nios_gpio.o.usb_speed, |
| 815 |
sync => usb_speed_pclk |
| 816 |
); |
| 817 |
|
| 818 |
U_sync_usb_speed_rx : entity work.synchronizer |
| 819 |
generic map ( |
| 820 |
RESET_LEVEL => '0' |
| 821 |
) |
| 822 |
port map ( |
| 823 |
reset => '0', |
| 824 |
clock => rx_clock, |
| 825 |
async => nios_gpio.o.usb_speed, |
| 826 |
sync => usb_speed_rx |
| 827 |
); |
| 828 |
|
| 829 |
U_sync_usb_speed_tx : entity work.synchronizer |
| 830 |
generic map ( |
| 831 |
RESET_LEVEL => '0' |
| 832 |
) |
| 833 |
port map ( |
| 834 |
reset => '0', |
| 835 |
clock => tx_clock, |
| 836 |
async => nios_gpio.o.usb_speed, |
| 837 |
sync => usb_speed_tx |
| 838 |
); |
| 839 |
|
| 840 |
|
| 841 |
U_sync_meta_en_pclk : entity work.synchronizer |
| 842 |
generic map ( |
| 843 |
RESET_LEVEL => '0' |
| 844 |
) |
| 845 |
port map ( |
| 846 |
reset => '0', |
| 847 |
clock => fx3_pclk_pll, |
| 848 |
async => nios_gpio.o.meta_sync, |
| 849 |
sync => meta_en_pclk |
| 850 |
); |
| 851 |
|
| 852 |
U_sync_meta_en_rx : entity work.synchronizer |
| 853 |
generic map ( |
| 854 |
RESET_LEVEL => '0' |
| 855 |
) |
| 856 |
port map ( |
| 857 |
reset => '0', |
| 858 |
clock => rx_clock, |
| 859 |
async => nios_gpio.o.meta_sync, |
| 860 |
sync => meta_en_rx |
| 861 |
); |
| 862 |
|
| 863 |
U_sync_meta_en_tx : entity work.synchronizer |
| 864 |
generic map ( |
| 865 |
RESET_LEVEL => '0' |
| 866 |
) |
| 867 |
port map ( |
| 868 |
reset => '0', |
| 869 |
clock => tx_clock, |
| 870 |
async => nios_gpio.o.meta_sync, |
| 871 |
sync => meta_en_tx |
| 872 |
); |
| 873 |
|
| 874 |
generate_sync_rx_mux_sel : for i in rx_mux_sel'range generate |
| 875 |
U_sync_rx_mux_sel : entity work.synchronizer |
| 876 |
generic map ( |
| 877 |
RESET_LEVEL => '0' |
| 878 |
) |
| 879 |
port map ( |
| 880 |
reset => '0', |
| 881 |
clock => rx_clock, |
| 882 |
async => nios_gpio.o.rx_mux_sel(i), |
| 883 |
sync => rx_mux_sel(i) |
| 884 |
); |
| 885 |
end generate; |
| 886 |
|
| 887 |
--generate_sync_mimo_rx_en : for i in mimo_rx_enables'range generate |
| 888 |
-- U_sync_mimo_rx_en : entity work.synchronizer |
| 889 |
-- generic map ( |
| 890 |
-- RESET_LEVEL => '0' |
| 891 |
-- ) |
| 892 |
-- port map ( |
| 893 |
-- reset => '0', |
| 894 |
-- clock => rx_clock, |
| 895 |
-- async => unpack(rffe_gpio.o).mimo_rx_en(i), |
| 896 |
-- sync => mimo_rx_enables(i) |
| 897 |
-- ); |
| 898 |
--end generate; |
| 899 |
|
| 900 |
generate_sync_mimo_tx_en : for i in mimo_tx_enables'range generate |
| 901 |
U_sync_mimo_tx_en : entity work.synchronizer |
| 902 |
generic map ( |
| 903 |
RESET_LEVEL => '0' |
| 904 |
) |
| 905 |
port map ( |
| 906 |
reset => '0', |
| 907 |
clock => tx_clock, |
| 908 |
async => unpack(rffe_gpio.o).mimo_tx_en(i), |
| 909 |
sync => mimo_tx_enables(i) |
| 910 |
); |
| 911 |
end generate; |
| 912 |
|
| 913 |
generate_sync_adi_ctrl_out : for i in adi_ctrl_out'range generate |
| 914 |
U_sync_adi_ctrl_out : entity work.synchronizer |
| 915 |
generic map ( |
| 916 |
RESET_LEVEL => '0' |
| 917 |
) |
| 918 |
port map ( |
| 919 |
reset => '0', |
| 920 |
clock => sys_clock, |
| 921 |
async => adi_ctrl_out(i), |
| 922 |
sync => rffe_gpio.i.ctrl_out(i) |
| 923 |
); |
| 924 |
end generate; |
| 925 |
|
| 926 |
U_sync_adf_muxout : entity work.synchronizer |
| 927 |
generic map ( |
| 928 |
RESET_LEVEL => '0' |
| 929 |
) |
| 930 |
port map ( |
| 931 |
reset => '0', |
| 932 |
clock => sys_clock, |
| 933 |
async => adf_muxout, |
| 934 |
sync => rffe_gpio.i.adf_muxout |
| 935 |
); |
| 936 |
|
| 937 |
generate_sync_xb_gpio_in : for i in exp_gpio'range generate |
| 938 |
U_sync_xb_gpio_in : entity work.synchronizer |
| 939 |
generic map ( |
| 940 |
RESET_LEVEL => '0' |
| 941 |
) port map ( |
| 942 |
reset => '0', |
| 943 |
clock => sys_clock, |
| 944 |
async => exp_gpio(i), |
| 945 |
sync => nios_xb_gpio_in(i) |
| 946 |
); |
| 947 |
end generate; |
| 948 |
|
| 949 |
U_sync_rx_enable : entity work.synchronizer |
| 950 |
generic map ( |
| 951 |
RESET_LEVEL => '0' |
| 952 |
) |
| 953 |
port map ( |
| 954 |
reset => rx_reset, |
| 955 |
clock => rx_clock, |
| 956 |
async => rx_enable_pclk, |
| 957 |
sync => rx_enable |
| 958 |
); |
| 959 |
|
| 960 |
U_sync_tx_enable : entity work.synchronizer |
| 961 |
generic map ( |
| 962 |
RESET_LEVEL => '0' |
| 963 |
) |
| 964 |
port map ( |
| 965 |
reset => tx_reset, |
| 966 |
clock => tx_clock, |
| 967 |
async => tx_enable_pclk, |
| 968 |
sync => tx_enable |
| 969 |
); |
| 970 |
|
| 971 |
|
| 972 |
-- ======================================================================== |
| 973 |
-- HANDSHAKES |
| 974 |
-- ======================================================================== |
| 975 |
|
| 976 |
drive_handshake_timestamp : process( fx3_pclk_pll, sys_reset_pclk ) |
| 977 |
begin |
| 978 |
if( sys_reset_pclk = '1' ) then |
| 979 |
timestamp_req <= '0'; |
| 980 |
elsif( rising_edge(fx3_pclk_pll) ) then |
| 981 |
if( meta_en_pclk = '0' ) then |
| 982 |
timestamp_req <= '0'; |
| 983 |
else |
| 984 |
if( timestamp_ack = '0' ) then |
| 985 |
timestamp_req <= '1'; |
| 986 |
elsif( timestamp_ack = '1' ) then |
| 987 |
timestamp_req <= '0'; |
| 988 |
end if; |
| 989 |
end if; |
| 990 |
end if; |
| 991 |
end process; |
| 992 |
|
| 993 |
U_handshake_timestamp : entity work.handshake |
| 994 |
generic map ( |
| 995 |
DATA_WIDTH => tx_timestamp'length |
| 996 |
) |
| 997 |
port map ( |
| 998 |
source_clock => tx_clock, |
| 999 |
source_reset => tx_reset, |
| 1000 |
source_data => std_logic_vector(tx_timestamp), |
| 1001 |
|
| 1002 |
dest_clock => fx3_pclk_pll, |
| 1003 |
dest_reset => sys_reset_pclk, |
| 1004 |
unsigned(dest_data) => fx3_timestamp, |
| 1005 |
dest_req => timestamp_req, |
| 1006 |
dest_ack => timestamp_ack |
| 1007 |
); |
| 1008 |
|
| 1009 |
end architecture; |