Add HW PWM controller top module

This commit is contained in:
Madeline Busig 2025-12-02 21:33:38 -08:00
parent 616166f69f
commit 1c532bdd95

View File

@ -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