S
Stefan Oedenkoven
Guest
Hi Ng,
i have a statemachine which should do some action on a sensor-signal 'sX'
pSYNC_PROC: process (CLK, Reset)
begin
if (Reset='0') then
sCurrentState <= U001;
elsif (CLK'event and CLK = '1') then
sCurrentState <= sNextState;
end if;
end process;
pCOMB_PROC: process (Reset, sCurrentState, sX, sY)
variable vX_read : STD_LOGIC := '0';
begin
if Reset = '0' then
sNextState <= U001;
else
case sCurrentState is
when U001 =>
if sX = '0' then
sNextState <= U002;
vX_read := '1';
else
sNextState <= U001;
end if;
when U002 =>
if sX = '1' then
vX_read := '0'; -- ok, now Signal sX was again high,
so the next falling edge will be used
sNextState <= U002;
elsif sX = '0' then
if vX_read = '0' then
vX_read := '1'; -- this is only working on XilinxISE
and XV9500 ... with Altera Quartus and 10K-Series i never leave U002!
why???
sNextState <= U003;
else
sNextState <= U002;
end if;
end if;
when U003 =>
....
....
Is this the right way to handle asynchronous signals???
thanks in advance,
Stefan
i have a statemachine which should do some action on a sensor-signal 'sX'
pSYNC_PROC: process (CLK, Reset)
begin
if (Reset='0') then
sCurrentState <= U001;
elsif (CLK'event and CLK = '1') then
sCurrentState <= sNextState;
end if;
end process;
pCOMB_PROC: process (Reset, sCurrentState, sX, sY)
variable vX_read : STD_LOGIC := '0';
begin
if Reset = '0' then
sNextState <= U001;
else
case sCurrentState is
when U001 =>
if sX = '0' then
sNextState <= U002;
vX_read := '1';
else
sNextState <= U001;
end if;
when U002 =>
if sX = '1' then
vX_read := '0'; -- ok, now Signal sX was again high,
so the next falling edge will be used
sNextState <= U002;
elsif sX = '0' then
if vX_read = '0' then
vX_read := '1'; -- this is only working on XilinxISE
and XV9500 ... with Altera Quartus and 10K-Series i never leave U002!
why???
sNextState <= U003;
else
sNextState <= U002;
end if;
end if;
when U003 =>
....
....
Is this the right way to handle asynchronous signals???
thanks in advance,
Stefan