# dingusdev/dingusppc architecture

> Architecture diagram of the GitHub repository dingusdev/dingusppc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dingusdev/dingusppc
- Repository: https://github.com/dingusdev/dingusppc

## Overview

##### Main Components Overview
The system should be divided into these major components:

a. Core Emulation Layer
- CPU Emulation (PowerPC)
- Memory Management
- Timer Management
- Core Signals

b. Device Emulation Layer
- Common Devices (ADB, ATA, SCSI, PCI, etc.)
- I/O Controllers
- Memory Controllers
- Video Subsystem
- Sound Subsystem
- Storage Devices
- Network Devices

c. Machine Abstraction Layer
- Machine Base Implementation
- Machine Factory
- Specific Machine Models (Catalyst, Gazelle, etc.)

d. Debugging Infrastructure
- Interactive Debugger
- Disassembler
- Test Framework

##### Component Relationships

**[Host System Interface (SDL)] ←→ [Core Emulation Layer]**
- ↕
- [Device Emulation Layer]
- ↕
- [Machine Abstraction Layer]
- ↕
- [Debugging Infrastructure]

##### Specific Implementation Details

a. Core Components (Hexagons):
- PowerPC CPU Emulation (cpu/ppc/)
- Memory Management Unit (cpu/ppc/ppcmmu)
- Timer Manager (core/timermanager)

b. Device Controllers (Rectangles):
- PCI Subsystem (devices/common/pci/)
- SCSI Controllers (devices/common/scsi/)
- ATA Controllers (devices/common/ata/)
- Video Controllers (devices/video/)
- Sound Controllers (devices/sound/)

c. Machine Implementation (Rounded Rectangles):
- Machine Base Class
- Specific Machine Implementations
- Machine Factory

d. Support Systems (Ovals):
- Debugger
- Test Framework
- Host System Interface

##### Data Flow Indicators

- Memory access paths
- I/O operations
- Interrupt signals
- DMA transfers
- Device communications

##### Technical Details

Annotations for:
- C++20 implementation
- SDL2 dependency
- External libraries (CubeB, Capstone)
- Build system (CMake)

## Diagram (Mermaid)

```mermaid
graph TB
    classDef core fill:#f9d,stroke:#333,stroke-width:2px
    classDef device fill:#afd,stroke:#333,stroke-width:2px
    classDef machine fill:#daf,stroke:#333,stroke-width:2px
    classDef debug fill:#fda,stroke:#333,stroke-width:2px
    classDef host fill:#ddd,stroke:#333,stroke-width:2px

    subgraph Host
        SDL[SDL Interface]:::host
        HostEvents[Host Events]:::host
        Display[Display]:::host
    end

    subgraph CoreEmulation
        CPU[PowerPC CPU]:::core
        MMU[Memory Management]:::core
        Timer[Timer Management]:::core
        CoreSignals[Core Signals]:::core
    end

    subgraph DeviceEmulation
        ADB[ADB Subsystem]:::device
        ATA[ATA Controllers]:::device
        SCSI[SCSI Subsystem]:::device
        PCI[PCI Subsystem]:::device
        Video[Video Subsystem]:::device
        Sound[Sound Subsystem]:::device
        Network[Network Devices]:::device
        Storage[Storage Devices]:::device
        DMA[DMA Controller]:::device
    end

    subgraph MachineAbstraction
        MachineBase[Machine Base]:::machine
        MachineFactory[Machine Factory]:::machine
        MachineProps[Machine Properties]:::machine
        subgraph Machines
            Catalyst[Catalyst]:::machine
            Gazelle[Gazelle]:::machine
            TNT[TNT]:::machine
        end
    end

    subgraph Debugging
        Debugger[Interactive Debugger]:::debug
        TestFramework[Test Framework]:::debug
        PPCTests[PowerPC Tests]:::debug
    end

    SDL --> CoreEmulation
    HostEvents --> CoreEmulation
    Display --> Video

    CoreEmulation <--> DeviceEmulation
    DeviceEmulation <--> MachineAbstraction
    MachineAbstraction <--> Debugging

    click CPU "https://github.com/dingusdev/dingusppc/tree/master/cpu/ppc/"
    click MMU "https://github.com/dingusdev/dingusppc/blob/master/cpu/ppc/ppcmmu.h"
    click Timer "https://github.com/dingusdev/dingusppc/blob/master/core/timermanager.h"
    click CoreSignals "https://github.com/dingusdev/dingusppc/blob/master/core/coresignal.h"
    click ADB "https://github.com/dingusdev/dingusppc/tree/master/devices/common/adb/"
    click ATA "https://github.com/dingusdev/dingusppc/tree/master/devices/common/ata/"
    click SCSI "https://github.com/dingusdev/dingusppc/tree/master/devices/common/scsi/"
    click PCI "https://github.com/dingusdev/dingusppc/tree/master/devices/common/pci/"
    click Video "https://github.com/dingusdev/dingusppc/tree/master/devices/video/"
    click Sound "https://github.com/dingusdev/dingusppc/tree/master/devices/sound/"
    click Network "https://github.com/dingusdev/dingusppc/tree/master/devices/ethernet/"
    click Storage "https://github.com/dingusdev/dingusppc/tree/master/devices/storage/"
    click DMA "https://github.com/dingusdev/dingusppc/blob/master/devices/common/dbdma.h"
    click MachineBase "https://github.com/dingusdev/dingusppc/blob/master/machines/machinebase.h"
    click MachineFactory "https://github.com/dingusdev/dingusppc/blob/master/machines/machinefactory.h"
    click MachineProps "https://github.com/dingusdev/dingusppc/blob/master/machines/machineproperties.h"
    click Catalyst "https://github.com/dingusdev/dingusppc/blob/master/machines/machinecatalyst.cpp"
    click Gazelle "https://github.com/dingusdev/dingusppc/blob/master/machines/machinegazelle.cpp"
    click TNT "https://github.com/dingusdev/dingusppc/blob/master/machines/machinetnt.cpp"
    click Debugger "https://github.com/dingusdev/dingusppc/blob/master/debugger/debugger.h"
    click TestFramework "https://github.com/dingusdev/dingusppc/tree/master/cpu/ppc/test/"
    click PPCTests "https://github.com/dingusdev/dingusppc/blob/master/cpu/ppc/test/ppctests.cpp"
    click SDL "https://github.com/dingusdev/dingusppc/blob/master/main_sdl.cpp"
    click HostEvents "https://github.com/dingusdev/dingusppc/blob/master/core/hostevents_sdl.cpp"
    click Display "https://github.com/dingusdev/dingusppc/blob/master/devices/video/display_sdl.cp"

    %% Legend
    classDef legendClass fill:none,stroke:none
    subgraph Legend
        L1[Core Components]:::core
        L2[Device Components]:::device
        L3[Machine Components]:::machine
        L4[Debug Components]:::debug
        L5[Host Components]:::host
    end
```
