You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rgb_led_top.sv 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. module led_top (
  2. input wire clk12M,
  3. input wire rst,
  4. input wire [1:0] color_sel,
  5. input wire RGB_Blink_En,
  6. output reg REDn,
  7. output reg BLUn,
  8. output reg GRNn,
  9. output reg RED,
  10. output reg BLU,
  11. output reg GRN
  12. );
  13. wire red_pwm;
  14. wire grn_pwm;
  15. wire blu_pwm;
  16. //parameter on_hi = 2'b10;
  17. //parameter on_lo = 2'b01;
  18. //parameter off = 2'b00;
  19. //parameter LED_OFF = 2'b00;
  20. //parameter RAMP_UP = 2'b01;
  21. //parameter LED_ON = 2'b10;
  22. //parameter RAMP_DOWN = 2'b11;
  23. //parameter on_max_cnt = 28'h16E35ED; // 1 sec steady
  24. //parameter [3:0] Brightness=4'b0111; //50% Brightness
  25. //parameter [3:0] BreatheRamp=4'b0110; //2x
  26. //parameter [3:0] BlinkRate=4'b0101; //1sec
  27. //parameter string RGB0_CURRENT = "0b111111";
  28. //parameter string RGB1_CURRENT = "0b111111";
  29. //parameter string RGB2_CURRENT = "0b111111";
  30. defparam U1.on_hi = 2'b10;
  31. defparam U1.on_lo = 2'b01;
  32. defparam U1.off = 2'b00;
  33. defparam U1.LED_OFF = 2'b00;
  34. defparam U1.RAMP_UP = 2'b01;
  35. defparam U1.LED_ON = 2'b10;
  36. defparam U1.RAMP_DOWN = 2'b11;
  37. defparam U1.on_max_cnt = 28'h16E35ED; // 1 sec steady
  38. defparam U1.Brightness = 4'b0111; // 50% Brightness
  39. defparam U1.BreatheRamp = 4'b0110; // 2x
  40. defparam U1.BlinkRate = 4'b0101; // 1 sec
  41. defparam U2.RGB0_CURRENT = "0b111111";
  42. defparam U2.RGB1_CURRENT = "0b111111";
  43. defparam U2.RGB2_CURRENT = "0b111111";
  44. LED_control1 U1 (.clk12M(clk12M),.rst(rst),.color_sel(color_sel),.RGB_Blink_En(RGB_Blink_En),.red_pwm(red_pwm),.blu_pwm(blu_pwm),.grn_pwm(grn_pwm));
  45. RGB U2 (.CURREN('b1),.RGB0PWM(blu_pwm),.RGB1PWM(grn_pwm),.RGB2PWM(red_pwm),.RGBLEDEN('b1),.RGB0(BLUn),.RGB1(GRNn),.RGB2(REDn));
  46. assign RED = red_pwm;
  47. assign GRN = grn_pwm;
  48. assign BLU = blu_pwm;
  49. endmodule