Forum Discussion
Altera_Forum
Honored Contributor
10 years agoThe source compiles OK with Quartus II 14.1
However the following code is a bit odd to read process(clk_in, init_in, counter)
begin
if (rising_edge(clk_in) and init_in = '1') then
if (counter = 63) then
counter <= 0; -- resets counter when it reaches 320
else
counter <= counter + 1;
end if;
elsif (rising_edge(clk_in) and init_in = '0') then
counter <= 0; -- if "init_in" is set to 0, counter resets, as well as "start_tx_out"
end if;
end process; and most would write it like this: process(clk_in)
begin
if rising_edge(clk_in) then
if (init_in = '1') then
if (counter = 63) then
counter <= 0; -- resets counter when it reaches 320
else
counter <= counter + 1;
end if;
else
counter <= 0; -- if "init_in" is set to 0, counter resets, as well as "start_tx_out"
end if ;
end if;
end process; Both ways seem to generate the same result, though.