mirror of
https://github.com/supleed2/EIE4-FYP.git
synced 2024-12-22 22:25:50 +00:00
Add pwm module to set LED colour from LiteX Console
This commit is contained in:
parent
d960053a7e
commit
529efcaf9f
20
rtl/flipPwm.sv
Normal file
20
rtl/flipPwm.sv
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
`default_nettype none
|
||||||
|
|
||||||
|
module flipPwm
|
||||||
|
( input var clk
|
||||||
|
, input var [23:0] rgb
|
||||||
|
, output var ledr
|
||||||
|
, output var ledg
|
||||||
|
, output var ledb
|
||||||
|
);
|
||||||
|
|
||||||
|
logic [7:0] counter;
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
counter <= counter + 1;
|
||||||
|
|
||||||
|
assign ledr = (rgb[23:16] > counter);
|
||||||
|
assign ledg = (rgb[15: 8] > counter);
|
||||||
|
assign ledb = (rgb[ 7: 0] > counter);
|
||||||
|
|
||||||
|
endmodule
|
Loading…
Reference in a new issue