# glaciens/galaga architecture

> Architecture diagram of the GitHub repository glaciens/galaga, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/glaciens/galaga
- Repository: https://github.com/glaciens/galaga

## Overview

Galaga is an FPGA implementation of the classic arcade game. The apparent user-to-result workflow is player input driving game state and enemy behavior, followed by VGA rendering of gameplay and score. The tree shows modules for menus, levels, sprites, and display, but README.md contains no capability details and the sampled source is generated Vivado run tooling, not game RTL. Accordingly, subsystem links below are dashed and unverified; the implementation relationships were not inspected.

Main entry points: [`Galaga.srcs/sources_1/new/Galaga.v`](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/Galaga.v) (Game top level), [`Galaga.srcs/sources_1/new/enemy_movement.v`](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/enemy_movement.v) (Enemy behavior), [`Galaga.srcs/sources_1/new/PS2_Ctrl.v`](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/PS2_Ctrl.v) (PS/2 controls), [`Galaga.srcs/sources_1/new/mouse.v`](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/mouse.v) (Mouse input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game logic"]
  node_player["Player and ship<br/>[player.v]"]
  node_enemies["Enemy behavior<br/>[enemy_movement.v]"]
  node_enemytypes["Enemy types<br/>[bee.v]"]
  node_level["Level data<br/>[level.v]"]
  node_score["Score and lives<br/>[score.v]"]
  node_menu["Menu<br/>[menu.v]"]
  node_game["Game top level<br/>[Galaga.v]"]
end

subgraph group_controls["Player controls"]
  node_input["PS/2 controls<br/>[PS2_Ctrl.v]"]
  node_mouse["Mouse input<br/>[mouse.v]"]
end

subgraph group_display["Video and graphics"]
  node_vga["VGA output<br/>[VGA1024.v]"]
  node_rgb["RGB conversion<br/>[RGB_Converter.v]"]
  node_background["Background<br/>[background.v]"]
  node_stars["Star field<br/>[stars.v]"]
  node_sprites["Sprite assets"]
end

subgraph group_platform["FPGA platform"]
  node_clock["Clock tree<br/>[ClkTree.v]"]
  node_board["ZYBO board<br/>[hw.xml]"]
end

node_user(("Player"))

node_user -.->|"sends controls"| node_input
node_user -.->|"sends input"| node_mouse
node_game -.->|"uses controls"| node_input
node_game -.->|"uses input"| node_mouse
node_game -.->|"updates state"| node_player
node_game -.->|"updates enemies"| node_enemies
node_game -.->|"loads levels"| node_level
node_game -.->|"updates score"| node_score
node_game -.->|"uses menu"| node_menu
node_enemies -.->|"moves enemies"| node_enemytypes
node_game -.->|"renders scene"| node_background
node_game -.->|"renders stars"| node_stars
node_game -.->|"uses sprites"| node_sprites
node_game -.->|"provides color"| node_rgb
node_game -.->|"drives display"| node_vga
node_game -.->|"uses timing"| node_clock
node_board -.->|"hosts design"| node_game

click node_player "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/player.v"
click node_enemies "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/enemy_movement.v"
click node_enemytypes "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/bee.v"
click node_level "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/level.v"
click node_score "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/score.v"
click node_menu "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/menu.v"
click node_input "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/PS2_Ctrl.v"
click node_mouse "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/mouse.v"
click node_game "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/Galaga.v"
click node_clock "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/ClkTree.v"
click node_vga "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/VGA1024.v"
click node_rgb "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/RGB_Converter.v"
click node_background "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/background.v"
click node_stars "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/stars.v"
click node_sprites "https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/PlayerShipSprite.txt"
click node_board "https://github.com/glaciens/galaga/blob/main/Galaga.hw/hw_1/hw.xml"

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_player,node_enemies,node_enemytypes,node_level,node_score,node_menu,node_game toneBlue
class node_input,node_mouse toneAmber
class node_vga,node_rgb,node_background,node_stars,node_sprites toneMint
class node_clock,node_board toneRose
class node_user toneIndigo
```

## Components

### Game logic

- [Player and ship](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/player.v): `Galaga.srcs/sources_1/new/player.v`
- [Enemy behavior](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/enemy_movement.v): `Galaga.srcs/sources_1/new/enemy_movement.v`
- [Enemy types](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/bee.v): `Galaga.srcs/sources_1/new/bee.v`
- [Level data](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/level.v): `Galaga.srcs/sources_1/new/level.v`
- [Score and lives](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/score.v): `Galaga.srcs/sources_1/new/score.v`
- [Menu](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/menu.v): `Galaga.srcs/sources_1/new/menu.v`
- [Game top level](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/Galaga.v): `Galaga.srcs/sources_1/new/Galaga.v`

### Player controls

- [PS/2 controls](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/PS2_Ctrl.v): `Galaga.srcs/sources_1/new/PS2_Ctrl.v`
- [Mouse input](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/mouse.v): `Galaga.srcs/sources_1/new/mouse.v`

### Video and graphics

- [VGA output](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/VGA1024.v): `Galaga.srcs/sources_1/new/VGA1024.v`
- [RGB conversion](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/RGB_Converter.v): `Galaga.srcs/sources_1/new/RGB_Converter.v`
- [Background](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/background.v): `Galaga.srcs/sources_1/new/background.v`
- [Star field](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/stars.v): `Galaga.srcs/sources_1/new/stars.v`
- [Sprite assets](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/PlayerShipSprite.txt): `Galaga.srcs/sources_1/new/PlayerShipSprite.txt`

### FPGA platform

- [Clock tree](https://github.com/glaciens/galaga/blob/main/Galaga.srcs/sources_1/new/ClkTree.v): `Galaga.srcs/sources_1/new/ClkTree.v`
- [ZYBO board](https://github.com/glaciens/galaga/blob/main/Galaga.hw/hw_1/hw.xml): `Galaga.hw/hw_1/hw.xml`

### Other components

- **Player**

## Connections

- Player → PS/2 controls: sends controls
- Player → Mouse input: sends input
- Game top level → PS/2 controls: uses controls
- Game top level → Mouse input: uses input
- Game top level → Player and ship: updates state
- Game top level → Enemy behavior: updates enemies
- Game top level → Level data: loads levels
- Game top level → Score and lives: updates score
- Game top level → Menu: uses menu
- Enemy behavior → Enemy types: moves enemies
- Game top level → Background: renders scene
- Game top level → Star field: renders stars
- Game top level → Sprite assets: uses sprites
- Game top level → RGB conversion: provides color
- Game top level → VGA output: drives display
- Game top level → Clock tree: uses timing
- ZYBO board → Game top level: hosts design
