RxFifoPtrSync.v 638 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. module RxFifoPtrSync #(
  2. parameter WIDTH = 8,
  3. parameter STAGES = 3
  4. )
  5. (
  6. input ClkFast_i,
  7. input ClkSlow_i,
  8. input [WIDTH-1:0] RxFifoWrPtr_i,
  9. output [WIDTH-1:0] RxFifoWrPtr_o
  10. );
  11. //lauch registers
  12. reg [WIDTH-1:0] rxFifoWrPtrReg;
  13. // capture registers
  14. (* ASYNC_REG = "TRUE" *) reg [STAGES*WIDTH-1:0] rxFifoWrPtrReg_c;
  15. assign RxFifoWrPtr_o = rxFifoWrPtrReg_c[STAGES*WIDTH-1:(STAGES-1)*WIDTH];
  16. always @(posedge ClkFast_i) begin
  17. rxFifoWrPtrReg <= RxFifoWrPtr_i;
  18. end
  19. always @(posedge ClkSlow_i) begin
  20. rxFifoWrPtrReg_c <= {rxFifoWrPtrReg_c[(STAGES-1)*WIDTH-1:0], rxFifoWrPtrReg};
  21. end
  22. endmodule