# nemewt10/atmega32-zl3avr-emulator architecture

> Architecture diagram of the GitHub repository nemewt10/atmega32-zl3avr-emulator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nemewt10/atmega32-zl3avr-emulator
- Repository: https://github.com/nemewt10/atmega32-zl3avr-emulator

## Overview

ZL3AVR is an educational browser emulator for the ATmega32-based ZL3AVR board. A student edits C code, compiles it to Intel HEX, loads it into the simulated MCU, wires board pins and peripherals, and observes execution through the board and serial terminal; a Python “PC” can communicate over the simulated serial connection. The graph also retains the documented guide, reference material, and timer calculator. Paths for those documented capabilities use their enclosing directories because their internals were not sampled.

Main entry points: [`apps/web/src/App.tsx`](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/App.tsx) (Application shell), [`apps/web/src/sim/Simulator.ts`](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/sim/Simulator.ts) (Simulation engine), [`apps/web/src/sim/SimulationContext.tsx`](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/sim/SimulationContext.tsx) (Simulation context), [`packages/avr-core/src/mcu.ts`](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/avr-core/src/mcu.ts) (ATmega32 model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_app["Application shell<br/>[App.tsx]"]
  node_workspace["Workspace state<br/>[workspace.ts]"]
  node_terminal["Serial terminal<br/>[TerminalView.tsx]"]
  node_pc["Python PC<br/>[PcView.tsx]"]
  node_pythonhost["Python host<br/>[PythonHost.ts]"]
  node_pythonworker["Python runtime<br/>[python.worker.ts]"]
end

subgraph group_authoring["Code workflow"]
  node_ide["C editor<br/>[IdeView.tsx]"]
  node_project["Project files<br/>[project.ts]"]
  node_toolchain["AVR compiler<br/>[toolchain.ts]"]
  node_wasmcompiler["WASM toolchain"]
end

subgraph group_simulation["Emulation"]
  node_simview["Simulator view<br/>[SimulatorView.tsx]"]
  node_simulator["Simulation engine<br/>[Simulator.ts]"]
  node_simcontext["Simulation context"]
  node_mcu["ATmega32 model<br/>[mcu.ts]"]
  node_cpu["AVR CPU<br/>[cpu.ts]"]
  node_peripherals["MCU peripherals"]
  node_fuses["Fuse bits<br/>[fuses.ts]"]
  node_hex["Intel HEX<br/>[hex.ts]"]
end

subgraph group_board["Board interface"]
  node_boardview["Board view<br/>[BoardView.tsx]"]
  node_board["Board model<br/>[board.ts]"]
  node_wiring["Wires and connectors<br/>[wiring.ts]"]
  node_parts["Board peripherals"]
  node_route["Wire rendering<br/>[route.ts]"]
end

subgraph group_learning["Learning tools"]
  node_guide["User guide<br/>[GuideView.tsx]"]
  node_reference["AVR reference<br/>[KompendiumView.tsx]"]
  node_calculator["Timer calculator<br/>[KalkulatorView.tsx]"]
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"shows"| node_ide
node_app -->|"shows"| node_simview
node_app -->|"shows"| node_boardview
node_app -->|"shows"| node_terminal
node_app -->|"shows"| node_pc
node_app -->|"shows"| node_guide
node_app -->|"shows"| node_reference
node_app -->|"shows"| node_calculator
node_app -->|"saves and restores"| node_workspace
node_ide -->|"edits"| node_project
node_ide -->|"compiles with"| node_toolchain
node_toolchain -->|"dispatches"| node_wasmcompiler
node_wasmcompiler -->|"produces"| node_hex
node_app -->|"provides"| node_simcontext
node_simcontext -->|"owns"| node_simulator
node_simview -->|"observes"| node_simcontext
node_boardview -->|"observes"| node_simcontext
node_simulator -->|"runs"| node_mcu
node_simulator -->|"updates"| node_board
node_mcu -->|"executes on"| node_cpu
node_mcu -->|"models"| node_peripherals
node_mcu -->|"uses"| node_fuses
node_simulator -->|"loads program"| node_hex
node_boardview -->|"interacts with"| node_board
node_board -->|"tracks connections"| node_wiring
node_board -->|"models"| node_parts
node_boardview -->|"renders wires with"| node_route
node_terminal -->|"observes serial"| node_simcontext
node_pc -->|"controls"| node_pythonhost
node_pythonhost -->|"starts runtime"| node_pythonworker
node_pythonworker -->|"exchanges serial data"| node_simulator

click node_app "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/App.tsx"
click node_workspace "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/workspace.ts"
click node_ide "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/IdeView.tsx"
click node_project "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/ide/project.ts"
click node_toolchain "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/ide/toolchain.ts"
click node_wasmcompiler "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/ide/wasm/toolchain.worker.ts"
click node_simview "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/SimulatorView.tsx"
click node_simulator "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/sim/Simulator.ts"
click node_simcontext "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/sim/SimulationContext.tsx"
click node_mcu "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/avr-core/src/mcu.ts"
click node_cpu "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/avr-core/src/cpu.ts"
click node_peripherals "https://github.com/nemewt10/atmega32-zl3avr-emulator/tree/main/packages/avr-core/src/peripherals"
click node_fuses "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/avr-core/src/fuses.ts"
click node_hex "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/avr-core/src/hex.ts"
click node_boardview "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/BoardView.tsx"
click node_board "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/board/src/board.ts"
click node_wiring "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/board/src/wiring.ts"
click node_parts "https://github.com/nemewt10/atmega32-zl3avr-emulator/tree/main/packages/board/src/parts"
click node_route "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/board-view/route.ts"
click node_terminal "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/TerminalView.tsx"
click node_pc "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/PcView.tsx"
click node_pythonhost "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/pc/PythonHost.ts"
click node_pythonworker "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/pc/python.worker.ts"
click node_guide "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/GuideView.tsx"
click node_reference "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/KompendiumView.tsx"
click node_calculator "https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/KalkulatorView.tsx"

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_app,node_workspace,node_terminal,node_pc,node_pythonhost,node_pythonworker toneBlue
class node_ide,node_project,node_toolchain,node_wasmcompiler toneAmber
class node_simview,node_simulator,node_simcontext,node_mcu,node_cpu,node_peripherals,node_fuses,node_hex toneMint
class node_boardview,node_board,node_wiring,node_parts,node_route toneRose
class node_guide,node_reference,node_calculator,node_student toneIndigo
```

## Components

### Application

- [Application shell](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Workspace state](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/workspace.ts): `apps/web/src/workspace.ts`
- [Serial terminal](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/TerminalView.tsx): `apps/web/src/views/TerminalView.tsx`
- [Python PC](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/PcView.tsx): `apps/web/src/views/PcView.tsx`
- [Python host](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/pc/PythonHost.ts): `apps/web/src/pc/PythonHost.ts`
- [Python runtime](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/pc/python.worker.ts): `apps/web/src/pc/python.worker.ts`

### Code workflow

- [C editor](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/IdeView.tsx): `apps/web/src/views/IdeView.tsx`
- [Project files](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/ide/project.ts): `apps/web/src/ide/project.ts`
- [AVR compiler](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/ide/toolchain.ts): `apps/web/src/ide/toolchain.ts`
- [WASM toolchain](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/ide/wasm/toolchain.worker.ts): `apps/web/src/ide/wasm/toolchain.worker.ts`

### Emulation

- [Simulator view](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/SimulatorView.tsx): `apps/web/src/views/SimulatorView.tsx`
- [Simulation engine](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/sim/Simulator.ts): `apps/web/src/sim/Simulator.ts`
- [Simulation context](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/sim/SimulationContext.tsx): `apps/web/src/sim/SimulationContext.tsx`
- [ATmega32 model](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/avr-core/src/mcu.ts): `packages/avr-core/src/mcu.ts`
- [AVR CPU](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/avr-core/src/cpu.ts): `packages/avr-core/src/cpu.ts`
- [MCU peripherals](https://github.com/nemewt10/atmega32-zl3avr-emulator/tree/main/packages/avr-core/src/peripherals): `packages/avr-core/src/peripherals`
- [Fuse bits](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/avr-core/src/fuses.ts): `packages/avr-core/src/fuses.ts`
- [Intel HEX](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/avr-core/src/hex.ts): `packages/avr-core/src/hex.ts`

### Board interface

- [Board view](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/BoardView.tsx): `apps/web/src/views/BoardView.tsx`
- [Board model](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/board/src/board.ts): `packages/board/src/board.ts`
- [Wires and connectors](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/packages/board/src/wiring.ts): `packages/board/src/wiring.ts`
- [Board peripherals](https://github.com/nemewt10/atmega32-zl3avr-emulator/tree/main/packages/board/src/parts): `packages/board/src/parts`
- [Wire rendering](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/board-view/route.ts): `apps/web/src/board-view/route.ts`

### Learning tools

- [User guide](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/GuideView.tsx): `apps/web/src/views/GuideView.tsx`
- [AVR reference](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/KompendiumView.tsx): `apps/web/src/views/KompendiumView.tsx`
- [Timer calculator](https://github.com/nemewt10/atmega32-zl3avr-emulator/blob/main/apps/web/src/views/KalkulatorView.tsx): `apps/web/src/views/KalkulatorView.tsx`

### Other components

- **Student**

## Connections

- Student → Application shell: uses
- Application shell → C editor: shows
- Application shell → Simulator view: shows
- Application shell → Board view: shows
- Application shell → Serial terminal: shows
- Application shell → Python PC: shows
- Application shell → User guide: shows
- Application shell → AVR reference: shows
- Application shell → Timer calculator: shows
- Application shell → Workspace state: saves and restores
- C editor → Project files: edits
- C editor → AVR compiler: compiles with
- AVR compiler → WASM toolchain: dispatches
- WASM toolchain → Intel HEX: produces
- Application shell → Simulation context: provides
- Simulation context → Simulation engine: owns
- Simulator view → Simulation context: observes
- Board view → Simulation context: observes
- Simulation engine → ATmega32 model: runs
- Simulation engine → Board model: updates
- ATmega32 model → AVR CPU: executes on
- ATmega32 model → MCU peripherals: models
- ATmega32 model → Fuse bits: uses
- Simulation engine → Intel HEX: loads program
- Board view → Board model: interacts with
- Board model → Wires and connectors: tracks connections
- Board model → Board peripherals: models
- Board view → Wire rendering: renders wires with
- Serial terminal → Simulation context: observes serial
- Python PC → Python host: controls
- Python host → Python runtime: starts runtime
- Python runtime → Simulation engine: exchanges serial data
