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

Subversion Repositories spdif_interface

[/] [spdif_interface/] [tags/] [rx_beta_1/] [rtl/] [vhdl/] [gen_event_reg.vhd] - Blame information for rev 43

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 gedra
----------------------------------------------------------------------
2
----                                                              ----
3
---- WISHBONE SPDIF IP Core                                       ----
4
----                                                              ----
5
---- This file is part of the SPDIF project                       ----
6
---- http://www.opencores.org/cores/spdif_interface/              ----
7
----                                                              ----
8
---- Description                                                  ----
9
---- Generic event register.                                      ----
10
----                                                              ----
11
----                                                              ----
12
---- To Do:                                                       ----
13
---- -                                                            ----
14
----                                                              ----
15
---- Author(s):                                                   ----
16
---- - Geir Drange, gedra@opencores.org                           ----
17
----                                                              ----
18
----------------------------------------------------------------------
19
----                                                              ----
20
---- Copyright (C) 2004 Authors and OPENCORES.ORG                 ----
21
----                                                              ----
22
---- This source file may be used and distributed without         ----
23
---- restriction provided that this copyright statement is not    ----
24
---- removed from the file and that any derivative work contains  ----
25
---- the original copyright notice and the associated disclaimer. ----
26
----                                                              ----
27
---- This source file is free software; you can redistribute it   ----
28
---- and/or modify it under the terms of the GNU Lesser General   ----
29
---- Public License as published by the Free Software Foundation; ----
30
---- either version 2.1 of the License, or (at your option) any   ----
31
---- later version.                                               ----
32
----                                                              ----
33
---- This source is distributed in the hope that it will be       ----
34
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ----
35
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ----
36
---- PURPOSE. See the GNU Lesser General Public License for more  ----
37
---- details.                                                     ----
38
----                                                              ----
39
---- You should have received a copy of the GNU Lesser General    ----
40
---- Public License along with this source; if not, download it   ----
41
---- from http://www.opencores.org/lgpl.shtml                     ----
42
----                                                              ----
43
----------------------------------------------------------------------
44
--
45
-- CVS Revision History
46
--
47
-- $Log: not supported by cvs2svn $
48 42 gedra
-- Revision 1.4  2004/07/11 16:19:50  gedra
49
-- Bug-fix.
50
--
51 39 gedra
-- Revision 1.3  2004/06/06 15:42:20  gedra
52
-- Cleaned up lint warnings.
53
--
54 13 gedra
-- Revision 1.2  2004/06/04 15:55:07  gedra
55
-- Cleaned up lint warnings.
56
--
57 8 gedra
-- Revision 1.1  2004/06/03 17:49:26  gedra
58
-- Generic event register. Used in both receiver and transmitter.
59 6 gedra
--
60 8 gedra
--
61 6 gedra
 
62
library IEEE;
63
use IEEE.std_logic_1164.all;
64
 
65
entity gen_event_reg is
66 8 gedra
  generic (DATA_WIDTH: integer:=32);
67 6 gedra
  port (
68
    clk: in std_logic;   -- clock  
69
    rst: in std_logic; -- reset
70
    evt_wr: in std_logic; -- event register write       
71
    evt_rd: in std_logic; -- event register read
72 8 gedra
    evt_din: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- write data
73
    event: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- event vector
74
    evt_mask: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- irq mask
75 6 gedra
    evt_en: in std_logic;               -- irq enable
76 8 gedra
    evt_dout: out std_logic_vector(DATA_WIDTH - 1 downto 0); -- read data
77 6 gedra
    evt_irq: out std_logic); -- interrupt  request
78
end gen_event_reg;
79
 
80
architecture rtl of gen_event_reg is
81
 
82 8 gedra
  signal evt_internal, zero: std_logic_vector(DATA_WIDTH - 1 downto 0);
83 6 gedra
 
84
begin
85 13 gedra
 
86 6 gedra
  evt_dout <= evt_internal when evt_rd = '1' else (others => '0');
87
  zero <= (others => '0');
88
 
89
-- IRQ generation:
90 8 gedra
-- IRQ signal will pulse low when writing to the event register. This will
91
-- capture situations when not all active events are cleared or an event happens
92
-- at the same time as it is cleared.
93 6 gedra
  IR: process (clk)
94
  begin
95
    if rising_edge(clk) then
96 13 gedra
      if ((evt_internal and evt_mask) /= zero) and evt_wr = '0'
97
        and evt_en = '1' then
98 6 gedra
        evt_irq <= '1';
99
      else
100
        evt_irq <= '0';
101
      end if;
102
    end if;
103
  end process IR;
104
 
105
-- event register generation   
106
  EVTREG: for k in evt_din'range generate
107
    EBIT: process (clk, rst)
108
    begin
109
      if rst = '1' then
110
        evt_internal(k) <= '0';
111
      else
112
        if rising_edge(clk) then
113 42 gedra
          if event(k)= '1' then    -- set event
114 6 gedra
            evt_internal(k) <= '1';
115
          elsif evt_wr = '1' and evt_din(k) = '1' then -- clear event
116
            evt_internal(k) <= '0';
117
          end if;
118
        end if;
119
      end if;
120
    end process EBIT;
121 8 gedra
  end generate EVTREG;
122 6 gedra
 
123
end rtl;

powered by: WebSVN 2.1.0

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