Part of Curriculum: Verilog Fundamentals (Module 7: Half Adders & Arithmetic Primitives)
View Full Roadmap →
Level 1 Easy ★ Flagship #7 10 pts ✓ Solved

Half Adder — Sum and Carry

Arithmetic Circuits · combinational, logic-gates, easy, adders-&-subtractors

Construct a 1-bit half adder that computes the binary sum and carry-out of two 1-bit operands a and b.

Write a synthesizable Verilog module named top_module matching the ports below exactly.
📐 Circuit Schematic Diagram
abcinsumcoutADDERDATAPATH
⚡ Timing & Synthesizability Constraints

Timing Contract: Combinational logic path: $t_{sum}$ and $t_{cout}$.

RTL Constraints: Synthesizable combinational RTL.

Objective: Understand basic 1-bit binary arithmetic: XOR for Sum, AND for Carry.

Prerequisites: Binary addition, truth tables of XOR and AND.
NameDirWidthDescription
ainput1First 1-bit operand
binput1Second 1-bit operand
sumoutput1Sum bit (a ^ b)
coutoutput1Carry-out bit (a & b)
Expected Waveform (Golden Timing Contract)
💡 Need Guidance? Progressive Hints (3 Levels)
Hint 1: Conceptual Direction & Hardware Primitives
Sum is high when only one input is high: use XOR (`^`).
Hint 2: Implementation Architecture & Approach
Carry-out is high when both inputs are 1: use AND (`&`).
Hint 3: Edge Cases, Timing & Verilog Syntax
Alternatively, concatenate: `assign {cout, sum} = a + b;`.
🔒 Reveal Verified Reference RTL Solution (Click to expand)
⚠️ Self-Discovery Warning: Try solving and simulating first! Viewing the verified reference implementation will bypass the real debugging experience.
Verified Synthesizable RTL
module top_module(
  input   a,
  input   b,
  output  sum,
  output  cout
);
  assign sum  = a ^ b;
  assign cout = a & b;
endmodule
Verilog-2001 / SV Saved
Font: |
// Click Run Tests (or press Ctrl+Enter) to compile your RTL and simulate against hidden testbenches.
Simulation Timing Diagram (VCD Waveform)
100%
No simulation waveform yet. Run tests to simulate and generate VCD traces.
No compilation run yet. Syntax warnings and elaboration messages will appear here.
No simulation output yet. Raw stdout from vvp will appear here.

RTL Problems / Level 1 · Arithmetic Circuits

What You Will Learn

By solving Half Adder — Sum and Carry, you will acquire core industry skills:

  • Synthesizable hardware modeling in standard Verilog-2001 / SystemVerilog.
  • Correct handling of interface port contracts, edge-triggered clocks, and active-low/high resets.
  • Simulation waveform interpretation and debugging using timing diagrams (VCD traces).
  • Architectural avoidance of timing violations, glitching hazards, and synthesis warnings.

Problem Statement & Requirements

Construct a 1-bit half adder that computes the binary sum and carry-out of two 1-bit operands a and b.

Hardware design teams at leading semiconductor firms evaluate these exact port contracts, race-condition assertions, and corner cases during technical design reviews and ASIC engineer interviews.

Objective: Understand basic 1-bit binary arithmetic: XOR for Sum, AND for Carry.

Prerequisites: Binary addition, truth tables of XOR and AND.

Port List & Interface Timing

The hidden testbench instantiates top_module. Module port names and bit-widths must match the interface contract exactly:

NameDirWidthDescription
ainput1First 1-bit operand
binput1Second 1-bit operand
sumoutput1Sum bit (a ^ b)
coutoutput1Carry-out bit (a & b)

Timing Constraints & Synthesizable RTL Rules

⚡ Synthesizable Implementation Guidelines

Timing Contract: Combinational logic path: $t_{sum}$ and $t_{cout}$.

Synthesis Constraints: Synthesizable combinational RTL.

Architectural Deep Dive & Implementation Walkthrough

Adding two 1-bit values $a + b$ produces a 2-bit result $\{cout, sum\} \in \{0, 1, 2\}$. The least-significant bit (Sum) represents modulo-2 addition ($a \oplus b$), and the most-significant bit (Cout) represents the overflow carry ($a \cdot b$).

Common RTL Designer Pitfalls

⚠️ Common Mistakes to Avoid

['Swapping `sum` and `cout` outputs.', 'Using OR instead of XOR for sum, which fails for $1+1$.']

Silicon & Hardware Engineering Notes

🛠️ ASIC vs FPGA Hardware Considerations

A half adder cannot accept a carry-in from a previous stage; chaining multiple bits requires full adders with carry-in support.

Starter RTL Code

module top_module(
  input   a,
  input   b,
  output  sum,
  output  cout
);

  // Compute sum and carry-out

endmodule

Verified Reference Solution

🔒 Reveal Verified Reference RTL Solution
module top_module(
  input   a,
  input   b,
  output  sum,
  output  cout
);
  assign sum  = a ^ b;
  assign cout = a & b;
endmodule
Advertisement

Related RTL Problems in Level 1

Frequently Asked Questions

What does Half Adder — Sum and Carry require?

Construct a 1-bit half adder that computes the binary sum and carry-out of two 1-bit operands a and b. Implement it as Verilog module top_module matching the listed ports.

Is this design combinational or sequential?

Tags: combinational, logic-gates, easy, adders-&-subtractors. If a clock signal is present in the port table, implement it as sequential logic; otherwise, use continuous assignments or combinational blocks.

How is my solution graded?

A hidden SystemVerilog testbench simulates your module in the cloud judge. You pass when all directed corner cases match the golden model and the VCD timing waveform matches the contract.

How does this challenge help with semiconductor interviews?

Technical interviewers at NVIDIA, Qualcomm, Apple, and Intel routinely ask candidates to code, debug, and explain the timing waveforms of Half Adder — Sum and Carry to assess real-world synthesizability and race-condition awareness.

Advertisement