summaryrefslogtreecommitdiff
path: root/pb_APP_log_comb.srcs/sources_1/new/parity_check.vhd
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2025-05-03 15:31:02 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2025-05-03 15:31:02 -0400
commitfeb78868167b4543c2ce87643f54761fea721605 (patch)
tree24675a9f5d3e2abd972cd491f9b932ca4de14d4d /pb_APP_log_comb.srcs/sources_1/new/parity_check.vhd
parent1b8b70ea0d1f1dd79a1b1f1a1b05208bb8c1ca30 (diff)
Follow instructions for parity check
Diffstat (limited to 'pb_APP_log_comb.srcs/sources_1/new/parity_check.vhd')
-rw-r--r--pb_APP_log_comb.srcs/sources_1/new/parity_check.vhd66
1 files changed, 66 insertions, 0 deletions
diff --git a/pb_APP_log_comb.srcs/sources_1/new/parity_check.vhd b/pb_APP_log_comb.srcs/sources_1/new/parity_check.vhd
new file mode 100644
index 0000000..50ffdfa
--- /dev/null
+++ b/pb_APP_log_comb.srcs/sources_1/new/parity_check.vhd
@@ -0,0 +1,66 @@
+----------------------------------------------------------------------------------
+-- Company:
+-- Engineer:
+--
+-- Create Date: 05/03/2025 03:20:01 PM
+-- Design Name:
+-- Module Name: parity_check - Behavioral
+-- Project Name:
+-- Target Devices:
+-- Tool Versions:
+-- Description:
+--
+-- Dependencies:
+--
+-- Revision:
+-- Revision 0.01 - File Created
+-- Additional Comments:
+--
+----------------------------------------------------------------------------------
+
+
+library IEEE;
+use IEEE.STD_LOGIC_1164.ALL;
+
+-- Uncomment the following library declaration if using
+-- arithmetic functions with Signed or Unsigned values
+--use IEEE.NUMERIC_STD.ALL;
+
+-- Uncomment the following library declaration if instantiating
+-- any Xilinx leaf cells in this code.
+--library UNISIM;
+--use UNISIM.VComponents.all;
+
+entity parity_check is
+ Port ( ADCbin : in STD_LOGIC_VECTOR (3 downto 0);
+ S1 : in STD_LOGIC;
+ Parite : out STD_LOGIC);
+end parity_check;
+
+architecture Behavioral of parity_check is
+
+ signal Y : STD_LOGIC_VECTOR (2 downto 0);
+ signal PreFlip : STD_LOGIC;
+
+begin
+
+ Y(0) <= ADCbin(0) xor ADCbin(1);
+ Y(1) <= ADCbin(2) xor ADCbin(3);
+ Y(2) <= Y(0) xor Y(1);
+
+ flipCheck : process(Y, S1)
+ begin
+
+ case (S1) is
+ when '0' =>
+ Parite <= Y(2);
+ when '1' =>
+ Parite <= not Y(2);
+ when others =>
+ Parite <= '0';
+ end case;
+
+ end process;
+
+
+end Behavioral;