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

Subversion Repositories w11

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

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

Line No. Rev Author Line
1 2 wfjm
-- $Id: pdp11_irq.vhd 314 2010-07-09 17:38:41Z mueller $
2
--
3
-- Copyright 2007-2008 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
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
-- Dependencies:   -
19
-- Test bench:     tb/tb_pdp11_core (implicit)
20
-- Target Devices: generic
21
-- Tool versions:  xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25
22
-- Revision History: 
23
-- Date         Rev Version  Comment
24
-- 2008-08-22   161   1.1.4  use iblib
25
-- 2008-04-25   138   1.1.3  use BRESET to clear pirq
26
-- 2008-01-06   111   1.1.2  rename signal EI_ACK->EI_ACKM (master ack)
27
-- 2008-01-05   110   1.1.1  rename IB_MREQ(ena->req) SRES(sel->ack, hold->busy)
28
-- 2007-12-30   107   1.1    use IB_MREQ/IB_SRES interface now
29
-- 2007-10-12    88   1.0.2  avoid ieee.std_logic_unsigned, use cast to unsigned
30
-- 2007-06-14    56   1.0.1  Use slvtypes.all
31
-- 2007-05-12    26   1.0    Initial version 
32
------------------------------------------------------------------------------
33
 
34
library ieee;
35
use ieee.std_logic_1164.all;
36
use ieee.std_logic_arith.all;
37
 
38
use work.slvtypes.all;
39
use work.iblib.all;
40
use work.pdp11.all;
41
 
42
-- ----------------------------------------------------------------------------
43
 
44
entity pdp11_irq is                     -- interrupt requester
45
  port (
46
    CLK : in slbit;                     -- clock
47
    BRESET : in slbit;                  -- ibus reset
48
    INT_ACK : in slbit;                 -- interrupt acknowledge from CPU
49
    EI_PRI : in slv3;                   -- external interrupt priority
50
    EI_VECT : in slv9_2;                -- external interrupt vector
51
    EI_ACKM : out slbit;                -- external interrupt acknowledge
52
    PRI : out slv3;                     -- interrupt priority
53
    VECT : out slv9_2;                  -- interrupt vector
54
    IB_MREQ : in ib_mreq_type;          -- ibus request
55
    IB_SRES : out ib_sres_type          -- ibus response
56
  );
57
end pdp11_irq;
58
 
59
architecture syn of pdp11_irq is
60
 
61
  constant ibaddr_pirq : slv16 := conv_std_logic_vector(8#177772#,16);
62
 
63
  subtype  pirq_ubf_pir    is integer range 15 downto 9;
64
  subtype  pirq_ubf_pia_h  is integer range  7 downto 5;
65
  subtype  pirq_ubf_pia_l  is integer range  3 downto 1;
66
 
67
  signal IBSEL_PIRQ : slbit := '0';
68
  signal R_PIRQ : slv8_1 := (others => '0');  -- pirq register
69
  signal PI_PRI : slv3 := (others => '0');   -- prog.int. priority
70
 
71
--  attribute PRIORITY_EXTRACT : string;
72
--  attribute PRIORITY_EXTRACT of PI_PRI : signal is "force";
73
 
74
begin
75
 
76
  proc_ibsel: process (IB_MREQ)
77
    variable ipirq : slbit := '0';
78
  begin
79
    ipirq := '0';
80
    if IB_MREQ.req='1' and IB_MREQ.addr=ibaddr_pirq(12 downto 1) then
81
      ipirq := '1';
82
    end if;
83
    IBSEL_PIRQ   <= ipirq;
84
    IB_SRES.ack  <= ipirq;
85
    IB_SRES.busy <= '0';
86
  end process proc_ibsel;
87
 
88
  proc_ibdout : process (IBSEL_PIRQ, R_PIRQ, PI_PRI)
89
    variable pirqout : slv16 := (others=>'0');
90
  begin
91
    pirqout := (others=>'0');
92
    if IBSEL_PIRQ = '1' then
93
      pirqout(pirq_ubf_pir)   := R_PIRQ;
94
      pirqout(pirq_ubf_pia_h) := PI_PRI;
95
      pirqout(pirq_ubf_pia_l) := PI_PRI;
96
    end if;
97
    IB_SRES.dout <= pirqout;
98
  end process proc_ibdout;
99
 
100
  proc_pirq : process (CLK)
101
  begin
102
    if CLK'event and CLK='1' then
103
      if BRESET = '1' then
104
        R_PIRQ <= (others => '0');
105
      elsif IBSEL_PIRQ='1' and IB_MREQ.we='1'and IB_MREQ.be1='1'  then
106
        R_PIRQ <= IB_MREQ.din(pirq_ubf_pir);
107
      end if;
108
    end if;
109
  end process proc_pirq;
110
 
111
  PI_PRI <= "111" when R_PIRQ(7)='1' else
112
            "110" when R_PIRQ(6)='1' else
113
            "101" when R_PIRQ(5)='1' else
114
            "100" when R_PIRQ(4)='1' else
115
            "011" when R_PIRQ(3)='1' else
116
            "010" when R_PIRQ(2)='1' else
117
            "001" when R_PIRQ(1)='1' else
118
            "000";
119
 
120
  proc_irq : process (PI_PRI, EI_PRI, EI_VECT, INT_ACK)
121
 
122
  begin
123
 
124
    EI_ACKM <= '0';
125
 
126
    if unsigned(EI_PRI) > unsigned(PI_PRI) then
127
      PRI  <= EI_PRI;
128
      VECT <= EI_VECT;
129
      EI_ACKM <= INT_ACK;
130
    else
131
      PRI  <= PI_PRI;
132
      VECT <= conv_std_logic_vector(8#240#,9)(8 downto 2);
133
    end if;
134
 
135
  end process proc_irq;
136
 
137
end syn;

powered by: WebSVN 2.1.0

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