# johnh2448/hyper-fetch architecture

> Architecture diagram of the GitHub repository johnh2448/hyper-fetch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/johnh2448/hyper-fetch
- Repository: https://github.com/johnh2448/hyper-fetch

## Overview

Hyper-Fetch is a parameterizable RISC-V instruction prefetcher with integrated branch prediction. Its principal workflow accepts memory responses, predicts branch direction, preprocesses instructions, queues them, and presents registered instructions in program order for the CPU to consume. The README documents a two-step preprocessing pipeline and native compressed-instruction support. The tree identifies the implementation modules, but no source excerpts were available; internal connections below reflect the documented integrated design rather than inspected call or data-transfer statements.

Main entry points: [`Source/Top.sv`](https://github.com/johnh2448/hyper-fetch/blob/main/Source/Top.sv) (Prefetch controller), [`Source/InstructionMemory.sv`](https://github.com/johnh2448/hyper-fetch/blob/main/Source/InstructionMemory.sv) (Instruction memory), [`Source/Predictor.sv`](https://github.com/johnh2448/hyper-fetch/blob/main/Source/Predictor.sv) (BTFNT predictor), [`Source/Queue.sv`](https://github.com/johnh2448/hyper-fetch/blob/main/Source/Queue.sv) (Instruction queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fetch["Fetch pipeline"]
  node_top["Prefetch controller<br/>[Top.sv]"]
  node_preprocess["Two-step preprocessing<br/>[Top.sv]"]
  node_compressed["Compressed support<br/>[Top.sv]"]
  node_instruction_memory["Instruction memory"]
end

subgraph group_prediction["Branch prediction"]
  node_predictor["BTFNT predictor<br/>[Predictor.sv]"]
end

subgraph group_buffer["Instruction buffering"]
  node_queue["Instruction queue<br/>[Queue.sv]"]
end

node_cpu(("CPU"))
node_memory[("Cache / memory")]

node_memory -->|"sends responses"| node_top
node_top -->|"presents instructions"| node_cpu
node_cpu -->|"signals consumption"| node_top
node_top -->|"integrates prediction"| node_predictor
node_top -->|"preprocesses fetches"| node_preprocess
node_top -->|"supports compressed"| node_compressed
node_top -->|"queues instructions"| node_queue
node_top -->|"uses instruction memory"| node_instruction_memory

click node_top "https://github.com/johnh2448/hyper-fetch/blob/main/Source/Top.sv"
click node_preprocess "https://github.com/johnh2448/hyper-fetch/blob/main/Source/Top.sv"
click node_compressed "https://github.com/johnh2448/hyper-fetch/blob/main/Source/Top.sv"
click node_predictor "https://github.com/johnh2448/hyper-fetch/blob/main/Source/Predictor.sv"
click node_queue "https://github.com/johnh2448/hyper-fetch/blob/main/Source/Queue.sv"
click node_instruction_memory "https://github.com/johnh2448/hyper-fetch/blob/main/Source/InstructionMemory.sv"

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_top,node_preprocess,node_compressed,node_instruction_memory toneBlue
class node_predictor,node_memory toneAmber
class node_queue toneMint
class node_cpu toneIndigo
```

## Components

### Fetch pipeline

- [Prefetch controller](https://github.com/johnh2448/hyper-fetch/blob/main/Source/Top.sv): `Source/Top.sv`
- [Two-step preprocessing](https://github.com/johnh2448/hyper-fetch/blob/main/Source/Top.sv): `Source/Top.sv`
- [Compressed support](https://github.com/johnh2448/hyper-fetch/blob/main/Source/Top.sv): `Source/Top.sv`
- [Instruction memory](https://github.com/johnh2448/hyper-fetch/blob/main/Source/InstructionMemory.sv): `Source/InstructionMemory.sv`

### Branch prediction

- [BTFNT predictor](https://github.com/johnh2448/hyper-fetch/blob/main/Source/Predictor.sv): `Source/Predictor.sv`

### Instruction buffering

- [Instruction queue](https://github.com/johnh2448/hyper-fetch/blob/main/Source/Queue.sv): `Source/Queue.sv`

### Other components

- **CPU**
- **Cache / memory**

## Connections

- Cache / memory → Prefetch controller: sends responses
- Prefetch controller → CPU: presents instructions
- CPU → Prefetch controller: signals consumption
- Prefetch controller → BTFNT predictor: integrates prediction
- Prefetch controller → Two-step preprocessing: preprocesses fetches
- Prefetch controller → Compressed support: supports compressed
- Prefetch controller → Instruction queue: queues instructions
- Prefetch controller → Instruction memory: uses instruction memory
