f4pga-examples/xc7/pulse_width_led/PWM.v
Joshua Fife 96bbace913 Added completed pwm and stop watch examples. Partially complete debouncer and uart_tx
Signed-off-by: Joshua Fife <jpfife17@gmail.com>
2021-07-21 15:27:08 -06:00

17 lines
219 B
Verilog

module PWM(
input wire clk,
input wire [13:0] width,
output reg pulse
);
reg[13:0] counter = 0;
always @(posedge clk)
begin
counter <= counter + 1;
if(counter < width)
pulse <= 1'b1;
else
pulse <= 1'b0;
end
endmodule