# cs683-iitb-autumn-2026/pa2 architecture

> Architecture diagram of the GitHub repository cs683-iitb-autumn-2026/pa2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cs683-iitb-autumn-2026/pa2
- Repository: https://github.com/cs683-iitb-autumn-2026/pa2

## Overview

ChampSim is a trace-driven microarchitecture simulator. A user supplies a trace and warmup/simulation lengths; the runtime processes instructions through an out-of-order core and memory hierarchy, then reports IPC and other statistics. The graph separates core execution, translation, cache behavior, and uncore memory. Some internal wiring—especially policy callbacks and lower-level request routing—is not shown in the excerpts, so those links are omitted rather than inferred.

Main entry points: [`src/ooo_cpu.cc`](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/ooo_cpu.cc) (Out-of-order core), [`src/main.cc`](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/main.cc) (Simulation driver), [`src/cache.cc`](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/cache.cc) (L1 caches), [`prefetcher`](https://github.com/cs683-iitb-autumn-2026/pa2/tree/main/prefetcher) (Prefetch policies)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Simulation runtime"]
  node_driver["Simulation driver<br/>[main.cc]"]
  node_results["Metrics output<br/>[main.cc]"]
end

subgraph group_core["Core execution"]
  node_cpu["Out-of-order core<br/>[ooo_cpu.cc]"]
  node_predictor["Branch predictor"]
  node_ptw["Page-table walker"]
end

subgraph group_memory["Memory hierarchy"]
  node_tlb["TLB caches<br/>[cache.cc]"]
  node_l1["L1 caches<br/>[cache.cc]"]
  node_l2["L2 cache<br/>[cache.cc]"]
  node_llc["Last-level cache<br/>[cache.cc]"]
  node_dram[("DRAM controller<br/>[dram_controller.cc]")]
end

subgraph group_policies["Configurable policies"]
  node_prefetch["Prefetch policies"]
  node_replacement["Replacement policies"]
end

node_user(("Researcher"))
node_trace["Instruction trace"]

node_user -->|"configures and runs"| node_driver
node_user -->|"provides"| node_trace
node_trace -->|"read by"| node_driver
node_driver -->|"executes instructions"| node_cpu
node_driver -->|"prints metrics"| node_results
node_cpu -.->|"predicts branches"| node_predictor
node_cpu -.->|"requests translation"| node_ptw
node_cpu -.->|"accesses"| node_tlb
node_cpu -.->|"issues memory accesses"| node_l1
node_ptw -.->|"uses translation caches"| node_tlb
node_l1 -.->|"forwards misses"| node_l2
node_l2 -.->|"forwards misses"| node_llc
node_llc -.->|"services misses"| node_dram
node_prefetch -.->|"prefetches for"| node_l1
node_prefetch -.->|"prefetches for"| node_l2
node_prefetch -.->|"prefetches for"| node_llc
node_replacement -.->|"selects victims"| node_l1
node_replacement -.->|"selects victims"| node_l2
node_replacement -.->|"selects victims"| node_llc

click node_driver "https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/main.cc"
click node_results "https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/main.cc"
click node_cpu "https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/ooo_cpu.cc"
click node_predictor "https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/branch/branch_predictor.cc"
click node_ptw "https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/page_table_walker.cc"
click node_tlb "https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/cache.cc"
click node_l1 "https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/cache.cc"
click node_l2 "https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/cache.cc"
click node_llc "https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/cache.cc"
click node_dram "https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/dram_controller.cc"
click node_prefetch "https://github.com/cs683-iitb-autumn-2026/pa2/tree/main/prefetcher"
click node_replacement "https://github.com/cs683-iitb-autumn-2026/pa2/tree/main/replacement"

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_driver,node_results toneBlue
class node_cpu,node_predictor,node_ptw toneAmber
class node_tlb,node_l1,node_l2,node_llc,node_dram toneMint
class node_prefetch,node_replacement toneRose
class node_user,node_trace toneIndigo
```

## Components

### Simulation runtime

- [Simulation driver](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/main.cc): `src/main.cc`
- [Metrics output](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/main.cc): `src/main.cc`

### Core execution

- [Out-of-order core](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/ooo_cpu.cc): `src/ooo_cpu.cc`
- [Branch predictor](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/branch/branch_predictor.cc): `branch/branch_predictor.cc`
- [Page-table walker](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/page_table_walker.cc): `src/page_table_walker.cc`

### Memory hierarchy

- [TLB caches](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/cache.cc): `src/cache.cc`
- [L1 caches](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/cache.cc): `src/cache.cc`
- [L2 cache](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/cache.cc): `src/cache.cc`
- [Last-level cache](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/cache.cc): `src/cache.cc`
- [DRAM controller](https://github.com/cs683-iitb-autumn-2026/pa2/blob/main/src/dram_controller.cc): `src/dram_controller.cc`

### Configurable policies

- [Prefetch policies](https://github.com/cs683-iitb-autumn-2026/pa2/tree/main/prefetcher): `prefetcher`
- [Replacement policies](https://github.com/cs683-iitb-autumn-2026/pa2/tree/main/replacement): `replacement`

### Other components

- **Researcher**
- **Instruction trace**

## Connections

- Researcher → Simulation driver: configures and runs (evidence: `README.md`)
- Researcher → Instruction trace: provides (evidence: `README.md`)
- Instruction trace → Simulation driver: read by (evidence: `README.md`)
- Simulation driver → Out-of-order core: executes instructions (evidence: `src/main.cc`)
- Simulation driver → Metrics output: prints metrics (evidence: `README.md`)
- Out-of-order core → Branch predictor: predicts branches
- Out-of-order core → Page-table walker: requests translation
- Out-of-order core → TLB caches: accesses
- Out-of-order core → L1 caches: issues memory accesses
- Page-table walker → TLB caches: uses translation caches
- L1 caches → L2 cache: forwards misses (evidence: `src/cache.cc`)
- L2 cache → Last-level cache: forwards misses (evidence: `src/cache.cc`)
- Last-level cache → DRAM controller: services misses
- Prefetch policies → L1 caches: prefetches for
- Prefetch policies → L2 cache: prefetches for
- Prefetch policies → Last-level cache: prefetches for
- Replacement policies → L1 caches: selects victims
- Replacement policies → L2 cache: selects victims
- Replacement policies → Last-level cache: selects victims
