# jnaraujo/tec498_2023_2_projeto_03 architecture

> Architecture diagram of the GitHub repository jnaraujo/tec498_2023_2_projeto_03, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jnaraujo/tec498_2023_2_projeto_03
- Repository: https://github.com/jnaraujo/tec498_2023_2_projeto_03

## Overview

##### Project Type Analysis
This is a digital circuit design project implemented using Verilog HDL (Hardware Description Language), targeting a specific CPLD hardware (EPM240T100C5). The project consists of multiple Verilog modules that work together to create a complete digital system.

##### Main Components

a. Core Components:
- Main Control Unit (mef_principal.v)
- Controller (display.v)
- Counter Modules:
- contador_0_99.v
- contador_cd.v
- contador_duzias.v
- Multiplexers and Demultiplexers:
- mux_16x8.v, mux_32x8.v, mux_2x1.v, mux_4x1.v
- demux_1x2.v, demux_1x4.v
- Flip-Flops:
- FF_d.v
- FF_jk.v

b. Support Components:
- Frequency Divider (divisor_freq.v)
- Level to Pulse Converter (level_to_pulse.v)
- Decoders (decodificador_num.v)
- Condition Checkers (eh_nove.v, menor_5.v)

##### Specific Implementation Details

a. Top Level (projeto.v):
- External inputs and outputs
- Pin assignments for the CPLD

b. Control Path:
- State machine transitions
- Interaction with counters and display

c. Data Path:
- Counter connections
- Multiplexer selections
- Decoder outputs

##### Documentation Elements

- Symbol descriptions
- Signal type indicators

b. Notes:
- CPLD model information
- Clock frequency details
- Critical timing requirements

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External
        CLK((Clock))
        RST((Reset))
        IN[External Inputs]
        OUT[External Outputs]
    end

    subgraph Control
        MEF["Main Control Unit"]:::control
        DISP["Display Controller"]:::control
    end

    subgraph Counters
        CNT99["Counter 0-99"]:::counter
        CNTCD["Counter CD"]:::counter
        CNTDZ["Counter Dozens"]:::counter
    end

    subgraph Multiplexers
        MUX16["MUX 16x8"]:::mux
        MUX32["MUX 32x8"]:::mux
        MUX2["MUX 2x1"]:::mux
        MUX4["MUX 4x1"]:::mux
    end

    subgraph Demultiplexers
        DMUX2["DEMUX 1x2"]:::demux
        DMUX4["DEMUX 1x4"]:::demux
    end

    subgraph FlipFlops
        FFD["D Flip-Flop"]:::ff
        FFJK["JK Flip-Flop"]:::ff
    end

    subgraph Support
        FREQ["Frequency Divider"]:::support
        L2P["Level to Pulse"]:::support
        DEC["Number Decoder"]:::support
        CHK9["Nine Checker"]:::support
        CHK5["Less Than 5"]:::support
    end

    CLK --> FREQ
    FREQ --> MEF
    RST --> MEF
    IN --> MEF
    MEF --> DISP
    MEF --> CNT99
    MEF --> CNTCD
    MEF --> CNTDZ
    
    CNT99 --> MUX16
    CNTCD --> MUX32
    CNTDZ --> MUX2
    
    MUX16 --> DMUX2
    MUX32 --> DMUX4
    
    DMUX2 --> FFD
    DMUX4 --> FFJK
    
    FFD --> DEC
    FFJK --> DEC
    
    DEC --> CHK9
    DEC --> CHK5
    
    CHK9 --> DISP
    CHK5 --> DISP
    
    L2P --> MEF
    DISP --> OUT

    %% Styles
    classDef control fill:#a2d2ff
    classDef counter fill:#bde0fe
    classDef mux fill:#ffafcc
    classDef demux fill:#ffc8dd
    classDef ff fill:#cdb4db
    classDef support fill:#95d5b2

    %% Click events
    click MEF "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/mef_principal.v"
    click DISP "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/display.v"
    click CNT99 "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/contador_0_99.v"
    click CNTCD "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/contador_cd.v"
    click CNTDZ "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/contador_duzias.v"
    click MUX16 "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/mux_16x8.v"
    click MUX32 "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/mux_32x8.v"
    click MUX2 "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/mux_2x1.v"
    click MUX4 "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/mux_4x1.v"
    click DMUX2 "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/demux_1x2.v"
    click DMUX4 "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/demux_1x4.v"
    click FFD "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/FF_d.v"
    click FFJK "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/FF_jk.v"
    click FREQ "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/divisor_freq.v"
    click L2P "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/level_to_pulse.v"
    click DEC "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/decodificador_num.v"
    click CHK9 "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/eh_nove.v"
    click CHK5 "https://github.com/jnaraujo/tec498_2023_2_projeto_03/blob/main/quartus/menor_5.v"
```
