# sameer07-sam/arithmetic-logic-unit-alu- architecture

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

- Interactive diagram: https://gitdiagram.com/sameer07-sam/arithmetic-logic-unit-alu-
- Repository: https://github.com/sameer07-sam/arithmetic-logic-unit-alu-

## Overview

##### Project Type and Purpose
- This is a VLSI‐domain hardware design project: a simple 8-bit Arithmetic Logic Unit (ALU) implemented in Verilog.
- Purpose: support addition, subtraction, bitwise AND, OR, NOT based on a 3-bit selector, and verify via a testbench.

##### File Structure Analysis
- ALU.v    – Verilog source for the ALU module
- ALU_TB.v  – Verilog testbench to simulate and verify ALU behavior
- ALU REPORT.docx – Design report/documentation
- README.md – Project overview and instructions

##### README Insights
- Lists supported operations and sel encoding (000→add, 001→sub, 010→AND, 011→OR, 100→NOT).
- Describes simulation flow (ModelSim, waveform verification).

##### System Design as a Flow Chart
We will create a flow chart that shows:
a. Input capture (A[7:0], B[7:0], sel[2:0])
b. Operation decode (chain of decisions on sel)
c. Functional units (adder/subtractor block, AND gate, OR gate, NOT gate)
d. Output multiplexing and result presentation
e. Testbench stimulus loop (optional sub-chart)

ASCII flow chart blueprint:

+-------------------------------------------------+
|                     START                       |
+-------------------------------------------------+
│
Read inputs A[7:0], B[7:0], sel[2:0]
│
▼
+----------------------------------------------+
| sel == 000 ? (Addition)                      |
+----------------------------------------------+
│ Yes                     │ No
▼                         ▼
Compute sum = A + B         +------------------------------------+
│                     | sel == 001 ? (Subtraction)         |
│                     +------------------------------------+
│ Yes                 │ No                   │ Yes
│                     ▼                      ▼
│             Compute diff = A – B        +----------------------+
│                                    | sel == 010 ? (AND)       |
│                                    +--------------------------+
│                                    │ No                │ Yes
│                                    ▼                   ▼
│                            +------------------+   Compute A & B
│                            | sel == 011 ? OR? |
│                            +------------------+
│                            │ No            │ Yes
│                            ▼               ▼
│                      +----------------+  Compute A | B
│                      | sel == 100 ?   |
│                      | (NOT A)        |
│                      +----------------+
│                      │ No         │ Yes
│                      ▼            ▼
│                +----------------+  Compute ~A
│                | Invalid sel?   |
│                | (Default = 0)  |
│                +----------------+
│                         │
└─────────────────────────┴─────────────────►
│
▼
+-------------------------------+
|  OUTPUT result[7:0] to bus   |
+-------------------------------+
│
▼
+------------------+
|     END LOOP     |
+------------------+

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef input fill:#add8e6,stroke:#333,stroke-width:1px
    classDef operation fill:#90ee90,stroke:#333,stroke-width:1px
    classDef decision fill:#e6e6fa,stroke:#333,stroke-width:1px
    classDef output fill:#ffa500,stroke:#333,stroke-width:1px
    classDef testbench fill:#d3d3d3,stroke:#333,stroke-width:1px

    subgraph "ALU Module"
        ALU_Module["ALU Module"]:::operation
        Start["START"]:::operation
        A["A[7:0]"]:::input
        B["B[7:0]"]:::input
        sel["sel[2:0]"]:::input
        d1{"sel == 000?"}:::decision
        add["Compute A + B"]:::operation
        d2{"sel == 001?"}:::decision
        sub["Compute A - B"]:::operation
        d3{"sel == 010?"}:::decision
        andOp["Compute A & B"]:::operation
        d4{"sel == 011?"}:::decision
        orOp["Compute A | B"]:::operation
        d5{"sel == 100?"}:::decision
        notOp["Compute ~A"]:::operation
        inv["Invalid sel? (Default=0)"]:::operation
        Out["OUTPUT result[7:0] to bus"]:::output
        End["END LOOP"]:::operation

        ALU_Module --> Start
        Start --> A
        A --> B
        B --> sel
        sel --> d1
        d1 -->|Yes| add
        d1 -->|No| d2
        add --> Out
        d2 -->|Yes| sub
        d2 -->|No| d3
        sub --> Out
        d3 -->|Yes| andOp
        d3 -->|No| d4
        andOp --> Out
        d4 -->|Yes| orOp
        d4 -->|No| d5
        orOp --> Out
        d5 -->|Yes| notOp
        d5 -->|No| inv
        notOp --> Out
        inv --> Out
        Out --> End
    end

    subgraph "Testbench"
        TB["ALU_TB Stimulus & Verification"]:::testbench
        End --> TB
        TB --> Start
    end

    subgraph "Documentation"
        Doc1["ALU REPORT.docx"]:::testbench
        Doc2["README.md"]:::testbench
    end

    click ALU_Module "https://github.com/sameer07-sam/arithmetic-logic-unit-alu-/blob/main/ALU.v"
    click TB "https://github.com/sameer07-sam/arithmetic-logic-unit-alu-/blob/main/ALU_TB.v"
    click Doc1 "https://github.com/sameer07-sam/arithmetic-logic-unit-alu-/blob/main/ALU REPORT.docx"
    click Doc2 "https://github.com/sameer07-sam/arithmetic-logic-unit-alu-/blob/main/README.md"
```
