# bhaskar0120/hardpy architecture

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

- Interactive diagram: https://gitdiagram.com/bhaskar0120/hardpy
- Repository: https://github.com/bhaskar0120/hardpy

## Overview

HardPy is a small Python toolkit for describing digital circuits as composable signal and operation objects, then rendering them as synthesizable Verilog. The main workflow is to create nodes and primitives, connect them into a circuit, and use a Module to traverse the output dependencies and assemble declarations and assignments. The excerpts support these core relationships; the README also describes the graph-building capability. No external integrations or separate storage systems are shown.

Main entry points: [`Node.py`](https://github.com/bhaskar0120/hardpy/blob/v2/Node.py) (Signals and operations), [`Module.py`](https://github.com/bhaskar0120/hardpy/blob/v2/Module.py) (Module builder), [`Primitives.py`](https://github.com/bhaskar0120/hardpy/blob/v2/Primitives.py) (Circuit primitives)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_circuit_model["Circuit model"]
  node_nodes["Signals and operations<br/>[Node.py]"]
  node_primitives["Circuit primitives<br/>[Primitives.py]"]
end

subgraph group_verilog_output["Verilog output"]
  node_module["Module builder<br/>[Module.py]"]
  node_verilog["Synthesizable Verilog"]
end

node_designer(("Circuit designer"))

node_designer -->|"describes circuits"| node_nodes
node_designer -->|"uses primitives"| node_primitives
node_primitives -->|"constructs nodes"| node_nodes
node_module -->|"traverses dependencies"| node_nodes
node_module -->|"renders Verilog"| node_verilog

click node_nodes "https://github.com/bhaskar0120/hardpy/blob/v2/Node.py"
click node_primitives "https://github.com/bhaskar0120/hardpy/blob/v2/Primitives.py"
click node_module "https://github.com/bhaskar0120/hardpy/blob/v2/Module.py"

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_nodes,node_primitives toneBlue
class node_module,node_verilog toneAmber
class node_designer toneIndigo
```

## Components

### Circuit model

- [Signals and operations](https://github.com/bhaskar0120/hardpy/blob/v2/Node.py): `Node.py`
- [Circuit primitives](https://github.com/bhaskar0120/hardpy/blob/v2/Primitives.py): `Primitives.py`

### Verilog output

- [Module builder](https://github.com/bhaskar0120/hardpy/blob/v2/Module.py): `Module.py`
- **Synthesizable Verilog**

### Other components

- **Circuit designer**

## Connections

- Circuit designer → Signals and operations: describes circuits (evidence: `README.md`)
- Circuit designer → Circuit primitives: uses primitives (evidence: `README.md`)
- Circuit primitives → Signals and operations: constructs nodes (evidence: `Primitives.py`)
- Module builder → Signals and operations: traverses dependencies (evidence: `Module.py`)
- Module builder → Synthesizable Verilog: renders Verilog (evidence: `Module.py`)
