1 ------------------------------------------------------------------------------- 3 --! @brief Step Generator module 4 ------------------------------------------------------------------------------- 9 --! Using IEEE standard logic components 10 USE ieee.std_logic_1164.
ALL;
12 --! Using IEE standard numeric components 15 --! @brief Step Generator entity 17 --! This step-generator entity produces a number of step-pulses. This is 18 --! commonly used for devices such as stepper motor driver chips. 20 --! When the user asserts the enable_in signal the step-generation begins. The 21 --! user can de-assert enable_in to cancel step-generation. 23 --! The advance_in flag should be pulsed at the basic step-generation rate. 24 --! This rate is divided down by the delay_in count to produce the stepping 28 count_wid : RANGE 1 TO 'high := 4;
--! Width of count 29 delay_wid : RANGE 1 TO 'high := 6 --! Width of delay 34 enable_in :
IN ; --! Generator enable flag
40 END ENTITY step_generator;
42 --! Architecture rtl of step_generator entity 45 --! Current step counter 48 --! Current delay counter 56 --! @brief Process to generate steps 62 count <= (OTHERS => '0');
63 delay <= (OTHERS => '0');
65 ELSIF (rising_edge(clk_in)) THEN 68 count <= (OTHERS => '0');
69 delay <= (OTHERS => '0');
72 -- Check for step-generator delay 74 -- Delay expired, reset 77 -- Check for more steps to generate 79 -- Check for end of step ('1' going to '0') 100 END ARCHITECTURE rtl;
out step_outstd_logic
Step output.
in clk_instd_logic
Clock.
unsigned( delay_wid- 1 DOWNTO 0) delay
Current delay counter.
count_widinteger range 1 TO integer'high:= 4
Width of count.
in rst_instd_logic
Asynchronous reset.
in count_instd_logic_vector( count_wid- 1 DOWNTO 0)
Count of steps.
in delay_instd_logic_vector( delay_wid- 1 DOWNTO 0)
Delay between steps.
in advance_instd_logic
Advance flag.
unsigned( count_wid- 1 DOWNTO 0) count
Current step counter.
in enable_instd_logic
Generator enable flag.
std_logic step
Step state.
delay_widinteger range 1 TO integer'high:= 6
Width of delay.
_library_ ieeeieee
Drive quadrature output.