GRAND-AB Decoder Lab Project
收藏资源简介:
GRAND-AB Decoder Lab Project This repository contains a modular implementation of the Guessing Random Additive Noise Decoding (GRAND) algorithm, specifically the GRAND-AB (Abandon) variant. This project was developed as part of research into high-speed, hardware-efficient error correction for BCH codes. 📌 Project Overview The GRAND-AB decoder approaches error correction by guessing noise patterns rather than using traditional algebraic decoding. It is particularly effective for short-to-medium length block codes where high throughput is required. Key Features: Syndrome-based Hash Table: Pre-computes and stores syndromes for all error patterns up to weight $AB$. Constant Time Lookup: Provides extremely fast decoding for error patterns within the searchable threshold. Modular Design: Separate components for logging, encoding, channel simulation (AWGN), and decoding. 📂 Repository Structure demo.py: Example script demonstrating the end-to-end encoding, transmission, and decoding process using GRAND-AB. logger.py: Custom ANSI-colored logging utility for clear console debugging. encoder.py: Core logic for Linear Block Codes. Includes the BCHCodeMatrix class to handle $G$ and $H$ matrices. decoder.py: Implementation of the GrandAB class, including automatic hash table generation. awgn.py: Communication channel model (BPSK modulation + Additive White Gaussian Noise). environment.yml: Conda environment configuration file. data/: Directory containing the Parity Check ($H$) and Generator ($G$) matrices in .txt format. 🚀 Installation & Setup Clone the repository: git clone <repository-url> cd <repository-directory> Create the Conda Environment: Use the provided environment.yml to set up all dependencies (NumPy, Galois, etc.): conda env create -f environment.yml Activate the Environment: conda activate grand_env Prepare Matrices: Ensure your data/ folder contains the required matrix files, named following the convention: H_BCH_{N}_{K}.txt and G_BCH_{N}_{K}.txt. 🛠 Usage Example from encoder import BCHCodeMatrix from decoder import GrandAB from logger import configure_logger Initialize logger for colored output configure_logger() Load BCH(256, 239) matrices from the data folder code = BCHCodeMatrix(N=256, K=239) Initialize GRAND-AB with an error correction threshold of 2 decoder = GrandAB(code_e=code, AB=2) To decode a batch of received bits: decoded_bits = decoder.decode_all(received_bits) 🔬 Mathematical Background The GRAND-AB (Guessing Random Additive Noise Decoding - Abandon) algorithm is a universal decoding technique that operates by identifying noise patterns rather than solving complex algebraic equations specific to a code's structure. 1. Syndrome Computation In any linear block code, the parity-check matrix $H$ defines the space of valid codewords. For a received vector $r$, we compute the syndrome $s$: $$s = H \cdot r^T \pmod 2$$ If $s = 0$, $r$ is a valid codeword. If $s \neq 0$, an error $e$ has occurred such that $r = c \oplus e$. 2. The GRAND-AB Approach Instead of traditional decoding, GRAND-AB uses a pre-computed hash table that maps syndromes to the most likely error patterns: $$\text{Table}[s] \rightarrow e$$ The decoder "abandons" (the AB in GRAND-AB) the search if the error weight exceeds a predefined threshold, ensuring high-speed, constant-time lookups for the most common error cases. ⚖️ License & Credits Copyright © 2024-2026 TCL EPFL Authors: Ludovic D. Blanc, Wenqing Song.



