x393  1.0
FPGAcodeforElphelNC393camera
sim_clk_div.v
Go to the documentation of this file.
1 
39 `timescale 1ns/1ps
40 
41 module sim_clk_div#(
42  parameter DIVISOR = 5
43  ) (
44  input clk_in,
45  input en,
46  output clk_out
47  );
48  integer cntr = 0;
49  reg clk_out_r = 0;
50  assign clk_out = (DIVISOR == 1) ? clk_in: clk_out_r;
51  always @(clk_in) if (en) begin
52  if (cntr == 0) begin
53  cntr = DIVISOR - 1;
55  end else begin
56  cntr = cntr - 1;
57  end
58  end
59 endmodule
60 
8812cntrinteger
Definition: sim_clk_div.v:48
8813clk_out_rreg
Definition: sim_clk_div.v:49