有如下几个信号
输入信号
1、同步后的rstnsync_clk
2、时钟:clk
3、test_mode
4、软件控制信号:clk_sub_en
输出信号
1、clk_sub
功能:软件配置的使能信号clk_sub_en经过时钟clk 2拍同步处理后产生clk 域下的enable信号,然后使用工艺库里的时钟门控cell产生门控时钟clk_sub
使用工艺库里的门控时钟原因如下
clkgating_lte u0_clk_sub_gen (
.rstn (rstnsync_clk ), // input
.clk_in (clk ), // input
.test_mode (test_mode ), // input
.gating (clk_sub_en ), // input
.clk_out (clk_sub ) // output
);
module clkgating_lte (
rstn,
clk_in,
test_mode,
gating,
clk_out
);
input rstn;
input clk_in;
input test_mode;
input gating;
output clk_out;
wire gatingSync1;
wire gatingSync2;
dsync2s u_dsync2s(.q(gatingSync2), .d(gating), .clk(clk_in), .rst_(rstn));
clk_gate u_gating (.TE(test_mode), .E(gatingSync2), .CK(clk_in), .QCK(clk_out));
endmodule
// clock gate
module clk_gate (CK, E, TE, QCK);
input CK;
input E;
input TE;
output QCK;
`ifdef FPGA
assign QCK = CK;
`else
`ifdef ARM_22ULP_9T
PREICG_X4B_A9PP140ZTS_C35 U_gate (
.SE(TE),
.E (E),
.CK(CK),
.ECK(QCK)
);
`elsif ARM_22ULP_6T
PREICG_X4B_A6P5PP140ZTS_C35 U_gate (
.SE(TE),
.E (E),
.CK(CK),
.ECK(QCK)
);
`elsif TSMC_22NM_9T
CKLNQD2BWP35P140 donttouch_cg_pos (
.TE(TE),
.E (E),
.CP(CK),
.Q (QCK)
);
`else
CKLNQD2BWP7T35P140 donttouch_cg_pos (
.TE(TE),
.E (E),
.CP(CK),
.Q (QCK)
);
`endif
`endif
endmodule // pmu_clk_gate