# shahriar-0/computer-architecture-lab-experiments-f2023 architecture

> Architecture diagram of the GitHub repository shahriar-0/computer-architecture-lab-experiments-f2023, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shahriar-0/computer-architecture-lab-experiments-f2023
- Repository: https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023

## Overview

##### Main Components
- CPU/Processor Core: At the heart of the system are modules like CPU.v, ALU.v, RegFile.v, and ControlUnit.v. These represent the processor’s datapath and control.
- Memory Components: Identify Instruction_Memory.v and DataMemory.v (or SRAM.v with its controller), which are essential for fetching instructions and storing data.
- Multiplexers and Registers: Modules like Mux2to1.v, Mux4to1.v, RegisterNegEdge.v, RegisterPosEdge.v play supportive roles in selecting data paths and clock edge-triggered storage.
- Testbench: It is worth mentioning the Testbench.v which is used for simulation and validation purposes.

##### Relationships and Interactions
- Data & Control Flow: Highlight the control path coming from the ControlUnit.v, which directs the operation of the ALU, registers, and memory accesses. Similarly, indicate the data flow through modules such as the RegFile, ALU, and multiplexer units.
- Hazard Management: Represent connections from the HazardUnit and ForwardingUnit to the control logic or datapath elements, indicating how they adjust or override normal flows to prevent issues.
- Memory Access: Illustrate how the Instruction_Memory and DataMemory (or associated SRAM components) interact with the CPU core, with particular emphasis on cache memory which is treated in later iterations (ARM-7).

##### Architectural Patterns and Design Principles
- Pipeline Architecture: Since the project is designed with pipelined stages, emphasize how instructions move from one stage to the next.
- Modular Component Design: Each Verilog file corresponds to a specific module, following a modular design principle that simplifies integration and testing.
- Handling of Hazards: Include explicit notes on mitigation of data hazards through dedicated units (HazardUnit, ForwardingUnit), a key part of processor design.
- Simulation Support: Acknowledge that there is a simulation setup (Testbench.v and supporting ModelSim output directories) which is vital for verifying the digital design.

##### Relevant Technologies and Frameworks
- Verilog HDL is the key technology.
- Simulation technologies such as ModelSim or similar EDA tools play a role in generating signal traces and verifying operation.
- The project also references educational documents (such as ARM_ISA.pdf and the lab report) that may include additional architectural insights to incorporate.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Simulation Environment
    subgraph "Simulation Environment"
        TB["Testbench"]:::simulation
    end

    %% CPU Core
    subgraph "CPU Core"
        CPU["CPU"]:::core
        ALU["ALU"]:::core
        RF["RegFile"]:::core
        CU["Control Unit"]:::core
    end

    %% Pipeline Stages
    subgraph "Pipeline Stages"
        IF["IF Stage"]:::pipeline
        IFR["IF Stage Reg"]:::pipeline
        ID["ID Stage"]:::pipeline
        IDR["ID Stage Reg"]:::pipeline
        EX["EX Stage"]:::pipeline
        EXR["EX Stage Reg"]:::pipeline
        MEM["MEM Stage"]:::pipeline
        MEMR["MEM Stage Reg"]:::pipeline
        WB["WB Stage"]:::pipeline
    end

    %% Hazard and Forwarding Units
    subgraph "Hazard Handling"
        HZ["Hazard Unit"]:::hazard
        FW["Forwarding Unit"]:::hazard
    end

    %% Memory Components
    subgraph "Memory Components"
        IM["Instruction Memory"]:::memory
        DM["Data Memory"]:::memory
        SRAM["SRAM & Controller"]:::memory
    end

    %% Multiplexers and Registers
    subgraph "Multiplexers & Registers"
        M2["Mux2to1"]:::mux
        M4["Mux4to1"]:::mux
        RN["RegisterNegEdge"]:::mux
        RP["RegisterPosEdge"]:::mux
    end

    %% Documentation and Reference
    subgraph "Documentation & Reference"
        DOC1["Descriptions"]:::docs
        DOC2["Pictures"]:::docs
        DOC3["Reference"]:::docs
        DOC4["Report"]:::docs
    end

    %% Connections
    TB -->|"triggers"| CPU
    CU -->|"control"| IF
    IM -->|"fetches"| IF
    IF --> IFR
    IFR --> ID
    ID --> IDR
    IDR --> EX
    EX --> EXR
    EXR --> MEM
    MEM --> MEMR
    MEMR --> WB
    WB -->|"writes"| RF
    ID -->|"reads"| RF
    CU -->|"signals"| M2
    CU -->|"signals"| M4
    CU -->|"signals"| RN
    CU -->|"signals"| RP
    CU -->|"hazard"| HZ
    CU -->|"forward"| FW
    HZ -->|"mitigates"| IDR
    FW -->|"bypasses"| EX
    EX -->|"computes"| ALU
    MEM -->|"accesses"| DM
    MEM -->|"accesses"| SRAM

    %% Click Events
    click CPU "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/CPU.v"
    click ALU "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/ALU.v"
    click RF "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/RegFile.v"
    click CU "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/ControlUnit.v"
    click IF "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/IF_Stage.v"
    click IFR "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/IF_Stage_Reg.v"
    click ID "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/ID_Stage.v"
    click IDR "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/ID_Stage_Reg.v"
    click EX "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/EX_Stage.v"
    click EXR "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/EX_Stage_Reg.v"
    click MEM "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/MEM_Stage.v"
    click MEMR "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/MEM_Stage_Reg.v"
    click WB "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/WB_Stage.v"
    click HZ "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/HazardUnit.v"
    click FW "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/ForwardingUnit.v"
    click IM "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/Instruction_Memory.v"
    click DM "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/DataMemory.v"
    click SRAM "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/SRAM.v"
    click M2 "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/Mux2to1.v"
    click M4 "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/Mux4to1.v"
    click RN "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/RegisterNegEdge.v"
    click RP "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/RegisterPosEdge.v"
    click TB "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/blob/main/ARM/Code/Testbench.v"
    click DOC1 "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/tree/main/ARM/Descriptions"
    click DOC2 "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/tree/main/ARM/Picrtures"
    click DOC3 "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/tree/main/ARM/Reference"
    click DOC4 "https://github.com/shahriar-0/computer-architecture-lab-experiments-f2023/tree/main/ARM/Report"

    %% Styles
    classDef core fill:#f2c14e,stroke:#000,stroke-width:2px;
    classDef pipeline fill:#AADDFF,stroke:#000,stroke-width:2px;
    classDef hazard fill:#FFAAAA,stroke:#000,stroke-width:2px;
    classDef memory fill:#D5E8D4,stroke:#000,stroke-width:2px;
    classDef mux fill:#E1D5E7,stroke:#000,stroke-width:2px;
    classDef simulation fill:#FFF2CC,stroke:#000,stroke-width:2px;
    classDef docs fill:#CFE2F3,stroke:#000,stroke-width:2px;
```
