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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [rtl/] [w11a/] [pdp11_irq.vhd] - Blame information for rev 8

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

Line No. Rev Author Line
1 8 wfjm
-- $Id: pdp11_irq.vhd 335 2010-10-24 22:24:23Z mueller $
2 2 wfjm
--
3 8 wfjm
-- Copyright 2007-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 2 wfjm
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
--
14
------------------------------------------------------------------------------
15
-- Module Name:    pdp11_irq - syn
16
-- Description:    pdp11: interrupt requester
17
--
18 8 wfjm
-- Dependencies:   ib_sel
19 2 wfjm
-- Test bench:     tb/tb_pdp11_core (implicit)
20
-- Target Devices: generic
21 8 wfjm
-- Tool versions:  xst 8.1, 8.2, 9.1, 9.2, 12.1; ghdl 0.18-0.29
22
--
23 2 wfjm
-- Revision History: 
24
-- Date         Rev Version  Comment
25 8 wfjm
-- 2010-10-23   335   1.2.1  use ib_sel
26
-- 2010-10-17   333   1.2    use ibus V2 interface
27 2 wfjm
-- 2008-08-22   161   1.1.4  use iblib
28
-- 2008-04-25   138   1.1.3  use BRESET to clear pirq
29
-- 2008-01-06   111   1.1.2  rename signal EI_ACK->EI_ACKM (master ack)
30
-- 2008-01-05   110   1.1.1  rename IB_MREQ(ena->req) SRES(sel->ack, hold->busy)
31
-- 2007-12-30   107   1.1    use IB_MREQ/IB_SRES interface now
32
-- 2007-10-12    88   1.0.2  avoid ieee.std_logic_unsigned, use cast to unsigned
33
-- 2007-06-14    56   1.0.1  Use slvtypes.all
34
-- 2007-05-12    26   1.0    Initial version 
35
------------------------------------------------------------------------------
36
 
37
library ieee;
38
use ieee.std_logic_1164.all;
39
use ieee.std_logic_arith.all;
40
 
41
use work.slvtypes.all;
42
use work.iblib.all;
43
use work.pdp11.all;
44
 
45
-- ----------------------------------------------------------------------------
46
 
47
entity pdp11_irq is                     -- interrupt requester
48
  port (
49
    CLK : in slbit;                     -- clock
50
    BRESET : in slbit;                  -- ibus reset
51
    INT_ACK : in slbit;                 -- interrupt acknowledge from CPU
52
    EI_PRI : in slv3;                   -- external interrupt priority
53
    EI_VECT : in slv9_2;                -- external interrupt vector
54
    EI_ACKM : out slbit;                -- external interrupt acknowledge
55
    PRI : out slv3;                     -- interrupt priority
56
    VECT : out slv9_2;                  -- interrupt vector
57
    IB_MREQ : in ib_mreq_type;          -- ibus request
58
    IB_SRES : out ib_sres_type          -- ibus response
59
  );
60
end pdp11_irq;
61
 
62
architecture syn of pdp11_irq is
63
 
64
  constant ibaddr_pirq : slv16 := conv_std_logic_vector(8#177772#,16);
65
 
66
  subtype  pirq_ubf_pir    is integer range 15 downto 9;
67
  subtype  pirq_ubf_pia_h  is integer range  7 downto 5;
68
  subtype  pirq_ubf_pia_l  is integer range  3 downto 1;
69
 
70
  signal IBSEL_PIRQ : slbit := '0';
71
  signal R_PIRQ : slv8_1 := (others => '0');  -- pirq register
72
  signal PI_PRI : slv3 := (others => '0');   -- prog.int. priority
73
 
74
--  attribute PRIORITY_EXTRACT : string;
75
--  attribute PRIORITY_EXTRACT of PI_PRI : signal is "force";
76
 
77
begin
78
 
79 8 wfjm
  SEL : ib_sel
80
    generic map (
81
      IB_ADDR => ibaddr_pirq)
82
    port map (
83
      CLK     => CLK,
84
      IB_MREQ => IB_MREQ,
85
      SEL     => IBSEL_PIRQ
86
    );
87 2 wfjm
 
88 8 wfjm
  proc_ibres : process (IBSEL_PIRQ, IB_MREQ, R_PIRQ, PI_PRI)
89
    variable idout : slv16 := (others=>'0');
90 2 wfjm
  begin
91 8 wfjm
    idout := (others=>'0');
92 2 wfjm
    if IBSEL_PIRQ = '1' then
93 8 wfjm
      idout(pirq_ubf_pir)   := R_PIRQ;
94
      idout(pirq_ubf_pia_h) := PI_PRI;
95
      idout(pirq_ubf_pia_l) := PI_PRI;
96 2 wfjm
    end if;
97 8 wfjm
    IB_SRES.dout <= idout;
98
    IB_SRES.ack  <= IBSEL_PIRQ and (IB_MREQ.re or IB_MREQ.we); -- ack all
99
    IB_SRES.busy <= '0';
100
  end process proc_ibres;
101 2 wfjm
 
102
  proc_pirq : process (CLK)
103
  begin
104
    if CLK'event and CLK='1' then
105
      if BRESET = '1' then
106
        R_PIRQ <= (others => '0');
107
      elsif IBSEL_PIRQ='1' and IB_MREQ.we='1'and IB_MREQ.be1='1'  then
108
        R_PIRQ <= IB_MREQ.din(pirq_ubf_pir);
109
      end if;
110
    end if;
111
  end process proc_pirq;
112
 
113
  PI_PRI <= "111" when R_PIRQ(7)='1' else
114
            "110" when R_PIRQ(6)='1' else
115
            "101" when R_PIRQ(5)='1' else
116
            "100" when R_PIRQ(4)='1' else
117
            "011" when R_PIRQ(3)='1' else
118
            "010" when R_PIRQ(2)='1' else
119
            "001" when R_PIRQ(1)='1' else
120
            "000";
121
 
122
  proc_irq : process (PI_PRI, EI_PRI, EI_VECT, INT_ACK)
123
 
124
  begin
125
 
126
    EI_ACKM <= '0';
127
 
128
    if unsigned(EI_PRI) > unsigned(PI_PRI) then
129
      PRI  <= EI_PRI;
130
      VECT <= EI_VECT;
131
      EI_ACKM <= INT_ACK;
132
    else
133
      PRI  <= PI_PRI;
134
      VECT <= conv_std_logic_vector(8#240#,9)(8 downto 2);
135
    end if;
136
 
137
  end process proc_irq;
138
 
139
end syn;

powered by: WebSVN 2.1.0

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