| 1 |
-- Copyright (c) 2013 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 |
entity lms6002d_model is |
| 28 |
port ( |
| 29 |
-- LMS RX Interface |
| 30 |
rx_clock : in std_logic ; |
| 31 |
rx_clock_out : buffer std_logic ; |
| 32 |
rx_data : buffer signed(11 downto 0) ; |
| 33 |
rx_enable : in std_logic ; |
| 34 |
rx_iq_select : buffer std_logic ; |
| 35 |
|
| 36 |
-- LMS TX Interface |
| 37 |
tx_clock : in std_logic ; |
| 38 |
tx_data : in signed(11 downto 0) ; |
| 39 |
tx_enable : in std_logic ; |
| 40 |
tx_iq_select : in std_logic ; |
| 41 |
|
| 42 |
-- LMS SPI Interface |
| 43 |
sclk : in std_logic ; |
| 44 |
sen : in std_logic ; |
| 45 |
sdio : in std_logic ; |
| 46 |
sdo : buffer std_logic ; |
| 47 |
|
| 48 |
-- LMS Control Interface |
| 49 |
pll_out : buffer std_logic ; |
| 50 |
resetx : in std_logic |
| 51 |
) ; |
| 52 |
end entity ; -- lms6002d_model |
| 53 |
|
| 54 |
architecture arch of lms6002d_model is |
| 55 |
|
| 56 |
begin |
| 57 |
|
| 58 |
pll_out <= '0' ; |
| 59 |
|
| 60 |
-- Write transmit samples to a file or drop them on the floor |
| 61 |
|
| 62 |
-- Read receive samples from a file or predetermined tone |
| 63 |
rx_clock_out <= rx_clock ; |
| 64 |
|
| 65 |
drive_rx_data : process( resetx, rx_clock ) |
| 66 |
begin |
| 67 |
if( resetx = '0' ) then |
| 68 |
rx_data <= (others =>'0') ; |
| 69 |
rx_iq_select <= '0' ; |
| 70 |
elsif( rising_edge(rx_clock) ) then |
| 71 |
if( rx_enable = '1' ) then |
| 72 |
rx_data <= rx_data + 1 ; |
| 73 |
rx_iq_select <= not rx_iq_select ; |
| 74 |
else |
| 75 |
rx_data <= (others =>'0') ; |
| 76 |
rx_iq_select <= '0' ; |
| 77 |
end if ; |
| 78 |
end if ; |
| 79 |
end process ; |
| 80 |
|
| 81 |
-- Keep track of the SPI register set |
| 82 |
sdo <= '0' ; |
| 83 |
|
| 84 |
end architecture ; -- arch |
| 85 |
|