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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 wfjm
-- $Id: pdp11_mem70.vhd 427 2011-11-19 21:04:11Z mueller $
2 2 wfjm
--
3 13 wfjm
-- Copyright 2008-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_mem70 - syn
16
-- Description:    pdp11: 11/70 memory system registers
17
--
18
-- Dependencies:   -
19
-- Test bench:     tb/tb_pdp11_core (implicit)
20
-- Target Devices: generic
21 13 wfjm
-- Tool versions:  xst 8.2, 9.1, 9.2, 12.1, 13.1; ghdl 0.18-0.29
22 8 wfjm
--
23 2 wfjm
-- Revision History: 
24
-- Date         Rev Version  Comment
25 13 wfjm
-- 2011-11-18   427   1.1.1  now numeric_std clean
26 8 wfjm
-- 2010-10-17   333   1.1    use ibus V2 interface
27 2 wfjm
-- 2008-08-22   161   1.0.2  rename ubf_ -> ibf_; use iblib
28
-- 2008-02-23   118   1.0.1  use sys_conf_mem_losize; rename CACHE_ENA->_FMISS
29
-- 2008-01-27   115   1.0    Initial version 
30
------------------------------------------------------------------------------
31
 
32
library ieee;
33
use ieee.std_logic_1164.all;
34 13 wfjm
use ieee.numeric_std.all;
35 2 wfjm
 
36
use work.slvtypes.all;
37
use work.iblib.all;
38
use work.pdp11.all;
39
use work.sys_conf.all;
40
 
41
-- ----------------------------------------------------------------------------
42
 
43
entity pdp11_mem70 is                   -- 11/70 memory system registers
44
  port (
45
    CLK : in slbit;                     -- clock
46
    CRESET : in slbit;                  -- console reset
47
    HM_ENA : in slbit;                  -- hit/miss enable
48
    HM_VAL : in slbit;                  -- hit/miss value
49
    CACHE_FMISS : out slbit;            -- cache force miss
50
    IB_MREQ : in ib_mreq_type;          -- ibus request
51
    IB_SRES : out ib_sres_type          -- ibus response
52
  );
53
end pdp11_mem70;
54
 
55
architecture syn of pdp11_mem70 is
56
 
