successful test of module omdazz_WS2812b.v

This commit is contained in:
pavel 2026-08-07 20:49:16 +03:00
parent cd96a065b8
commit a0711a5e13
2 changed files with 33 additions and 10 deletions

View File

@ -1,11 +1,12 @@
module omdazz_WS2812b #(
parameter integer WS2812_NUM = 10 - 1,
parameter integer WS2812_WIDTH = 24,
parameter integer CLK_FRE = 50_000_000,
parameter [WS2812_NUM:0] LED_MASK
parameter integer CLK_FRE = 50_000_000
//parameter [WS2812_NUM:0] LED_MASK
)(
input wire CLOCK_50,
output reg WS2812
input wire [WS2812_NUM-1:0] LED_MASK,
output reg WS2812
);

36
top.v
View File

@ -1,16 +1,38 @@
module top(
input wire CLOCK_50,
input wire [4:4] D_INP,
output wire WS2812_OUT
input wire CLOCK_50,
output wire WS2812_OUT
);
localparam integer LED_NUM = 10;
localparam integer TICK_1SEC = 50_000_000;
localparam integer COUNTER_WIDTH = 26;
reg [COUNTER_WIDTH-1:0] sec_count;
reg [LED_NUM-1:0] led_mask;
initial begin
sec_count = 0;
led_mask = 10'b0000000001;
end
always @(posedge CLOCK_50) begin
if (sec_count == TICK_1SEC - 1) begin
sec_count <= 0;
// LED0 -> LED1 -> ... -> LED9 -> LED0
led_mask <= {led_mask[LED_NUM-2:0], led_mask[LED_NUM-1]};
end
else begin
sec_count <= sec_count + 1'b1;
end
end
omdazz_WS2812b #(
.WS2812_NUM(10 - 1),
.CLK_FRE(50_000_000),
.LED_MASK(10'b11_1111_1111) // LED0 и LED2
.WS2812_NUM(LED_NUM),
.CLK_FRE (50_000_000)
) u_ws2812 (
.CLOCK_50(CLOCK_50),
.LED_MASK(led_mask),
.WS2812 (WS2812_OUT)
);