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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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