if you implement an async fifo, you must use gray code fifo pointer to aviod metastable or glitch problems.
eg: ptr[3:0] is binary code, when a state change, the 4 bits are not changed at the same time. so there may be some time that ptr turns to be a transition state.(4'b101 -> 4'b110, there may be 4'b100 or 4'b111 states). that will make your async logic to judge fifo empty/full fail.
When designing asynch FIFOs, we must use Gray style pointers to avoid errors when comparing the read and write pointers.
To compare the read pointer with the write pointer for Full flag, we need to take the read pointer to the write clock domain.
When this is done using binary style pointers, the read pinter address value changes more than one bit and thus can lead to errors when comparing the pointers. When using Gray style logic, the bit change is limited to only one-bit and thus the comparison errors are eliminated or minimized.
This is the main reason why gray style pointers are used rather than binary.