Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. TITLE pulse_shaper
  2.  
  3. include "lib/edge.inc";
  4. include "lpm_counter.inc";
  5.  
  6. PARAMETERS(
  7. Duration = 16
  8. )
  9. Constant (
  10. CounterSize = CEIL(log2(Duration)
  11. )
  12.  
  13. INCLUDE
  14. lib/edge.tdf
  15.  
  16. SUBDESIGN pulse_shaper (
  17. D, CLK, CLR : INPUT;
  18. q : OUTPUT;
  19. )
  20. VARIABLE
  21. _edge : edge;
  22. _trig : SRFF;
  23. _counter : lpm_counter with (counter_size = CounterSize);
  24. _trigEnd : node;
  25.  
  26.  
  27. BEGIN
  28. _edge.(d,clk,clr) = (d,clk,clr);
  29. _trig.(s,clk,r) = (_edge.q, clk, _trigEnd);
  30. _counter:(Cnt_en,Clock,Sclr) = (_trig.q,clk,_trig_end);
  31.  
  32. IF(_counter.q[CounterSize-1..0] == Duration - 1)
  33. THEN _trigEnd = VCC;
  34. ELSE _trigEnd = GND;
  35. END IF
  36.  
  37. q = _trig.q
  38.  
  39. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement