replaced subtraction and less than with a stateful flag

This commit is contained in:
Erik Örtenberg 2025-05-27 22:17:55 +02:00
parent 4fa2b530ca
commit 1d95d2b7d6
2 changed files with 11 additions and 4 deletions

View File

@ -477,6 +477,9 @@ begin
if next_rx_transaction /= NO_OP then
st.rx_transaction <= next_rx_transaction;
st.rx_data_size <= next_rx_data_size;
if next_rx_transaction = WRITE_ADD or next_rx_transaction = WRITE then
st.manager_first_word <= true;
end if;
if next_rx_transaction = WRITE_ADD or next_rx_transaction = WRITE
or next_rx_transaction = READ_RESPONSE then
st.rx_stage <= next_rx_data_size;
@ -508,16 +511,18 @@ begin
st.rx_stage <= st.rx_stage - 1;
st.manager_data(next_slice_32_8_upper(st.rx_stage mod 4) downto next_slice_32_8_lower(st.rx_stage mod 4)) <= st.ext_to_socbridge_driver_reg.data;
end if;
if st.rx_stage mod 4 = 2 and st.rx_data_size - st.rx_stage > 4 then
st.manager_addr <= std_logic_vector(to_unsigned(to_integer(unsigned(st.manager_addr) + 4), 32));
if st.rx_stage mod 4 = 2 then
if st.manager_first_word then
st.manager_first_word <= false;
else
st.manager_addr <= std_logic_vector(to_unsigned(to_integer(unsigned(st.manager_addr) + 4), 32));
end if;
end if;
when RX_AWAIT =>
st.manager_data <= manager_to_socbridge_driver.data;
if st.tx_transaction = READ_RESPONSE or st.tx_transaction = WRITE_ACK then
if (st.rx_transaction = READ or st.rx_transaction = READ_ADD) and st.tx_stage mod 4 = 2 then
st.manager_addr <= std_logic_vector(to_unsigned(to_integer(unsigned(st.manager_addr) + 4), 32));
elsif (st.rx_transaction = WRITE or st.rx_transaction = WRITE_ADD) and st.rx_stage mod 4 = 2 then
st.manager_addr <= std_logic_vector(to_unsigned(to_integer(unsigned(st.manager_addr) + 4), 32));
end if;
end if;
when ADDR1 =>

View File

@ -60,6 +60,7 @@ package socbridge_driver_pkg is
last_sent_transaction : transaction_t;
manager_addr : std_logic_vector(31 downto 0);
manager_data : std_logic_vector(31 downto 0);
manager_first_word: boolean;
end record state_rec_t;
impure function calc_parity(
d : STD_LOGIC_VECTOR(interface_inst.socbridge.payload_width - 1 downto 0)
@ -111,6 +112,7 @@ package socbridge_driver_pkg is
tx_addr => (others => '0'),
manager_addr => (others => '0'),
manager_data => (others => '0'),
manager_first_word => true,
read_in_flight => false,
write_in_flight => false,
last_sent_transaction => NO_OP