# valmyr/img2col architecture

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

- Interactive diagram: https://gitdiagram.com/valmyr/img2col
- Repository: https://github.com/valmyr/img2col

## Overview

Este pequeno RTL implementa um único estágio de pré-processamento Im2Col: aceita uma janela de imagem, extrai patches em paralelo e apresenta a matriz resultante com handshake. Os nós internos representam responsabilidades descritas no README, não módulos separados; as relações seguem apenas a documentação, pois não havia trechos de código disponíveis.

Main entry points: [`rtl/im2col.sv`](https://github.com/valmyr/img2col/blob/main/rtl/im2col.sv) (Control FSM)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_producer(("Image Producer"))
node_core["Im2Col Core<br/>[im2col.sv]"]
node_fsm["Control FSM<br/>[im2col.sv]"]
node_extractor["Parallel Extraction<br/>[im2col.sv]"]
node_matrix["Output Matrix<br/>[im2col.sv]"]
node_consumer(("Result Consumer"))

node_producer -->|"supplies image"| node_core
node_core -->|"accepts handshake"| node_fsm
node_fsm -->|"advances scan"| node_extractor
node_extractor -->|"provides patches"| node_matrix
node_fsm -->|"writes patches"| node_matrix
node_matrix -->|"delivers result"| node_consumer
node_consumer -->|"acknowledges result"| node_core

click node_core "https://github.com/valmyr/img2col/blob/main/rtl/im2col.sv"
click node_fsm "https://github.com/valmyr/img2col/blob/main/rtl/im2col.sv"
click node_extractor "https://github.com/valmyr/img2col/blob/main/rtl/im2col.sv"
click node_matrix "https://github.com/valmyr/img2col/blob/main/rtl/im2col.sv"

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_producer,node_consumer toneIndigo
class node_core,node_fsm,node_extractor,node_matrix toneTeal
```

## Components

### Other components

- **Image Producer**
- [Im2Col Core](https://github.com/valmyr/img2col/blob/main/rtl/im2col.sv): `rtl/im2col.sv`
- [Control FSM](https://github.com/valmyr/img2col/blob/main/rtl/im2col.sv): `rtl/im2col.sv`
- [Parallel Extraction](https://github.com/valmyr/img2col/blob/main/rtl/im2col.sv): `rtl/im2col.sv`
- [Output Matrix](https://github.com/valmyr/img2col/blob/main/rtl/im2col.sv): `rtl/im2col.sv`
- **Result Consumer**

## Connections

- Image Producer → Im2Col Core: supplies image
- Im2Col Core → Control FSM: accepts handshake
- Control FSM → Parallel Extraction: advances scan
- Parallel Extraction → Output Matrix: provides patches
- Control FSM → Output Matrix: writes patches
- Output Matrix → Result Consumer: delivers result
- Result Consumer → Im2Col Core: acknowledges result
