J
john
Guest
Hi,
I have the following problem with the control statment generated by the
state machine to control the counter. In the code mentioned below, I am
trying to increment a counter when trigger = '1' and at the same time,
I want to change the state to CONTROL. Can anyone advice a better
solution to solve this problem? So, "incr" should get updated (
change from 0 to 1 ) in CONTROL state before the state machine switches
to state "Stop".
type State is (
INIT,
CONTROL,
STOP
);
signal state_r, incr, state_x : State
begin
case state_r is
when INIT =>
incr <= '0';
state_x <= CONTROL;
when CONTROL =>
if Trigger = '1' the
incr <= '1';
state_x <= STOP
else
incr<='0';
state_x <= CONTROL;
end if;
When STOP=>
................
When others =>
--some code--
if clk'event and clk = '1' then
if rst = YES then
state_r <=INIT;
else
state_r <=state_x;
end if;
end if;
end process;
Process ( rst , clock)
Begin
if (rst = '1') then
elsif ( if clk='1' and clk'event ) then
if ( inc ='1') then
addr_r <= addr_r + 1;
End If;
Regards,
John
I have the following problem with the control statment generated by the
state machine to control the counter. In the code mentioned below, I am
trying to increment a counter when trigger = '1' and at the same time,
I want to change the state to CONTROL. Can anyone advice a better
solution to solve this problem? So, "incr" should get updated (
change from 0 to 1 ) in CONTROL state before the state machine switches
to state "Stop".
type State is (
INIT,
CONTROL,
STOP
);
signal state_r, incr, state_x : State
begin
case state_r is
when INIT =>
incr <= '0';
state_x <= CONTROL;
when CONTROL =>
if Trigger = '1' the
incr <= '1';
state_x <= STOP
else
incr<='0';
state_x <= CONTROL;
end if;
When STOP=>
................
When others =>
--some code--
if clk'event and clk = '1' then
if rst = YES then
state_r <=INIT;
else
state_r <=state_x;
end if;
end if;
end process;
Process ( rst , clock)
Begin
if (rst = '1') then
elsif ( if clk='1' and clk'event ) then
if ( inc ='1') then
addr_r <= addr_r + 1;
End If;
Regards,
John