Forum Discussion
Altera_Forum
Honored Contributor
12 years ago -- for guidance
signal counter : unsigned(2 downto 0) := "000";
signal count : integer range 0 to ... := 0;
...
process(stepper_clk_in)
begin
if rising_edge(stepper_clk_in) then
counter <= counter+1; -- 0 ~ 7
end if;
end process;
clk_12 <= std_logic(counter(0));
clk_6 <= std_logic(counter(1));
clk_3 <= std_logic(counter(2));
process(stepper_in_clk)
begin
if rising_edge(stepper_in_clk) then
if clk_12 = '1' then
if count = ? then
count <= ?;
elsif direction_i = '0' and run_i = '1' and halt_ctrl = '0' then
count <= 0;
else
count <= count + 1;
end if;
end if;
end if;
end process;