试一下改RTL。
先把gatingcnt的时钟从clka改成clkb。
再改一下pwmcnt书写风格。
always@(posedge clkb or negedge rst_n) begin
if (!rst_n) begin
pwmcnt <= 'b0;
end
else begin
if (gating) begin
pwmcnt <= pwmcnt + 1'b1;
end
else begin
pwmcnt <= pwmcnt;
end
end
end
综合工具要设置一下,让工具infer clock gate