| Status | Title | Difficulty | Tags |
|---|---|---|---|
A Half Adder is the simplest digital circuit that performs binary addition.
It takes two 1-bit inputs and produces two outputs:
In this tutorial, we will describe how to design and test a Half Adder using RTL (Register Transfer Level) modeling in Verilog.
The Half Adder works with the following logic equations:
Sum Equation:
Sum = A ⊕ B
Carry Equation:
Carry = A · B
| a | b | sum | carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
In RTL style:
always block.always @(*) is used for combinational logic.A testbench is used to apply all input combinations and observe the outputs.
It should include:
initial block where inputs are changed over time.$finish.iverilog).sum and carry as reg when using RTL modeling.always @(*), which may cause incomplete sensitivity list issues.^) with OR (|) operator when writing equations.Submit your Verilog code using Cmd+Enter to see the simulation results and waveform visualization.