# kulp/tenyr architecture

> Architecture diagram of the GitHub repository kulp/tenyr, 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/kulp/tenyr
- Repository: https://github.com/kulp/tenyr

## Overview

##### Main Components

a. Hardware Layer:
- FPGA Implementation (hw/verilog/)
- Device Controllers (VGA, GPIO, RAM)
- Hardware Simulation Components (hw/icarus/)
- VPI Interface (hw/vpi/)

b. Software Tools Layer:
- Assembler (tas)
- Linker (tld)
- Simulator (tsim)
- Plugin System

c. Standard Library Layer:
- Core Functions
- System Utilities
- Memory Operations

##### Component Relationships

**[User Programs / Examples]**
- ↓
**[Software Development Tools]**
- ↙            ↘
**[Standard Library]  [Simulator]**
- ↓           ↓
**[Hardware Abstraction Layer]**
- ↓
**[FPGA Implementation]**

##### Specific Implementation Details

a. Hardware Section:
- Verilog implementation components
- Device interfaces (VGA, RAM, GPIO)
- Demonstrate simulation paths (Icarus, VPI)

b. Software Tools Section:
- Compilation pipeline: Assembly → Linking → Execution
- Plugin system architecture
- Demonstrate the simulator's interaction with hardware models

c. Library Section:
- Standard library functions by category
- Dependencies between library components
- Interaction points with hardware

##### Key Interactions to Highlight

- Assembly code compilation flow
- Hardware simulation paths
- Device interface implementations
- Plugin system integration
- Standard library usage paths

##### Additional Elements

- Version information
- Supported platforms
- Test coverage paths
- Critical system interfaces

Remember to include the supported platforms (Mac, *nix, Windows) and the demonstrated FPGA implementations (Lattice ECP5, Xilinx Spartan6) as deployment targets.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph User["User Interface Layer"]
        Examples["Example Programs"]:::user
        UserCode["User Code"]:::user
    end

    subgraph Tools["Development Tools Layer"]
        Assembler["Assembler (tas)"]:::tools
        Linker["Linker (tld)"]:::tools
        Simulator["Simulator (tsim)"]:::tools
        PluginSys["Plugin System"]:::tools
    end

    subgraph Lib["Library Layer"]
        StdLib["Standard Library"]:::lib
        OSSupport["OS Support"]:::lib
    end

    subgraph HW["Hardware Layer"]
        FPGA["FPGA Implementation"]:::hw
        HWSim["Hardware Simulation"]:::hw
        VPI["VPI Interface"]:::hw
        
        subgraph Devices["Device Controllers"]
            VGA["VGA Controller"]:::device
            GPIO["GPIO Controller"]:::device
            RAM["RAM Controller"]:::device
        end
    end

    Examples --> Assembler
    UserCode --> Assembler
    Assembler --> Linker
    Linker --> Simulator
    Simulator --> VPI
    VPI --> HWSim
    VPI --> FPGA
    
    StdLib --> Simulator
    OSSupport --> Simulator
    PluginSys --> Simulator
    
    FPGA --> Devices
    HWSim --> Devices

    %% Component Mappings
    click FPGA "https://github.com/kulp/tenyr/tree/develop/hw/verilog/"
    click HWSim "https://github.com/kulp/tenyr/tree/develop/hw/icarus/"
    click VPI "https://github.com/kulp/tenyr/tree/develop/hw/vpi/"
    click VGA "https://github.com/kulp/tenyr/blob/develop/hw/verilog/vga_text.v"
    click GPIO "https://github.com/kulp/tenyr/blob/develop/hw/verilog/gpio.v"
    click RAM "https://github.com/kulp/tenyr/blob/develop/hw/verilog/ram.v"
    click Assembler "https://github.com/kulp/tenyr/blob/develop/src/tas.c"
    click Linker "https://github.com/kulp/tenyr/blob/develop/src/tld.c"
    click Simulator "https://github.com/kulp/tenyr/blob/develop/src/tsim.c"
    click PluginSys "https://github.com/kulp/tenyr/blob/develop/src/plugin.c"
    click StdLib "https://github.com/kulp/tenyr/tree/develop/lib/"
    click OSSupport "https://github.com/kulp/tenyr/tree/develop/src/os/"
    click Examples "https://github.com/kulp/tenyr/tree/develop/ex/"

    %% Styling
    classDef hw fill:#a8d1f0,stroke:#333
    classDef tools fill:#90ee90,stroke:#333
    classDef lib fill:#ffeb99,stroke:#333
    classDef user fill:#ffc266,stroke:#333
    classDef device fill:#d3d3d3,stroke:#333

    %% Legend
    subgraph Legend
        HWComp["Hardware Components"]:::hw
        DevTools["Development Tools"]:::tools
        Libraries["Libraries"]:::lib
        UserComp["User Components"]:::user
        DeviceComp["Device Components"]:::device
    end
```
