openfpga-litex icon indicating copy to clipboard operation
openfpga-litex copied to clipboard

Add cart pin synchronization to prevent metastability

Open eric-humane opened this issue 8 months ago • 0 comments

Overview

This PR implements proper synchronization for cartridge pins and interface signals to prevent metastability issues when crossing clock domains. It adds a parameterized two-stage synchronizer module and introduces GBA PHI clock generation for cartridge operations.

Key Changes

  • Add cart_pin_synchronizer.sv
    • reusable two-stage synchronization module with proper bitwise vector operations
  • Implement synchronizers for all cartridge banks/pins with synthesis preservation attributes
  • Add proper direction signal synchronization with break-before-make protection
  • Generate PHI clock (~1.058 MHz) for cartridge timing
  • Update signal paths to use synchronized inputs

eric-humane avatar May 16 '25 04:05 eric-humane