udpprot: Add round-robin scheduler
This commit is contained in:
parent
474d444f59
commit
3a42c865c6
@ -16,6 +16,9 @@ use ieee.numeric_std.all;
|
|||||||
use work.trashernet_pkg.all;
|
use work.trashernet_pkg.all;
|
||||||
|
|
||||||
entity trashernet_udpprot is
|
entity trashernet_udpprot is
|
||||||
|
generic(
|
||||||
|
ROUND_ROBIN : boolean := true -- Prioritize, but prevent one channel from hogging all bandwidth (may add one cycle of latency between frames)
|
||||||
|
);
|
||||||
port(
|
port(
|
||||||
-- Global
|
-- Global
|
||||||
clk : in std_logic; -- Global clock
|
clk : in std_logic; -- Global clock
|
||||||
@ -98,8 +101,9 @@ begin
|
|||||||
elsif rising_edge(clk) then
|
elsif rising_edge(clk) then
|
||||||
case state is
|
case state is
|
||||||
when IDLE =>
|
when IDLE =>
|
||||||
|
tx_sel <= udpprot_tx_out'left;
|
||||||
for i in udpprot_tx_in'range loop
|
for i in udpprot_tx_in'range loop
|
||||||
if udpprot_tx_in(i).tx_en then
|
if (udpprot_tx_in(i).tx_en = '1') and (i >= tx_sel) then
|
||||||
tx_sel <= i;
|
tx_sel <= i;
|
||||||
state <= TXD;
|
state <= TXD;
|
||||||
exit; -- Prioritize according to vector
|
exit; -- Prioritize according to vector
|
||||||
@ -111,8 +115,12 @@ begin
|
|||||||
|
|
||||||
when WAITDONE =>
|
when WAITDONE =>
|
||||||
if udp_out.tx_err_stb or udp_out.tx_ok_stb then
|
if udp_out.tx_err_stb or udp_out.tx_ok_stb then
|
||||||
state <= IDLE;
|
state <= IDLE;
|
||||||
tx_sel <= udpprot_tx_in'left; -- To avoid arbitration errors, always select the highest priority one by default
|
if (not ROUND_ROBIN) or (tx_sel = udpprot_tx_out'high) then
|
||||||
|
tx_sel <= udpprot_tx_out'left;
|
||||||
|
else
|
||||||
|
tx_sel <= tx_sel + 1;
|
||||||
|
end if;
|
||||||
end if;
|
end if;
|
||||||
end case;
|
end case;
|
||||||
end if;
|
end if;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user