# ombhilare999/seven-segment-with-tang-primer-fpga architecture

> Architecture diagram of the GitHub repository ombhilare999/seven-segment-with-tang-primer-fpga, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ombhilare999/seven-segment-with-tang-primer-fpga
- Repository: https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga

## Overview

##### Project type and purpose
- This is an FPGA‐based hardware design project targeting the Sipeed Tang Primer board. It implements a Fibonacci number generator in Verilog, drives a seven-segment display through a segment-mapping module, and uses the Tang TD IDE flow to produce a bitstream for the FPGA.

##### File structure
- Top level
- constraint/io.adc – pin assignment file that maps logical signals (segments A–G, digit enables, clock, reset) to the FPGA’s physical I/O pins.
- src/
– Fibonacci_Series.v – synthesizable module that generates successive Fibonacci numbers on each clock tick.
– Seven_Segment.v – driver module that takes a 4-bit value and outputs segment signals for a common-cathode display.
– Fibonacci_Series_TB.v – testbench (top) for behavioral simulation, instantiating both generator and display modules.
- prj/ – Tang TD IDE project artifacts: .al design source, .bit bitstream, synthesis/routing reports (.area, .db), and log files.
- assets/ – images documenting the circuit wiring, physical summary, and demonstration GIF.

##### Extract insights from the README
- Purpose: Demonstrate real-time Fibonacci number display on seven-segment hardware.
- Workflow: Edit Verilog sources → simulate with TB → synthesize & implement with TD IDE using io.adc → program Tang Primer → observe display.
- Hardware: Common-cathode segments wired via 330 Ω resistors to FPGA I/O.

##### Main components and their interactions
a. Verilog Source Layer (src/)
- Fibonacci Generator – clocked process producing 4-bit output.
- Segment Decoder – combinational logic mapping 0–9 to A–G segment patterns.
- Testbench – verifies functionality in simulation.
b. Build/Toolchain Layer (prj/)
- Constraint Parser – imports io.adc for I/O mapping.
- Synthesis & Implementation – produces netlist, runs placement & routing.
- Bitstream Generation – outputs Seven_Segment.bit.
c. Hardware Layer
- FPGA (Tang Primer) – configures with bitstream, hosts logic.
- Seven-Segment Display – common-cathode segments, current limit resistors.
- Clock & Reset – on‐board oscillator and user button or jumper.

Flow:
Verilog sources → (simulate via testbench) → (synthesize & implement with constraints) → bitstream → FPGA configuration → drives segment pins → display hardware.

##### Architectural patterns and design principles
- Separation of Concerns: computation (Fibonacci), presentation (segment decoder), and constraints/toolchain are kept in distinct directories.
- Test-Driven Hardware: dedicated testbench module ensures correctness before synthesis.
- Dataflow style: purely combinational mapping in decoder, sequential logic in generator.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Source & Simulation Layer
    subgraph "Source & Simulation"
        direction TB
        FG["Fibonacci Generator\n(4-bit sequential logic)"]:::source
        SD["Segment Decoder\n(combinational logic)"]:::source
        TB["Testbench\n(behavioral simulation)"]:::source
    end

    %% Toolchain Layer
    subgraph "Toolchain" 
        direction TB
        CON["Constraint Loader\n(io.adc)"]:::tool
        SYN["Synthesis & Implementation\n(TD IDE)"]:::tool
        BIT["Bitstream\n(Seven_Segment.bit)"]:::tool
        subgraph "Reports" 
            direction TB
            R1["Seven_Segment_gate.area"]:::tool
            R2["Seven_Segment_gate.db"]:::tool
            R3["Seven_Segment_phy.area"]:::tool
            R4["Seven_Segment_pr.db"]:::tool
            R5["Seven_Segment_rtl.area"]:::tool
            R6["Seven_Segment_rtl.db"]:::tool
        end
        subgraph "Design Sources" 
            direction TB
            A1["Seven_Segment.al"]:::tool
            A2[".Seven_Segment.al.bak"]:::tool
            A3[".led.al.bak"]:::tool
        end
        subgraph "Logs"
            direction TB
            L1["td_2021-01-03_17-04-28.log"]:::tool
            L2["td_2021-01-03_20-49-33.log"]:::tool
            L3["td_2021-01-04_15-55-37.log"]:::tool
        end
    end

    %% Hardware Layer
    subgraph "Deployment & Hardware"
        direction TB
        FPGA["Tang Primer FPGA"]:::hw
        CLK["Clock & Reset"]:::hw
        RES["Resistor Network"]:::hw
        DISP["Seven-Segment Display\n(common-cathode)"]:::hw
    end

    %% Documentation & Assets
    subgraph "Assets & Docs"
        direction TB
        AS["Hardware Documentation Assets"]:::hw
        RD["README.md"]:::hw
        LI["LICENSE"]:::hw
    end

    %% Connections
    FG -->|" .v → netlist"| SYN
    SD -->|" .v → netlist"| SYN
    CON -->|" .adc → pin map"| SYN
    SYN -->|" .bit → config"| BIT
    BIT --> FPGA
    FPGA -->|"signals A–G, digit enable"| RES
    RES --> DISP
    TB -->|"simulate"| FG
    TB -->|"simulate"| SD
    TB -->|"waveform"| TB

    %% Click Events
    click FG "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/src/Fibonacci_Series.v"
    click SD "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/src/Seven_Segment.v"
    click TB "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/src/Fibonacci_Series_TB.v"
    click CON "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/constraint/io.adc"
    click BIT "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/Seven_Segment.bit"
    click R1 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/Seven_Segment_gate.area"
    click R2 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/Seven_Segment_gate.db"
    click R3 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/Seven_Segment_phy.area"
    click R4 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/Seven_Segment_pr.db"
    click R5 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/Seven_Segment_rtl.area"
    click R6 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/Seven_Segment_rtl.db"
    click A1 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/Seven_Segment.al"
    click A2 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/.Seven_Segment.al.bak"
    click A3 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/.led.al.bak"
    click L1 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/td_2021-01-03_17-04-28.log"
    click L2 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/td_2021-01-03_20-49-33.log"
    click L3 "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/prj/td_2021-01-04_15-55-37.log"
    click AS "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/tree/main/assets/"
    click RD "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/blob/main/README.md"
    click LI "https://github.com/ombhilare999/seven-segment-with-tang-primer-fpga/tree/main/LICENSE"

    %% Styles
    classDef source fill:#e0f7fa,stroke:#0288d1,color:#01579b
    classDef tool fill:#e8f5e9,stroke:#43a047,color:#1b5e20
    classDef hw fill:#fff3e0,stroke:#fb8c00,color:#e65100
```
