Skip to content

Commit

Permalink
Update the clock gating primitive for VCS (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang-Haojin authored Mar 20, 2024
1 parent a4b0c8a commit fdd56a5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/resources/STD_CLKGT_func.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ module STD_CLKGT_func (

assign clk_en = E | TE;

`ifdef VCS
always @(CK or clk_en) begin
if (CK == 1'b0)
clk_en_reg <= clk_en;
end
`else
`ifdef VERILATOR_5
always @(CK or clk_en) begin
if (CK == 1'b0)
Expand All @@ -20,6 +26,7 @@ module STD_CLKGT_func (
begin
clk_en_reg = clk_en;
end
`endif
`endif

assign Q = CK & clk_en_reg;
Expand Down

0 comments on commit fdd56a5

Please sign in to comment.