Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Comparison between old value and new value

Hi All,

Its a very simple question but I am unable to do that. Below is my code. I want to store signal data_o_new to signal data_o_old and then compare these signals with each other and do increment or decrement until these two signals become same. data_o_new is coming from an ip. Please help me... thanks

Architechture starts here:

Begin

data_o_old <= data_o_new;

data_o <= data_o_old;

fading: PROCESS(clk)

Begin

if rising_edge(clk) then

if data_o_new > data_o_old then

data_o_old <= data_o_old + 1;

elsif data_o_new < data_o_old then

data_o_old <= data_o_old - 1;

else

data_o_old <= data_o_new;

end if;

end if;

end process;

end Architecture;

15 Replies