View on GitHub

Reconvergence Integration

Comprehensive guide to reconvergence detection integration with COP and SCOAP analysis.

Overview

Version 1.0.1 introduces automatic reconvergence detection into COP and SCOAP testability analysis with parallel computation support for large circuits.

What’s New

Quick Start

Using COP with Reconvergence

from opentestability.core.cop import run_cop

# Automatic reconvergence detection and parallel computation
run_cop('circuit.txt', 'results.txt',
        reconvergence_algorithm='auto',  # Auto-select best algorithm
        auto_parallel=True)              # Parallel for >100k gates

Using SCOAP with Reconvergence

from opentestability.core.scoap import run as run_scoap

# Automatic reconvergence detection
run_scoap('circuit.txt', 'results.json',
          reconvergence_algorithm='auto',
          auto_parallel=True)

Command Line Interface

# Auto commands (recommended)
opentest auto-cop -i circuit.txt -w 4
opentest auto-scoap -i circuit.txt -w 8

# Traditional commands with reconvergence flag
opentest cop -i circuit.txt -r -a simple
opentest scoap -i circuit.txt -r -a auto

Reconvergence Algorithms

Accuracy: 98%+ match with baseline methods
Complexity: O(n² log n)
Best For: Most production circuits

run_cop('circuit.txt', 'results.txt',
        reconvergence_algorithm='simple')

Characteristics:

Basic Algorithm

Accuracy: ~90%
Complexity: O(n²)
Best For: Quick analysis, simple circuits

run_cop('circuit.txt', 'results.txt',
        reconvergence_algorithm='basic')

Characteristics:

Advanced Algorithm

Accuracy: 100% (research-grade)
Complexity: O(n³)
Best For: Complex pipelined circuits, research

run_cop('circuit.txt', 'results.txt',
        reconvergence_algorithm='advanced')

Characteristics:

Auto Selection

Let the tool choose the best algorithm:

run_cop('circuit.txt', 'results.txt',
        reconvergence_algorithm='auto')  # Default

The auto-selection logic:

  1. Analyzes circuit structure
  2. Checks for pipelining patterns
  3. Estimates complexity
  4. Selects optimal algorithm

Parallel Computation

Automatic Activation

Parallel mode is automatically enabled for circuits with >100,000 gates.

run_cop('large_circuit.txt', 'results.txt',
        auto_parallel=True,  # Default
        max_workers=4)       # Default worker count

Performance Benchmarks

Circuit Size Algorithm Sequential Parallel Speedup
1,200 gates Simple 0.12s N/A 1.0x
45,000 gates Simple 2.4s N/A 1.0x
180,000 gates Simple 18.5s 5.2s 3.6x
520,000 gates Simple 95.2s 24.1s 3.9x

Manual Control

# Force parallel mode (even for small circuits)
run_cop('circuit.txt', 'results.txt',
        auto_parallel=False)  # Disable auto
        
# Custom worker count
run_cop('circuit.txt', 'results.txt',
        max_workers=8)  # Use 8 threads

API Reference

ReconvergenceIntegrator

Main integration class for unified reconvergence handling.

from opentestability.core.reconvergence.integration import ReconvergenceIntegrator

integrator = ReconvergenceIntegrator(dag_filename='circuit_dag.json')

Methods

detect_reconvergence(algorithm=’auto’)

Detect reconvergent fanout using specified algorithm.

reconv_data = integrator.detect_reconvergence(algorithm='simple')

Returns dictionary with:

extract_reconvergent_sites()

Extract all reconvergent sites from detection results.

sites = integrator.extract_reconvergent_sites()
# Returns: ['node1', 'node5', 'node12', ...]

extract_fanout_points()

Extract fanout points for SCOAP analysis.

fanouts = integrator.extract_fanout_points()
# Returns: ['node3', 'node7', 'node15', ...]

get_summary()

Get summary statistics.

summary = integrator.get_summary()
print(f"Reconvergent pairs: {summary['reconvergent_pairs']}")
print(f"Fanout points: {summary['fanout_points']}")
print(f"Algorithm: {summary['algorithm']}")

Integration Functions

integrate_with_cop()

Integrate reconvergence detection with COP analysis.

from opentestability.core.reconvergence.integration import integrate_with_cop

integrate_with_cop(
    input_file='circuit.txt',
    output_file='results.txt',
    algorithm='simple',
    auto_parallel=True,
    max_workers=4
)

integrate_with_scoap()

Integrate reconvergence detection with SCOAP analysis.

from opentestability.core.reconvergence.integration import integrate_with_scoap

integrate_with_scoap(
    input_file='circuit.txt',
    output_file='results.json',
    algorithm='simple',
    auto_parallel=True,
    max_workers=4
)

COP Integration Details

Correlation-Aware Analysis

