Introduction - If you have any usage issues, please Google them yourself
ENTITY maj IS
PORT(a,b,c : IN BIT m : OUT BIT)
END maj
--Dataflow style architecture
--Behavioural style architecture using a look-up table
ARCHITECTURE using_table OF maj IS
BEGIN
PROCESS(a,b,c)
CONSTANT lookuptable : BIT_VECTOR(0 TO 7) := "00010111"
VARIABLE index : NATURAL
BEGIN
index := 0 --index must be cleared each time process executes
IF a = 1 THEN index := index+ 1 END IF
IF b = 1 THEN index := index+ 2 END IF
IF c = 1 THEN index := index+ 4 END IF
m <= lookuptable(index)
END PROCESS
END using_table
------------------3,5,6,7 is 1 so 110 101 011 111 is 1