Commit 1a662f42 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

swcore: fix output block frame dropping on HP (still not perfect)

parent 7a1b9191
......@@ -284,6 +284,7 @@ architecture behavoural of xswc_output_block_new is
signal cycle_frozen_cnt : unsigned(9 downto 0);
signal current_tx_prio : std_logic_vector(g_queue_num - 1 downto 0);
signal new_tx_prio : std_logic_vector(g_queue_num - 1 downto 0);
signal hp_prio_mask : std_logic_vector(g_queue_num - 1 downto 0);
signal zero_prio_mask : std_logic_vector(g_queue_num - 1 downto 0);
......@@ -570,19 +571,23 @@ begin -- behavoural
begin
if rising_edge(clk_i) then
if(rst_n_i = '0') then
current_tx_prio <= (others => '0');
new_tx_prio <= (others => '0');
else
if(rd_valid = '1') then
current_tx_prio <= read_array;
new_tx_prio <= rd_array;
elsif((s_send_pck = S_EOF) and (s_prep_to_send = S_IDLE)) then
current_tx_prio <= (others => '0');
new_tx_prio <= (others => '0');
end if;
end if;
end if;
end process p_track_tx_prio;
-- deciding whether to drop currently tx-ed frame
hp_in_queuing <= '1' when ((read_array and hp_prio_mask) /= zero_prio_mask) else '0';
hp_in_queuing <= '1' when ((read_array and hp_prio_mask) /= zero_prio_mask) else
'1' when ((new_tx_prio and hp_prio_mask) /= zero_prio_mask) else
--'1' when ((new_tx_prio and hp_prio_mask) /= zero_prio_mask and (new_tx_prio /= current_tx_prio)) else
'0';
--non_hp_txing <= '1' when ((new_tx_prio and (not hp_prio_mask)) /= zero_prio_mask) else '0';
non_hp_txing <= '1' when ((current_tx_prio and (not hp_prio_mask)) /= zero_prio_mask) else '0';
abord_tx_at_hp <= non_hp_txing and -- we are currently sending frame which is not HP
......@@ -661,7 +666,7 @@ begin -- behavoural
--===========================================================================================
when S_NEWPCK_PAGE_SET_IN_ADVANCE =>
--===========================================================================================
if(request_retry = '1') then
if(request_retry = '1' or (abord_tx_at_hp = '1' and mpm_pg_req_i = '0')) then
mpm_abort <= '1';
s_prep_to_send <= S_RETRY_PREPARE;
mpm_pg_addr_memorized_valid <= '1';
......@@ -701,7 +706,13 @@ begin -- behavoural
when S_RETRY_PREPARE =>
--===========================================================================================
if(mpm_pg_req_i = '1') then
mpm_pg_addr <= pck_start_pgaddr;
--mpm_pg_addr <= pck_start_pgaddr;
if(mpm_pg_addr_memorized_valid = '1') then
mpm_pg_addr <= mpm_pg_addr_memorized;
mpm_pg_addr_memorized_valid <= '0';
else
mpm_pg_addr <= pck_start_pgaddr;
end if;
mpm_pg_valid <= '1';
s_prep_to_send <= S_RETRY_READY;
end if;
......@@ -760,6 +771,7 @@ begin -- behavoural
tmp_dat <= (others => '0');
tmp_sel <= (others => '0');
page_set_in_advance <= '0';
current_tx_prio <= (others => '0');
--========================================
else
-- default values
......@@ -773,10 +785,12 @@ begin -- behavoural
when S_IDLE =>
--===========================================================================================
if(s_prep_to_send = S_NEWPCK_PAGE_READY and src_i.err = '0' and src_i.stall = '0' and ifg_count = x"0") then
if((s_prep_to_send = S_NEWPCK_PAGE_READY or s_prep_to_send = S_RETRY_READY)
and src_i.err = '0' and src_i.stall = '0' and ifg_count = x"0") then
src_out_int.cyc <= '1';
s_send_pck <= S_DATA;
pck_start_pgaddr <= mpm_pg_addr;
current_tx_prio <= new_tx_prio;
end if;
--===========================================================================================
......@@ -866,7 +880,9 @@ begin -- behavoural
src_out_int.cyc <= '1';
s_send_pck <= S_DATA;
pck_start_pgaddr <= mpm_pg_addr;
current_tx_prio <= new_tx_prio;
else
current_tx_prio <= (others=>'0');
s_send_pck <= S_IDLE;
end if;
else
......@@ -891,7 +907,9 @@ begin -- behavoural
src_out_int.cyc <= '1';
s_send_pck <= S_DATA;
pck_start_pgaddr <= mpm_pg_addr;
current_tx_prio <= new_tx_prio;
else
current_tx_prio <= (others=>'0');
s_send_pck <= S_IDLE;
end if;
end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment