# ygbzyem/tdm-4---channel-multiplerxer-demultiplexer architecture

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

- Interactive diagram: https://gitdiagram.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer
- Repository: https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer

## Overview

This repository implements a fixed, counter-driven four-channel TDM RTL datapath and a Python reference-and-check workflow. The main runtime path serializes four input bytes onto one wire, then reconstructs them into channel outputs; the shared counter and top-level timing glue coordinate both sides. The verification branch compares RTL simulation outputs, stream bits, and measured latency against the Python model, then produces reports and an optional workbook. RTL wiring follows the README’s explicit block diagram; Python connections use the shown imports and calls. RTL implementation details beyond the README were not sampled.

Main entry points: [`golden_model/compare_output.py`](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/compare_output.py) (RTL Comparison), [`src/tdm_top.v`](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_top.v) (Timing Glue), [`src/tdm_mux.v`](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_mux.v) (Channel Mux), [`src/tdm_demux.v`](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_demux.v) (Channel Demux)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rtl["TDM RTL"]
  node_counter["Timing Counter<br/>[tdm_counter.v]"]
  node_top["Timing Glue<br/>[tdm_top.v]"]
  node_mux["Channel Mux<br/>[tdm_mux.v]"]
  node_tx["TX Shift Register<br/>[tx_shift_reg.v]"]
  node_wire["TDM Data Wire<br/>[tdm_top.v]"]
  node_rx["RX Shift Register<br/>[rx_shift_reg.v]"]
  node_demux["Channel Demux<br/>[tdm_demux.v]"]
end

subgraph group_model["Reference Model"]
  node_golden["Golden Model<br/>[golden_model.py]"]
end

subgraph group_verification["Verification"]
  node_compare["RTL Comparison<br/>[compare_output.py]"]
  node_runner["Verification Runner"]
  node_timing["Frame Check<br/>[timing_checker.py]"]
  node_latency["Latency Check<br/>[latency_checker.py]"]
  node_report["Report Writer"]
  node_workbook["Workbook Export<br/>[export_excel.py]"]
end

node_input(("Channel Inputs"))
node_outputs(("Channel Outputs"))

node_input -->|"supplies bytes"| node_mux
node_counter -->|"provides timing"| node_top
node_top -->|"selects channel"| node_mux
node_mux -->|"feeds byte"| node_tx
node_tx -->|"serializes onto"| node_wire
node_wire -->|"feeds serial data"| node_rx
node_rx -->|"provides completed byte"| node_demux
node_top -->|"aligns channel selection"| node_demux
node_demux -->|"updates channels"| node_outputs
node_runner -->|"runs comparison"| node_compare
node_compare -->|"computes expected results"| node_golden
node_compare -->|"checks frame length"| node_timing
node_compare -->|"checks measured latency"| node_latency
node_compare -->|"writes report"| node_report
node_compare -->|"exports workbook"| node_workbook

click node_counter "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_counter.v"
click node_top "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_top.v"
click node_mux "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_mux.v"
click node_tx "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tx_shift_reg.v"
click node_wire "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_top.v"
click node_rx "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/rx_shift_reg.v"
click node_demux "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_demux.v"
click node_golden "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/golden_model.py"
click node_compare "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/compare_output.py"
click node_runner "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/run_verification.py"
click node_timing "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/timing_checker.py"
click node_latency "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/latency_checker.py"
click node_report "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/report_generator.py"
click node_workbook "https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/export_excel.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_counter,node_top,node_mux,node_tx,node_wire,node_rx,node_demux toneBlue
class node_golden toneAmber
class node_compare,node_runner,node_timing,node_latency,node_report,node_workbook toneMint
class node_input,node_outputs toneIndigo
```

## Components

### TDM RTL

- [Timing Counter](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_counter.v): `src/tdm_counter.v`
- [Timing Glue](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_top.v): `src/tdm_top.v`
- [Channel Mux](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_mux.v): `src/tdm_mux.v`
- [TX Shift Register](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tx_shift_reg.v): `src/tx_shift_reg.v`
- [TDM Data Wire](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_top.v): `src/tdm_top.v`
- [RX Shift Register](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/rx_shift_reg.v): `src/rx_shift_reg.v`
- [Channel Demux](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/src/tdm_demux.v): `src/tdm_demux.v`

### Reference Model

- [Golden Model](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/golden_model.py): `golden_model/golden_model.py`

### Verification

- [RTL Comparison](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/compare_output.py): `golden_model/compare_output.py`
- [Verification Runner](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/run_verification.py): `golden_model/run_verification.py`
- [Frame Check](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/timing_checker.py): `golden_model/timing_checker.py`
- [Latency Check](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/latency_checker.py): `golden_model/latency_checker.py`
- [Report Writer](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/report_generator.py): `golden_model/report_generator.py`
- [Workbook Export](https://github.com/ygbzyem/tdm-4---channel-multiplerxer-demultiplexer/blob/main/golden_model/export_excel.py): `golden_model/export_excel.py`

### Other components

- **Channel Inputs**
- **Channel Outputs**

## Connections

- Channel Inputs → Channel Mux: supplies bytes (evidence: `README.md`)
- Timing Counter → Timing Glue: provides timing (evidence: `README.md`)
- Timing Glue → Channel Mux: selects channel (evidence: `README.md`)
- Channel Mux → TX Shift Register: feeds byte (evidence: `README.md`)
- TX Shift Register → TDM Data Wire: serializes onto (evidence: `README.md`)
- TDM Data Wire → RX Shift Register: feeds serial data (evidence: `README.md`)
- RX Shift Register → Channel Demux: provides completed byte (evidence: `README.md`)
- Timing Glue → Channel Demux: aligns channel selection (evidence: `README.md`)
- Channel Demux → Channel Outputs: updates channels (evidence: `README.md`)
- Verification Runner → RTL Comparison: runs comparison (evidence: `golden_model/run_verification.py`)
- RTL Comparison → Golden Model: computes expected results (evidence: `golden_model/compare_output.py`)
- RTL Comparison → Frame Check: checks frame length (evidence: `golden_model/compare_output.py`)
- RTL Comparison → Latency Check: checks measured latency (evidence: `golden_model/compare_output.py`)
- RTL Comparison → Report Writer: writes report (evidence: `golden_model/compare_output.py`)
- RTL Comparison → Workbook Export: exports workbook (evidence: `golden_model/compare_output.py`)
