Advertisement
1WaKa_WaKa1

freq_divider

Apr 6th, 2023
835
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2.  
  3. module freq_divider(
  4.     input clk,
  5.     output reg clk_out = 0
  6. );
  7.  
  8. reg[4:0] count = 3'b000;
  9.  
  10. always @(posedge clk) begin
  11.         if (count == 3'b100) begin
  12.             clk_out <= ~clk_out;
  13.             count <= 0;
  14.         end
  15.         else
  16.         count <= count + 1;
  17. end
  18. endmodule
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement