////////////////////////////////////////////////////////////////////////////////// // Company: TAIR // Engineer: // // Create Date: 10/30/2023 11:24:31 AM // Design Name: // Module Name: SpiClkMux // Project Name: S5443_V3_FPGA3 // Target Devices: BOARD: BY5443v3. FPGA: xc7s25csga225-2 // Tool Versions: // Description: This module muxes clock based on a clkCh signal - MMCM or // from a custom divider. // // Dependencies: // // Revision: // Revision 1.0 - File Created // Additional Comments: // ////////////////////////////////////////////////////////////////////////////////// module SpiClkMux ( input Rst_i, input clkCh, input clkOutMMCM, input clkMan, output SpiClk_o ); //================================================================================ // REG/WIRE //================================================================================ reg spiClkReg; wire spiClk; //================================================================================ // ASSIGNMENTS //=============================================================================== assign spiClk = spiClkReg; //================================================================================ // CODING //================================================================================ always @(*) begin if (Rst_i) begin spiClkReg = 0; end else begin if (clkCh) begin spiClkReg = clkOutMMCM; end else begin spiClkReg = clkMan; end end end BUFG BUFG_inst ( .O(SpiClk_o), // 1-bit output: Clock output .I(spiClk) // 1-bit input: Clock input ); endmodule