COP analysis now includes Bayesian correlation adjustments at reconvergent sites.

How it works:

  1. Identifies reconvergent fanout points
  2. Builds correlation graph for reconvergent paths
  3. Calculates correlation coefficients based on shared signals
  4. Adjusts observability probabilities using Bayesian networks
  5. Outputs more accurate testability metrics

Example:

from opentestability.core.cop.main import run_cop

# Automatic correlation-aware analysis
run_cop('circuit.txt', 'results.txt',
        reconvergence_algorithm='simple',  # Detect reconvergence
        auto_parallel=True)                # Parallel if >100k gates

Parallel COP Computation

For large circuits, COP computation is parallelized across reconvergent regions.

from opentestability.core.cop.parallel import build_cop_with_parallel

C1, Obs = build_cop_with_parallel(
    nets, inputs, outputs, gates,
    reconvergent_sites=['node5', 'node12'],
    max_workers=8
)

SCOAP Integration Details

Reconvergence-Aware Metrics

SCOAP analysis now automatically:

  1. Extracts fanout points from reconvergence data
  2. Processes reconvergent cones in parallel
  3. Applies correlation adjustments for observability

Example:

from opentestability.core.scoap.main import run as run_scoap

run_scoap('circuit.txt', 'results.json',
          reconvergence_algorithm='simple',
          auto_parallel=True,
          max_workers=4)

Parallel SCOAP Computation

Reconvergent cones are processed concurrently for improved performance.

# Manual configuration
run_scoap('circuit.txt', 'results.json',
          reconvergent_roots=['node1', 'node5', 'node12'],
          parallel=True,
          max_workers=8)

Examples

Example 1: Basic COP with Reconvergence

from opentestability.core.cop import run_cop

# Simple use case
run_cop('priority_encoder.txt', 'results.txt',
        reconvergence_algorithm='simple')

Example 2: SCOAP with Custom Workers

from opentestability.core.scoap import run as run_scoap

# Large circuit with 8 workers
run_scoap('large_design.txt', 'results.json',
          reconvergence_algorithm='auto',
          auto_parallel=True,
          max_workers=8)

Example 3: Direct API Usage

from opentestability.core.reconvergence.integration import ReconvergenceIntegrator

# Create integrator
integrator = ReconvergenceIntegrator('circuit_dag.json')

# Detect reconvergence
reconv_data = integrator.detect_reconvergence(algorithm='advanced')

# Extract sites
sites = integrator.extract_reconvergent_sites()
fanouts = integrator.extract_fanout_points()

print(f"Found {len(sites)} reconvergent sites")
print(f"Found {len(fanouts)} fanout points")

# Get summary
summary = integrator.get_summary()
print(summary)

Example 4: Algorithm Comparison

from opentestability.core.reconvergence.integration import ReconvergenceIntegrator

integrator = ReconvergenceIntegrator('circuit_dag.json')

# Test all algorithms
for algo in ['basic', 'simple', 'advanced']:
    reconv_data = integrator.detect_reconvergence(algorithm=algo)
    sites = integrator.extract_reconvergent_sites()
    print(f"{algo}: {len(sites)} sites")

Example 5: Batch Processing

from opentestability.core.reconvergence.integration import integrate_with_cop
import glob

# Process all circuits in directory
for circuit_file in glob.glob('data/parsed/*.txt'):
    output_file = circuit_file.replace('.txt', '_cop.txt')
    integrate_with_cop(
        input_file=circuit_file,
        output_file=output_file,
        algorithm='auto',
        auto_parallel=True
    )
    print(f"Processed: {circuit_file}")

Migration Guide

For Existing Users

Old code (still works):

from opentestability.core.cop import run_cop
run_cop('circuit.txt', 'results.txt')

Enhanced version (recommended):

from opentestability.core.cop import run_cop

run_cop('circuit.txt', 'results.txt',
        reconvergence_algorithm='auto',  # Add this
        auto_parallel=True)              # Add this

No breaking changes - all existing code continues to work!

Command Line Migration

Old:

opentest cop -i circuit.txt

New (automatic reconvergence):

opentest auto-cop -i circuit.txt

Troubleshooting

DAG File Not Found

Error: FileNotFoundError: DAG file not found

Solution: Generate DAG first:

from opentestability.core.dag.builder import create_dag_from_netlist
dag_path = create_dag_from_netlist('circuit.txt')

Reconvergence Detection Failed

Error: Reconvergence detection failed

Solution: Try different algorithm:

run_cop('circuit.txt', 'results.txt',
        reconvergence_algorithm='simple')  # Most reliable

Parallel Not Improving Performance

Possible Causes:

Solution: Disable parallel:

run_cop('circuit.txt', 'results.txt',
        auto_parallel=False)

Additional Resources