Advertisement
Sidsh

LED

Feb 1st, 2022
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module LED(
  2.     input [2:0] hl ,
  3.     input hl1,
  4.     input [2:0] id,
  5.     input clk_50,
  6.     output r1,
  7.     output g2,
  8.     output b3
  9. );
  10.    
  11.     reg R1=0;
  12.     reg G2=0;
  13.     reg B3=0;
  14.         reg HL = 3'b000;
  15.   always @ (posedge clk_50)
  16.   if(HL == 7)
  17.   begin
  18.   R1 =0 ;
  19.   G2 = 0;
  20.   B3 = 0;
  21.   HL = 0;
  22.   end
  23.   else
  24.     begin
  25.      
  26.       if (id == 1)
  27.         begin  
  28.             R1 = 1;
  29.             HL = HL + 1;
  30.            
  31.    
  32.         end
  33.       else
  34.         if (id == 2)
  35.         begin  
  36.             G2 = 1;
  37.             HL = HL + 1;;  
  38.            
  39.    
  40.         end
  41.          if (id == 3)
  42.         begin  
  43.             B3 = 1;
  44.             HL = HL + 1;
  45.            
  46.    
  47.         end
  48.        
  49.     end
  50. assign r1= R1;
  51. assign g2= G2;
  52. assign b3= B3;
  53. assign hl = HL;
  54. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement