# hawayswei/fpga-g6-final architecture

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

- Interactive diagram: https://gitdiagram.com/hawayswei/fpga-g6-final
- Repository: https://github.com/hawayswei/fpga-g6-final

## Overview

This is a Verilog FPGA wearable-care project for PYNQ-Z2. The principal documented flow samples arm-worn acceleration, detects a fall, asks whether the wearer is OK, then alarms and notifies a phone over Bluetooth unless cancelled; temperature alerts and manual SOS are additional capabilities. The repository is described as an evolving skeleton, and no OLED RTL directory appears in the tree. Hardware connections below rely on README-level descriptions; sampled Python sources establish the trial-analysis/model relationships, not unsampled RTL calls.

Main entry points: [`rtl/ctrl/ctrl_guardian_fsm.v`](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/ctrl/ctrl_guardian_fsm.v) (Control FSM), [`rtl/top/guardian_top.v`](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/top/guardian_top.v) (System Top), [`rtl/accel/acl_adxl362_ctrl.v`](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/accel/acl_adxl362_ctrl.v) (Accelerometer Interface), [`rtl/fall/fall_detect.v`](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/fall/fall_detect.v) (Fall Detection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensors"]
  node_accel["Accelerometer Interface<br/>[acl_adxl362_ctrl.v]"]
  node_spi["SPI Master<br/>[acl_spi_master.v]"]
  node_temp["Temperature Reader<br/>[tmp_tmp3_reader.v]"]
end

subgraph group_decision["Fall and Control"]
  node_fall["Fall Detection<br/>[fall_detect.v]"]
  node_params["Fall Parameters<br/>[fall_param_lut.v]"]
  node_guardian["System Top<br/>[guardian_top.v]"]
  node_control["Control FSM"]
  node_button["Button Input<br/>[ctrl_button.v]"]
  node_heartbeat["Heartbeat<br/>[ctrl_heartbeat.v]"]
end

subgraph group_response["User Alert and Phone"]
  node_oled["OLED Prompt"]
  node_bluetooth["Bluetooth Command Parser<br/>[bt_cmd_parser.v]"]
  node_bt_rx["Bluetooth UART Receive<br/>[bt_uart_rx.v]"]
  node_bt_tx["Bluetooth Message Transmit<br/>[bt_msg_tx.v]"]
end

subgraph group_analysis["Trial Analysis"]
  node_trial_analysis["Trial Analyzer<br/>[analyze_trials.py]"]
  node_fall_model["Python Fall Model<br/>[fall_model.py]"]
  node_trial_csv["Recorded Trial CSVs"]
  node_report["Analysis Report"]
end

node_wearer(("Wearer"))
node_phone(("Phone"))

node_accel -.->|"reads via"| node_spi
node_guardian -->|"integrates"| node_accel
node_guardian -->|"integrates"| node_temp
node_guardian -->|"integrates"| node_fall
node_guardian -->|"integrates"| node_control
node_guardian -.->|"integrates"| node_oled
node_guardian -.->|"integrates"| node_bt_tx
node_wearer -->|"wears"| node_accel
node_wearer -->|"wears"| node_temp
node_accel -->|"provides samples"| node_fall
node_params -.->|"sets thresholds"| node_fall
node_temp -.->|"signals abnormality"| node_control
node_fall -->|"signals fall"| node_control
node_button -.->|"provides input"| node_control
node_control -->|"requests confirmation"| node_oled
node_wearer -->|"cancels or requests SOS"| node_button
node_control -->|"triggers alarm"| node_bt_tx
node_phone -->|"sends settings"| node_bt_rx
node_bt_rx -.->|"delivers commands"| node_bluetooth
node_bluetooth -->|"sets mode and height"| node_control
node_bt_tx -->|"notifies"| node_phone
node_trial_csv -->|"supplies samples"| node_trial_analysis
node_trial_analysis -->|"replays detector"| node_fall_model
node_trial_analysis -->|"writes statistics and plots"| node_report

click node_accel "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/accel/acl_adxl362_ctrl.v"
click node_spi "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/accel/acl_spi_master.v"
click node_temp "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/temp/tmp_tmp3_reader.v"
click node_fall "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/fall/fall_detect.v"
click node_params "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/fall/fall_param_lut.v"
click node_guardian "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/top/guardian_top.v"
click node_control "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/ctrl/ctrl_guardian_fsm.v"
click node_button "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/ctrl/ctrl_button.v"
click node_heartbeat "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/ctrl/ctrl_heartbeat.v"
click node_bluetooth "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/bluetooth/bt_cmd_parser.v"
click node_bt_rx "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/bluetooth/bt_uart_rx.v"
click node_bt_tx "https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/bluetooth/bt_msg_tx.v"
click node_trial_analysis "https://github.com/hawayswei/fpga-g6-final/blob/main/tools/analyze_trials.py"
click node_fall_model "https://github.com/hawayswei/fpga-g6-final/blob/main/tools/fall_model.py"

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_accel,node_spi,node_temp toneBlue
class node_fall,node_params,node_guardian,node_control,node_button,node_heartbeat toneAmber
class node_oled,node_bluetooth,node_bt_rx,node_bt_tx toneMint
class node_trial_analysis,node_fall_model,node_trial_csv,node_report toneRose
class node_wearer,node_phone toneIndigo
```

## Components

### Sensors

- [Accelerometer Interface](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/accel/acl_adxl362_ctrl.v): `rtl/accel/acl_adxl362_ctrl.v`
- [SPI Master](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/accel/acl_spi_master.v): `rtl/accel/acl_spi_master.v`
- [Temperature Reader](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/temp/tmp_tmp3_reader.v): `rtl/temp/tmp_tmp3_reader.v`

### Fall and Control

- [Fall Detection](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/fall/fall_detect.v): `rtl/fall/fall_detect.v`
- [Fall Parameters](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/fall/fall_param_lut.v): `rtl/fall/fall_param_lut.v`
- [System Top](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/top/guardian_top.v): `rtl/top/guardian_top.v`
- [Control FSM](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/ctrl/ctrl_guardian_fsm.v): `rtl/ctrl/ctrl_guardian_fsm.v`
- [Button Input](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/ctrl/ctrl_button.v): `rtl/ctrl/ctrl_button.v`
- [Heartbeat](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/ctrl/ctrl_heartbeat.v): `rtl/ctrl/ctrl_heartbeat.v`

### User Alert and Phone

- **OLED Prompt**
- [Bluetooth Command Parser](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/bluetooth/bt_cmd_parser.v): `rtl/bluetooth/bt_cmd_parser.v`
- [Bluetooth UART Receive](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/bluetooth/bt_uart_rx.v): `rtl/bluetooth/bt_uart_rx.v`
- [Bluetooth Message Transmit](https://github.com/hawayswei/fpga-g6-final/blob/main/rtl/bluetooth/bt_msg_tx.v): `rtl/bluetooth/bt_msg_tx.v`

### Trial Analysis

- [Trial Analyzer](https://github.com/hawayswei/fpga-g6-final/blob/main/tools/analyze_trials.py): `tools/analyze_trials.py`
- [Python Fall Model](https://github.com/hawayswei/fpga-g6-final/blob/main/tools/fall_model.py): `tools/fall_model.py`
- **Recorded Trial CSVs**
- **Analysis Report**

### Other components

- **Wearer**
- **Phone**

## Connections

- Accelerometer Interface → SPI Master: reads via
- System Top → Accelerometer Interface: integrates (evidence: `README.md`)
- System Top → Temperature Reader: integrates (evidence: `README.md`)
- System Top → Fall Detection: integrates (evidence: `README.md`)
- System Top → Control FSM: integrates (evidence: `README.md`)
- System Top → OLED Prompt: integrates (evidence: `README.md`)
- System Top → Bluetooth Message Transmit: integrates (evidence: `README.md`)
- Wearer → Accelerometer Interface: wears (evidence: `README.md`)
- Wearer → Temperature Reader: wears (evidence: `README.md`)
- Accelerometer Interface → Fall Detection: provides samples (evidence: `README.md`)
- Fall Parameters → Fall Detection: sets thresholds
- Temperature Reader → Control FSM: signals abnormality (evidence: `README.md`)
- Fall Detection → Control FSM: signals fall (evidence: `README.md`)
- Button Input → Control FSM: provides input (evidence: `README.md`)
- Control FSM → OLED Prompt: requests confirmation (evidence: `README.md`)
- Wearer → Button Input: cancels or requests SOS (evidence: `README.md`)
- Control FSM → Bluetooth Message Transmit: triggers alarm (evidence: `README.md`)
- Phone → Bluetooth UART Receive: sends settings (evidence: `README.md`)
- Bluetooth UART Receive → Bluetooth Command Parser: delivers commands
- Bluetooth Command Parser → Control FSM: sets mode and height (evidence: `README.md`)
- Bluetooth Message Transmit → Phone: notifies (evidence: `README.md`)
- Recorded Trial CSVs → Trial Analyzer: supplies samples (evidence: `tools/analyze_trials.py`)
- Trial Analyzer → Python Fall Model: replays detector (evidence: `tools/analyze_trials.py`)
- Trial Analyzer → Analysis Report: writes statistics and plots (evidence: `tools/analyze_trials.py`)
