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

Subversion Repositories pcie_ds_dma

[/] [pcie_ds_dma/] [trunk/] [core/] [ds_dma64/] [pcie_src/] [pcie_core64_m1/] [pcie_ctrl/] [core64_interrupt.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dsmv
-------------------------------------------------------------------------------
2
--
3
-- Title       : core64_interrupt
4
-- Author      : Dmitry Smekhov
5
-- Company     : Instrumental Systems
6
-- E-mail      : dsmv@insys.ru
7
--
8
-- Version     : 1.0
9
--
10
-------------------------------------------------------------------------------
11
--
12
-- Description : Узел формирования прерываний 
13
--
14
-------------------------------------------------------------------------------
15
 
16
 
17
 
18
library ieee;
19
use ieee.std_logic_1164.all;
20
 
21
package core64_interrupt_pkg is
22
 
23
component core64_interrupt is
24
        port(
25
 
26
                rstp                                    : in std_logic;         --! 1 - сброс
27
                clk                                             : in std_logic;         --! Тактовая частота ядра 250 МГц
28
 
29
                irq                                             : in std_logic;         --! 1 - запрос прерывания
30
 
31
                cfg_command10                   : in  std_logic;        --! 1 - прерывания запрещены 
32
                cfg_interrupt                   : out std_logic;        --! 0 - изменение состояния прерывания
33
                cfg_interrupt_assert    : out std_logic;        --! 0 - формирование прерывания, 1 - сниятие прерывания 
34
                cfg_interrupt_rdy               : in  std_logic         --! 0 - подтверждение изменения прерывания 
35
 
36
        );
37
end component;
38
 
39
end package;
40
 
41
library ieee;
42
use ieee.std_logic_1164.all;
43
use ieee.std_logic_arith.all;
44
use ieee.std_logic_unsigned.all;
45
 
46
entity core64_interrupt is
47
        port(
48
 
49
                rstp                                    : in std_logic;         --! 1 - сброс
50
                clk                                             : in std_logic;         --! Тактовая частота ядра 250 МГц
51
 
52
                irq                                             : in std_logic;         --! 1 - запрос прерывания
53
 
54
                cfg_command10                   : in  std_logic;        --! 1 - прерывания запрещены 
55
                cfg_interrupt                   : out std_logic;        --! 0 - изменение состояния прерывания
56
                cfg_interrupt_assert    : out std_logic;        --! 0 - формирование прерывания, 1 - сниятие прерывания 
57
                cfg_interrupt_rdy               : in  std_logic         --! 0 - подтверждение изменения прерывания 
58
 
59
        );
60
end core64_interrupt;
61
 
62
 
63
architecture core64_interrupt of core64_interrupt is
64
 
65
type stp_type   is ( s0, s1, s2, s3 );
66
 
67
signal  stp                     : stp_type;
68
signal  cnt                     : std_logic_vector( 4 downto 0 );
69
signal  irq_en          : std_logic;
70
 
71
begin
72
 
73
pr_irq_en: process( clk ) begin
74
        if( rising_edge( clk ) ) then
75
                if( rstp='1' or cfg_command10='1' ) then
76
                        irq_en <= '0' after 1 ns;
77
                else
78
                        irq_en  <= irq after 1 ns;
79
                end if;
80
        end if;
81
end process;
82
 
83
pr_state: process( clk ) begin
84
        if( rising_edge( clk ) ) then
85
 
86
                case( stp ) is
87
                        when s0 =>
88
                                cfg_interrupt_assert <= '0' after 1 ns;
89
                                cfg_interrupt <= '1' after 1 ns;
90
                                if( irq_en='1' and cnt(4)='1' ) then
91
                                        stp <= s1 after 1 ns;
92
                                end if;
93
 
94
                        when s1 =>
95
 
96
                                if( cfg_interrupt_rdy='0' ) then
97
                                        cfg_interrupt <= '1' after 1 ns;
98
                                        stp <= s2 after 1 ns;
99
                                else
100
                                        cfg_interrupt <= '0' after 1 ns;
101
                                end if;
102
 
103
                        when s2 =>
104
                                cfg_interrupt <= '1' after 1 ns;
105
                                cfg_interrupt_assert <= '1' after 1 ns;
106
                                if( irq_en='0' and cnt(4)='1' ) then
107
                                        stp <= s3 after 1 ns;
108
                                end if;
109
 
110
                        when s3 =>
111
                                if( cfg_interrupt_rdy='0' ) then
112
                                        cfg_interrupt <= '1' after 1 ns;
113
                                        stp <= s0 after 1 ns;
114
                                else
115
                                        cfg_interrupt <= '0' after 1 ns;
116
                                end if;
117
 
118
                end case;
119
 
120
 
121
 
122
                if( rstp='1' ) then
123
                        stp <= s0 after 1 ns;
124
                end if;
125
 
126
        end if;
127
end process;
128
 
129
pr_cnt: process( clk ) begin
130
        if( rising_edge( clk ) ) then
131
                if( rstp='1' or stp=s1 or stp=s3 ) then
132
                        cnt <= "00000" after 1 ns;
133
                elsif( cnt(4)='0' ) then
134
                        cnt <= cnt + 1 after 1 ns;
135
                end if;
136
        end if;
137
end process;
138
 
139
 
140
end core64_interrupt;

powered by: WebSVN 2.1.0

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