Problem: Implement XOR Gate in Verilog
Objective
Design and verify a simple 2-input XOR gate using Verilog.
The design should be tested using a testbench that applies all possible input combinations.
Requirements
-
Create a Verilog module named
xor_gate
with:- Two inputs:
a
,b
- One output:
y
- Function:
y = a ^ b
- Two inputs:
-
Write a
testbench
module to verify the XOR gate:- Apply all 4 input combinations of
a
andb
(00, 01, 10, 11). - Observe the output
y
for correctness.
- Apply all 4 input combinations of
No Waveform Data
Submit your Verilog code using Cmd+Enter to see the simulation results and waveform visualization.