How anirudhsinga/tage_bp works
Project type and purpose
• From the file tree (README.md and tage.cc) and the README, we see this is a low-level, algorithmic component—a standalone implementation of the TAGE branch predictor used in CPU microarchitecture research and simulators.
File structure
• There are no separate “frontend/backend” folders or service boundaries. All logic lives in a single source file (tage.cc). This tells us there aren’t multiple services or layers; instead, the focus is on internal modules and data structures.
README for additional insights
• The predictor consists of:
• A global history register (GHR)
• Multiple predictor tables (each with geometric history length, partial tags, and usefulness counters)
• A selection mechanism that chooses which table’s prediction to trust
• An update mechanism that adjusts counters and tags after branch resolution
a. Main components
• Input Interface: accepts BranchPC and current GHR
• History-Length Index Generator: computes per-table indices based on different history lengths (geometric series)
• Tag Tables (T0, T1, …, Tn): each contains entries with partial tags, prediction counters, and usefulness counters
• Tag-Match Detector: compares tags from each table to the address tag
• Predictor Selector: picks the highest-priority matching table (using usefulness as tie-breaker)
• Output Interface: emits a Taken/Not-Taken decision back to the CPU pipeline
• Update Unit: on branch resolution, updates prediction counters, usefulness bits, partial tags, and GHR
b. Relationships and data flow
1. BranchPC & GHR → Index Generator
2. Index Generator → each Tag Table
3. Tables → Tag-Match Detector → Predictor Selector → Output
4. Branch outcome + PC → Update Unit → modifies Tables & GHR
c. Architectural patterns / design principles
• “Table of predictors” pattern: multiple tables with different histories
• Tag-based disambiguation to reduce aliasing
• Usefulness bits for confidence tracking and garbage-collection of stale entries
d. Key technologies / libraries
• Pure C++ (single source file) implementing bit-level manipulations
• No external dependencies—meant to be integrated into a CPU simulator