CMX
CMX firmware code in-line documentation
 All Classes Namespaces Files Functions Variables
parity_gen.vhd
Go to the documentation of this file.
1 
12 LIBRARY ieee ;
13 USE ieee.std_logic_1164.all;
14 USE ieee.numeric_std.all;
15 
16 ENTITY parity_gen IS
17  GENERIC(
18  width : integer := 60
19  );
20  PORT(
21  din : IN std_logic_vector (width-1 downto 0) ;
22  parity : OUT std_logic
23  );
24 
25 -- Declarations
26 
27 END parity_gen ;
28 
29 -- renoir interface_end
30 ARCHITECTURE rtl OF parity_gen IS
31 --------------------------------------------------------------------------------
32 -- Calculate the (odd) parity of incoming data and output result.
33 --
34 --------------------------------------------------------------------------------
35 BEGIN
36 
37  parity_check: process (din)
38  variable iparity: std_logic;
39  begin
40  iparity:= '1'; -- odd parity
41  for i in 0 to (width - 1) loop
42  iparity := iparity xor din(i);
43  end loop;
44  parity <= iparity;
45  end process;
46 
47 
48 END rtl;
_library_ ieeeieee
Definition: parity_gen.vhd:14
out paritystd_logic
Definition: parity_gen.vhd:24
widthinteger :=60
Definition: parity_gen.vhd:20
in dinstd_logic_vector (width - 1 downto 0)
Definition: parity_gen.vhd:23