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

Subversion Repositories w11

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

powered by: WebSVN 2.1.0

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