This repository contains a modular, "plug-and-play" simulation of a Half Adder digital circuit implemented in C++. It is designed to be easily dropped into larger digital logic simulation projects.
The module encapsulates logic within the DigitalCircuits namespace to prevent naming conflicts and utilizes static methods for efficient, stateless computation.
-
Plug & Play: Encapsulated in a header-only file (.hpp) for easy inclusion.
-
Namespace Protection: All logic is contained within the DigitalCircuits namespace.
-
Efficient: Uses bitwise operators for
$\mathcal{O}(1)$ simulation of logic gates. -
Demo Included: Comes with a main.cpp driver to demonstrate functionality and input validation.
-
HalfAdder.hpp: The core module containing the logic class.
-
main.cpp: A demonstration program that accepts user input and simulates the circuit.
A Half Adder is a combinational arithmetic circuit that adds two numbers and produces a sum bit (