
# LAB2 Project Presentation

## Project Description

The LAB2 project consists of the design and implementation of a digital system for image processing and data communication. The system is composed of several functional blocks, each responsible for a specific task in the processing pipeline. The main objectives are:

- Receive and process image data
- Perform color space conversion (e.g., RGB to grayscale)
- Apply convolution filters to the image
- Packetize the processed data for transmission
- Support loopback and test modes for verification

## Block Diagram

Below is a conceptual block diagram of the LAB2 system:

```mermaid
flowchart LR
    IN[PC] -.-> UART[UART]
    UART -.-> IN
    UART --> DEPACK[Depack]
    DEPACK --> C2G[Color to Grayscale Converter]
    C2G --> BRAM[BRAM Writer]
    BRAM --> Underflow
    BRAM -->Overflow
    BRAM -->Ok
    BRAM <-.-> CONV[Convolution Filter]
    BRAM <-.-> CONV
    CONV --> PACK[Packetizer]
    PACK --> UART
```

## Areas for Improvement

- In loopback mode, when sending an empty packet (FFF1), the module temporarily stores H and F and prepends them to the header of the next packet. There is an error in the pack/depack logic.
- The implementation of the depacketizer is complex, and the precise error has not been identified.
- The color conversion (C2G) uses a divider by 3, but the approximation method is unclear (it sums half of the power-of-two factor used in the divider—why?). -> Just add comments explainig how it works
- Convolution is performed with various unconstrained integers.
- In general, the VHDL code is somewhat complex, although generally correct. Aim to simplify and make the code more readable.