# drewbabel/fifo architecture

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

- Interactive diagram: https://gitdiagram.com/drewbabel/fifo
- Repository: https://github.com/drewbabel/fifo

## Overview

This repository provides configurable synchronous and asynchronous FIFO hardware in SystemVerilog. Its main workflow is writing and reading queued data; the asynchronous design adds separate write/read pointer logic and Gray-coded pointer synchronization across clock domains. The README documents these building blocks, but no RTL excerpts were available, so the internal connections below are documented relationships rather than inspected call or instantiation sites.

Main entry points: [`rtl/async_fifo.sv`](https://github.com/drewbabel/fifo/blob/main/rtl/async_fifo.sv) (Async FIFO), [`rtl/wptr_full.sv`](https://github.com/drewbabel/fifo/blob/main/rtl/wptr_full.sv) (Write Pointer), [`rtl/rptr_empty.sv`](https://github.com/drewbabel/fifo/blob/main/rtl/rptr_empty.sv) (Read Pointer), [`rtl/fifomem.sv`](https://github.com/drewbabel/fifo/blob/main/rtl/fifomem.sv) (Dual-Port Memory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fifo["FIFO Interfaces"]
  node_sync_fifo["Sync FIFO<br/>[sync_fifo.sv]"]
  node_async_fifo["Async FIFO<br/>[async_fifo.sv]"]
end

subgraph group_control["Pointer Control"]
  node_wptr_full["Write Pointer<br/>[wptr_full.sv]"]
  node_rptr_empty["Read Pointer<br/>[rptr_empty.sv]"]
end

subgraph group_cdc["Storage And CDC"]
  node_fifomem["Dual-Port Memory<br/>[fifomem.sv]"]
  node_synchronizer["Pointer Synchronizer<br/>[synchronizer.sv]"]
end

node_async_fifo -.->|"manages writes"| node_wptr_full
node_async_fifo -.->|"manages reads"| node_rptr_empty
node_async_fifo -.->|"uses memory"| node_fifomem
node_async_fifo -.->|"crosses domains"| node_synchronizer

click node_sync_fifo "https://github.com/drewbabel/fifo/blob/main/rtl/sync_fifo.sv"
click node_async_fifo "https://github.com/drewbabel/fifo/blob/main/rtl/async_fifo.sv"
click node_wptr_full "https://github.com/drewbabel/fifo/blob/main/rtl/wptr_full.sv"
click node_rptr_empty "https://github.com/drewbabel/fifo/blob/main/rtl/rptr_empty.sv"
click node_fifomem "https://github.com/drewbabel/fifo/blob/main/rtl/fifomem.sv"
click node_synchronizer "https://github.com/drewbabel/fifo/blob/main/rtl/synchronizer.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_sync_fifo,node_async_fifo toneBlue
class node_wptr_full,node_rptr_empty toneAmber
class node_fifomem,node_synchronizer toneMint
```

## Components

### FIFO Interfaces

- [Sync FIFO](https://github.com/drewbabel/fifo/blob/main/rtl/sync_fifo.sv): `rtl/sync_fifo.sv`
- [Async FIFO](https://github.com/drewbabel/fifo/blob/main/rtl/async_fifo.sv): `rtl/async_fifo.sv`

### Pointer Control

- [Write Pointer](https://github.com/drewbabel/fifo/blob/main/rtl/wptr_full.sv): `rtl/wptr_full.sv`
- [Read Pointer](https://github.com/drewbabel/fifo/blob/main/rtl/rptr_empty.sv): `rtl/rptr_empty.sv`

### Storage And CDC

- [Dual-Port Memory](https://github.com/drewbabel/fifo/blob/main/rtl/fifomem.sv): `rtl/fifomem.sv`
- [Pointer Synchronizer](https://github.com/drewbabel/fifo/blob/main/rtl/synchronizer.sv): `rtl/synchronizer.sv`

## Connections

- Async FIFO → Write Pointer: manages writes (evidence: `README.md`)
- Async FIFO → Read Pointer: manages reads (evidence: `README.md`)
- Async FIFO → Dual-Port Memory: uses memory (evidence: `README.md`)
- Async FIFO → Pointer Synchronizer: crosses domains (evidence: `README.md`)
