# vidhyamadhavivemuri-spec/microcontroller-register-simulator architecture

> Architecture diagram of the GitHub repository vidhyamadhavivemuri-spec/microcontroller-register-simulator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator
- Repository: https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator

## Overview

This is a software-only embedded microcontroller simulator. Its runtime demonstrates peripheral activity flowing through interrupts and events to application decisions, system-state changes, and alert output; it also exposes standalone simulated GPIO, UART, PWM, SPI, and I2C peripherals. The README describes the broader peripheral behavior; sampled source confirms the application, interrupt, event, SPI, and I2C implementations, but not every peripheral’s internal wiring.

Main entry points: [`src/main.c`](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/main.c) (Simulator Main), [`src/register.c`](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/register.c) (Simulated Registers), [`src/application.c`](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/application.c) (Application Logic), [`src/interrupt.c`](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/interrupt.c) (Interrupt Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hardware["Simulated Hardware"]
  node_registers[("Simulated Registers<br/>[register.c]")]
  node_gpio["GPIO<br/>[gpio.c]"]
  node_uart["UART<br/>[uart.c]"]
  node_timer["Timer<br/>[timer.c]"]
  node_adc["ADC<br/>[adc.c]"]
  node_pwm["PWM<br/>[pwm.c]"]
  node_spi["SPI<br/>[spi.c]"]
  node_i2c["I2C<br/>[i2c.c]"]
  node_wdt["Watchdog Timer<br/>[wdt.c]"]
end

subgraph group_dispatch["Interrupt and Events"]
  node_interrupt["Interrupt Controller<br/>[interrupt.c]"]
  node_events["Event Flags<br/>[events.c]"]
end

subgraph group_application["Application Response"]
  node_application["Application Logic<br/>[application.c]"]
  node_system["System State<br/>[system.c]"]
  node_alert["Alert Output<br/>[alert_output.c]"]
end

subgraph group_runtime["Runtime Entry"]
  node_main["Simulator Main<br/>[main.c]"]
end

node_main -->|"initializes and configures"| node_interrupt
node_main -->|"initializes and processes"| node_application
node_main -->|"starts and updates"| node_timer
node_main -->|"starts and updates"| node_adc
node_main -->|"enables and updates"| node_wdt
node_gpio -->|"reads and writes"| node_registers
node_uart -->|"reads and writes"| node_registers
node_timer -->|"reads and writes"| node_registers
node_adc -->|"reads and writes"| node_registers
node_pwm -->|"reads and writes"| node_registers
node_spi -->|"reads and writes"| node_registers
node_i2c -->|"reads and writes"| node_registers
node_wdt -->|"reads and writes"| node_registers
node_timer -->|"triggers interrupt"| node_interrupt
node_adc -->|"triggers interrupt"| node_interrupt
node_wdt -->|"triggers INT2"| node_interrupt
node_interrupt -->|"dispatches handlers"| node_main
node_main -->|"handlers set events"| node_events
node_application -->|"checks and clears"| node_events
node_application -->|"reads conversion"| node_adc
node_application -->|"updates state"| node_system
node_application -->|"controls output"| node_alert
node_main -->|"reads status"| node_registers

click node_main "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/main.c"
click node_registers "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/register.c"
click node_gpio "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/gpio.c"
click node_uart "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/uart.c"
click node_timer "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/timer.c"
click node_adc "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/adc.c"
click node_pwm "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/pwm.c"
click node_spi "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/spi.c"
click node_i2c "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/i2c.c"
click node_wdt "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/wdt.c"
click node_interrupt "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/interrupt.c"
click node_events "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/events.c"
click node_application "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/application.c"
click node_system "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/system.c"
click node_alert "https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/alert_output.c"

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_registers,node_gpio,node_uart,node_timer,node_adc,node_pwm,node_spi,node_i2c,node_wdt toneBlue
class node_interrupt,node_events toneAmber
class node_application,node_system,node_alert toneMint
class node_main toneRose
```

## Components

### Simulated Hardware

- [Simulated Registers](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/register.c): `src/register.c`
- [GPIO](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/gpio.c): `src/gpio.c`
- [UART](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/uart.c): `src/uart.c`
- [Timer](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/timer.c): `src/timer.c`
- [ADC](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/adc.c): `src/adc.c`
- [PWM](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/pwm.c): `src/pwm.c`
- [SPI](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/spi.c): `src/spi.c`
- [I2C](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/i2c.c): `src/i2c.c`
- [Watchdog Timer](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/wdt.c): `src/wdt.c`

### Interrupt and Events

- [Interrupt Controller](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/interrupt.c): `src/interrupt.c`
- [Event Flags](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/events.c): `src/events.c`

### Application Response

- [Application Logic](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/application.c): `src/application.c`
- [System State](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/system.c): `src/system.c`
- [Alert Output](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/alert_output.c): `src/alert_output.c`

### Runtime Entry

- [Simulator Main](https://github.com/vidhyamadhavivemuri-spec/microcontroller-register-simulator/blob/main/src/main.c): `src/main.c`

## Connections

- Simulator Main → Interrupt Controller: initializes and configures
- Simulator Main → Application Logic: initializes and processes
- Simulator Main → Timer: starts and updates
- Simulator Main → ADC: starts and updates
- Simulator Main → Watchdog Timer: enables and updates
- GPIO → Simulated Registers: reads and writes
- UART → Simulated Registers: reads and writes
- Timer → Simulated Registers: reads and writes
- ADC → Simulated Registers: reads and writes
- PWM → Simulated Registers: reads and writes
- SPI → Simulated Registers: reads and writes
- I2C → Simulated Registers: reads and writes
- Watchdog Timer → Simulated Registers: reads and writes
- Timer → Interrupt Controller: triggers interrupt
- ADC → Interrupt Controller: triggers interrupt
- Watchdog Timer → Interrupt Controller: triggers INT2
- Interrupt Controller → Simulator Main: dispatches handlers
- Simulator Main → Event Flags: handlers set events
- Application Logic → Event Flags: checks and clears
- Application Logic → ADC: reads conversion
- Application Logic → System State: updates state
- Application Logic → Alert Output: controls output
- Simulator Main → Simulated Registers: reads status
