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

Subversion Repositories spdif_interface

[/] [spdif_interface/] [trunk/] [rtl/] [vhdl/] [gen_event_reg.vhd] - Blame information for rev 73

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 72 gedra
-- Revision 1.5  2004/07/12 17:06:41  gedra
49
-- Fixed bug with lock event generation.
50
--
51 42 gedra
-- Revision 1.4  2004/07/11 16:19:50  gedra
52
-- Bug-fix.
53
--
54 39 gedra
-- Revision 1.3  2004/06/06 15:42:20  gedra
55
-- Cleaned up lint warnings.
56
--
57 13 gedra
-- Revision 1.2  2004/06/04 15:55:07  gedra
58
-- Cleaned up lint warnings.
59
--
60 8 gedra
-- Revision 1.1  2004/06/03 17:49:26  gedra
61
-- Generic event register. Used in both receiver and transmitter.
62 6 gedra
--
63 8 gedra
--
64 72 gedra
 
65 6 gedra
library IEEE;
66
use IEEE.std_logic_1164.all;
67
 
68 72 gedra
entity gen_event_reg is
69
   generic (DATA_WIDTH : integer := 32);
70
   port (
71
      clk      : in  std_logic;         -- clock  
72
      rst      : in  std_logic;         -- reset
73
      evt_wr   : in  std_logic;         -- event register write     
74
      evt_rd   : in  std_logic;         -- event register read
75
      evt_din  : in  std_logic_vector(DATA_WIDTH - 1 downto 0);  -- write data
76
      event    : in  std_logic_vector(DATA_WIDTH - 1 downto 0);  -- event vector
77
      evt_mask : in  std_logic_vector(DATA_WIDTH - 1 downto 0);  -- irq mask
78
      evt_en   : in  std_logic;         -- irq enable
79
      evt_dout : out std_logic_vector(DATA_WIDTH - 1 downto 0);  -- read data
80
      evt_irq  : out std_logic);        -- interrupt  request
81 6 gedra
end gen_event_reg;
82
 
83
architecture rtl of gen_event_reg is
84
 
85 72 gedra
   signal evt_internal, zero : std_logic_vector(DATA_WIDTH - 1 downto 0);
86 6 gedra
 
87
begin
88 13 gedra
 
89 72 gedra
   evt_dout <= evt_internal when evt_rd = '1' else (others => '0');
90
   zero     <= (others                                     => '0');
91
 
92 6 gedra
-- IRQ generation:
93 8 gedra
-- IRQ signal will pulse low when writing to the event register. This will
94
-- capture situations when not all active events are cleared or an event happens
95
-- at the same time as it is cleared.
96 72 gedra
   IR : process (clk)
97
   begin
98
      if rising_edge(clk) then
99
         if ((evt_internal and evt_mask) /= zero) and evt_wr = '0'
100
            and evt_en = '1' then
101
            evt_irq <= '1';
102
         else
103
            evt_irq <= '0';
104
         end if;
105 6 gedra
      end if;
106 72 gedra
   end process IR;
107
 
108 6 gedra
-- event register generation   
109 72 gedra
   EVTREG : for k in evt_din'range generate
110
      EBIT : process (clk, rst)
111
      begin
112
         if rst = '1' then
113
            evt_internal(k) <= '0';
114
         else
115
            if rising_edge(clk) then
116
               if event(k) = '1' then                        -- set event
117
                  evt_internal(k) <= '1';
118
               elsif evt_wr = '1' and evt_din(k) = '1' then  -- clear event
119
                  evt_internal(k) <= '0';
120
               end if;
121
            end if;
122
         end if;
123
      end process EBIT;
124
   end generate EVTREG;
125
 
126 6 gedra
end rtl;

powered by: WebSVN 2.1.0

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