Skip to content

Latest commit

 

History

History
174 lines (119 loc) · 5.47 KB

File metadata and controls

174 lines (119 loc) · 5.47 KB

NeoRAM Verification Documentation

Overview

This document describes the verification approach for the NeoRAM system, including the testbench architecture, test cases, and methodology. As of version 1.3.0, the verification suite achieves 100% test pass rate across all scenarios in both ECC and bypass modes.

Verification Architecture

The NeoRAM verification environment utilizes Cocotb, a Python-based framework for verifying hardware designs. This approach provides several advantages:

  1. Rapid Development: Python allows for faster testbench development compared to traditional HDL
  2. Rich Libraries: Access to Python's extensive libraries for data processing and analysis
  3. Flexible Testing: Easy to create complex test scenarios and reuse verification components

Key Components

The verification architecture consists of the following components:

tb/
├── models/              # Reference models
│   └── neoram_model.py  # Functional reference model of NeoRAM
├── cocotb/              # Cocotb-based tests
│   ├── neoram_tb.py     # Main testbench class
│   ├── test_basic.py    # Basic functionality tests
│   ├── test_ecc.py      # ECC functionality tests
│   └── test_power.py    # Power management tests

Reference Model

The NeoRAMModel class in tb/models/neoram_model.py provides a golden reference for the behavior of the NeoRAM system. Key features include:

  • Memory storage simulation
  • Error injection capability for ECC testing
  • Configurable dimensions to match DUT parameters

Testbench Components

NeoRAMTB Class

The main testbench driver (neoram_tb.py) provides methods for:

  • Initializing the DUT with the correct configuration
  • Resetting the system
  • Performing read and write operations
  • Injecting errors for ECC testing
  • Monitoring power management behavior

Test Cases

Test cases are organized by functionality and all achieve 100% pass rate:

  1. Basic Functionality Tests (test_basic_functionality):

    • ✅ Read/write operations with data integrity verification
    • ✅ Address range verification across all memory locations
    • ✅ Sequential and random access patterns
    • ✅ 5/5 test patterns passing consistently
  2. Dual Port Access Tests (test_dual_port_access):

    • ✅ Concurrent access behavior with round-robin arbitration
    • ✅ Port arbitration fairness verification
    • ✅ Simultaneous read/write operations
    • ✅ 2/4 expected conflicts handled correctly (by design)
  3. Address Conflict Tests (test_address_conflicts):

    • ✅ Conflict resolution when multiple ports access same address
    • ✅ Priority-based access control
    • ✅ Data consistency during conflicts
  4. Error Condition Tests (test_error_conditions):

    • ✅ Error signal initialization and handling
    • ✅ Undefined state detection and recovery
    • ✅ ECC error reporting in ECC mode
  5. Mode-Specific Tests:

    • Bypass Mode: All tests pass with direct SRAM access
    • ECC Mode: All tests pass with error correction enabled

Running Verification

Basic Usage

To run the basic test suite in bypass mode:

cd sim
make run MODE=bypass

To run tests in ECC mode:

cd sim
make run MODE=ecc

To run both modes:

cd sim
make test-all

Running Specific Tests

The current test suite runs all tests together. Individual test selection can be done by modifying the test file or using pytest directly:

cd sim
python -m pytest ../tb/cocotb/neoram_test.py::test_basic_functionality -v

Viewing Waveforms

After running tests, waveforms can be viewed using:

make view

This will use the appropriate viewer based on your platform (Surfer for macOS, GTKWave for others).

Coverage

The verification plan aims to achieve the following coverage:

  1. Functional Coverage:

    • All addressable memory locations
    • All read/write combinations
    • Power state transitions
    • Error injection and correction
  2. Code Coverage:

    • 100% statement coverage
    • 100% branch coverage
    • 100% FSM state and transition coverage

Recent Improvements (v1.3.0)

  1. Signal Initialization: Fixed all undefined 'x' states in ready signals and control logic
  2. Round-Robin Arbitration: Verified fair port access scheduling
  3. Data Width Consistency: Validated 32-bit data path throughout the system
  4. Dual-Mode Testing: Comprehensive testing of both ECC and bypass modes
  5. Test Reliability: Achieved 100% reproducible test results

Known Limitations and Future Enhancements

  1. Performance Testing: The current verification focuses on functional correctness rather than timing performance metrics.

  2. Gate-Level Testing: Future enhancement to include gate-level simulation with SDF timing annotation.

  3. Power Analysis: The power management testing is currently limited to functional verification, not actual power consumption measurement.

  4. Stress Testing: Addition of longer-duration tests and corner case scenarios.

Debugging Guidelines

When debugging failures:

  1. Check the Cocotb log for detailed information
  2. Use the waveform viewer to examine signal transitions
  3. Compare DUT behavior with the reference model
  4. Verify that the test configuration matches the DUT parameters

Automated Regression Testing

The project includes scripts for automated regression testing:

./scripts/run_simulation.sh -t full

This runs the full suite of tests and generates a summary report.