Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module LED(
- input [2:0] hl ,
- input [3:0]hl1,
- input [2:0] id,
- input clk_50,
- output r1,
- output g2,
- output b3
- );
- reg ID =[2:0]0;
- reg R1 =0;
- reg G2 =0;
- reg B3 =0;
- reg HL1 = 0; //Register for hl
- reg HL = 0; //counter
- always @ (posedge clk_50)
- begin
- if(HL1 == 1)
- begin
- if (HL == 8 && ID == 0)
- begin
- R1 =0;
- G2 =0;
- B3 =0;
- end
- else
- begin
- HL = HL + 1;
- if (ID == 1)
- begin
- R1 =1;
- end
- else if (ID == 2)
- begin
- G2 = 1;
- end
- else if (ID == 3)
- begin
- B3 = 1;
- end
- end
- end
- end
- assign r1= R1;
- assign g2= G2;
- assign b3= B3;
- assign hl = HL1;
- assign hl1 = HL;
- assign id = ID;
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement