CMX
CMX firmware code in-line documentation
 All Classes Namespaces Files Functions Variables
PARITY_CALC.vhd
Go to the documentation of this file.
1 ----------------------------------------------------------------------------------
10 ----------------------------------------------------------------------------------
11 library IEEE;
12 use IEEE.STD_LOGIC_1164.ALL;
13 --use IEEE.REDUCE_PKG.ALL;
14 
15 library work;
16 use work.CMXpackage.all;
17 
18 
19 -- Uncomment the following library declaration if using
20 -- arithmetic functions with Signed or Unsigned values
21 --use IEEE.NUMERIC_STD.ALL;
22 
23 -- Uncomment the following library declaration if instantiating
24 -- any Xilinx primitives in this code.
25 --library UNISIM;
26 --use UNISIM.VComponents.all;
27 
28 entity PARITY_CALC is
29  port (
30  DATA : in std_logic_vector(numbitsinchan - 1 downto 0);
31  PARITY : out std_logic);
32 end PARITY_CALC;
33 
34 architecture Behavioral of PARITY_CALC is
35  signal tmp : std_logic_vector(numbitsinchan - 1 downto 0);
36 
37 begin
38 
39  tmp(0)<=DATA(0);
40  xor_gen: for bitnum in 1 to (numbitsinchan-1) generate
41  tmp(bitnum) <= DATA(bitnum) xor tmp(bitnum-1);
42  end generate xor_gen;
43  PARITY<=tmp(numbitsinchan-1);
44 
45  --PARITY<=xor_reduce(DATA);
46 
47 end Behavioral;
48 
out PARITYstd_logic
Definition: PARITY_CALC.vhd:31
std_logic_vector (numbitsinchan - 1 downto 0) tmp
Definition: PARITY_CALC.vhd:35
in DATAstd_logic_vector (numbitsinchan - 1 downto 0)
Definition: PARITY_CALC.vhd:30
_library_ IEEEIEEE
Definition: or_all.vhd:12
_library_ workwork
Definition: or_all.vhd:15