Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. begin
  2.  
  3. pulsetimer : process(TRIGGER, CLK) --counts wave on-time from start of trigger
  4. begin
  5. if rising_edge(CLK) then
  6. if TRIGGER = '1' then --trigger must be high at least length of pulse
  7. if x = stopticks then
  8. enable <= '0';
  9. else
  10. enable <= '1';
  11. x <= x + 1;
  12. end if;
  13. else
  14. enable <= '0';
  15. x <= 0;
  16. end if;
  17. end if;
  18. end process;
  19.  
  20.  
  21. waveform : process(CLK)
  22. begin
  23. if rising_edge(CLK) then
  24. if enable = '1' then
  25. if pulse14 ='1' then
  26. if count14 = onticks then
  27. count14 <= 0;
  28. pulse14 <= '0';
  29. else
  30. count14 <= count14+1;
  31. end if;
  32. end if;
  33. if pulse14 ='0' then
  34. if count14 = (deadticks*2 + onticks) then
  35. count14 <= 0;
  36. pulse14 <= '1';
  37. else
  38. count14 <= count14+1;
  39. end if;
  40. end if;
  41.  
  42. if y = (deadticks + onticks) then
  43. if pulse23 ='1' then
  44. if count23 = onticks then
  45. count23 <= 0;
  46. pulse23 <= '0';
  47. else
  48. count23 <= count23+1;
  49. end if;
  50. end if;
  51. if pulse23 ='0' then
  52. if count23 = (deadticks*2 + onticks) then
  53. count23 <= 0;
  54. pulse23 <= '1';
  55. else
  56. count23 <= count23+1;
  57. end if;
  58. end if;
  59. else
  60. y <= y + 1;
  61. end if;
  62. else
  63. pulse14 <= '0';
  64. pulse23 <= '0';
  65. y <= 0;
  66. end if;
  67. end if;
  68. end process;
  69.  
  70. G14 <= pulse14;
  71. G23 <= pulse23;
  72.  
  73. LED14 <= pulse14;
  74. LED23 <= pulse23;
  75. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement