Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Implement and Verify a Two-Input XOR

Hardware interview practice

Implement and Verify a Two-Input XOR

EasyRTL DesignSystemVerilog

A parity helper needs a purely combinational two-input exclusive-OR output. Write the XOR RTL, truth table, and equivalent sum-of-products expression.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

module xor2(
 input logic A,B,
 output logic Y
);
Reviewed example

Work through one case

Input
Case 1: A=0,B=0
Case 2: A=0,B=1
Case 3: A=1,B=1
Expected output
Case 1: Gives Y=0.
Case 2: Gives Y=1.
Case 3: Gives Y=0.

The shown result follows by applying this rule: The operator, sum-of-products expression, and four-row table are mutually equivalent. The cases also demonstrate this requirement: Verify all four two-state input combinations and do not treat X or Z as a required Boolean truth-table value.

What to cover

Requirements

  1. Implement Y as `A ^ B` using combinational RTL with no storage.
  2. Give the complete input order 00,01,10,11 and output sequence 0,1,1,0.
  3. State the equivalent Boolean expression `(~A & B) | (A & ~B)`.
  4. Verify all four two-state input combinations and do not treat X or Z as a required Boolean truth-table value.
asic.fyi · Learn silicon end to end.info@asic.fyi