A graph-based digital logic design environment written in C++ that enables you to build, simulate, and evaluate digital circuits using common logic gates, hierarchical gate composition, and an automated wiring + persistence system.
Demo/usage playlist: https://www.youtube.com/playlist?list=PLbDnyrrfgzH6rByhw83TfR-hEWR1vLolN
- Logic gate modeling: NOT, BUFFER, NAND, AND, NOR, OR, XNOR, XOR
- Graph/tree-based circuit design
- Gates can have children (hierarchical composition)
- Gates can have siblings (linked-list style at the same level)
- Wiring system
- Connect the output of any gate to the input of another (beyond the tree structure)
- Connect / disconnect wires and clear all wiring
- Circuit evaluation
- Evaluates circuits using post-order traversal (children first, then parents)
- Persistence (save/load)
- Save circuits/components to files
- Reload components and re-apply wiring using a path notation system
- Interactive navigation UI
- Move around the circuit using keyboard controls and view logic
This project is primarily implemented in:
logic_gates.h— class definitions + declarationslogic_gates.cpp— full implementation (gate logic, graph operations, save/load, wiring, UI loop)
Additional docs:
DOCUMENTATION.MD— full detailed documentationDEMO.md— short overview + demo linkfeatures.readme— feature listUpdates.md— development log / series notes
enum {
NOT = 0,
BUFFER,
NAND,
AND,
NOR,
OR,
XNOR,
XOR
};- The main circuit is an n-ary tree
- Each gate may have multiple children
- Children are stored as a linked list (siblings connected by
next/prev)
- A separate wire system provides cross-links:
wire_input: gates feeding this gatewire_output: gates receiving this gate’s output
Paths are strings used to locate a gate from the root:
c= go to childr= go to right sibling""(empty string) = root
Example: crrc = child → right → right → child
The program exposes an interactive menu:
- Insert gate
- Connect (wire gates)
- Disconnect (remove wire)
- Edit gate properties
- Remove all wiring
- Resize input pins for all leaf gates
- Test logic (set inputs and evaluate)
- Remove selected gate
- Remove entire circuit
- Save circuit to files
- Load circuit from files
- Navigate circuit (move command)
- Quit
wparentschildaprevious siblingdnext siblingrreturn to rootenterselect current gateqquit navigation
NOT and BUFFER gates must have exactly one input source and cannot mix sources:
- ONE input pin OR
- ONE child gate OR
- ONE wired connection
…but not a combination.
This prevents ambiguous/invalid gate behavior.
Each line:
GATE_TYPE:IN_SIZE_OR_CHILD_COUNT:LEAF_STATUS
gate_enum: 0–7 (NOT..XOR)size: input pin count (leaf) or children count (non-leaf)leaf_status:1leaf (uses input pins),0non-leaf (uses children)
Each line:
from_path:to_path
Where both sides are path strings (using the c/r notation).
If you want the full deep-dive (classes, algorithms, save/load, wiring, UI details), read:
DOCUMENTATION.MD
Per Updates.md, the project reached a point where building very complex systems through a CLI-only interface becomes difficult without a GUI; however, it remains useful for experimenting with gate networks, building smaller reusable components, and learning how logic simulation, wiring, and persistence can be implemented.