Skip to main content

Open-Source SSD Controller & 3D NAND Research Platform

Project description

OpenNANDLab

License: MIT Python Versions CI Code Quality Documentation Documentation PRs Welcome

Open-Source SSD Controller & 3D NAND Research Platform

A comprehensive toolkit for optimizing 3D NAND flash storage performance, reliability, and efficiency through advanced defect handling, performance optimization, firmware integration, and NAND characterization.


Features

OpenNANDLab brings a unified, modern architecture designed for hardware researchers and storage engineers:

  • NAND Defect Handling

    • Advanced BCH and LDPC error correction implementations (including Forney's algorithm and belief propagation).
    • Dynamic bad block management and factory defect tracking.
    • Intelligent wear leveling algorithms utilizing Min-Heap prioritization for optimal block rotation.
  • Performance Optimization

    • Adaptive data compression (LZ4/Zstandard) directly integrated into the logical-to-physical (L2P) pipeline.
    • Multi-policy caching system (LRU, LFU, FIFO, TTL) replacing naive lookup buffers.
    • Parallel access operations designed to simulate multi-plane NAND concurrency.
  • Flash Translation Layer (FTL)

    • Page-level flat-array L2P mapping for extreme memory efficiency.
    • Robust Garbage Collection (GC) utilizing Greedy and Cost-Benefit algorithms.
    • Asynchronous Write Buffering logic mapped accurately to physical block boundaries.
  • Firmware Integration

    • Template-based firmware specification generation directly mapped via Pydantic.
    • Comprehensive validation with schema and semantic rules.
    • Automated test bench execution for custom workloads.
  • NAND Characterization & Analytics

    • Real-time data collection and statistical analysis.
    • Dynamic derivation of the Write Amplification Factor (WAF), IOPS, and Error Rates.
    • Visualization of wear patterns and error distributions.
  • User Interfaces

    • Streamlit dashboard for interactive visual tracking.
    • Unified command-line interface (CLI) powered by Click.
    • Python API for deep-integration with external pipelines.

Installation

Prerequisites

  • Python 3.10 or higher
  • pip (Python package installer)

From Source

# Clone the repository
git clone https://github.com/muditbhargava66/OpenNANDLab.git

# Navigate to the project directory
cd OpenNANDLab

# Create a virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate.bat

# Install dependencies in development mode
pip install -e ".[dev]"

Quick Start

Using the Command Line Interface (CLI)

OpenNANDLab provides a powerful unified CLI. Use it for script-based or terminal operations:

# Run a basic simulation using a random write workload
opennandlab run --workload random_write

# Run performance benchmarks using specific configurations
opennandlab benchmark --config specs/firmware_spec_standard_tlc_nand.yaml

# Characterize current device wear and errors
opennandlab characterize --samples 100 --output-dir results/

Dashboard

Launch the Streamlit dashboard for interactive operation and visualization of your storage characteristics:

opennandlab dashboard

API Usage

If you prefer script-level integration, you can directly import the NANDController and SimulatorConfig from the opennandlab namespace:

from opennandlab.simulator import NANDController
from opennandlab.config import SimulatorConfig

# Load standard configuration defaults
config = SimulatorConfig()

# Create controller and initialize
controller = NANDController(config, simulation_mode=True)
controller.initialize()

# Perform basic operations using Logical Block Numbers (LBN)
controller.write_page(0, b'Hello, NAND world!')
data = controller.read_page(0)
print(data)  # b'Hello, NAND world!'

# Clean up
controller.shutdown()

Configuration

The simulator is securely driven by Pydantic configuration models (SimulatorConfig), replacing outdated dictionaries. It natively validates nested attributes to ensure hardware simulation safety.

Default Configuration Example

Configurations are provided in standard YAML formatting. A typical template might look like:

# NAND Flash Physical Configuration
nand:
  cell_type: "TLC"
  page_size_bytes: 4096
  pages_per_block: 256
  blocks_per_plane: 1024
  oob_size_bytes: 128
  max_pe_cycles: 3000

# Flash Translation Layer Configuration
ftl:
  type: "page"
  gc_policy: "greedy"
  gc_trigger_free_pct: 0.10
  over_provisioning_pct: 0.07
  write_buffer_pages: 64

# Optimization Configuration
ecc:
  algorithm: "bch" 
  bch_m: 8          
  bch_t: 4          

You can point to these templates using the CLI (--config) or programmatically load them via load_config('path.yaml').

Architecture

OpenNANDLab's architecture enforces strict separation of concerns, decoupling logical translation (FTL) from hardware execution (NAND Device) while intercepting reads/writes for telemetry.

For full details, please read our Architecture Document.

Directory Structure

The project has been aggressively restructured in v2.0.0 for maintainability and scalability:

OpenNANDLab/
├── docs/                      # ReadTheDocs Markdown & Asset Storage
│   ├── resources/             # Configuration templates and images
│   ├── API_REFERENCE.md       # Full Python API breakdown
│   ├── ARCHITECTURE.md        # Central design document
│   ├── BENCHMARKS.md          # Expected performance references
│   ├── CONTRIBUTING.md        # Open Source contribution guidelines
│   ├── DATA_FLOW.md           # Pipeline execution maps
│   ├── EXAMPLES.md            # Guide to example implementations
│   ├── FIRMWARE_INTEGRATION.md
│   ├── FTL_DESIGN.md          # Flash Translation Layer structures
│   ├── INDEX.md               # Main Sphinx documentation index
│   ├── NAND_CHARACTERIZATION.md
│   ├── NAND_DEFECT_HANDLING.md
│   ├── PERFORMANCE_OPTIMIZATION.md
│   ├── REFERENCES.md          # Academic paper citations
│   ├── SCRIPTS_AND_SPECS.md   # Setup rules
│   └── USER_MANUAL.md         # General end-user handbook
├── examples/                  # Python examples showing programmatic usage
├── specs/                     # YAML files detailing hardware templates
├── src/
│   └── opennandlab/           # Main Python Package
│       ├── analytics/         # Data collection & WAF metrics
│       ├── defect/            # Bad block management & Wear leveling
│       ├── ecc/               # LDPC & BCH logic
│       ├── firmware/          # Spec generators
│       ├── ftl/               # Logical-to-Physical translation and GC
│       ├── nand/              # Raw hardware simulators
│       ├── optimization/      # Caching & Compression algorithms
│       ├── utils/             # Loggers & file handlers
│       ├── visualization/     # Streamlit interfaces
│       ├── workloads/         # Synthesized data flows
│       ├── cli.py             # Click command-line entrypoint
│       ├── config.py          # Pydantic configuration schemas
│       └── simulator.py       # Main NANDController orchestrator
├── tests/                     # Pytest suite (Unit, Integration, Property)
├── tox.ini                    # Tox configuration for multi-version testing
├── pyproject.toml             # Python build and dependencies list
├── CHANGELOG.md               # Versioning history
├── CODE_OF_CONDUCT.md         # Contributor conduct guidelines
└── SECURITY.md                # Vulnerability handling

Documentation

Comprehensive, web-ready documentation is available. You can build it locally or view it online via ReadTheDocs.

To generate the documentation locally:

cd docs
pip install -r requirements.txt
sphinx-build -b html . _build/html

Read more about specific modules:

Examples

The examples directory contains standalone python scripts demonstrating various features of OpenNANDLab. You can run these directly to see the console output of internal subsystems:

Contributing

OpenNANDLab welcomes external contributors! If you're looking to help improve the project:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

See CONTRIBUTING.md for more information on commit conventions and architectural decision making.

Development and Testing

The project uses pytest for internal validation, ruff for code styling, and tox for multi-environment execution.

# Setup pre-commit hooks
pre-commit install

# Run type checking
tox -e type

# Run code linting
tox -e lint

# Run all unit and integration tests locally
pytest

# Run tests with a detailed coverage report
pytest --cov=src/opennandlab tests/

We rigorously enforce code quality. All new pull requests must maintain at least 80% test coverage and zero linting errors.

Compatibility Matrix

Python Version Linux macOS Windows
3.10 Pass Pass Pass
3.11 Pass Pass Pass
3.12 Pass Pass Pass

License

This project is licensed under the MIT License - see the LICENSE file for details.


If you find OpenNANDLab useful, please consider giving it a star on GitHub!

Contact: @muditbhargava66
Report Issues: Issue Tracker

© 2026 Mudit Bhargava. MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opennandlab-2.0.0.tar.gz (116.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opennandlab-2.0.0-py3-none-any.whl (64.6 kB view details)

Uploaded Python 3

File details

Details for the file opennandlab-2.0.0.tar.gz.

File metadata

  • Download URL: opennandlab-2.0.0.tar.gz
  • Upload date:
  • Size: 116.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for opennandlab-2.0.0.tar.gz
Algorithm Hash digest
SHA256 fb0a2a9c65eee1d23cc959ea84f82d05f01e22b65f3f744349b558527722e3b1
MD5 5fd26219587923d3916e2516e9c82a61
BLAKE2b-256 87905e90a6b5e94c61d07465c1b7889ae61c7be7afcfa16692d70817a2215cd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for opennandlab-2.0.0.tar.gz:

Publisher: publish.yml on muditbhargava66/OpenNANDLab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file opennandlab-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: opennandlab-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 64.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for opennandlab-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5b33a6d6197d84605d00196d2e0cc585f137a907ceedca3cc93bb23a5407e98
MD5 44861d15c4898ed0e3a8b2e7db30cf78
BLAKE2b-256 f8a650a55a349a17e16eb73da8c61163761d689eea7264ebd83bb682a82350c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for opennandlab-2.0.0-py3-none-any.whl:

Publisher: publish.yml on muditbhargava66/OpenNANDLab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page