Advertisement
Guest User

Untitled

a guest
Jul 7th, 2019
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1.  
  2. module LED_Rotation(
  3. input clk,
  4. output LED1,
  5. output LED2,
  6. output LED3,
  7. output LED4,
  8. output LED5
  9. );
  10.  
  11. reg[15:0] div_cntr1;
  12. reg[6:0] div_cntr2;
  13. reg[1:0] dec_cntr;
  14. reg half_sec_pulse;
  15.  
  16. always@(posedge clk)
  17. begin
  18. div_cntr1 <= div_cntr1 + 1;
  19. if (div_cntr1 == 0)
  20. if (div_cntr2 == 91)
  21. begin
  22. div_cntr2 <= 0;
  23. half_sec_pulse <= 1;
  24. end
  25. else
  26. div_cntr2 <= div_cntr2 + 1;
  27. else
  28. half_sec_pulse <= 0;
  29.  
  30. if (half_sec_pulse == 1)
  31. dec_cntr <= dec_cntr + 1;
  32.  
  33. end
  34.  
  35.  
  36. assign LED1 = (dec_cntr == 0) ;
  37. assign LED2 = (dec_cntr == 1) ;
  38. assign LED3 = (dec_cntr == 2) ;
  39. assign LED4 = (dec_cntr == 3) ;
  40. assign LED5 = 1'b1;
  41.  
  42. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement