10 use ieee.std_logic_1164.
all;
11 use ieee.std_logic_unsigned.
all;
12 use ieee.std_logic_arith.
all;
21 TxData : in ;
-- DAV pin, active high for this module
22 TxCntl : in ;
-- CAV pin (Not used for CMX, not functional in this module)
26 -- Debug outputs (kept for legacy purposes)
38 signal Flag : := '0';
-- Flagsel always zero
43 -----------------------------------------------------------------------------------------------------------
44 -- Calculate accumulated disparity and produce correct output accordingly
45 -----------------------------------------------------------------------------------------------------------
48 variable tx_uninverted, tx_inverted : (23 downto 0);
49 variable ones : (7 downto 0);
57 elsif rising_edge(Clock) then
59 -- Construct inverted and non-inverted words
61 if TxData = '0' then -- Idle (send fill frames)
62 tx_uninverted := "110000000000011111111111";
-- Idle Word 1a (C007FF)
63 tx_inverted := "110000000000000111111111";
-- Idle Word 1b (C001FF)
64 else -- DAV asserted (send data frame)
65 Flag <=
not (Flag); -- toggle the Flag only
when a data frame
is sent
67 tx_uninverted := "1011" & tx_in;
68 tx_inverted := "0100" & not(tx_in);
70 tx_uninverted := "1101" & tx_in;
71 tx_inverted := "0010" & not(tx_in);
75 -- calculate word disparity
77 ones := (OTHERS => '0');
79 if (tx_uninverted(i) = '1') then
85 tx_out <= tx_uninverted;
-- If no disparity, send uninverted output
87 elsif TDisparity(7) = '0' then -- Zero or positive total disparity
89 tx_out <= tx_inverted;
-- Positive word disparity, send inverted output
92 tx_out <= tx_uninverted;
-- negative word disparity, send uninverted output
95 else -- Negative total disparity
97 tx_out <= tx_uninverted;
-- Positive word disparity, send uninverted output
100 tx_out <= tx_inverted;
-- Negative word disparity, send inverted output
105 -- Output to legacy ports
121 end if;
-- Rising edge of Clock
in tx_instd_logic_vector (19 downto 0)
std_logic_vector (7 downto 0) :=( others =>'0' ) TDisparity
out TDisparity_Qstd_logic_vector (5 downto 0)
out tx_outstd_logic_vector (23 downto 0)