duty.v 222 B

1234567891011121314151617
  1. `timescale 1ns / 1ps
  2. module duty(
  3. input CLK,
  4. input [15:0] cmp,
  5. output reg out
  6. );
  7. reg [15:0]cnt;
  8. reg [15:0]cmp_buf;
  9. always @(posedge CLK) begin
  10. cnt<=cnt+1;
  11. out<=cnt>cmp_buf;
  12. cmp_buf<=cmp;
  13. end
  14. endmodule