# possible clock domain crossing?

Please see the following code. (For the sake of clarity, it is a YCbCr 4:2:2 to 4:4:4 SerDes.)

always @(posedge clk_54, posedge reset) begin
if (reset)
cntr <= 0;
else if (flag_in)
cntr <= cntr+1;
end

always @(posedge clk_54, posedge reset) begin
if (reset) begin
Y  <= 0;
Cb <= 0;
Cr <= 0; end
if (cntr==0)
Cb <= YCbCr;
else if ((cntr==1)||(cntr==3))
Y <= YCbCr;
else if (cntr==2)
Cr <= YCbCr;
end


The input clock is 54 MHz. cntr is a two bit counter. flag_in is a flag telling the counter when to start. It is very clear than none of the three output signals, Y, Cb, or Cr, change at a faster rate than 27 MHz (half of 54). If so, can I safely sample the signals at 27 MHz and not worry about clock domain crossing issues, setup and hold, etc?

I plan on synthesizing with Vivado and placing onto an FPGA. The 27 MHz clock will be derived from the 54 Mhz with Vivado clocking wizard.

• Are the 27 MHz and 54 MHz clocks asynchronous to each other i.e. from separate sources? If so, their phase can/will drift as their frequency ratio won't be a precise 2:1 and your 54 MHz input DFFs (which you should have) can go metastable as you will indeed be crossing clock domains. – TonyM May 21 '18 at 9:52
• I mentioned in the question that "The 27 MHz clock will be derived from the 54 Mhz with Vivado clocking wizard." – David May 21 '18 at 10:00
• Vivado clocking wizard is a GUI, familiar to those who have used it. Sticking with the actual circuitry, are you saying that they are produced from the same PLL and therefore phase-locked to each other? – TonyM May 21 '18 at 12:34
• What I am saying is that the 54 MHz clk comes from outside the board, and the 27 MHz is derived from the 54 MHz clock using the Vivado clocking wizard using the PLL option – David May 22 '18 at 4:35
• Again, you're describing the Vivado GUI actions, not the circuitry it creates, so let's forget about Vivado for now. If you want to answer just my comment question above, I can give you a clear answer on your domain crossing, don't bother if you don't want that though. – TonyM May 22 '18 at 8:13