Write two modules. majority3 outputs 1 when at least two of its three inputs are 1. majority5 outputs 1 when at least three of its five inputs are 1.
majority3: inputs a, b, c; output y.
majority5: input in (5 bits); output y.
The testbench instantiates both and sweeps all 8 and all 32 input combinations.
Contributed by Indicore