RTL Studio Open IDE

Logic Gates

3-Input Majority Voter

Combinational logic module that outputs the majority value of three binary inputs.

About this block

Simulate it in the Verilog IDE

Easyverilogsimsyn

3-Input Majority Voter is a Verilog reference block in the Logic Gates catalog. AND, OR, XOR, and other combinational gate and boolean logic primitives. Marked Easy: a small block you can read, simulate, and synthesize in one sitting.

The 3-Input Majority Voter determines the majority value of three binary inputs. Output is high if two or more inputs are high. This is a purely combinational logic block.

The 3-Input Majority Voter is a simple, efficient combinational circuit. It correctly identifies the majority value of three binary signals. Simulation confirms correct behavior for all input combinations.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 3-Input Majority Voter.
  2. Read the Verilog module in the editor. The catalog line for this block: Combinational logic module that outputs the majority value of three binary inputs.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.

RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.

Architecture

The module implements the boolean expression: out = (a & b) | (b & c) | (a & c). It uses standard AND and OR gates to evaluate the majority condition. No clock or state is required for this operation.

Ports

PortDirectionWidthDescription
aInput1First input bit
bInput1Second input bit
cInput1Third input bit
outOutput1Majority result

Verification

The testbench iterates through all 8 possible input combinations. It checks the output against the expected majority value for each case. All 8 test cases passed successfully in simulation.

Test CaseInputs (a,b,c)ExpectedActualStatus
00, 0, 000PASS
10, 0, 100PASS
20, 1, 000PASS
30, 1, 111PASS
41, 0, 000PASS
51, 0, 111PASS
61, 1, 011PASS
71, 1, 111PASS

More in Logic Gates

All Logic Gates blocks