Advertisement
minh1999

pwm

May 21st, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module pwm(clk_in,select,clk_out);
  2.  
  3. input clk_in;
  4. input [1:0] select;
  5. output reg clk_out;
  6.  
  7. initial
  8. begin
  9.     clk_out = 0;
  10. end
  11.  
  12. integer count = 0;
  13. always @(posedge clk_in)
  14. begin
  15.     if(count!=25)
  16.         count <= count + 1;
  17.     else
  18.     begin
  19.         clk_out <= ~clk_out;
  20.         count <= 0;
  21.     end
  22. end
  23.  
  24. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement