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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 wfjm
-- $Id: pdp11_mmu_sadr.vhd 427 2011-11-19 21:04:11Z mueller $
2 2 wfjm
--
3 13 wfjm
-- Copyright 2006-2011 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_mmu_sadr - syn
16
-- Description:    pdp11: mmu SAR/SDR register set
17
--
18
-- Dependencies:   memlib/ram_1swar_gen
19
--
20
-- Test bench:     tb/tb_pdp11_core (implicit)
21
-- Target Devices: generic
22 13 wfjm
-- Tool versions:  xst 8.2, 9.1, 9.2, 12.1, 13.1; ghdl 0.18-0.29
23 8 wfjm
--
24 2 wfjm
-- Revision History: 
25
-- Date         Rev Version  Comment
26 13 wfjm
-- 2011-11-18   427   1.3.3  now numeric_std clean
27 9 wfjm
-- 2010-12-30   351   1.3.2  BUGFIX: fix sensitivity list of proc_eaddr
28 8 wfjm
-- 2010-10-23   335   1.3.1  change proc_eaddr logic, shorten logic path
29
-- 2010-10-17   333   1.3    use ibus V2 interface
30 2 wfjm
-- 2008-08-22   161   1.2.2  rename ubf_ -> ibf_; use iblib
31
-- 2008-01-05   110   1.2.1  rename _mmu_regs -> _mmu_sadr
32
--                           rename IB_MREQ(ena->req) SRES(sel->ack, hold->busy)
33
-- 2008-01-01   109   1.2    renamed from _mmu_regfile.
34
--                           redesign of _mmu register file, use one large dram.
35
--                           logic from _mmu_regfile, interface from _mmu_regset
36
-- 2007-12-30   108   1.1.1  use ubf_byte[01]; move SADR memory address mux here
37
-- 2007-12-30   107   1.1    use IB_MREQ/IB_SRES interface now
38
-- 2007-06-14    56   1.0.1  Use slvtypes.all
39
-- 2007-05-12    26   1.0    Initial version 
40
------------------------------------------------------------------------------
41
 
42
library ieee;
43
use ieee.std_logic_1164.all;
44 13 wfjm
use ieee.numeric_std.all;
45 2 wfjm
 
46
use work.slvtypes.all;
47
use work.memlib.all;
48
use work.iblib.all;
49
use work.pdp11.all;
50
 
51
-- ----------------------------------------------------------------------------
52
 
53
entity pdp11_mmu_sadr is                -- mmu SAR/SDR register set
54
  port (
55
    CLK : in slbit;                     -- clock
56
    MODE : in slv2;                     -- mode
57
    ASN : in slv4;                      -- augmented segment number (1+3 bit)
58
    AIB_WE : in slbit;                  -- update AIB
59
    AIB_SETA : in slbit;                -- set access AIB
60
    AIB_SETW : in slbit;                -- set write AIB
61
    SARSDR : out sarsdr_type;           -- combined SAR/SDR
62
    IB_MREQ : in ib_mreq_type;          -- ibus request
63
    IB_SRES : out ib_sres_type          -- ibus response
64
  );
65
end pdp11_mmu_sadr;
66
 
67
architecture syn of pdp11_mmu_sadr is
68
 
69
  --             bit 1 111 1
70
  --             bit 5 432 109 876 543 210
71
  --
72
  -- kmdr 172300 ->  1 111 010 011 000 000
73
  -- kmar 172340 ->  1 111 010 011 100 000
74
  -- smdr 172200 ->  1 111 010 010 000 000
75
  -- smar 172240 ->  1 111 010 010 100 000
76
  -- umdr 177600 ->  1 111 111 110 000 000
77
  -- umar 177640 ->  1 111 111 110 100 000
78
  --
79
  --  mode => (addr(8), not addr(6))   [Note: km "00" sm "01" um "11"]
80
 
81 13 wfjm
  constant ibaddr_kmdar : slv16 := slv(to_unsigned(8#172300#,16));
82
  constant ibaddr_smdar : slv16 := slv(to_unsigned(8#172200#,16));
83
  constant ibaddr_umdar : slv16 := slv(to_unsigned(8#177600#,16));
84 2 wfjm
 
85
  subtype sdr_ibf_slf is integer range 14 downto 8;
86
  subtype sdr_ibf_aib is integer range  7 downto 6;
87
  subtype sdr_ibf_acf is integer range  3 downto 0;
88
 
89
  signal SADR_ADDR : slv6 := (others=>'0'); -- address (from mmu or ibus)
90
 
91
  signal SAR_HIGH_WE : slbit := '0';    -- write enables
92
  signal SAR_LOW_WE : slbit := '0';     -- ...
93
  signal SDR_SLF_WE : slbit := '0';     -- ...
94
  signal SDR_AIB_WE : slbit := '0';     -- ...
95
  signal SDR_LOW_WE : slbit := '0';     -- ...
96
 
97 8 wfjm
  signal R_IBSEL_DR : slbit := '0';     -- DR's selected from ibus
98
  signal R_IBSEL_AR : slbit := '0';     -- AR's selected from ibus
99 2 wfjm
 
100
  signal SAF : slv16 := (others=>'0');  -- current SAF
101
  signal SLF : slv7 := (others=>'0');   -- current SLF
102
  signal AIB : slv2 := "00";            -- current AIB flags
103 8 wfjm
  signal N_AIB : slv2 := "00";          -- next AIB flags
104 2 wfjm
  signal ED_ACF : slv4 := "0000";       -- current ED & ACF
105
 
106
begin
107
 
108
  SAR_HIGH : ram_1swar_gen
109
    generic map (
110
      AWIDTH => 6,
111
      DWIDTH => 8)
112
    port map (
113
      CLK  => CLK,
114
      WE   => SAR_HIGH_WE,
115
      ADDR => SADR_ADDR,
116
      DI   => IB_MREQ.din(ibf_byte1),
117
      DO   => SAF(ibf_byte1));
118
 
119
  SAR_LOW : ram_1swar_gen
120
    generic map (
121
      AWIDTH => 6,
122
      DWIDTH => 8)
123
    port map (
124
      CLK  => CLK,
125
      WE   => SAR_LOW_WE,
126
      ADDR => SADR_ADDR,
127
      DI   => IB_MREQ.din(ibf_byte0),
128
      DO   => SAF(ibf_byte0));
129
 
130
  SDR_SLF : ram_1swar_gen
131
    generic map (
132
      AWIDTH => 6,
133
      DWIDTH => 7)
134
    port map (
135
      CLK  => CLK,
136
      WE   => SDR_SLF_WE,
137
      ADDR => SADR_ADDR,
138
      DI   => IB_MREQ.din(sdr_ibf_slf),
139
      DO   => SLF);
140
 
141
  SDR_AIB : ram_1swar_gen
142
    generic map (
143
      AWIDTH => 6,
144
      DWIDTH => 2)
145
    port map (
146
      CLK  => CLK,
147
      WE   => SDR_AIB_WE,
148
      ADDR => SADR_ADDR,
149 8 wfjm
      DI   => N_AIB,
150 2 wfjm
      DO   => AIB);
151
 
152
  SDR_LOW : ram_1swar_gen
153
    generic map (
154
      AWIDTH => 6,
155
      DWIDTH => 4)
156
    port map (
157
      CLK  => CLK,
158
      WE   => SDR_LOW_WE,
159
      ADDR => SADR_ADDR,
160
      DI   => IB_MREQ.din(sdr_ibf_acf),
161
      DO   => ED_ACF);
162
 
163 8 wfjm
  -- determine IBSEL's and the address for accessing the SADR's
164
 
165
  proc_ibsel: process (CLK)
166
    variable ibsel_dr : slbit := '0';
167
    variable ibsel_ar : slbit := '0';
168 2 wfjm
  begin
169 13 wfjm
    if rising_edge(CLK) then
170 8 wfjm
      ibsel_dr := '0';
171
      ibsel_ar := '0';
172
      if IB_MREQ.aval = '1' then
173
        if IB_MREQ.addr(12 downto 6)=ibaddr_kmdar(12 downto 6) or
174
           IB_MREQ.addr(12 downto 6)=ibaddr_smdar(12 downto 6) or
175
           IB_MREQ.addr(12 downto 6)=ibaddr_umdar(12 downto 6) then
176
          if IB_MREQ.addr(5) = '0' then
177
            ibsel_dr := '1';
178
          else
179
            ibsel_ar := '1';
180
          end if;
181 2 wfjm
        end if;
182
      end if;
183 8 wfjm
      R_IBSEL_DR <= ibsel_dr;
184
      R_IBSEL_AR <= ibsel_ar;
185 2 wfjm
    end if;
186
  end process proc_ibsel;
187 8 wfjm
 
188
  proc_ibres : process (R_IBSEL_DR, R_IBSEL_AR, IB_MREQ, SAF, SLF, AIB, ED_ACF)
189 2 wfjm
    variable sarout : slv16 := (others=>'0');  -- IB sar out
190
    variable sdrout : slv16 := (others=>'0');  -- IB sdr out
191
  begin
192
 
193
    sarout := (others=>'0');
194 8 wfjm
    if R_IBSEL_AR = '1' then
195 2 wfjm
      sarout := SAF;
196
    end if;
197
 
198
    sdrout := (others=>'0');
199 8 wfjm
    if R_IBSEL_DR = '1' then
200 2 wfjm
      sdrout(sdr_ibf_slf) := SLF;
201
      sdrout(sdr_ibf_aib) := AIB;
202
      sdrout(sdr_ibf_acf) := ED_ACF;
203
    end if;
204
 
205
    IB_SRES.dout <= sarout or sdrout;
206 8 wfjm
    IB_SRES.ack  <= (R_IBSEL_DR or R_IBSEL_AR) and
207
                    (IB_MREQ.re or IB_MREQ.we); -- ack all
208
    IB_SRES.busy <= '0';
209 2 wfjm
 
210 8 wfjm
  end process proc_ibres;
211 2 wfjm
 
212 8 wfjm
  -- the eaddr select should be done as early as possible, it is in the
213
  -- mmu paadr logic path. Currently it's derived from 4 flops. If that's
214
  -- to slow just use IB_MREQ.we or IB_MREQ.we, that should be sufficient
215
  -- and reduce the eaddr mux to a 4-input LUT. Last resort is a 2 cycle ibus
216
  -- access with a state flop marking the 2nd cycle of a re/we transaction.
217
 
218 9 wfjm
  proc_eaddr: process (IB_MREQ, MODE, ASN, R_IBSEL_DR, R_IBSEL_AR)
219 8 wfjm
    variable eaddr : slv6 := (others=>'0');
220
    variable idr : slbit := '0';
221
    variable iar : slbit := '0';
222
  begin
223
 
224
    eaddr := MODE & ASN;
225
 
226
    if (R_IBSEL_DR='1' or R_IBSEL_AR='1') and
227
       (IB_MREQ.re='1' or IB_MREQ.we='1') then
228
      eaddr(5)          := IB_MREQ.addr(8);
229
      eaddr(4)          := not IB_MREQ.addr(6);
230
      eaddr(3 downto 0) := IB_MREQ.addr(4 downto 1);
231
    end if;
232
 
233
    SADR_ADDR    <= eaddr;
234
 
235
  end process proc_eaddr;
236
 
237
  proc_comb : process (R_IBSEL_AR, R_IBSEL_DR, IB_MREQ, AIB_WE,
238
                       AIB_SETA, AIB_SETW,
239 2 wfjm
                       SAF, SLF, AIB, ED_ACF)
240
  begin
241
 
242 8 wfjm
    N_AIB <= "00";
243 2 wfjm
    SAR_HIGH_WE <= '0';
244
    SAR_LOW_WE <= '0';
245
    SDR_SLF_WE <= '0';
246
    SDR_AIB_WE <= '0';
247
    SDR_LOW_WE <= '0';
248
 
249
    if IB_MREQ.we = '1' then
250 8 wfjm
      if R_IBSEL_AR = '1' then
251 2 wfjm
        if IB_MREQ.be1 = '1' then
252
          SAR_HIGH_WE <= '1';
253
        end if;
254
        if IB_MREQ.be0 = '1' then
255
          SAR_LOW_WE <= '1';
256
        end if;
257
      end if;
258
 
259 8 wfjm
      if R_IBSEL_DR = '1' then
260 2 wfjm
        if IB_MREQ.be1 = '1' then
261
          SDR_SLF_WE <= '1';
262
        end if;
263
        if IB_MREQ.be0 = '1' then
264
          SDR_LOW_WE <= '1';
265
        end if;
266
      end if;
267
 
268 8 wfjm
      if (R_IBSEL_AR or R_IBSEL_DR)='1' then
269
        N_AIB <= "00";
270 2 wfjm
        SDR_AIB_WE <= '1';
271
      end if;
272
    end if;
273
 
274
    if AIB_WE = '1' then
275 8 wfjm
      N_AIB(0) <= AIB(0) or AIB_SETW;
276
      N_AIB(1) <= AIB(1) or AIB_SETA;
277 2 wfjm
      SDR_AIB_WE  <= '1';
278
    end if;
279
 
280
    SARSDR.saf <= SAF;
281
    SARSDR.slf <= SLF;
282
    SARSDR.ed  <= ED_ACF(3);
283
    SARSDR.acf <= ED_ACF(2 downto 0);
284
 
285
  end process proc_comb;
286
 
287
end syn;

powered by: WebSVN 2.1.0

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