Debian Codegraph @

hdl/fpga/ip/nuand/synthesis/lms6002d/vhdl/lms6002d.vhd

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