OpenCores
URL https://opencores.org/ocsvn/spi_slave/spi_slave/trunk

Subversion Repositories spi_slave

[/] [spi_slave/] [trunk/] [pcore/] [opb_spi_slave_v1_00_a/] [hdl/] [vhdl/] [irq_ctl.vhd] - Diff between revs 2 and 18

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 18
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';

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.