Project Info / 项目信息
- Author / 作者: Haoyu Tang (汤皓宇)
- University / 学校: Tongji University (同济大学)
- Major / 专业: Information Security (信息安全)
- Course / 课程: Digital Logic (2024) - Final Project (数字逻辑课程大作业)
[English] A FPGA-based 3D graphics rendering engine that visualizes rotating polyhedrons on an OLED display. The rotation is controlled in real-time by an external L3G4200D gyroscope sensor. This project demonstrates hardware-accelerated geometry processing, sensor data fusion, and display driving using Verilog.
[中文] 基于 FPGA 的 3D 图形渲染引擎,可在 OLED 显示屏上可视化旋转的多面体。旋转角度由外部 L3G4200D 陀螺仪传感器实时控制。本项目演示了使用 Verilog 实现硬件加速几何处理、传感器数据融合和显示驱动。
-
Real-time 3D Rendering: Implements a complete 3D pipeline including vertex rotation (using Euler angles) and isometric projection.
-
Sensor Integration: Reads angular velocity from L3G4200D via SPI and performs integration to calculate attitude.
-
Hardware Acceleration: Utilizes Xilinx CORDIC and Floating-Point IP cores for high-performance geometric calculations.
-
OLED Display: Drives an SSD1331 Color OLED (96x64) to draw wireframe models.
-
Interactive Control:
- Rotate the physical sensor to rotate the 3D model on screen.
- Switch between different polyhedrons (Hexahedron, Octahedron, Icosahedron, etc.) via button input.
-
Debug Output: Displays raw sensor data or angles on 7-segment displays.
-
实时 3D 渲染:实现了包括顶点旋转(使用欧拉角)和等轴投影在内的完整 3D 流水线。
-
传感器集成:通过 SPI 读取 L3G4200D 角速度并进行积分以计算姿态。
-
硬件加速:利用 Xilinx CORDIC 和浮点 IP 核进行高性能几何计算。
-
OLED 显示:驱动 SSD1331 彩色 OLED (96x64) 绘制线框模型。
-
交互控制:
- 转动物理传感器以旋转屏幕上的 3D 模型。
- 通过按键输入在不同多面体(六面体、八面体、二十面体等)之间切换。
-
调试输出:在数码管上显示原始传感器数据或角度。
- FPGA Board: Xilinx Artix-7 Series or compatible (Project relies on Xilinx IP cores).
- Display: SSD1331 SPI OLED Module (96x64 RGB).
- Sensor: L3G4200D 3-Axis Gyroscope Module.
- Peripherals:
- 7-Segment Display (for debugging).
- Buttons/Switches (Reset, Shape Switch).
| Module / 模块 | Description / 描述 |
|---|---|
kpv_top.v |
Top Module. Instantiates and connects all sub-modules. 顶层模块。实例化并连接所有子模块。 |
l3g4200d_interface.v |
SPI Master interface for L3G4200D gyroscope. Handles initialization and data reading. L3G4200D 陀螺仪的 SPI 主机接口。处理初始化和数据读取。 |
attitude_estimator.v |
Integrates angular velocity data to estimate current orientation (Euler angles). Handles zero-rate bias thresholding. 对角速度数据进行积分以估计当前方向(欧拉角)。处理零偏阈值。 |
polyhedron_data.v |
Database of 3D vertices for supported polyhedrons. 支持的多面体的 3D 顶点数据库。 |
isometric_transform.v |
Geometry Engine. Rotates 3D points using CORDIC and projects them to 2D screen coordinates. 几何引擎。使用 CORDIC 旋转 3D 点并将其投影到 2D 屏幕坐标。 |
graphic_engine.v |
Rendering Engine. Controls the drawing state machine, fetching edges and sending draw commands to the display driver. 渲染引擎。控制绘制状态机,获取边并向显示驱动发送绘制命令。 |
ssd1331_driver.v |
SPI Driver for SSD1331 OLED. Supports hardware acceleration commands (Draw Line, Clear Window). SSD1331 OLED 的 SPI 驱动。支持硬件加速命令(画线、清窗)。 |
clk_div.v / spi_clk_generator.v |
Clock management and generation for SPI interfaces. SPI 接口的时钟管理和生成。 |
- IDE: Xilinx Vivado (Tested on 2016.2).
- Language: Verilog HDL.
- Simulation: Vivado Simulator.
-
Open the project in Xilinx Vivado.
-
Generate Bitstream.
-
Connect the L3G4200D sensor and SSD1331 OLED to the FPGA pins as defined in the constraints file.
-
Program the FPGA.
-
Ensure the sensor is stationary during the initial reset to calibrate (if auto-calibration is implemented) or simply reset to start.
-
在 Xilinx Vivado 中打开项目。
-
生成比特流 (Generate Bitstream)。
-
按照约束文件中的定义,将 L3G4200D 传感器和 SSD1331 OLED 连接到 FPGA 引脚。
-
烧录 FPGA。
-
确保传感器在初始复位期间保持静止。
Note: This README was automatically generated by an AI assistant based on the project source code. 备注:本 README 由 AI 助手根据项目源代码自动生成。