RxFifoPtrSync.v 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //////////////////////////////////////////////////////////////////////////////////
  2. // Company: TAIR
  3. // Engineer:
  4. //
  5. // Create Date: 10/30/2023 11:24:31 AM
  6. // Design Name:
  7. // Module Name: RxFifoPtrSync
  8. // Project Name: S5443_V3_FPGA3
  9. // Target Devices: BOARD: BY5443v3. FPGA: xc7s25csga225-2
  10. // Tool Versions:
  11. // Description:
  12. //
  13. // Dependencies:
  14. //
  15. // Revision:
  16. // Revision 1.0 - File Created
  17. // Additional Comments:
  18. //
  19. //////////////////////////////////////////////////////////////////////////////////
  20. module RxFifoPtrSync #(
  21. parameter WIDTH = 8,
  22. parameter STAGES = 3
  23. )
  24. (
  25. input ClkFast_i,
  26. input ClkSlow_i,
  27. input [WIDTH-1:0] RxFifoWrPtr_i,
  28. output [WIDTH-1:0] RxFifoWrPtr_o
  29. );
  30. //================================================================================
  31. // REG/WIRE
  32. //================================================================================
  33. //lauch registers
  34. reg [WIDTH-1:0] rxFifoWrPtrReg;
  35. // capture registers
  36. (* ASYNC_REG = "TRUE" *) reg [STAGES*WIDTH-1:0] rxFifoWrPtrReg_c;
  37. //================================================================================
  38. // ASSIGNMENTS
  39. //================================================================================
  40. assign RxFifoWrPtr_o = rxFifoWrPtrReg_c[STAGES*WIDTH-1:(STAGES-1)*WIDTH];
  41. //================================================================================
  42. // LOCALPARAMS
  43. //================================================================================
  44. //================================================================================
  45. // CODING
  46. //================================================================================
  47. always @(posedge ClkFast_i) begin
  48. rxFifoWrPtrReg <= RxFifoWrPtr_i;
  49. end
  50. always @(posedge ClkSlow_i) begin
  51. rxFifoWrPtrReg_c <= {rxFifoWrPtrReg_c[(STAGES-1)*WIDTH-1:0], rxFifoWrPtrReg};
  52. end
  53. endmodule