57 13 wfjm
  constant ibaddr_loaddr : slv16 := slv(to_unsigned(8#177740#,16));
58
  constant ibaddr_hiaddr : slv16 := slv(to_unsigned(8#177742#,16));
59
  constant ibaddr_syserr : slv16 := slv(to_unsigned(8#177744#,16));
60
  constant ibaddr_cntl   : slv16 := slv(to_unsigned(8#177746#,16));
61
  constant ibaddr_maint  : slv16 := slv(to_unsigned(8#177750#,16));
62
  constant ibaddr_hm     : slv16 := slv(to_unsigned(8#177752#,16));
63
  constant ibaddr_losize : slv16 := slv(to_unsigned(8#177760#,16));
64
  constant ibaddr_hisize : slv16 := slv(to_unsigned(8#177762#,16));
65 2 wfjm
 
66
  subtype  cntl_ibf_frep    is integer range  5 downto  4;
67
  subtype  cntl_ibf_fmiss   is integer range  3 downto  2;
68
  constant cntl_ibf_disutrap : integer :=  1;
69
  constant cntl_ibf_distrap  : integer :=  0;
70
 
71
  type regs_type is record              -- state registers
72 8 wfjm
    ibsel_cr : slbit;                   -- ibus select cntl
73
    ibsel_hm : slbit;                   -- ibus select hitmiss
74
    ibsel_ls : slbit;                   -- ibus select losize
75
    ibsel_nn : slbit;                   -- ibus select others
76 2 wfjm
    hm_data : slv6;                     -- hit/miss: data
77
    cr_frep : slv2;                     -- cntl: force replacement bits
78
    cr_fmiss : slv2;                    -- cntl: force miss bits
79
    cr_disutrap: slbit;                 -- cntl: disable unibus trap
80
    cr_distrap: slbit;                  -- cntl: disable traps
81
  end record regs_type;
82
 
83
  constant regs_init : regs_type := (
84 8 wfjm
    '0','0','0','0',                    -- ibsel_*
85 2 wfjm
    (others=>'0'),                      -- hm_data
86
    "00","00",                          -- cr_freq,_fmiss
87
    '0','0'                             -- dis(u)trap
88
  );
89
 
90
  signal R_REGS : regs_type := regs_init;
91
  signal N_REGS : regs_type := regs_init;
92
 
93
begin
94
 
95
  proc_regs: process (CLK)
96
  begin
97 13 wfjm
    if rising_edge(CLK) then
98 2 wfjm
      if CRESET = '1' then
99
        R_REGS <= regs_init;
100
     else
101
        R_REGS <= N_REGS;
102
      end if;
103
    end if;
104
  end process proc_regs;
105
 
106
  proc_next: process (R_REGS, HM_ENA, HM_VAL, IB_MREQ)
107
    variable r : regs_type := regs_init;
108
    variable n : regs_type := regs_init;
109
    variable idout : slv16 := (others=>'0');
110 8 wfjm
    variable ibreq : slbit := '0';
111
    variable ibw0 : slbit := '0';
112 2 wfjm
  begin
113
 
114
    r := R_REGS;
115
    n := R_REGS;
116
 
117
    idout := (others=>'0');
118 8 wfjm
    ibreq := IB_MREQ.re or IB_MREQ.we;
119
    ibw0  := IB_MREQ.we and IB_MREQ.be0;
120 2 wfjm
 
121 8 wfjm
    -- ibus address decoder
122
    n.ibsel_cr := '0';
123
    n.ibsel_hm := '0';
124
    n.ibsel_ls := '0';
125
    n.ibsel_nn := '0';
126
    if IB_MREQ.aval = '1' then
127 2 wfjm
      if IB_MREQ.addr = ibaddr_cntl(12 downto 1) then
128 8 wfjm
        n.ibsel_cr := '1';
129 2 wfjm
      end if;
130
      if IB_MREQ.addr = ibaddr_hm(12 downto 1) then
131 8 wfjm
        n.ibsel_hm := '1';
132 2 wfjm
      end if;
133
      if IB_MREQ.addr = ibaddr_losize(12 downto 1) then
134 8 wfjm
        n.ibsel_ls := '1';
135 2 wfjm
      end if;
136
      if IB_MREQ.addr=ibaddr_loaddr(12 downto 1) or
137
         IB_MREQ.addr=ibaddr_hiaddr(12 downto 1) or
138
         IB_MREQ.addr=ibaddr_syserr(12 downto 1) or
139
         IB_MREQ.addr=ibaddr_maint(12 downto 1)  or
140
         IB_MREQ.addr=ibaddr_hisize(12 downto 1) then
141 8 wfjm
        n.ibsel_nn := '1';
142 2 wfjm
      end if;
143
    end if;
144
 
145 8 wfjm
    -- ibus transactions
146
    if r.ibsel_cr = '1' then
147 2 wfjm
      idout(cntl_ibf_frep)     := r.cr_frep;
148
      idout(cntl_ibf_fmiss)    := r.cr_fmiss;
149
      idout(cntl_ibf_disutrap) := r.cr_disutrap;
150
      idout(cntl_ibf_distrap)  := r.cr_distrap;
151
    end if;
152 8 wfjm
    if r.ibsel_hm = '1' then
153 2 wfjm
      idout(r.hm_data'range)  := r.hm_data;
154
    end if;
155 8 wfjm
    if r.ibsel_ls = '1' then
156 13 wfjm
      idout := slv(to_unsigned(sys_conf_mem_losize,16));
157 2 wfjm
    end if;
158
 
159 8 wfjm
    if r.ibsel_cr='1' and ibw0='1' then
160 2 wfjm
      n.cr_frep     := IB_MREQ.din(cntl_ibf_frep);
161
      n.cr_fmiss    := IB_MREQ.din(cntl_ibf_fmiss);
162
      n.cr_disutrap := IB_MREQ.din(cntl_ibf_disutrap);
163
      n.cr_distrap  := IB_MREQ.din(cntl_ibf_distrap);
164
    end if;
165
 
166
    if HM_ENA = '1' then
167
     n.hm_data := r.hm_data(r.hm_data'left-1 downto 0) & HM_VAL;
168
    end if;
169
 
170
    N_REGS <= n;
171
 
172 8 wfjm
    IB_SRES.dout <= idout;
173
    IB_SRES.ack  <= (r.ibsel_cr or r.ibsel_hm or
174
                     r.ibsel_ls or r.ibsel_nn) and ibreq;
175 2 wfjm
    IB_SRES.busy <= '0';
176
 
177
  end process proc_next;
178
 
179
  CACHE_FMISS <= (R_REGS.cr_fmiss(1) or R_REGS.cr_fmiss(0));
180
 
181
end syn;

powered by: WebSVN 2.1.0

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