Commit dbf0b46b authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

xvme64x_core: support for static address DIP switch

parent 6abee52c
...@@ -66,21 +66,21 @@ architecture rtl of vme_funct_match is ...@@ -66,21 +66,21 @@ architecture rtl of vme_funct_match is
signal s_function : std_logic_vector(ader_i'range); signal s_function : std_logic_vector(ader_i'range);
signal s_ader_am_valid : std_logic_vector(ader_i'range); signal s_ader_am_valid : std_logic_vector(ader_i'range);
begin begin
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- Address and AM comparators -- Address and AM comparators
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
gen_match_loop : for i in ader_i'range generate gen_match_loop : for i in ader_i'range generate
-- True in case of match -- True in case of match
s_function(i) <= s_function(i) <=
'1' when (((addr_i(t_ADEM_M) and g_DECODER(i).adem(t_ADEM_M)) '1' when (((addr_i(t_ADEM_M) and g_DECODER(i).adem(t_ADEM_M))
= ader_i(i)(t_ADEM_M)) = ader_i(i)(t_ADEM_M))
and ((am_i = ader_i(i)(t_ADER_AM)) and ((am_i = ader_i(i)(t_ADER_AM))
or not g_DECODE_AM)) or not g_DECODE_AM))
else '0'; else '0';
-- True if the AM is enabled by AMCAP -- True if the AM is enabled by AMCAP
s_ader_am_valid(i) <= s_ader_am_valid(i) <=
g_DECODER(i).amcap(to_integer(unsigned(am_i))); g_DECODER(i).amcap(to_integer(unsigned(am_i)));
end generate; end generate;
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- Function priority encoder -- Function priority encoder
......
...@@ -107,6 +107,9 @@ entity xvme64x_core is ...@@ -107,6 +107,9 @@ entity xvme64x_core is
g_BEG_SN : std_logic_vector(23 downto 0) := x"000000"; g_BEG_SN : std_logic_vector(23 downto 0) := x"000000";
g_END_SN : std_logic_vector(23 downto 0) := x"000000"; g_END_SN : std_logic_vector(23 downto 0) := x"000000";
g_USE_BASE_ADDR_SWITCH : boolean := FALSE;
g_BASE_ADDR_BITS : integer := 6;
-- Function decoder parameters. -- Function decoder parameters.
g_DECODER : t_vme64x_decoder_arr := c_vme64x_decoders_default); g_DECODER : t_vme64x_decoder_arr := c_vme64x_decoders_default);
port ( port (
...@@ -134,6 +137,9 @@ entity xvme64x_core is ...@@ -134,6 +137,9 @@ entity xvme64x_core is
-- pulse to the IRQ Generator. -- pulse to the IRQ Generator.
irq_ack_o : out std_logic; irq_ack_o : out std_logic;
-- Base address switch(es)
base_addr_switch_i : in std_logic_vector(g_BASE_ADDR_BITS-1 downto 0) := (others => '0');
-- User CSR -- User CSR
-- The following signals are used when g_USER_CSR_EXT = true -- The following signals are used when g_USER_CSR_EXT = true
-- otherwise they are connected to the internal user CSR. -- otherwise they are connected to the internal user CSR.
...@@ -181,7 +187,7 @@ architecture rtl of xvme64x_core is ...@@ -181,7 +187,7 @@ architecture rtl of xvme64x_core is
-- Compute the ADER for each function if CR/CSR is not used. For example: -- Compute the ADER for each function if CR/CSR is not used. For example:
-- ADEM=FF000000, GA=05 => ADER=05000000 -- ADEM=FF000000, GA=05 => ADER=05000000
-- ADEM=FFE00000, GA=05 => ADER=00A00000 -- ADEM=FFE00000, GA=05 => ADER=00A00000
function compute_static_ader (ga : std_logic_vector(4 downto 0)) return t_ader_array is function compute_static_ader (ga : std_logic_vector) return t_ader_array is
variable a : t_ader_array(0 to c_last_ader) := (others => x"0000_0000"); variable a : t_ader_array(0 to c_last_ader) := (others => x"0000_0000");
begin begin
for i in a'range loop for i in a'range loop
...@@ -396,7 +402,7 @@ begin ...@@ -396,7 +402,7 @@ begin
port map ( port map (
clk_i => clk_i, clk_i => clk_i,
rst_n_i => s_reset_n, rst_n_i => s_reset_n,
addr_i => s_addr_decoder_i, addr_i => s_addr_decoder_i,
addr_o => s_addr_decoder_o, addr_o => s_addr_decoder_o,
decode_start_i => s_decode_start, decode_start_i => s_decode_start,
...@@ -519,7 +525,10 @@ begin ...@@ -519,7 +525,10 @@ begin
s_module_enable <= '1'; s_module_enable <= '1';
s_module_reset <= '0'; s_module_reset <= '0';
s_bar <= s_ga; s_bar <= s_ga;
s_ader <= compute_static_ader(s_ga);
s_ader <= compute_static_ader(s_ga) when not g_USE_BASE_ADDR_SWITCH
else compute_static_ader(base_addr_switch_i);
end generate; end generate;
user_csr_addr_o <= s_user_csr_addr; user_csr_addr_o <= s_user_csr_addr;
......
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