BitFlow

Half Adder

beginner · combinational · 75 XP

Sign in to write your solution, run it in the simulator and submit it for grading.

Sign in or create a free account →

Problem

Half Adder Implement a half adder that adds two 1-bit numbers. **Interface** | Port | Direction | Width | Description | |----------|-----------|-------|-----------------| | `a` | input | 1 | First operand | | `b` | input | 1 | Second operand | | `sum` | output | 1 | Sum bit (LSB) | | `carry`| output | 1 | Carry out (MSB) | **Truth Table** | a | b | carry | sum | |---|---|-------|-----| | 0 | 0 | 0 | 0 | | 0 | 1 | 0 | 1 | | 1 | 0 | 0 | 1 | | 1 | 1 | 1 | 0 | **Notes** - `sum = a XOR b` - `carry = a AND b`

Constraints

  • Use only assign statements.
  • Do not use always blocks.

Examples

Input: a=1, b=1

Output: sum=0, carry=1

Input: a=0, b=1

Output: sum=1, carry=0

Common questions

What does the Half Adder problem ask you to build?
Half Adder Implement a half adder that adds two 1-bit numbers. **Interface** | Port | Direction | Width | Description | |----------|-----------|-------|-----------------| | `a` | input | 1 | First operand | | `b` | input | 1 | Second operand | | `sum` | output | 1 | Sum bit (LSB) | | `carry`| output…
What constraints does Half Adder have?
Use only assign statements.; Do not use always blocks.
What is an example input and output for Half Adder?
Input a=1, b=1 gives output sum=0, carry=1.
Which Verilog concepts does Half Adder practise?
combinational, arithmetic.