1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
library ieee ;
use ieee.std_logic_1164.all ;
use ieee.numeric_std.all ;
entity lms6002d is
port (
-- RX Controls
rx_clock : in std_logic ;
rx_reset : in std_logic ;
rx_enable : in std_logic ;
-- RX Interface with LMS6002D
rx_lms_data : in signed(11 downto 0) ;
rx_lms_iq_sel : in std_logic ;
rx_lms_enable : buffer std_logic ;
-- RX Sample Interface
rx_sample_i : buffer signed(11 downto 0) ;
rx_sample_q : buffer signed(11 downto 0) ;
rx_sample_valid : buffer std_logic ;
-- TX Controls
tx_clock : in std_logic ;
tx_reset : in std_logic ;
tx_enable : in std_logic ;
-- TX Sample Interface
tx_sample_i : in signed(11 downto 0) ;
tx_sample_q : in signed(11 downto 0) ;
tx_sample_valid : in std_logic ;
-- TX Interface to the LMS6002D
tx_lms_data : buffer signed(11 downto 0) ;
tx_lms_iq_sel : buffer std_logic ;
tx_lms_enable : buffer std_logic
) ;
end entity ;
architecture arch of lms6002d is
begin
-------------
-- Receive --
-------------
rx_sample : process(rx_clock, rx_reset)
begin
if( rx_reset = '1' ) then
rx_sample_i <= (others =>'0') ;
rx_sample_q <= (others =>'0') ;
rx_sample_valid <= '0' ;
rx_lms_enable <= '0' ;
elsif( rising_edge( rx_clock ) ) then
if( rx_lms_iq_sel = '0' ) then
rx_lms_enable <= rx_enable ;
end if ;
rx_sample_valid <= '0' ;
if( rx_lms_enable = '1' ) then
if(rx_lms_iq_sel = '1' ) then
rx_sample_i <= rx_lms_data ;
else
rx_sample_q <= rx_lms_data ;
rx_sample_valid <= '1' ;
end if ;
end if ;
end if ;
end process ;
--------------
-- Transmit --
--------------
tx_sample : process(tx_clock, tx_reset)
variable tx_q_reg : signed(11 downto 0) ;
begin
if( tx_reset = '1' ) then
tx_lms_data <= (others =>'0') ;
tx_lms_iq_sel <= '0' ;
tx_lms_enable <= '0' ;
tx_q_reg := (others =>'0') ;
elsif( rising_edge( tx_clock ) ) then
if( tx_lms_iq_sel = '0' ) then
tx_lms_enable <= tx_enable ;
end if ;
if( tx_sample_valid = '1' ) then
tx_lms_data <= tx_sample_i ;
tx_q_reg := tx_sample_q ;
tx_lms_iq_sel <= '0' ;
elsif( tx_lms_enable = '1' ) then
tx_lms_data <= tx_q_reg ;
tx_lms_iq_sel <= '1' ;
else
tx_lms_data <= (others =>'0') ;
tx_lms_iq_sel <= '0' ;
end if ;
end if ;
end process ;
end architecture ;
|