Advertisement
evage

freq

Nov 27th, 2022
1,502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module frequency_divider #(parameter DIVISOR = 2)(
  2.     input clock_in,
  3.     output clock_out   
  4. );
  5.     wire[27:0] counter;
  6.    
  7.     clk_func #(.width(28), .step(1), .up_down(0), .M(DIVISOR)) mod_clk(
  8.         .clk(clock_in), .out(counter)  // CHANGE .up_down, 1 - addition, 0 - substraction
  9.     );     
  10.     assign clock_out = (counter < DIVISOR / 2) ? 1'b0 : 1'b1;
  11.  
  12. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement