Line 6... |
Line 6... |
--*
|
--*
|
--* @author: Daniel Köthe
|
--* @author: Daniel Köthe
|
--* @version: 1.0
|
--* @version: 1.0
|
--* @date: 2007-11-11
|
--* @date: 2007-11-11
|
--/
|
--/
|
|
-- Version 1.1
|
|
-- Bugfix
|
|
-- added syncronisation registers opb_fifo_flg_int_r[0,1] to prevent
|
|
-- metastability
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
|
|
entity irq_ctl is
|
entity irq_ctl is
|
Line 26... |
Line 30... |
end irq_ctl;
|
end irq_ctl;
|
|
|
architecture behavior of irq_ctl is
|
architecture behavior of irq_ctl is
|
|
|
signal opb_fifo_flg_int : std_logic;
|
signal opb_fifo_flg_int : std_logic;
|
|
-- Sync to clock domain register
|
|
signal opb_fifo_flg_int_r0 : std_logic;
|
|
signal opb_fifo_flg_int_r1 : std_logic;
|
|
|
|
|
signal opb_fifo_flg_reg : std_logic;
|
signal opb_fifo_flg_reg : std_logic;
|
begin -- behavior
|
begin -- behavior
|
|
|
opb_fifo_flg_int <= opb_fifo_flg when (C_ACTIVE_EDGE = '1') else
|
opb_fifo_flg_int_r0 <= opb_fifo_flg when (C_ACTIVE_EDGE = '1') else
|
not opb_fifo_flg;
|
not opb_fifo_flg;
|
|
|
irq_ctl_proc: process(rst, clk)
|
irq_ctl_proc: process(rst, clk)
|
begin
|
begin
|
if (rst = '1') then
|
if (rst = '1') then
|
opb_isr <= '0';
|
opb_isr <= '0';
|
elsif rising_edge(clk) then
|
elsif rising_edge(clk) then
|
|
-- sync to clock domain
|
|
opb_fifo_flg_int_r1 <= opb_fifo_flg_int_r0;
|
|
opb_fifo_flg_int <= opb_fifo_flg_int_r1;
|
|
|
opb_fifo_flg_reg <= opb_fifo_flg_int;
|
opb_fifo_flg_reg <= opb_fifo_flg_int;
|
if (opb_ier= '1' and opb_fifo_flg_int = '1' and opb_fifo_flg_reg = '0') then
|
if (opb_ier= '1' and opb_fifo_flg_int = '1' and opb_fifo_flg_reg = '0') then
|
opb_isr <= '1';
|
opb_isr <= '1';
|
elsif (opb_isr_clr = '1') then
|
elsif (opb_isr_clr = '1') then
|
opb_isr <= '0';
|
opb_isr <= '0';
|