Menu
Coddy logo textTech

Writing The Module

Part of the Fundamentals section of Coddy's Verilog journey — lesson 43 of 90.

challenge icon

Challenge

A half adder is a circuit that adds two single bits and tells you:

  • sum — the result (0 or 1)
  • carry — if there is an overflow (1 when both inputs are 1)

Example

absumcarry
00no overflow
011no overflow
101no overflow
110overflow (carry = 1)

When you add 1 + 1 in binary, the result is 0 with a carry of 1 (just like 5 + 5 = 0 with a carry of 1 in decimal).

Before we add the logic, we need to create the module container — the empty shell that will hold our half adder circuit.

For a half adder, these are the tasks:

  1. Create a module called half_adder
  2. Add two inputs: a and b
  3. Add two outputs: sum and carry

Try it yourself

  // Task 1: Create a module named half_adder

  // Task 2: Add two inputs: a and b
  
  // Task 3: Add two outputs: sum and carry

  // Logic will be added later

All lessons in Fundamentals