Commit 2433a795 authored by Maciej Lipinski's avatar Maciej Lipinski

[wr_streamers] changed static (generic) to dynamic (input signal)

configuration of rx frames filtering by MAC.

The rx streamer used to allow filtering of received streamer frames
by source MAC address. This remote_mac could be dynamicaly configured
but the filtering ena/disable was configured with generic. This is now
a dymanic configuration
parent 155bad9a
......@@ -38,7 +38,6 @@ package streamers_pkg is
generic (
g_data_width : integer := 32;
g_buffer_size : integer := 16;
g_filter_remote_mac : boolean := false;
g_escape_code_disable : boolean := FALSE;
g_expected_words_number : integer := 0);
port (
......@@ -66,6 +65,7 @@ package streamers_pkg is
cfg_mac_remote_i : in std_logic_vector(47 downto 0) := x"000000000000";
cfg_ethertype_i : in std_logic_vector(15 downto 0) := x"dbff";
cfg_accept_broadcasts_i : in std_logic := '1';
cfg_filter_remote_i : in std_logic := '0';
cfg_fixed_latency_i : in std_logic_vector(27 downto 0) := x"0000000");
end component;
......@@ -150,10 +150,6 @@ package streamers_pkg is
-- Size of RX buffer, in data words.
g_rx_buffer_size : integer := 16;
-- When true, receives only packets whose destination MAC equals
-- cfg_mac_remote_i. When false. accepts all incoming packets.
g_rx_filter_remote_mac : boolean := false;
-- DO NOT USE unless you know what you are doing
-- legacy stuff: the streamers that were initially used in Btrain did not check/insert
-- the escape code. This is justified if only one block of a known number of words is
......@@ -221,6 +217,7 @@ package streamers_pkg is
rx_cfg_mac_remote_i : in std_logic_vector(47 downto 0) := x"000000000000";
rx_cfg_ethertype_i : in std_logic_vector(15 downto 0) := x"dbff";
rx_cfg_accept_broadcasts_i : in std_logic := '1';
rx_cfg_filter_remote_i : in std_logic := '0';
rx_cfg_fixed_latency_i : in std_logic_vector(27 downto 0) := x"0000000"
);
end component;
......
......@@ -3,7 +3,7 @@
---------------------------------------------------------------------------------------
-- File : wr_transmission_wb.vhd
-- Author : auto-generated by wbgen2 from wr_transmission_wb.wb
-- Created : Wed Nov 23 15:09:24 2016
-- Created : Thu Nov 24 17:03:04 2016
-- Standard : VHDL'87
---------------------------------------------------------------------------------------
-- THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE wr_transmission_wb.wb
......@@ -49,6 +49,7 @@ signal wr_transmission_tx_cfg3_mac_target_lsb_int : std_logic_vector(31 downto 0
signal wr_transmission_tx_cfg4_mac_target_msb_int : std_logic_vector(15 downto 0);
signal wr_transmission_rx_cfg0_ethertype_int : std_logic_vector(15 downto 0);
signal wr_transmission_rx_cfg0_accept_broadcast_int : std_logic ;
signal wr_transmission_rx_cfg0_filter_remote_int : std_logic ;
signal wr_transmission_rx_cfg1_mac_local_lsb_int : std_logic_vector(31 downto 0);
signal wr_transmission_rx_cfg2_mac_local_msb_int : std_logic_vector(15 downto 0);
signal wr_transmission_rx_cfg3_mac_remote_lsb_int : std_logic_vector(31 downto 0);
......@@ -95,6 +96,7 @@ begin
wr_transmission_tx_cfg4_mac_target_msb_int <= "0000000000000000";
wr_transmission_rx_cfg0_ethertype_int <= "0000000000000000";
wr_transmission_rx_cfg0_accept_broadcast_int <= '0';
wr_transmission_rx_cfg0_filter_remote_int <= '0';
wr_transmission_rx_cfg1_mac_local_lsb_int <= "00000000000000000000000000000000";
wr_transmission_rx_cfg2_mac_local_msb_int <= "0000000000000000";
wr_transmission_rx_cfg3_mac_remote_lsb_int <= "00000000000000000000000000000000";
......@@ -286,10 +288,11 @@ begin
if (wb_we_i = '1') then
wr_transmission_rx_cfg0_ethertype_int <= wrdata_reg(15 downto 0);
wr_transmission_rx_cfg0_accept_broadcast_int <= wrdata_reg(16);
wr_transmission_rx_cfg0_filter_remote_int <= wrdata_reg(17);
end if;
rddata_reg(15 downto 0) <= wr_transmission_rx_cfg0_ethertype_int;
rddata_reg(16) <= wr_transmission_rx_cfg0_accept_broadcast_int;
rddata_reg(17) <= 'X';
rddata_reg(17) <= wr_transmission_rx_cfg0_filter_remote_int;
rddata_reg(18) <= 'X';
rddata_reg(19) <= 'X';
rddata_reg(20) <= 'X';
......@@ -540,6 +543,8 @@ begin
regs_o.rx_cfg0_ethertype_o <= wr_transmission_rx_cfg0_ethertype_int;
-- Accept Broadcast
regs_o.rx_cfg0_accept_broadcast_o <= wr_transmission_rx_cfg0_accept_broadcast_int;
-- Filter Remote
regs_o.rx_cfg0_filter_remote_o <= wr_transmission_rx_cfg0_filter_remote_int;
-- MAC Local LSB
regs_o.rx_cfg1_mac_local_lsb_o <= wr_transmission_rx_cfg1_mac_local_lsb_int;
-- MAC Local MSB
......
......@@ -288,6 +288,15 @@ peripheral {
access_bus = READ_WRITE;
access_dev = READ_ONLY;
};
field {
name = "Filter Remote";
description = "0: accept streamer frames with any source MAC address; \
1: accept streamer frames only with the source MAC address defined in mac_remote";
prefix = "filter_remote";
type = BIT;
access_bus = READ_WRITE;
access_dev = READ_ONLY;
};
};
reg {
name = "Rx Config Reg 1";
......
......@@ -3,7 +3,7 @@
---------------------------------------------------------------------------------------
-- File : wr_transmission_wbgen2_pkg.vhd
-- Author : auto-generated by wbgen2 from wr_transmission_wb.wb
-- Created : Wed Nov 23 15:09:24 2016
-- Created : Thu Nov 24 17:03:04 2016
-- Standard : VHDL'87
---------------------------------------------------------------------------------------
-- THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE wr_transmission_wb.wb
......@@ -70,6 +70,7 @@ package wr_transmission_wbgen2_pkg is
tx_cfg4_mac_target_msb_o : std_logic_vector(15 downto 0);
rx_cfg0_ethertype_o : std_logic_vector(15 downto 0);
rx_cfg0_accept_broadcast_o : std_logic;
rx_cfg0_filter_remote_o : std_logic;
rx_cfg1_mac_local_lsb_o : std_logic_vector(31 downto 0);
rx_cfg2_mac_local_msb_o : std_logic_vector(15 downto 0);
rx_cfg3_mac_remote_lsb_o : std_logic_vector(31 downto 0);
......@@ -92,6 +93,7 @@ package wr_transmission_wbgen2_pkg is
tx_cfg4_mac_target_msb_o => (others => '0'),
rx_cfg0_ethertype_o => (others => '0'),
rx_cfg0_accept_broadcast_o => '0',
rx_cfg0_filter_remote_o => '0',
rx_cfg1_mac_local_lsb_o => (others => '0'),
rx_cfg2_mac_local_msb_o => (others => '0'),
rx_cfg3_mac_remote_lsb_o => (others => '0'),
......
......@@ -42,10 +42,6 @@ entity xrx_streamer is
-- Size of RX buffer, in data words.
g_buffer_size : integer := 16;
-- When true, receives only packets whose destination MAC equals
-- cfg_mac_remote_i. When false. accepts all incoming packets.
g_filter_remote_mac : boolean := false;
-- DO NOT USE unless you know what you are doing
-- legacy stuff: the streamers that were initially used in Btrain did not check/insert
-- the escape code. This is justified if only one block of a known number of words is
......@@ -125,6 +121,10 @@ entity xrx_streamer is
-- 1: accept all broadcast packets
-- 0: accept only unicasts
cfg_accept_broadcasts_i : in std_logic := '1';
-- filtering of streamer frames on reception by source MAC address
-- 0: accept frames from any source
-- 1: accept frames only from the source MAC address defined in cfg_mac_remote_i
cfg_filter_remote_i : in std_logic := '0';
-- value in cycles of fixed-latency enforced on data
cfg_fixed_latency_i : in std_logic_vector(27 downto 0) := x"0000000"
);
......@@ -487,17 +487,17 @@ begin -- rtl
end if;
count <= count + 1;
when x"03" =>
if(fsm_in.data /= cfg_mac_remote_i(47 downto 32) and g_filter_remote_mac) then
if(fsm_in.data /= cfg_mac_remote_i(47 downto 32) and cfg_filter_remote_i ='1') then
state <= IDLE;
end if;
count <= count + 1;
when x"04" =>
if(fsm_in.data /= cfg_mac_remote_i(31 downto 16) and g_filter_remote_mac) then
if(fsm_in.data /= cfg_mac_remote_i(31 downto 16) and cfg_filter_remote_i ='1') then
state <= IDLE;
end if;
count <= count + 1;
when x"05" =>
if(fsm_in.data /= cfg_mac_remote_i(15 downto 0) and g_filter_remote_mac) then
if(fsm_in.data /= cfg_mac_remote_i(15 downto 0) and cfg_filter_remote_i ='1') then
state <= IDLE;
end if;
count <= count + 1;
......
......@@ -94,10 +94,6 @@ entity xwr_transmission is
-- Size of RX buffer, in data words.
g_rx_buffer_size : integer := 16;
-- When true, receives only packets whose destination MAC equals
-- cfg_mac_remote_i. When false. accepts all incoming packets.
g_rx_filter_remote_mac : boolean := false;
-- DO NOT USE unless you know what you are doing
-- legacy stuff: the streamers that were initially used in Btrain did not check/insert
-- the escape code. This is justified if only one block of a known number of words is
......@@ -219,6 +215,10 @@ entity xwr_transmission is
-- 1: accept all broadcast packets
-- 0: accept only unicasts
rx_cfg_accept_broadcasts_i : in std_logic := '1';
-- filtering of streamer frames on reception by source MAC address
-- 0: accept frames from any source
-- 1: accept frames only from the source MAC address defined in cfg_mac_remote_i
rx_cfg_filter_remote_i : in std_logic := '0';
-- value in cycles of fixed-latency enforced on data
rx_cfg_fixed_latency_i : in std_logic_vector(27 downto 0) := x"0000000"
......@@ -272,6 +272,7 @@ architecture rtl of xwr_transmission is
signal rx_cfg_mac_remote : std_logic_vector(47 downto 0);
signal rx_cfg_ethertype : std_logic_vector(15 downto 0);
signal rx_cfg_accept_broadcasts: std_logic;
signal rx_cfg_filter_remote : std_logic;
signal rx_cfg_fixed_latency : std_logic_vector(27 downto 0);
function f_dbg_word_starting_at_byte(data_in, start_bit : std_logic_vector; g_data_width: integer) return std_logic_vector is
......@@ -322,7 +323,6 @@ begin
generic map(
g_data_width => g_rx_data_width,
g_buffer_size => g_rx_buffer_size,
g_filter_remote_mac => g_rx_filter_remote_mac,
g_escape_code_disable => g_rx_escape_code_disable,
g_expected_words_number => g_rx_expected_words_number
)
......@@ -350,6 +350,7 @@ begin
cfg_mac_remote_i => rx_cfg_mac_remote_i,
cfg_ethertype_i => rx_cfg_ethertype_i,
cfg_accept_broadcasts_i => rx_cfg_accept_broadcasts_i,
cfg_filter_remote_i => rx_cfg_filter_remote,
cfg_fixed_latency_i => rx_cfg_fixed_latency);
rx_data_o <= rx_data;
......@@ -500,6 +501,8 @@ begin
rx_cfg_mac_remote_i(47 downto 32);
rx_cfg_accept_broadcasts <= from_wb.rx_cfg0_accept_broadcast_o when (from_wb.cfg_rx_ena_o='1') else
rx_cfg_accept_broadcasts_i;
rx_cfg_filter_remote <= from_wb.rx_cfg0_filter_remote_o when (from_wb.cfg_rx_ena_o='1') else
rx_cfg_filter_remote_i;
rx_cfg_fixed_latency <= from_wb.rx_cfg5_fixed_latency_o when (from_wb.cfg_rx_ena_o='1') else
rx_cfg_fixed_latency_i;
end rtl;
\ No newline at end of file
......@@ -59,6 +59,8 @@
`define WR_TRANSMISSION_RX_CFG0_ETHERTYPE 32'h0000ffff
`define WR_TRANSMISSION_RX_CFG0_ACCEPT_BROADCAST_OFFSET 16
`define WR_TRANSMISSION_RX_CFG0_ACCEPT_BROADCAST 32'h00010000
`define WR_TRANSMISSION_RX_CFG0_FILTER_REMOTE_OFFSET 17
`define WR_TRANSMISSION_RX_CFG0_FILTER_REMOTE 32'h00020000
`define ADDR_WR_TRANSMISSION_RX_CFG1 7'h44
`define WR_TRANSMISSION_RX_CFG1_MAC_LOCAL_LSB_OFFSET 0
`define WR_TRANSMISSION_RX_CFG1_MAC_LOCAL_LSB 32'hffffffff
......
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