Skip to content

Commit

Permalink
fpga: ignore bufgmux in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrilKoe committed Jul 6, 2023
1 parent a9cae21 commit 360fe59
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
24 changes: 17 additions & 7 deletions src/fpga/tc_clk_xilinx.sv
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,29 @@ module tc_clk_inverter (

endmodule

module tc_clk_mux2 (
module tc_clk_mux2 #(
/// Using BUFGMUX on FPGA can allocate limited clock ressources
/// to non clock signals. It can also create long buffer chain
/// depending on your design.
/// If you need your signal to be buffered, use EN_BUF_FPGA = 0
parameter bit EN_BUF_FPGA = 1'b0
)(
input logic clk0_i,
input logic clk1_i,
input logic clk_sel_i,
output logic clk_o
);

BUFGMUX i_BUFGMUX (
.S ( clk_sel_i ),
.I0 ( clk0_i ),
.I1 ( clk1_i ),
.O ( clk_o )
);
if (EN_BUF_FPGA) begin
BUFGMUX i_BUFGMUX (
.S ( clk_sel_i ),
.I0 ( clk0_i ),
.I1 ( clk1_i ),
.O ( clk_o )
);
end else begin
assign clk_o = clk_sel_i ? clk1_i : clk0_i;
end

endmodule

Expand Down
6 changes: 5 additions & 1 deletion src/rtl/tc_clk.sv
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ endmodule
// reset state during the transition phase. If you need dynamic switching
// between arbitrary input clocks without introducing glitches, have a look at
// the clk_mux_glitch_free cell in the pulp-platform/common_cells repository.
module tc_clk_mux2 (
module tc_clk_mux2 #(
/// EN_BUF_FPGA is used when avoiding to use buffered clk mux on FPGA.
/// (see tc_clk_xilinx.sv)
parameter bit EN_BUF_FPGA = 1'b0
)(
input logic clk0_i,
input logic clk1_i,
input logic clk_sel_i,
Expand Down

0 comments on commit 360fe59

Please sign in to comment.