Line 52... |
Line 52... |
clk_i : in std_ulogic; -- global clock line
|
clk_i : in std_ulogic; -- global clock line
|
rstn_i : in std_ulogic; -- global reset line, low-active
|
rstn_i : in std_ulogic; -- global reset line, low-active
|
addr_i : in std_ulogic_vector(31 downto 0); -- address
|
addr_i : in std_ulogic_vector(31 downto 0); -- address
|
rden_i : in std_ulogic; -- read enable
|
rden_i : in std_ulogic; -- read enable
|
wren_i : in std_ulogic; -- write enable
|
wren_i : in std_ulogic; -- write enable
|
ben_i : in std_ulogic_vector(03 downto 0); -- byte write enable
|
|
data_i : in std_ulogic_vector(31 downto 0); -- data in
|
data_i : in std_ulogic_vector(31 downto 0); -- data in
|
data_o : out std_ulogic_vector(31 downto 0); -- data out
|
data_o : out std_ulogic_vector(31 downto 0); -- data out
|
ack_o : out std_ulogic; -- transfer acknowledge
|
ack_o : out std_ulogic; -- transfer acknowledge
|
-- clock generator --
|
-- clock generator --
|
clkgen_en_o : out std_ulogic; -- enable clock generator
|
clkgen_en_o : out std_ulogic; -- enable clock generator
|
Line 109... |
Line 108... |
begin
|
begin
|
|
|
-- Access Control -------------------------------------------------------------------------
|
-- Access Control -------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
acc_en <= '1' when (addr_i(hi_abb_c downto lo_abb_c) = wdt_base_c(hi_abb_c downto lo_abb_c)) else '0';
|
acc_en <= '1' when (addr_i(hi_abb_c downto lo_abb_c) = wdt_base_c(hi_abb_c downto lo_abb_c)) else '0';
|
pwd_ok <= '1' when (data_i(15 downto 8) = wdt_password_c) and (ben_i(1) = '1') else '0'; -- password check
|
pwd_ok <= '1' when (data_i(15 downto 8) = wdt_password_c) else '0'; -- password check
|
wren <= '1' when ((acc_en = '1') and (wren_i = '1') and (pwd_ok = '1')) else '0'; -- write access ok
|
wren <= '1' when ((acc_en = '1') and (wren_i = '1') and (pwd_ok = '1')) else '0'; -- write access ok
|
fail <= '1' when ((acc_en = '1') and (wren_i = '1') and (pwd_ok = '0')) else '0'; -- write access fail!
|
fail <= '1' when ((acc_en = '1') and (wren_i = '1') and (pwd_ok = '0')) else '0'; -- write access fail!
|
|
|
|
|
-- Write Access, Reset Generator ----------------------------------------------------------
|
-- Write Access, Reset Generator ----------------------------------------------------------
|
Line 127... |
Line 126... |
clk_sel <= (others => '1'); -- slowest clock rst_source
|
clk_sel <= (others => '1'); -- slowest clock rst_source
|
rst_gen <= (others => '1'); -- do NOT fire on reset!
|
rst_gen <= (others => '1'); -- do NOT fire on reset!
|
else
|
else
|
-- control register write access --
|
-- control register write access --
|
if (wren = '1') then -- allow write if password is correct
|
if (wren = '1') then -- allow write if password is correct
|
if (ben_i(0) = '1') then
|
|
enable <= data_i(ctrl_enable_c);
|
enable <= data_i(ctrl_enable_c);
|
clk_sel <= data_i(ctrl_clksel2_c downto ctrl_clksel0_c);
|
clk_sel <= data_i(ctrl_clksel2_c downto ctrl_clksel0_c);
|
mode <= data_i(ctrl_mode_c);
|
mode <= data_i(ctrl_mode_c);
|
end if;
|
end if;
|
end if;
|
|
-- trigger system reset when enabled AND reset mode AND timeout OR unauthorized access --
|
-- trigger system reset when enabled AND reset mode AND timeout OR unauthorized access --
|
if (enable = '1') and (mode = '1') and ((cnt(cnt'left) = '1') or (fail_ff = '1')) then
|
if (enable = '1') and (mode = '1') and ((cnt(cnt'left) = '1') or (fail_ff = '1')) then
|
rst_gen <= (others => '0');
|
rst_gen <= (others => '0');
|
else
|
else
|
rst_gen <= rst_gen(rst_gen'left-1 downto 0) & '1';
|
rst_gen <= rst_gen(rst_gen'left-1 downto 0) & '1';
|