diff --git a/hw_pwm_controller/src/top.v b/hw_pwm_controller/src/top.v new file mode 100644 index 0000000..32e09a2 --- /dev/null +++ b/hw_pwm_controller/src/top.v @@ -0,0 +1,37 @@ +`timescale 1ns/1ps + +module top ( + input clk, + input [0:0] btn, + input [7:0] sw, + output [2:0] RGB_led_A, + output [7:0] led +); + +wire clk2; + +conf_div clock_div ( + .clk_in(clk), + .rst(0), + .sel(6), + .clk_out(clk2) +); + +wire clk_cur = btn[0] ? clk2 : clk; + +pwm_core #( + .WINDOW_REG_SIZE(8) +) pwm_core_r ( + .clk(clk_cur), + .rst(0), + .duty(sw[7:0]), + .window_width(255), + .oen(sw[11]), + .pulse(RGB_led_A[0]) +); + +assign RGB_led_A[1] = 0; +assign RGB_led_A[2] = 0; + +endmodule +