Question

Write a behavioral code in VHDL for a 3 - input majority circuit. This means that...

Write a behavioral code in VHDL for a 3 - input majority circuit. This means that if the majority of inputs is 1, the output is 1. Otherwise, the output is 0.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity majority1 is

    Port ( I : in STD_LOGIC_VECTOR (2 downto 0);

           Y : out STD_LOGIC);

end majority1;

architecture Behavioral of majority1 is

begin

process (I)

begin

if (I <= "000") then

Y <= ‘0’;

elsif (I <= "001") then

Y <= ‘0’;

elsif (I <= "010") then

Y <= ‘0’;

elsif (I <= "011") then

Y <= ‘1’;

elsif (I <= "100") then

Y <= ‘0’;

elsif (I <= "101") then

Y <= ‘1’;

elsif (I <= "110") then

Y <= ‘1’;

else (I <= "111") then

Y <= ‘1’;

end if;

end process;

end Behavioral;

Add a comment
Know the answer?
Add Answer to:
Write a behavioral code in VHDL for a 3 - input majority circuit. This means that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT