| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- //////////////////////////////////////////////////////////////////////////////////
- // Company: TAIR
- // Engineer:
- //
- // Create Date: 10/30/2023 11:24:31 AM
- // Design Name:
- // Module Name: Sync1bit
- // Project Name: S5443_V3_FPGA3
- // Target Devices: BOARD: BY5443v3. FPGA: xc7s25csga225-2
- // Tool Versions:
- // Description: This module synchronizes Spi enable command
- //
- // Dependencies:
- //
- // Revision:
- // Revision 1.0 - File Created
- // Additional Comments:
- //
- //////////////////////////////////////////////////////////////////////////////////
- module Sync1bit #(
- parameter WIDTH = 1,
- parameter STAGES = 3
- )
- (
- input ClkFast_i,
- input ClkSlow_i,
- input TxEn_i,
- output [WIDTH-1:0] TxEn_o
- );
- //================================================================================
- // REG/WIRE
- //================================================================================
- //lauch registers
- reg spiTxEnReg;
- // capture registers
- (* ASYNC_REG = "TRUE" *) reg [STAGES*WIDTH-1:0] spiTxEnReg_c;
- //================================================================================
- // ASSIGNMENTS
- //================================================================================
- assign TxEn_o = spiTxEnReg_c[STAGES*WIDTH-1:(STAGES-1)*WIDTH];
- //================================================================================
- // LOCALPARAMS
- //================================================================================
- //================================================================================
- // CODING
- //================================================================================
- always @(posedge ClkFast_i) begin
- spiTxEnReg <= TxEn_i;
- end
- always @(posedge ClkSlow_i) begin
- spiTxEnReg_c <= {spiTxEnReg_c[(STAGES-1)*WIDTH-1:0], spiTxEnReg};
- end
- endmodule
|