Altera_Forum
Honored Contributor
13 years agoSerial data from shift register to FIFO
Hi,
let's assume conditions: Receive domain: Data clock : 125 MHz Data encoded with with 5b/4b method Data frame contains 32 * 64 bits (4bits before encoding - 40 * 64 bits in 5bit version) Frame frequency is 44 kHz The begin of the frame is synchronized with following bits "11000" So first i have to detect the beginning of the frame - i use for this 15 bit shift register. Serial data goes into the shift registers , and sync is asserted when the most significant 10 bits are 1100011000 and the least significant are different from 11000. Shift register is clocked with 125 MHz. My object is to: After getting sync flag, i need to decode 5 lsb bits of shift register into 4 bits. And put them into the FIFO. After decoding data from 5 bit to 4 bit i get 25 MHz clock to drive the wrclk of the fifo. So my question is -> How to correclty get this 5 bits (then 4 bits) into the fifo ? I assume that this 25 MHz clock is derived directly from this 125 MHz clock , so the are synchronized. I should also assert correctly wrreq signal in fifo - and use a counter to write only these 32 * 64 bits and nothing else. wrreq must be asserted somehow before the rising edge of wrclk (falling edge) ? What if i assert it in the rising edge? Will data be put into the fifo, or on the next cycle? Or something wrong will happen ? I suppose that i should use a synchronizer for the sync flag in 125 Mhz- but don't know how to do it - it will give some delay to the sync in 25 MHz domain. I will lose then the actual data from the shift register (it will be shifted with 125Mhz clocks before i will be able to correctly read those 5 bits and put them into 25 Mhz clock domain) ? Sorry for the mess, thanks for any suggestions and help best regards madness