Commit 332b8403 authored by Maciej Lipinski's avatar Maciej Lipinski

swcore: added pck dropping (@RTU decision) in the input block

parent b488795e
......@@ -212,6 +212,7 @@ architecture syn of xswc_input_block is
signal read_mask : std_logic_vector(c_swc_num_ports - 1 downto 0);
signal read_prio : std_logic_vector(c_swc_prio_width - 1 downto 0);
signal read_drop : std_logic;
signal read_usecnt : std_logic_vector(c_swc_usecount_width - 1 downto 0);
signal write_mask : std_logic_vector(c_swc_num_ports - 1 downto 0);
......@@ -244,7 +245,8 @@ architecture syn of xswc_input_block is
S_INTERPCK_PAGE_REQ); -- allocating in advance page to be used by
-- all but first page of the pck
type t_write_state is (S_IDLE,
type t_write_state is (S_IDLE,
S_DROP_PCK,
S_START_FIFO_RD, -- start requesting data from FIFO, but still
-- not outputing to write_pump (initial cycle)
-- trick: drdy restricted only to S_WRITE_MPM
......@@ -402,7 +404,9 @@ begin --arch
write_ctrl <= fifo_data_out(c_swc_data_width + c_swc_ctrl_width - 1 downto c_swc_data_width);
fifo_rd <= ((not fifo_empty) and (not mpm_full_i)) when (write_state = S_WRITE_MPM or
write_state = S_START_FIFO_RD) else '0';
write_state = S_START_FIFO_RD) else
'1' when (write_state = S_DROP_PCK) else
'0';
fifo_populated_enough <= '1' when
......@@ -649,9 +653,52 @@ begin --arch
(rcv_rtu_state = S_RTU_DECISION_AVAILABLE) and -- there is RTU decision avaible (TODO: *)
(mpm_full_i = '0' )) then -- obvious, no write to full MPM
write_state <= S_START_FIFO_RD;
if(read_drop = '1' or read_mask = zeros(c_swc_num_ports - 1 downto 0)) then
--droping pcks
--
write_state <= S_DROP_PCK;
rtu_data_read_by_write_process <= '1';
else
write_state <= S_START_FIFO_RD;
end if;
end if;
--========================================================================================
when S_DROP_PCK =>
--========================================================================================
rtu_data_read_by_write_process <= '0';
------------------------------------------------------------------------------------------
if(tx_rerror = '1' or -- handling error, this signal is generated by read_fsm
write_ctrl_out = b"10") then -- should not use this (this should be indicated previously
-- by tx_rerror
------------------------------------------------------------------------------------------
write_state <= S_IDLE;
------------------------------------------------------------------------------------------
elsif(write_ctrl_out /= b"01" and -- the data coming from FIFO indicates its not the first
-- word of PCK *and*
mpm_pckstart = '1') then -- we are saying to MPM it's first word of PCK
------------------------------------------------------------------------------------------
-- this is pathologic situation, bad, not sure what to do
assert false
report "write_fsm: S_WRITE_MPM, should not go here";
------------------------------------------------------------------------------------------
else -- in normal case, we end up here
------------------------------------------------------------------------------------------
if(write_ctrl_out = b"11") then -- EOF without valid data -
write_state <= S_LAST_MPM_WR;
end if;
------------------------------------------------------------------------------------------
end if;
-- TODO* enable to write to MPM even without RTU decision (will be quite some work)
-- for the time being wait for RTU here
--========================================================================================
......@@ -809,18 +856,27 @@ begin --arch
(rcv_rtu_state = S_RTU_DECISION_AVAILABLE) and -- there is RTU decision avaible (TODO: !!!)
(mpm_full_i = '0' )) then -- obvious, no write to full MPM
-- first word of the pck
current_pckstart_pageaddr <= pckstart_pageaddr;
write_mask <= read_mask;
write_prio <= read_prio;
write_usecnt <= read_usecnt;
rtu_data_read_by_write_process <= '1';
if(read_drop = '1' or read_mask = zeros(c_swc_num_ports - 1 downto 0)) then
--droping pcks
write_state <= S_DROP_PCK;
rtu_data_read_by_write_process <= '1';
mpm_pckstart <= '1';
mpm_pagereq <= '1';
mpm_pageaddr <= pckstart_pageaddr;
else
write_state <= S_WRITE_MPM;
-- first word of the pck
current_pckstart_pageaddr <= pckstart_pageaddr;
write_mask <= read_mask;
write_prio <= read_prio;
write_usecnt <= read_usecnt;
rtu_data_read_by_write_process <= '1';
mpm_pckstart <= '1';
mpm_pagereq <= '1';
mpm_pageaddr <= pckstart_pageaddr;
write_state <= S_WRITE_MPM;
end if;
end if;
......@@ -1090,6 +1146,7 @@ begin --arch
read_mask <= (others => '0');
read_prio <= (others => '0');
read_usecnt <= (others => '0');
read_drop <= '0';
rtu_rsp_ack <= '0';
--========================================
else
......@@ -1105,6 +1162,7 @@ begin --arch
read_mask <= rtu_dst_port_mask_i;
read_prio <= rtu_prio_i;
read_drop <= rtu_drop_i;
read_usecnt <= std_logic_vector(to_signed(cnt(rtu_dst_port_mask_i), read_usecnt'length));
rcv_rtu_state <= S_RTU_DECISION_AVAILABLE;
rtu_rsp_ack <= '1';
......
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