|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- module led_top (
- input wire clk12M,
- input wire rst,
- input wire [1:0] color_sel,
- input wire rw,
- output reg REDn,
- output reg BLUn,
- output reg GRNn,
- output reg RED,
- output reg BLU,
- output reg GRN
- );
-
- wire red_pwm;
- wire grn_pwm;
- wire blu_pwm;
-
- //parameter on_hi = 2'b10;
- //parameter on_lo = 2'b01;
- //parameter off = 2'b00;
- //parameter LED_OFF = 2'b00;
- //parameter RAMP_UP = 2'b01;
- //parameter LED_ON = 2'b10;
- //parameter RAMP_DOWN = 2'b11;
- //parameter on_max_cnt = 28'h16E35ED; // 1 sec steady
- //parameter [3:0] Brightness=4'b0111; //50% Brightness
- //parameter [3:0] BreatheRamp=4'b0110; //2x
- //parameter [3:0] BlinkRate=4'b0101; //1sec
- //parameter string RGB0_CURRENT = "0b111111";
- //parameter string RGB1_CURRENT = "0b111111";
- //parameter string RGB2_CURRENT = "0b111111";
- defparam U1.on_hi = 2'b10;
- defparam U1.on_lo = 2'b01;
- defparam U1.off = 2'b00;
- defparam U1.LED_OFF = 2'b00;
- defparam U1.RAMP_UP = 2'b01;
- defparam U1.LED_ON = 2'b10;
- defparam U1.RAMP_DOWN = 2'b11;
- defparam U1.on_max_cnt = 28'h16E35ED; // 1 sec steady
- defparam U1.Brightness = 4'b0111; // 50% Brightness
- defparam U1.BreatheRamp = 4'b0110; // 2x
- defparam U1.BlinkRate = 4'b0101; // 1 sec
- defparam U2.RGB0_CURRENT = "0b111111";
- defparam U2.RGB1_CURRENT = "0b111111";
- defparam U2.RGB2_CURRENT = "0b111111";
-
- LED_control1 U1 (.clk12M(clk12M),.rst(rst),.color_sel(color_sel),.rw(rw),.red_pwm(red_pwm),.blu_pwm(blu_pwm),.grn_pwm(grn_pwm));
-
-
- RGB U2 (.CURREN('b1),.RGB0PWM(blu_pwm),.RGB1PWM(grn_pwm),.RGB2PWM(red_pwm),.RGBLEDEN('b1),.RGB0(BLUn),.RGB1(GRNn),.RGB2(REDn));
-
- assign RED = red_pwm;
- assign GRN = grn_pwm;
- assign BLU = blu_pwm;
-
- endmodule
-
|