# wudiudiu07/3dq5-lab architecture

> Architecture diagram of the GitHub repository wudiudiu07/3dq5-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wudiudiu07/3dq5-lab
- Repository: https://github.com/wudiudiu07/3dq5-lab

## Overview

##### Project type and purpose
- The README explicitly states that the system is a “Hardware Implementation of an Image Decompressor.”
- The file tree reinforces this with directories for labs (lab1, lab2, lab3, lab4, lab5) that cover various aspects of FPGA and digital design (e.g., clock PLL, different controllers, memory interface, VGA output) and a project folder that contains comprehensive milestone implementations.
- This is not a full-stack or a typical software application but a hardware design with multiple subsystems integrated into an FPGA-based image processing pipeline.

##### File structure
- Top-level directories separate experimental labs (lab1, lab2, lab3, etc.) and a final project directory, suggesting both incremental learning and integration into the final system.
- In the lab directories, you see files like “LCD_controller.v”, “PS2_controller.v”, “VGA_Controller.v”, “SRAM_Controller.v”, “UART_Receive_Controller.v”, and clock management modules (PLL implementations). These indicate individual components that have been built and tested separately.
- The project directory (with Milestone1_2 and Milestone3) suggests that the complete system integrates these controllers and additional interface modules (M1_interface.v, M2_interface.v, M3_interface.v) into a cohesive architecture.
- Support files such as simulation scripts (e.g., .do files), testbench files (e.g., tb_SRAM_Emulator.v), and configuration files (e.g., project.qsf) are also present to aid verification and synthesis.

##### README for additional insights
- The README confirms that there are three milestones indicating progressive enhancements or integration points.
- Although brief, it indicates that the focus is on creating a hardware decompression system—likely involving input, decompression processing, memory management, and output display.

##### Main components
- Clock Generation: Multiple PLLs (e.g., Clock_25_PLL.v, Clock_100_PLL.v) supply clock signals to various parts of the system.
- Input Controllers: These include PS2 and pushbutton controllers for user input and control.
- Memory Components: SRAM controllers and interfaces (including dual-port RAM modules) handle image data storage. This is critical for buffering compressed and decompressed image data.
- Video/Display Controller: The VGA_Controller and accompanying parameter/header files (VGA_Param.h) drive the image display.
- UART Components: Modules like UART_Receive_Controller enable external communication, potentially for loading compressed image data or parameters.
- Milestone Interfaces: M1_interface, M2_interface, and M3_interface in the project directories likely represent different functional phases (e.g., data input & preprocessing, decompression logic, output interfacing) of the image decompression process.
- Additional Conversion Modules: Files such as convert_hex_to_seven_segment.v and convert_hex_to_char_rom_address.v indicate supportive logic converting data to a human-readable format—perhaps for debugging or display on an alternative output (LCD).

##### Relationships and interactions
- The Clock Generation block feeds synchronized timing to all other controllers.
- Input controllers (PS2, PB controllers) capture user signals and may trigger processing events.
- The SRAM Controller interacts with memory blocks (dual port RAM modules) to store the compressed input and then to provide data for decompression.
- The Milestone interface modules serve as bridges between raw data handling and the actual decompression logic (not explicitly described but implied by the progressive milestones).
- The decompressed image data is then passed to the VGA Controller, which drives a display output.
- UART components might be used for configuration or uploading new image/parameter data into the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Clock
    A["Clock Generation\n(Clock_100_PLL.v)"]:::clock

    %% Input Controllers Subgraph
    subgraph "Input Controllers"
        B["PS2 Input Controller\n(PS2_controller.v)"]:::input
        C["Pushbutton Controller\n(PB_Controller.v)"]:::input
    end

    %% Memory Interface Subgraph
    subgraph "Memory Interface"
        D["SRAM Memory Interface\n(SRAM_Controller.v)"]:::memory
    end

    %% Processing Modules Subgraph
    subgraph "Processing Modules"
        E["M1 Interface\n(M1_interface.v)"]:::processing
        F["M2 Interface\n(M2_interface.v)"]:::processing
        G["M3 Interface\n(M3_interface.v)"]:::processing
        H["Seven-Segment Converter\n(convert_hex_to_seven_segment.v)"]:::conversion
        I["Char ROM Addr Converter\n(convert_hex_to_char_rom_address.v)"]:::conversion
    end

    %% Output Controllers Subgraph
    subgraph "Output Controllers"
        J["Video Controller\n(VGA_Controller.v)"]:::output
        K["UART Controller\n(UART_Receive_Controller.v)"]:::output
        L["Video Param Header\n(VGA_Param.h)"]:::output
    end

    %% Connections from Clock to all primary subsystems
    A --> B
    A --> C
    A --> D
    A --> E
    A --> J

    %% Data flow from Input Controllers to Memory
    B --> D
    C --> D

    %% Data flow from Memory to Processing Modules
    D --> E

    %% Sequential flow within Processing Modules
    E --> F
    F --> G

    %% Additional processing support modules connecting to Output
    E --> H
    H --> J
    I --> J

    %% Flow from Processing to Output Controllers
    G --> J
    G --> K

    %% Class Definitions for styling
    classDef clock fill:#DDEEFF,stroke:#0000FF,stroke-width:2px,color:#000;
    classDef input fill:#E0FFE0,stroke:#008000,stroke-width:2px,color:#000;
    classDef memory fill:#FFF4CC,stroke:#FF8C00,stroke-width:2px,color:#000;
    classDef processing fill:#FFE0FF,stroke:#FF00FF,stroke-width:2px,color:#000;
    classDef output fill:#FFDADA,stroke:#FF0000,stroke-width:2px,color:#000;
    classDef conversion fill:#F0F0F0,stroke:#808080,stroke-width:2px,color:#000;

    %% Click Events for component mapping
    click A "https://github.com/wudiudiu07/3dq5-lab/blob/master/project/Milestone1_2/Clock_100_PLL.v"
    click B "https://github.com/wudiudiu07/3dq5-lab/blob/master/lab2/PS2_controller.v"
    click C "https://github.com/wudiudiu07/3dq5-lab/blob/master/lab3/PB_Controller.v"
    click D "https://github.com/wudiudiu07/3dq5-lab/blob/master/project/Milestone1_2/SRAM_Controller.v"
    click E "https://github.com/wudiudiu07/3dq5-lab/blob/master/project/Milestone1_2/M1_interface.v"
    click F "https://github.com/wudiudiu07/3dq5-lab/blob/master/project/Milestone1_2/M2_interface.v"
    click G "https://github.com/wudiudiu07/3dq5-lab/blob/master/project/Milestone3/M3_interface.v"
    click H "https://github.com/wudiudiu07/3dq5-lab/blob/master/project/Milestone1_2/convert_hex_to_seven_segment.v"
    click I "https://github.com/wudiudiu07/3dq5-lab/blob/master/lab3/convert_hex_to_char_rom_address.v"
    click J "https://github.com/wudiudiu07/3dq5-lab/blob/master/project/Milestone1_2/VGA_Controller.v"
    click K "https://github.com/wudiudiu07/3dq5-lab/blob/master/project/Milestone1_2/UART_Receive_Controller.v"
    click L "https://github.com/wudiudiu07/3dq5-lab/blob/master/project/Milestone1_2/VGA_Param.h"
```
