Sometimes we need to do some sequential processes with some conditions that comes from outside of Process. we can declare some controlling signals for this conditions, for example like this :
Architecture ...
Signal C : std_logic;
begin
Process(SomeInputs)
begin
C <= '1';
end Process;
Process(Clock)
Variable Counter : Integer := 0;
begin
if (Clock'Event and Clock = '1') then
if C = '1' then
Counter := Counter + 1;
if Counter = 10 then
Counter := 0;
C <= '0';
end if;
end if;
end if;
end Process;
end;
end ... ;
in this situation signal C is multi source and can not be synthesizable.
Another example is Reset Signal, when the reset comes from outside the process or outside the component we can not Invert it.
One approach is to make a state machine like this :
Process(Clock)
begin
if (Clock'Event and Clock = '1') then
case Current_State is
when State_X =>
Current_State <= State_Y;
when State_Y =>
if C = '1' then
Current_State <= State_X;
else
Current_State <= State_Y;
end if;
...
end case;
end if;
end Process;
Or another way to handle this situation is declaring temporary signals like this :
Architecture ...
Signal MySignal, MyTempSignal : std_logic_vector(N downto 0);
begin
Process(Clock)
Variable Counter : Integer := 0;
begin
if (Clock'Event and Clock = '1') then
if MySignal /= MyTempSignal then
Counter := Counter + 1;
if Counter = 10 then
Counter := 0;
MyTempSignal <= MySignal;
end if;
end if;
end if;
end Process;
end ...;
With temporary signals we can do some process when some signals are changed.
Another way is adding condition signals in the sensitivity list of the process, but when the process is sequential with clock, it`s hard to handle them.
The main problem is every signal must drive from 1 source ( in one process ) and the question is :
What is the best synthesizable way to handle this situation when we need some controlling signals like 'Reset' ?