added next_state concurrent assignment
This commit is contained in:
parent
12897f0ae2
commit
147d9e4d7b
@ -72,6 +72,31 @@ begin
|
|||||||
READ_RESPONSE when "01100",
|
READ_RESPONSE when "01100",
|
||||||
NO_OP when others;
|
NO_OP when others;
|
||||||
|
|
||||||
|
--- State Transition Diagram ---
|
||||||
|
--
|
||||||
|
-- +-----+
|
||||||
|
-- \|/ |
|
||||||
|
-- RESET --+
|
||||||
|
-- |
|
||||||
|
-- |
|
||||||
|
-- IDLE<-------------------+
|
||||||
|
-- / \ |
|
||||||
|
-- / \ |
|
||||||
|
-- / \ |
|
||||||
|
-- \|/ \|/ |
|
||||||
|
-- TX_HEADER RX_HEADER |
|
||||||
|
-- | | |
|
||||||
|
-- | | ----+ |
|
||||||
|
-- \|/ \|/ \|/ | |
|
||||||
|
-- TX_BODY RX_RESPONSE---+ |
|
||||||
|
-- | | |
|
||||||
|
-- | +--+ | |
|
||||||
|
-- \|/\|/ | \|/ |
|
||||||
|
-- TX_ACK--+ RX_BODY |
|
||||||
|
-- | | |
|
||||||
|
-- | | |
|
||||||
|
-- +-----------+--------------+
|
||||||
|
--
|
||||||
case curr_state is
|
case curr_state is
|
||||||
when IDLE =>
|
when IDLE =>
|
||||||
if curr_command = WRITE or curr_command = WRITE_ADD then
|
if curr_command = WRITE or curr_command = WRITE_ADD then
|
||||||
@ -82,12 +107,37 @@ begin
|
|||||||
next_state <= IDLE;
|
next_state <= IDLE;
|
||||||
end if;
|
end if;
|
||||||
when RESET =>
|
when RESET =>
|
||||||
|
next_state <= IDLE;
|
||||||
when TX_HEADER =>
|
when TX_HEADER =>
|
||||||
|
-- The header only takes one word (cycle) to transmit.
|
||||||
|
-- Continue to body directly afterwards.
|
||||||
|
next_state <= TX_BODY;
|
||||||
when TX_BODY =>
|
when TX_BODY =>
|
||||||
|
-- Here we want to stay in TX_BODY for the duration of a packet.
|
||||||
|
-- Right now, we transfer one single word at a time for simplicity
|
||||||
|
next_state <= TX_ACK;
|
||||||
when TX_ACK =>
|
when TX_ACK =>
|
||||||
|
-- Wait for write acknowledgement.
|
||||||
|
if curr_respoonse = WRITE_ACK then
|
||||||
|
next_state <= IDLE;
|
||||||
|
else
|
||||||
|
next_state <= TX_ACK;
|
||||||
|
end if;
|
||||||
when RX_HEADER =>
|
when RX_HEADER =>
|
||||||
|
-- The header only takes one word (cycle) to transmit.
|
||||||
|
-- Continue to awaiting response directly afterwards.
|
||||||
|
next_state <= RX_RESPONSE;
|
||||||
when RX_RESPONSE =>
|
when RX_RESPONSE =>
|
||||||
|
-- Wait for read response.
|
||||||
|
if curr_respoonse = READ_RESPONSE then
|
||||||
|
next_state <= RX_BODY;
|
||||||
|
else
|
||||||
|
next_state <= RX_RESPONSE;
|
||||||
|
end if;
|
||||||
when RX_BODY =>
|
when RX_BODY =>
|
||||||
|
-- Here we want to stay in RX_BODY for the duration of a packet.
|
||||||
|
-- Right now, we receive only one single word at a time for simplicity
|
||||||
|
next_state <= IDLE;
|
||||||
end case;
|
end case;
|
||||||
|
|
||||||
end process comb_proc;
|
end process comb_proc;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user