OpenCores
URL https://opencores.org/ocsvn/am9080_cpu_based_on_microcoded_am29xx_bit-slices/am9080_cpu_based_on_microcoded_am29xx_bit-slices/trunk

Subversion Repositories am9080_cpu_based_on_microcoded_am29xx_bit-slices

[/] [am9080_cpu_based_on_microcoded_am29xx_bit-slices/] [trunk/] [interrupt_controller.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 zpekic
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    21:12:03 12/12/2017 
6
-- Design Name: 
7
-- Module Name:    interrupt_controller - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
 
23
-- Uncomment the following library declaration if using
24
-- arithmetic functions with Signed or Unsigned values
25
--use IEEE.NUMERIC_STD.ALL;
26
 
27
-- Uncomment the following library declaration if instantiating
28
-- any Xilinx primitives in this code.
29
--library UNISIM;
30
--use UNISIM.VComponents.all;
31
 
32
entity interrupt_controller is
33
    Port ( CLK : in  STD_LOGIC;
34
           nRESET : in  STD_LOGIC;
35
           INT : out  STD_LOGIC;
36
           nINTA : in  STD_LOGIC;
37
           INTE : in  STD_LOGIC;
38
           D : out  STD_LOGIC_VECTOR (7 downto 0);
39
           DEVICEREQ : in  STD_LOGIC_VECTOR (7 downto 0);
40
           DEVICEACK : out  STD_LOGIC_VECTOR (7 downto 0));
41
end interrupt_controller;
42
 
43
architecture Behavioral of interrupt_controller is
44
 
45
--constant opcode_rst0: std_logic_vector(7 downto 0) := X"C7";
46
--constant opcode_rst1: std_logic_vector(7 downto 0) := X"CF";
47
--constant opcode_rst2: std_logic_vector(7 downto 0) := X"D7";
48
--constant opcode_rst3: std_logic_vector(7 downto 0) := X"DF";
49
--constant opcode_rst4: std_logic_vector(7 downto 0) := X"E7";
50
--constant opcode_rst5: std_logic_vector(7 downto 0) := X"EF";
51
--constant opcode_rst6: std_logic_vector(7 downto 0) := X"F7";
52
--constant opcode_rst7: std_logic_vector(7 downto 0) := X"FF";
53
constant opcode_noop: std_logic_vector(7 downto 0) := X"00";
54
 
55
signal vector: std_logic_vector(7 downto 0);
56
signal level: std_logic_vector(3 downto 0);
57
signal intreq, intclk: std_logic;
58
 
59
begin
60
 
61
D <= vector when (nINTA = '0') else "ZZZZZZZZ";
62
--intclk <= CLK when (intreq = '0') else nINTA;
63
INT <= intreq;
64
 
65
level <= "1111" when DEVICEREQ(7) = '1' else -- highest level 7 == RST 7
66
                        "1110" when DEVICEREQ(6) = '1' else
67
                        "1101" when DEVICEREQ(5) = '1' else
68
                        "1100" when DEVICEREQ(4) = '1' else
69
                        "1011" when DEVICEREQ(3) = '1' else
70
                        "1010" when DEVICEREQ(2) = '1' else
71
                        "1001" when DEVICEREQ(1) = '1' else
72
                        "1000" when DEVICEREQ(0) = '1' else -- lowest level 0 == RST 0
73
                        "0000";                                                                         -- no interrupt
74
 
75
generate_ack: process(nINTA, vector)
76
begin
77
    if (nINTA = '0') then
78
        case vector(5 downto 3) is
79
            when "000" =>
80
                                        DEVICEACK <= "00000001";
81
            when "001" =>
82
                                        DEVICEACK <= "00000010";
83
            when "010" =>
84
                                        DEVICEACK <= "00000100";
85
            when "011" =>
86
                                        DEVICEACK <= "00001000";
87
            when "100" =>
88
                                        DEVICEACK <= "00010000";
89
            when "101" =>
90
                                        DEVICEACK <= "00100000";
91
            when "110" =>
92
                                        DEVICEACK <= "01000000";
93
            when "111" =>
94
                                        DEVICEACK <= "10000000";
95
            when others =>
96
                                        null;
97
        end case;
98
    else
99
        DEVICEACK <= "00000000";
100
    end if;
101
end process;
102
 
103
loadvector: process(nRESET, CLK, level, INTE, nINTA)
104
begin
105
        if (nRESET = '0') then
106
                intreq <= '0';
107
                vector <= opcode_noop; --- not really used
108
        else
109
                if (rising_edge(CLK)) then
110
                        if (intreq = '0') then
111
                                if (level(3) = '1' and INTE = '1') then
112
                                        intreq <= '1';
113
                                        vector <= "11" & level(2 downto 0) & "111";
114
                                end if;
115
                        else
116
                                intreq <= nINTA;
117
                        end if;
118
                end if;
119
        end if;
120
end process;
121
 
122
end Behavioral;
123
 

powered by: WebSVN 2.1.0

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