Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TITLE pulse_shaper
- include "lib/edge.inc";
- include "lpm_counter.inc";
- PARAMETERS(
- Duration = 16
- )
- Constant (
- CounterSize = CEIL(log2(Duration)
- )
- INCLUDE
- lib/edge.tdf
- SUBDESIGN pulse_shaper (
- D, CLK, CLR : INPUT;
- q : OUTPUT;
- )
- VARIABLE
- _edge : edge;
- _trig : SRFF;
- _counter : lpm_counter with (counter_size = CounterSize);
- _trigEnd : node;
- BEGIN
- _edge.(d,clk,clr) = (d,clk,clr);
- _trig.(s,clk,r) = (_edge.q, clk, _trigEnd);
- _counter:(Cnt_en,Clock,Sclr) = (_trig.q,clk,_trig_end);
- IF(_counter.q[CounterSize-1..0] == Duration - 1)
- THEN _trigEnd = VCC;
- ELSE _trigEnd = GND;
- END IF
- q = _trig.q
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement