socbridge fully works with existing socbridge

This commit is contained in:
Erik Örtenberg 2025-04-07 11:24:51 +02:00
parent abbe417dd3
commit 31f0c45f2b
3 changed files with 19 additions and 13 deletions

View File

@ -4,7 +4,7 @@ use IEEE.NUMERIC_STD.all;
library ganimede; library ganimede;
use ganimede.io_types.all; use ganimede.io_types.all;
library gan_socbridge; library gan_socbridge;
use gan_socbridge.socbridge_driver_tb_pkg.all; use gan_socbridge.socbridge_driver_pkg.all;
entity socbridge_driver is entity socbridge_driver is
@ -114,7 +114,7 @@ begin
next_tx_state <= IDLE; next_tx_state <= IDLE;
end if; end if;
when TX_R_BODY => when TX_R_BODY =>
if st.tx_stage = 0 then if st.tx_stage <= 1 then
next_tx_state <= IDLE; next_tx_state <= IDLE;
else else
next_tx_state <= TX_R_BODY; next_tx_state <= TX_R_BODY;
@ -134,7 +134,7 @@ begin
next_tx_state <= IDLE; next_tx_state <= IDLE;
end if; end if;
when TX_W_BODY => when TX_W_BODY =>
if st.tx_stage = 0 then if st.tx_stage <= 1 then
next_tx_state <= TX_AWAIT; next_tx_state <= TX_AWAIT;
else else
next_tx_state <= TX_W_BODY; next_tx_state <= TX_W_BODY;
@ -145,7 +145,7 @@ begin
and st.curr_rx_transaction = WRITE_ACK then and st.curr_rx_transaction = WRITE_ACK then
next_tx_state <= IDLE; next_tx_state <= IDLE;
elsif (st.curr_tx_transaction = READ_ADD or st.curr_tx_transaction = READ) elsif (st.curr_tx_transaction = READ_ADD or st.curr_tx_transaction = READ)
and st.curr_rx_transaction = READ_RESPONSE and st.rx_stage = 0 then and st.curr_rx_transaction = READ_RESPONSE and st.rx_stage = 1 then
next_tx_state <= IDLE; next_tx_state <= IDLE;
else else
next_tx_state <= TX_AWAIT; next_tx_state <= TX_AWAIT;
@ -174,7 +174,7 @@ begin
next_rx_state <= IDLE; next_rx_state <= IDLE;
end if; end if;
when RX_R_BODY => when RX_R_BODY =>
if st.rx_stage = 0 then if st.rx_stage <= 1 then
next_rx_state <= IDLE; next_rx_state <= IDLE;
else else
next_rx_state <= RX_R_BODY; next_rx_state <= RX_R_BODY;
@ -194,7 +194,7 @@ begin
next_rx_state <= IDLE; -- Potentially superfluous safety next_rx_state <= IDLE; -- Potentially superfluous safety
end if; end if;
when RX_W_BODY => when RX_W_BODY =>
if st.rx_stage = 0 then if st.rx_stage <= 1 then
next_rx_state <= RX_AWAIT; next_rx_state <= RX_AWAIT;
else else
next_rx_state <= RX_W_BODY; next_rx_state <= RX_W_BODY;
@ -205,7 +205,7 @@ begin
and st.curr_tx_transaction = WRITE_ACK then and st.curr_tx_transaction = WRITE_ACK then
next_rx_state <= IDLE; next_rx_state <= IDLE;
elsif (st.curr_rx_transaction = READ_ADD or st.curr_rx_transaction = READ) elsif (st.curr_rx_transaction = READ_ADD or st.curr_rx_transaction = READ)
and st.curr_tx_transaction = READ_RESPONSE and st.tx_stage = 0 then and st.curr_tx_transaction = READ_RESPONSE and st.tx_stage = 1 then
next_rx_state <= IDLE; next_rx_state <= IDLE;
else else
next_rx_state <= RX_AWAIT; next_rx_state <= RX_AWAIT;
@ -222,7 +222,11 @@ begin
case st.curr_tx_state is case st.curr_tx_state is
when IDLE => when IDLE =>
when TX_HEADER => when TX_HEADER =>
if st.curr_tx_transaction = WRITE_ACK or st.curr_tx_transaction = READ_RESPONSE then
socbridge_driver_to_ext_data_cmd := get_header_bits(st.curr_tx_transaction, st.curr_rx_transaction) & get_size_bits(st.rx_data_size);
else
socbridge_driver_to_ext_data_cmd := get_header_bits(st.curr_tx_transaction, st.curr_rx_transaction) & get_size_bits(st.tx_data_size); socbridge_driver_to_ext_data_cmd := get_header_bits(st.curr_tx_transaction, st.curr_rx_transaction) & get_size_bits(st.tx_data_size);
end if;
when TX_W_BODY => when TX_W_BODY =>
if st.tx_stage > 0 then if st.tx_stage > 0 then
socbridge_driver_to_ip.is_full_out <= '0'; socbridge_driver_to_ip.is_full_out <= '0';
@ -305,6 +309,7 @@ begin
if st.curr_rx_transaction = WRITE or st.curr_rx_transaction = WRITE_ADD then if st.curr_rx_transaction = WRITE or st.curr_rx_transaction = WRITE_ADD then
next_tx_transaction := WRITE_ACK; next_tx_transaction := WRITE_ACK;
elsif st.curr_rx_transaction = READ or st.curr_rx_transaction = READ_ADD then elsif st.curr_rx_transaction = READ or st.curr_rx_transaction = READ_ADD then
next_tx_data_size <= st.rx_data_size;
next_tx_transaction := READ_RESPONSE; next_tx_transaction := READ_RESPONSE;
end if; end if;
end if; end if;
@ -389,6 +394,7 @@ begin
case st.curr_rx_state is case st.curr_rx_state is
when IDLE => when IDLE =>
st.curr_rx_transaction <= next_rx_transaction; st.curr_rx_transaction <= next_rx_transaction;
st.rx_data_size <= next_rx_data_size;
if next_rx_transaction = WRITE_ADD or next_rx_transaction = WRITE if next_rx_transaction = WRITE_ADD or next_rx_transaction = WRITE
or next_rx_transaction = READ_RESPONSE then or next_rx_transaction = READ_RESPONSE then
st.rx_stage <= next_rx_data_size; st.rx_stage <= next_rx_data_size;

View File

@ -6,7 +6,7 @@ library ganimede;
use ganimede.io_types.all; use ganimede.io_types.all;
package socbridge_driver_tb_pkg is package socbridge_driver_pkg is
subtype command_size_t is integer range 0 to 128; subtype command_size_t is integer range 0 to 128;
type transaction_t is type transaction_t is
@ -70,9 +70,9 @@ package socbridge_driver_tb_pkg is
signal G_trans_st : translator_state_rec_t; signal G_trans_st : translator_state_rec_t;
-- synthesis translate_on -- synthesis translate_on
end package socbridge_driver_tb_pkg; end package socbridge_driver_pkg;
package body socbridge_driver_tb_pkg is package body socbridge_driver_pkg is
function to_string ( a: std_logic_vector) return string is function to_string ( a: std_logic_vector) return string is
variable b : string (1 to a'length) := (others => NUL); variable b : string (1 to a'length) := (others => NUL);
variable stri : integer := 1; variable stri : integer := 1;
@ -171,4 +171,4 @@ package body socbridge_driver_tb_pkg is
val := std_logic_vector(TO_UNSIGNED(size - 1, 3)); val := std_logic_vector(TO_UNSIGNED(size - 1, 3));
return val; return val;
end function; end function;
end package body socbridge_driver_tb_pkg; end package body socbridge_driver_pkg;

View File

@ -3,7 +3,7 @@ use IEEE.std_logic_1164.all;
use ieee.numeric_std.all; use ieee.numeric_std.all;
use IEEE.MATH_REAL.all; use IEEE.MATH_REAL.all;
library work; library work;
use work.socbridge_driver_tb_pkg.all; use work.socbridge_driver_pkg.all;
library ganimede; library ganimede;
use ganimede.io_types.all; use ganimede.io_types.all;
library gan_socbridge; library gan_socbridge;