# m-castro2/godot_mips architecture

> Architecture diagram of the GitHub repository m-castro2/godot_mips, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/m-castro2/godot_mips
- Repository: https://github.com/m-castro2/godot_mips

## Overview

##### Main Components

a) Frontend Layer (GUI):
- Main Interface (main.tscn)
- Pipeline Visualization (Pipeline.tscn)
- Instruction Panel
- Menu System
- Component Information Windows

b) Backend Layer (MIPS Simulator):
- Pipeline Stages
- Register Management
- Instruction Processing
- Memory Management

c) Bridge Layer:
- A "GDExtension Bridge" component showing how the C++ backend connects to the Godot frontend
- PipelinedWrapper (connection between GUI and simulation)
- Register Types (type definitions and bindings)

##### Component Relationships

- User Interface → GDExtension Bridge (input flow)
- GDExtension Bridge → MIPS Simulation Core (command flow)
- MIPS Simulation Core → GDExtension Bridge (state updates)
- GDExtension Bridge → GUI (visualization updates)

##### Specific Implementation Details

- Pipeline Stages (IF, ID, EX, MEM, WB)
- Test Data Management (testdata directory)
- Resource Management (addons and extensions)

##### Technical Stack Indicators

Technology badges or labels for:
- Godot Engine
- GDExtension
- C++ Core
- MIPS Architecture

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph GUI["Godot GUI Layer"]
        direction TB
        MainInterface["Main Interface"]
        PipelineVis["Pipeline Visualization"]
        InstructionPanel["Instruction Panel"]
        MenuSystem["Menu System"]
        InfoWindows["Component Info Windows"]
        StageControl["Stage Control"]
        GlobalSettings["Global Settings"]
        
        subgraph PipelineStages["Pipeline Stages"]
            direction TB
            IF["IF Stage"]
            ID["ID Stage"]
            EX["EX Stage"]
            MEM["MEM Stage"]
            WB["WB Stage"]
        end
    end

    subgraph Bridge["GDExtension Bridge Layer"]
        direction TB
        PipelinedWrapper["Pipelined Wrapper"]
        RegisterTypes["Register Types"]
        CPUExtension["CPU Extension"]
    end

    subgraph Core["MIPS Simulation Core"]
        direction TB
        InstructionProc["Instruction Processing"]
        RegisterMgmt["Register Management"]
        MemoryMgmt["Memory Management"]
        PipelineControl["Pipeline Control"]
    end

    subgraph Support["Support Systems"]
        direction TB
        TestData["Test Data Management"]
        BuildConfig["Build Configuration"]
    end

    %% Relationships
    MainInterface --> PipelinedWrapper
    PipelineVis --> PipelinedWrapper
    InstructionPanel --> PipelinedWrapper
    PipelinedWrapper --> Core
    Core --> PipelinedWrapper
    PipelinedWrapper --> GUI
    RegisterTypes --> Core
    CPUExtension --> PipelinedWrapper

    %% Click Events
    click MainInterface "https://github.com/m-castro2/Godot_Mips/blob/main/GUI/main.tscn"
    click PipelineVis "https://github.com/m-castro2/Godot_Mips/blob/main/GUI/Pipeline.tscn"
    click InstructionPanel "https://github.com/m-castro2/Godot_Mips/blob/main/GUI/InstructionsPanel.tscn"
    click MenuSystem "https://github.com/m-castro2/Godot_Mips/blob/main/GUI/menu.tscn"
    click InfoWindows "https://github.com/m-castro2/Godot_Mips/blob/main/GUI/component_info_window.tscn"
    click PipelineStages "https://github.com/m-castro2/Godot_Mips/tree/main/GUI/stages"
    click IF "https://github.com/m-castro2/Godot_Mips/blob/main/GUI/stages/if_stage.tscn"
    click PipelinedWrapper "https://github.com/m-castro2/Godot_Mips/blob/main/src/PipelinedWrapper.cpp"
    click RegisterTypes "https://github.com/m-castro2/Godot_Mips/blob/main/src/register_types.cpp"
    click TestData "https://github.com/m-castro2/Godot_Mips/tree/main/GUI/testdata"
    click BuildConfig "https://github.com/m-castro2/Godot_Mips/tree/main/SConstruct"
    click CPUExtension "https://github.com/m-castro2/Godot_Mips/blob/main/GUI/bin/cpu_flex.gdextension"
    click GlobalSettings "https://github.com/m-castro2/Godot_Mips/blob/main/GUI/globals.gd"
    click StageControl "https://github.com/m-castro2/Godot_Mips/blob/main/GUI/stage_control.gd"

    %% Styling
    classDef gui fill:#3498db,stroke:#2980b9,color:white
    classDef bridge fill:#f1c40f,stroke:#f39c12,color:black
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef support fill:#95a5a6,stroke:#7f8c8d,color:white

    class MainInterface,PipelineVis,InstructionPanel,MenuSystem,InfoWindows,StageControl,GlobalSettings,PipelineStages,IF,ID,EX,MEM,WB gui
    class PipelinedWrapper,RegisterTypes,CPUExtension bridge
    class InstructionProc,RegisterMgmt,MemoryMgmt,PipelineControl core
    class TestData,BuildConfig support
```
