1 |
3 |
Andrewski |
--------------------------------------------------------------------------------
|
2 |
13 |
Andrewski |
--This file is part of fpga_gpib_controller.
|
3 |
|
|
--
|
4 |
|
|
-- Fpga_gpib_controller is free software: you can redistribute it and/or modify
|
5 |
|
|
-- it under the terms of the GNU General Public License as published by
|
6 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
7 |
|
|
-- (at your option) any later version.
|
8 |
|
|
--
|
9 |
|
|
-- Fpga_gpib_controller is distributed in the hope that it will be useful,
|
10 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
-- GNU General Public License for more details.
|
13 |
|
|
|
14 |
|
|
-- You should have received a copy of the GNU General Public License
|
15 |
|
|
-- along with Fpga_gpib_controller. If not, see <http://www.gnu.org/licenses/>.
|
16 |
|
|
--------------------------------------------------------------------------------
|
17 |
3 |
Andrewski |
-- Entity: InterruptGenerator
|
18 |
|
|
-- Date:2011-11-25
|
19 |
13 |
Andrewski |
-- Author: Andrzej Paluch
|
20 |
3 |
Andrewski |
--
|
21 |
|
|
-- Description ${cursor}
|
22 |
|
|
--------------------------------------------------------------------------------
|
23 |
|
|
library ieee;
|
24 |
|
|
use ieee.std_logic_1164.all;
|
25 |
|
|
use ieee.std_logic_unsigned.all;
|
26 |
|
|
|
27 |
|
|
use work.helperComponents.all;
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
entity InterruptGenerator is
|
31 |
|
|
port (
|
32 |
|
|
reset : std_logic;
|
33 |
|
|
clk : in std_logic;
|
34 |
|
|
interrupt : out std_logic;
|
35 |
|
|
-------------------- gpib device ---------------------
|
36 |
|
|
-- device is local controlled
|
37 |
|
|
isLocal : in std_logic;
|
38 |
|
|
-- input buffer ready
|
39 |
|
|
in_buf_ready : in std_logic;
|
40 |
|
|
-- output buffer ready
|
41 |
|
|
out_buf_ready : in std_logic;
|
42 |
|
|
-- clear device (DC)
|
43 |
|
|
clr : in std_logic;
|
44 |
|
|
-- trigger device (DT)
|
45 |
|
|
trg : in std_logic;
|
46 |
|
|
-- addressed to talk(L or LE)
|
47 |
|
|
att : in std_logic;
|
48 |
|
|
-- addressed to listen (T or TE)
|
49 |
|
|
atl : in std_logic;
|
50 |
|
|
-- seriall poll active
|
51 |
|
|
spa : in std_logic;
|
52 |
|
|
-------------------- gpib controller ---------------------
|
53 |
|
|
-- controller write commands
|
54 |
|
|
cwrc : in std_logic;
|
55 |
|
|
-- controller write data
|
56 |
|
|
cwrd : in std_logic;
|
57 |
|
|
-- service requested
|
58 |
|
|
srq : in std_logic;
|
59 |
|
|
-- parallel poll ready
|
60 |
|
|
ppr : in std_logic;
|
61 |
|
|
-- stb received
|
62 |
|
|
stb_received : in std_logic;
|
63 |
|
|
REN : in std_logic;
|
64 |
|
|
ATN : in std_logic;
|
65 |
|
|
IFC : in std_logic
|
66 |
|
|
);
|
67 |
|
|
end InterruptGenerator;
|
68 |
|
|
|
69 |
|
|
architecture arch of InterruptGenerator is
|
70 |
|
|
|
71 |
|
|
constant PULSE_WIDTH : integer := 10;
|
72 |
|
|
|
73 |
|
|
signal p0, p1, p2, p3, p4, p5, p6, p7 : std_logic;
|
74 |
|
|
|
75 |
|
|
begin
|
76 |
|
|
|
77 |
|
|
interrupt <= p0 or p1 or p2 or p3 or p4 or p5 or p6 or p7;
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
ed0: EdgeDetector generic map (RISING => '1', FALLING => '0',
|
81 |
|
|
PULSE_WIDTH => PULSE_WIDTH) port map (
|
82 |
|
|
reset => reset, clk => clk, in_data => in_buf_ready, pulse => p0
|
83 |
|
|
);
|
84 |
|
|
|
85 |
|
|
ed1: EdgeDetector generic map (RISING => '1', FALLING => '0',
|
86 |
|
|
PULSE_WIDTH => PULSE_WIDTH) port map (
|
87 |
|
|
reset => reset, clk => clk, in_data => out_buf_ready, pulse => p1
|
88 |
|
|
);
|
89 |
|
|
|
90 |
|
|
ed2: EdgeDetector generic map (RISING => '1', FALLING => '0',
|
91 |
|
|
PULSE_WIDTH => PULSE_WIDTH) port map (
|
92 |
|
|
reset => reset, clk => clk, in_data => clr, pulse => p2
|
93 |
|
|
);
|
94 |
|
|
|
95 |
|
|
ed3: EdgeDetector generic map (RISING => '1', FALLING => '0',
|
96 |
|
|
PULSE_WIDTH => PULSE_WIDTH) port map (
|
97 |
|
|
reset => reset, clk => clk, in_data => trg, pulse => p3
|
98 |
|
|
);
|
99 |
|
|
|
100 |
|
|
ed4: EdgeDetector generic map (RISING => '1', FALLING => '0',
|
101 |
|
|
PULSE_WIDTH => PULSE_WIDTH) port map (
|
102 |
|
|
reset => reset, clk => clk, in_data => srq, pulse => p4
|
103 |
|
|
);
|
104 |
|
|
|
105 |
|
|
ed5: EdgeDetector generic map (RISING => '1', FALLING => '0',
|
106 |
|
|
PULSE_WIDTH => PULSE_WIDTH) port map (
|
107 |
|
|
reset => reset, clk => clk, in_data => ppr, pulse => p5
|
108 |
|
|
);
|
109 |
|
|
|
110 |
|
|
ed6: EdgeDetector generic map (RISING => '1', FALLING => '0',
|
111 |
|
|
PULSE_WIDTH => PULSE_WIDTH) port map (
|
112 |
|
|
reset => reset, clk => clk, in_data => stb_received, pulse => p6
|
113 |
|
|
);
|
114 |
|
|
|
115 |
|
|
ed7: EdgeDetector generic map (RISING => '1', FALLING => '1',
|
116 |
|
|
PULSE_WIDTH => PULSE_WIDTH) port map (
|
117 |
|
|
reset => reset, clk => clk, in_data => isLocal, pulse => p7
|
118 |
|
|
);
|
119 |
|
|
|
120 |
|
|
end arch;
|
121 |
|
|
|