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 9

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

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

powered by: WebSVN 2.1.0

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