Continued work on updating FSMs in SoCBridge-driver
This commit is contained in:
parent
b09ab5f1ad
commit
421ed1c006
@ -99,8 +99,8 @@ begin
|
|||||||
-- / \ |
|
-- / \ |
|
||||||
-- V V |
|
-- V V |
|
||||||
-- TX_HEADER RX_HEADER |
|
-- TX_HEADER RX_HEADER |
|
||||||
-- |\ / | |
|
-- | \ / | |
|
||||||
-- | V V | |
|
-- | V V | |
|
||||||
-- | ADDR1 | |
|
-- | ADDR1 | |
|
||||||
-- | | | |
|
-- | | | |
|
||||||
-- | V | |
|
-- | V | |
|
||||||
@ -127,6 +127,16 @@ begin
|
|||||||
--- Next State Assignment Of RX FSM ---
|
--- Next State Assignment Of RX FSM ---
|
||||||
case st.curr_rx_state is
|
case st.curr_rx_state is
|
||||||
when IDLE =>
|
when IDLE =>
|
||||||
|
if PACKET_TYPE = COMMAND then -- TODO Make this a real type and variable
|
||||||
|
next_rx_state <= CMD;
|
||||||
|
elsif PACKET_TYPE = RESPONSE then
|
||||||
|
next_rx_state <= RX_HEADER;
|
||||||
|
else
|
||||||
|
next_rx_state <= IDLE;
|
||||||
|
end if;
|
||||||
|
when CMD =>
|
||||||
|
-- TODO This should be changed to not to check 'st.curr_cmd' but rather
|
||||||
|
-- the command received which may not be the same variable
|
||||||
if st.curr_cmd = WRITE_ADD then
|
if st.curr_cmd = WRITE_ADD then
|
||||||
next_rx_state <= ADDR1;
|
next_rx_state <= ADDR1;
|
||||||
elsif st.curr_cmd = WRITE then
|
elsif st.curr_cmd = WRITE then
|
||||||
@ -134,9 +144,7 @@ begin
|
|||||||
elsif st.curr_cmd = READ_ADD then
|
elsif st.curr_cmd = READ_ADD then
|
||||||
next_rx_state <= ADDR1;
|
next_rx_state <= ADDR1;
|
||||||
elsif st.curr_cmd = READ then
|
elsif st.curr_cmd = READ then
|
||||||
next_rx_state <= RX_RESPONSE;
|
next_rx_state <= GEN_ACCESS;
|
||||||
else
|
|
||||||
next_rx_state <= IDLE;
|
|
||||||
end if;
|
end if;
|
||||||
when RX_HEADER =>
|
when RX_HEADER =>
|
||||||
-- The header only takes one word (cycle) to transmit.
|
-- The header only takes one word (cycle) to transmit.
|
||||||
@ -168,6 +176,7 @@ begin
|
|||||||
when ADDR3 =>
|
when ADDR3 =>
|
||||||
next_rx_state <= ADDR4;
|
next_rx_state <= ADDR4;
|
||||||
when ADDR4 =>
|
when ADDR4 =>
|
||||||
|
-- TODO Unsure about this case. Should we enter RX_RESPONSE here?
|
||||||
if st.curr_cmd = WRITE or st.curr_cmd = WRITE_ADD then
|
if st.curr_cmd = WRITE or st.curr_cmd = WRITE_ADD then
|
||||||
next_rx_state <= PAYLOAD;
|
next_rx_state <= PAYLOAD;
|
||||||
else
|
else
|
||||||
@ -178,13 +187,23 @@ begin
|
|||||||
--- Next State Assignment Of TX FSM ---
|
--- Next State Assignment Of TX FSM ---
|
||||||
case st.curr_tx_state is
|
case st.curr_tx_state is
|
||||||
when IDLE =>
|
when IDLE =>
|
||||||
if st.curr_cmd = WRITE or st.curr_cmd = WRITE_ADD then
|
if st.curr_cmd = READ_ADD or st.curr_cmd = READ or
|
||||||
next_tx_state <= TX_HEADER;
|
st.curr_cmd = WRITE_ADD or st.curr_cmd = WRITE then
|
||||||
elsif st.curr_cmd = READ or st.curr_cmd = READ_ADD then
|
next_tx_state <= CMD;
|
||||||
next_tx_state <= RX_HEADER;
|
elsif RESPONSE_READY then -- TODO define RESPONSE_READY
|
||||||
|
next_tx_state <= RESPONSE;
|
||||||
else
|
else
|
||||||
next_tx_state <= IDLE;
|
next_tx_state <= IDLE;
|
||||||
end if;
|
end if;
|
||||||
|
when CMD =>
|
||||||
|
if st.curr_cmd = WRITE_ADD then
|
||||||
|
next_tx_state <= TX_HEADER;
|
||||||
|
elsif st.curr_cmd = WRITE then
|
||||||
|
next_tx_state <= WRITE;
|
||||||
|
elsif st.curr_cmd = READ or st.curr_cmd = READ_ADD then
|
||||||
|
next_tx_state <= RX_HEADER;
|
||||||
|
end if;
|
||||||
|
when RESPONSE =>
|
||||||
when TX_HEADER =>
|
when TX_HEADER =>
|
||||||
-- The header only takes one word (cycle) to transmit.
|
-- The header only takes one word (cycle) to transmit.
|
||||||
-- Continue to body or address directly afterwards.
|
-- Continue to body or address directly afterwards.
|
||||||
|
|||||||
@ -16,13 +16,13 @@ package socbridge_driver_tb_pkg is
|
|||||||
(NO_OP, WRITE_ACK, READ_RESPONSE);
|
(NO_OP, WRITE_ACK, READ_RESPONSE);
|
||||||
|
|
||||||
type rx_state_t is
|
type rx_state_t is
|
||||||
(IDLE, RESP, ADDR1, ADDR2, ADDR3, ADDR4,
|
(IDLE, ADDR1, ADDR2, ADDR3, ADDR4,
|
||||||
CMD, READ, WRITE, PAYLOAD,
|
CMD, RESPONSE, READ, WRITE, PAYLOAD,
|
||||||
RX_HEADER, RX_RESPONSE, RX_BODY);
|
RX_HEADER, RX_RESPONSE, RX_BODY);
|
||||||
|
|
||||||
type tx_state_t is
|
type tx_state_t is
|
||||||
(IDLE, RESP, ADDR1, ADDR2, ADDR3, ADDR4,
|
(IDLE, ADDR1, ADDR2, ADDR3, ADDR4,
|
||||||
CMD, READ, WRITE, PAYLOAD,
|
CMD, RESPONSE, READ, WRITE, PAYLOAD,
|
||||||
TX_HEADER, TX_BODY, TX_ACK);
|
TX_HEADER, TX_BODY, TX_ACK);
|
||||||
--- TRANSLATOR ---
|
--- TRANSLATOR ---
|
||||||
type translator_state_t is (IDLE, SEND, SEND_ACCEPTED, AWAIT);
|
type translator_state_t is (IDLE, SEND, SEND_ACCEPTED, AWAIT);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user