synchronizationvhdlfpgagray-codeclock-synchronization

clock domain crossing of a mutli bit signal


I have to use a multibit counter signal in another clock domain from the one that is generated. If there is no relation between the 2 clocks, is it safe to use gray code and classic 2 sync FFs and just read the coded value after that (just like it is done for pointers in asynchronous fifos)? In my understanding this would introduce less delay than using handshake signals ...


Solution

  • Yes, using Gray encoding/decoding of the counter value over the Clock Domain Crossing (CDC) is the usual way to do it.

    For this to work, the skew of the bits in the Gray encoded counter value plus the settling time for meta-stability must be less than the clock period. So remember to constrain the synthesis and Static Timing Analysis (STA).