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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wfjm
-- $Id: pdp11_psr.vhd 314 2010-07-09 17:38:41Z mueller $
2
--
3
-- Copyright 2006-2009 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_psr - syn
16
-- Description:    pdp11: processor status word register
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
-- 2009-05-30   220   1.1.4  final removal of snoopers (were already commented)
25
-- 2008-08-22   161   1.1.3  rename ubf_ -> ibf_; use iblib
26
-- 2008-03-02   121   1.1.2  remove snoopers
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-06-14    56   1.0.1  Use slvtypes.all
30
-- 2007-05-12    26   1.0    Initial version 
31
------------------------------------------------------------------------------
32
 
33
library ieee;
34
use ieee.std_logic_1164.all;
35
use ieee.std_logic_arith.all;
36
 
37
use work.slvtypes.all;
38
use work.iblib.all;
39
use work.pdp11.all;
40
 
41
-- ----------------------------------------------------------------------------
42
 
43
entity pdp11_psr is                     -- processor status word register
44
  port (
45
    CLK : in slbit;                     -- clock
46
    CRESET : in slbit;                  -- console reset
47
    DIN : in slv16;                     -- input data
48
    CCIN : in slv4;                     -- cc input
49
    CCWE : in slbit;                    -- enable update cc
50
    WE : in slbit;                      -- write enable (from DIN)
51
    FUNC : in slv3;                     -- write function (from DIN)
52
    PSW : out psw_type;                 -- current psw
53
    IB_MREQ : in ib_mreq_type;          -- ibus request
54
    IB_SRES : out ib_sres_type          -- ibus response
55
  );
56
end pdp11_psr;
57
 
58
architecture syn of pdp11_psr is
59
 
60
  constant ibaddr_psr : slv16 := conv_std_logic_vector(8#177776#,16);
61
 
62
  signal IBSEL_PSR : slbit := '0';
63
  signal R_PSW : psw_type := psw_init;  -- ps register
64
 
65
begin
66
 
67
  proc_ibsel: process (IB_MREQ)
68
    variable ipsr : slbit := '0';
69
  begin
70
    ipsr := '0';
71
    if IB_MREQ.req='1' and IB_MREQ.addr=ibaddr_psr(12 downto 1) then
72
      ipsr := '1';
73
    end if;
74
    IBSEL_PSR    <= ipsr;
75
    IB_SRES.ack  <= ipsr;
76
    IB_SRES.busy <= '0';
77
  end process proc_ibsel;
78
 
79
  proc_ibdout: process (IBSEL_PSR, R_PSW)
80
    variable pswout : slv16 := (others=>'0');
81
  begin
82
    pswout := (others=>'0');
83
    if IBSEL_PSR = '1' then
84
      pswout(psw_ibf_cmode) := R_PSW.cmode;
85
      pswout(psw_ibf_pmode) := R_PSW.pmode;
86
      pswout(psw_ibf_rset)  := R_PSW.rset;
87
      pswout(psw_ibf_pri)   := R_PSW.pri;
88
      pswout(psw_ibf_tflag) := R_PSW.tflag;
89
      pswout(psw_ibf_cc)    := R_PSW.cc;
90
    end if;
91
    IB_SRES.dout <= pswout;
92
  end process proc_ibdout;
93
 
94
  proc_psw : process (CLK)
95
  begin
96
 
97
    if CLK'event and CLK='1' then
98
 
99
      if CRESET = '1' then
100
        R_PSW <= psw_init;
101
 
102
      else
103
 
104
        if CCWE = '1' then
105
          R_PSW.cc <= CCIN;
106
        end if;
107
 
108
        if WE = '1' then
109
          case FUNC is
110
            when c_psr_func_wspl =>       -- wspl
111
              R_PSW.pri <= DIN(2 downto 0);
112
 
113
            when c_psr_func_wcc =>        -- wcc
114
              if DIN(4) = '1' then        --   set cc opcodes
115
                R_PSW.cc <= R_PSW.cc or DIN(3 downto 0);
116
              else                        --   clear cc opcodes
117
                R_PSW.cc <= R_PSW.cc and not DIN(3 downto 0);
118
              end if;
119
 
120
            when c_psr_func_wint =>       -- wint (interupt handling)
121
              R_PSW.cmode <= DIN(psw_ibf_cmode);
122
              R_PSW.pmode <= R_PSW.cmode; --   save current mode
123
              R_PSW.rset <= DIN(psw_ibf_rset);
124
              R_PSW.pri <= DIN(psw_ibf_pri);
125
              R_PSW.tflag <= DIN(psw_ibf_tflag);
126
              R_PSW.cc <= DIN(psw_ibf_cc);
127
 
128
            when c_psr_func_wrti =>       -- wrti (rti/rtt in non-kernel mode)
129
              R_PSW.cmode <= R_PSW.cmode or DIN(psw_ibf_cmode);
130
              R_PSW.pmode <= R_PSW.pmode or DIN(psw_ibf_pmode) or
131
                             R_PSW.cmode or DIN(psw_ibf_cmode);
132
              R_PSW.rset <= R_PSW.rset or DIN(psw_ibf_rset);
133
              R_PSW.tflag <= DIN(psw_ibf_tflag);
134
              R_PSW.cc <= DIN(psw_ibf_cc);
135
 
136
            when c_psr_func_wall =>       -- wall (rti/rtt kernel mode)
137
              R_PSW.cmode <= DIN(psw_ibf_cmode);
138
              R_PSW.pmode <= DIN(psw_ibf_pmode);
139
              R_PSW.rset <= DIN(psw_ibf_rset);
140
              R_PSW.pri <= DIN(psw_ibf_pri);
141
              R_PSW.tflag <= DIN(psw_ibf_tflag);
142
              R_PSW.cc <= DIN(psw_ibf_cc);
143
 
144
            when others => null;
145
          end case;
146
        end if;
147
      end if;
148
 
149
      if IBSEL_PSR='1' and IB_MREQ.we='1' then
150
        if IB_MREQ.be1 = '1' then
151
          R_PSW.cmode <= IB_MREQ.din(psw_ibf_cmode);
152
          R_PSW.pmode <= IB_MREQ.din(psw_ibf_pmode);
153
          R_PSW.rset <= IB_MREQ.din(psw_ibf_rset);
154
        end if;
155
        if IB_MREQ.be0 = '1' then
156
          R_PSW.pri <= IB_MREQ.din(psw_ibf_pri);
157
          R_PSW.cc <= IB_MREQ.din(psw_ibf_cc);
158
        end if;
159
      end if;
160
 
161
    end if;
162
 
163
  end process proc_psw;
164
 
165
  PSW <= R_PSW;
166
 
167
end syn;

powered by: WebSVN 2.1.0

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