blob: 2f8f540bfdd6a7da4f824f698520812bdd4aca34 [file] [log] [blame]
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//
// Common Library: Clock Gating cell
//
// The logic assumes that en_i is synchronized (so the instantiation site might need to put a
// synchronizer before en_i).
// This module isn't synthesizable, so don't even try.
`ifndef SYNTHESIS
module lowrisc_prim_generic_clock_gating #(
parameter bit NoFpgaGate = 1'b0, // this parameter has no function in generic
parameter bit FpgaBufGlobal = 1'b1 // this parameter has no function in generic
) (
input clk_i,
input en_i,
input test_en_i,
output logic clk_o
);
logic en_latch /* verilator clock_enable */;
always_latch begin
if (!clk_i) begin
en_latch = en_i | test_en_i;
end
end
assign clk_o = en_latch & clk_i;
endmodule
`endif