From ac783a17ae6764b3bf6c3864504d96862678aaef Mon Sep 17 00:00:00 2001 From: xingchen <1098756313@qq.com> Date: Fri, 25 Sep 2026 11:57:19 +0800 Subject: [PATCH] feat: add rtl/majority_vote.vhd --- rtl/majority_vote.vhd | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 rtl/majority_vote.vhd diff --git a/rtl/majority_vote.vhd b/rtl/majority_vote.vhd new file mode 100644 index 0000000..42c06b9 --- /dev/null +++ b/rtl/majority_vote.vhd @@ -0,0 +1,20 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity majority_vote is + port (channels : in std_logic_vector(2 downto 0); + voted : out std_logic; + fault_mask : out std_logic_vector(2 downto 0)); +end entity; + +architecture rtl of majority_vote is + signal majority : std_logic; +begin + majority <= (channels(0) and channels(1)) or + (channels(0) and channels(2)) or + (channels(1) and channels(2)); + voted <= majority; + fault_mask(0) <= channels(0) xor majority; + fault_mask(1) <= channels(1) xor majority; + fault_mask(2) <= channels(2) xor majority; +end architecture;