Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. // 5555 NE Moore Court
  2. // Hillsboro, OR 97214
  3. // U.S.A
  4. //
  5. // TEL: 1-800-Lattice (USA and Canada)
  6. // 503-268-8001 (other locations)
  7. //
  8. // web: http://www.latticesemi.com/
  9. // email: techsupport@latticesemi.com
  10. // --------------------------------------------------------------------
  11. //
  12. // Revision History :
  13.  
  14. module LED_Rotation(
  15. input clk,
  16. output LED1,
  17. output LED2,
  18. output LED3,
  19. output LED4,
  20. output LED5
  21. );
  22.  
  23. reg[15:0] div_cntr1;
  24. reg[6:0] div_cntr2;
  25. reg[1:0] dec_cntr;
  26. reg half_sec_pulse;
  27.  
  28. always@(posedge clk)
  29. begin
  30. div_cntr1 <= div_cntr1 + 1;
  31. if (div_cntr1 == 0)
  32. if (div_cntr2 == 91)
  33. begin
  34. div_cntr2 <= 0;
  35. half_sec_pulse <= 1;
  36. end
  37. else
  38. div_cntr2 <= div_cntr2 + 1;
  39. else
  40. half_sec_pulse <= 0;
  41.  
  42. if (half_sec_pulse == 1)
  43. dec_cntr <= dec_cntr + 1;
  44.  
  45. end
  46.  
  47.  
  48. assign LED1 = (dec_cntr == 0) ;
  49. assign LED2 = (dec_cntr == 1) ;
  50. assign LED3 = (dec_cntr == 2) ;
  51. assign LED4 = (dec_cntr == 3) ;
  52. assign LED5 = 1'b1;
  53.  
  54. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement