RTL Studio Open IDE

Logic Gates

2-Input XOR Gate

Basic 2-input XOR logic gate implementation in Verilog.

About this block

Simulate it in the Verilog IDE

Easyverilogsimsyn

2-Input XOR Gate 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.

This IP provides a minimal, synthesizable 2-input XOR gate implemented in Verilog. It is designed for educational purposes and simple logic manipulation tasks. The design is fully verified with a testbench covering all input combinations and is compatible with standard Verilog simulators (VCS, Icarus Verilog) and synthesis tools.

The module performs an exclusive-OR operation on two single-bit inputs (a and b). The output y is high (1) only when the inputs differ, and low (0) when they are the same. The implementation is purely combinational with no clock dependency.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 2-Input XOR Gate.
  2. Read the Verilog module in the editor. The catalog line for this block: Basic 2-input XOR logic gate implementation in Verilog.
  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.

Ports

PortDirectionWidthDescription
ainput1First input bit
binput1Second input bit
youtput1XOR result

Verification

The testbench (tb/tb_xor_gate_2input.v) covers all four input combinations to verify correctness.

Test CaseInput aInput bExpected yResult
TC1000PASS
TC2011PASS
TC3101PASS
TC4110PASS

All tests passed successfully. Use the VCD dump to inspect signals.

More in Logic Gates

All Logic Gates blocks