# itsmezerog/logic-gate-simulator architecture

> Architecture diagram of the GitHub repository itsmezerog/logic-gate-simulator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/itsmezerog/logic-gate-simulator
- Repository: https://github.com/itsmezerog/logic-gate-simulator

## Overview

#### Purpose and Scope
A small C++ hobby project intended to simulate digital logic gates and wires. Supported gate concepts are AND, OR, NOT, NAND, and NOR; the README does not establish a GUI, persistence layer, or networked service.

#### Application Entry Point
`src/main.cpp` is the only source file shown and therefore the likely location for program startup, simulation setup, and any current gate/wire evaluation loop. There is no evidence in the tree of separate domain modules, libraries, or plugin boundaries.

#### Simulation Core
The logical model is expected to represent gate inputs, outputs, and wire connections, with basic gates composing the primitive behavior and NAND/NOR representing derived behavior. As the repository exposes only `src/main.cpp`, these responsibilities are currently likely colocated:
- `src/main.cpp`

#### Primary Control and Data Flow
The expected flow is: construct or define logic gates → connect values through wires → evaluate gate truth functions → propagate output values to dependent inputs. The exact evaluation scheduling strategy (single-pass, iterative propagation, event-driven, or clocked) is not documented and should be verified in:
- `src/main.cpp`

#### Build and Dependency Boundary
CMake is the project build-system boundary. Presets likely define supported local build configurations, while vcpkg manifests declare externally acquired C++ dependencies:
- `CMakeLists.txt`
- `CMakePresets.json`
- `vcpkg.json`
- `vcpkg-configuration.json`

#### Runtime and Infrastructure
The material runtime is a native C++ executable built through CMake. No server runtime, database, browser client, cloud infrastructure, or external API integration is indicated by the supplied repository tree.

#### Current Architectural Shape
The architecture is intentionally compact and monolithic: one executable source unit plus build/dependency metadata. Future extraction candidates, if the simulator grows, are gate abstractions, wire/net propagation, circuit orchestration, and user-facing input/output; none are presently represented as separate paths.

Main entry points: [`CMakeLists.txt`](https://github.com/itsmezerog/logic-gate-simulator/blob/main/CMakeLists.txt) (CMake project), [`src/main.cpp`](https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp) (Wire connections), [`vcpkg.json`](https://github.com/itsmezerog/logic-gate-simulator/blob/main/vcpkg.json) (vcpkg manifest), [`CMakePresets.json`](https://github.com/itsmezerog/logic-gate-simulator/blob/main/CMakePresets.json) (CMake presets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build &amp; Dependencies"]
  node_cmake["CMake project<br/>build definition<br/>[CMakeLists.txt]"]
  node_presets["CMake presets<br/>build profiles<br/>[CMakePresets.json]"]
  node_vcpkg_manifest["vcpkg manifest<br/>dependency manifest<br/>[vcpkg.json]"]
  node_vcpkg_config["vcpkg configuration<br/>dependency configuration"]
end

subgraph group_simulator["Logic Simulator"]
  node_main["Simulator executable<br/>C++ entry point<br/>[main.cpp]"]
  node_circuit_setup["Circuit setup<br/>simulation stage<br/>[main.cpp]"]
  node_wires["Wire connections<br/>simulation stage<br/>[main.cpp]"]
  node_gate_evaluation["Gate evaluation<br/>simulation stage<br/>[main.cpp]"]
  node_propagation["Signal propagation<br/>simulation stage<br/>[main.cpp]"]
end

node_presets -->|"selects build configuration"| node_cmake
node_vcpkg_config -->|"configures dependency resolution"| node_vcpkg_manifest
node_vcpkg_manifest -.->|"supplies dependencies"| node_cmake
node_cmake -->|"builds"| node_main
node_main -->|"initializes"| node_circuit_setup
node_circuit_setup -->|"connects gates"| node_wires
node_wires -->|"provides inputs"| node_gate_evaluation
node_gate_evaluation -->|"produces outputs"| node_propagation
node_propagation -->|"updates dependent inputs"| node_wires

click node_cmake "https://github.com/itsmezerog/logic-gate-simulator/blob/main/CMakeLists.txt"
click node_presets "https://github.com/itsmezerog/logic-gate-simulator/blob/main/CMakePresets.json"
click node_vcpkg_manifest "https://github.com/itsmezerog/logic-gate-simulator/blob/main/vcpkg.json"
click node_vcpkg_config "https://github.com/itsmezerog/logic-gate-simulator/blob/main/vcpkg-configuration.json"
click node_main "https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp"
click node_circuit_setup "https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp"
click node_wires "https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp"
click node_gate_evaluation "https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp"
click node_propagation "https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cmake,node_presets,node_vcpkg_manifest,node_vcpkg_config toneBlue
class node_main,node_circuit_setup,node_wires,node_gate_evaluation,node_propagation toneAmber
```

## Components

### Build & Dependencies

- [CMake project](https://github.com/itsmezerog/logic-gate-simulator/blob/main/CMakeLists.txt): build definition · Defines the native executable build. · `CMakeLists.txt`
- [CMake presets](https://github.com/itsmezerog/logic-gate-simulator/blob/main/CMakePresets.json): build profiles · `CMakePresets.json`
- [vcpkg manifest](https://github.com/itsmezerog/logic-gate-simulator/blob/main/vcpkg.json): dependency manifest · `vcpkg.json`
- [vcpkg configuration](https://github.com/itsmezerog/logic-gate-simulator/blob/main/vcpkg-configuration.json): dependency configuration · `vcpkg-configuration.json`

### Logic Simulator

- [Simulator executable](https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp): C++ entry point · Current monolithic implementation and likely program startup. · `src/main.cpp`
- [Circuit setup](https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp): simulation stage · Constructs or defines gates and connections. · `src/main.cpp`
- [Wire connections](https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp): simulation stage · Carries output values to dependent gate inputs. · `src/main.cpp`
- [Gate evaluation](https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp): simulation stage · Evaluates AND, OR, NOT, NAND, and NOR truth functions. · `src/main.cpp`
- [Signal propagation](https://github.com/itsmezerog/logic-gate-simulator/blob/main/src/main.cpp): simulation stage · Scheduling strategy is currently undocumented. · `src/main.cpp`

## Connections

- CMake presets → CMake project: selects build configuration
- vcpkg configuration → vcpkg manifest: configures dependency resolution
- vcpkg manifest → CMake project: supplies dependencies
- CMake project → Simulator executable: builds
- Simulator executable → Circuit setup: initializes
- Circuit setup → Wire connections: connects gates
- Wire connections → Gate evaluation: provides inputs
- Gate evaluation → Signal propagation: produces outputs
- Signal propagation → Wire connections: updates dependent inputs
