Commit 5ec93cd8 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

wrsw_nic/nic_descriptors_pkg: convert unmarshalling procedures to functions like all others

Just a cleanup to have all subprobrams the same type (functions) in the
package.
parent 9a009ab1
......@@ -153,12 +153,12 @@ begin -- behavioral
end if;
when ARB_CHECK_EMPTY =>
p_unmarshall_rx_descriptor(dtbl_data_i, 1, tmp_desc_rx);
p_unmarshall_tx_descriptor(dtbl_data_i, 1, tmp_desc_tx);
tmp_desc_rx := f_unmarshall_rx_descriptor(dtbl_data_i, 1);
tmp_desc_tx := f_unmarshall_tx_descriptor(dtbl_data_i, 1);
granted_desc_tx <= tmp_desc_tx;
granted_desc_rx <= tmp_desc_rx;
if((tmp_desc_rx.empty = '1' and g_desc_mode = "rx") or (tmp_desc_tx.ready = '1' and g_desc_mode = "tx")) then
granted_desc_tx <= tmp_desc_tx;
granted_desc_rx <= tmp_desc_rx;
desc_subreg <= "01";
state <= ARB_FETCH;
bna_o <= '0';
......@@ -171,17 +171,17 @@ begin -- behavioral
when "10" => -- ignore the timestamps for RX
-- descriptors (they're
-- write-only by the NIC)
p_unmarshall_tx_descriptor(dtbl_data_i, 2, tmp_desc_tx);
tmp_desc_tx := f_unmarshall_tx_descriptor(dtbl_data_i, 2);
granted_desc_tx.len <= tmp_desc_tx.len;
granted_desc_tx.offset <= tmp_desc_tx.offset;
when "11" =>
p_unmarshall_tx_descriptor(dtbl_data_i, 3, tmp_desc_tx); -- TX
tmp_desc_tx := f_unmarshall_tx_descriptor(dtbl_data_i, 3); -- TX
granted_desc_tx.dpm(g_port_mask_bits-1 downto 0) <= tmp_desc_tx.dpm(g_port_mask_bits-1 downto 0);
p_unmarshall_rx_descriptor(dtbl_data_i, 3, tmp_desc_rx); -- RX
tmp_desc_rx := f_unmarshall_rx_descriptor(dtbl_data_i, 3); -- RX
granted_desc_rx.len <= tmp_desc_rx.len;
granted_desc_rx.offset <= tmp_desc_rx.offset;
......
......@@ -65,13 +65,11 @@ package nic_descriptors_pkg is
function f_marshall_rx_descriptor(desc : t_rx_descriptor;
regnum : integer) return std_logic_vector;
procedure p_unmarshall_tx_descriptor(mem_input : in std_logic_vector(31 downto 0);
regnum : in integer;
desc : inout t_tx_descriptor);
function f_unmarshall_tx_descriptor(mem_input : std_logic_vector(31 downto 0);
regnum : integer) return t_tx_descriptor;
procedure p_unmarshall_rx_descriptor(mem_input : in std_logic_vector(31 downto 0);
regnum : in integer;
desc : inout t_rx_descriptor);
function f_unmarshall_rx_descriptor(mem_input : std_logic_vector(31 downto 0);
regnum : integer) return t_rx_descriptor;
function f_resize_slv(x : std_logic_vector;
newsize : integer) return std_logic_vector;
......@@ -119,11 +117,10 @@ package body NIC_descriptors_pkg is
end f_marshall_rx_descriptor;
procedure p_unmarshall_tx_descriptor(mem_input : in std_logic_vector(31 downto 0);
regnum : in integer;
desc : inout t_tx_descriptor) is
function f_unmarshall_tx_descriptor(mem_input : std_logic_vector(31 downto 0); regnum : integer)
return t_tx_descriptor is
variable desc : t_tx_descriptor;
begin
case regnum is
when 1 =>
desc.ts_id := mem_input(31 downto 16);
......@@ -138,13 +135,13 @@ package body NIC_descriptors_pkg is
desc.dpm := mem_input;
when others => null;
end case;
end p_unmarshall_tx_descriptor;
return desc;
end f_unmarshall_tx_descriptor;
procedure p_unmarshall_rx_descriptor(mem_input : in std_logic_vector(31 downto 0);
regnum : in integer;
desc : inout t_rx_descriptor) is
function f_unmarshall_rx_descriptor(mem_input : std_logic_vector(31 downto 0); regnum : integer)
return t_rx_descriptor is
variable desc : t_rx_descriptor;
begin
case regnum is
when 1 =>
desc.empty := mem_input(0);
......@@ -162,7 +159,8 @@ package body NIC_descriptors_pkg is
desc.offset := mem_input(c_nic_buf_size_log2-1 downto 0);
when others => null;
end case;
end p_unmarshall_rx_descriptor;
return desc;
end f_unmarshall_rx_descriptor;
end package body;
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