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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 wfjm
-- $Id: pdp11_ubmap.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_ubmap - syn
16
-- Description:    pdp11: 11/70 unibus mapper
17
--
18 8 wfjm
-- Dependencies:   memlib/ram_1swar_gen
19
--                 ib_sel
20 2 wfjm
-- 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.1.2  now numeric_std clean
27 8 wfjm
-- 2010-10-23   335   1.1.1  use ib_sel
28
-- 2010-10-17   333   1.1    use ibus V2 interface
29 2 wfjm
-- 2008-08-22   161   1.0.1  use iblib
30
-- 2008-01-27   115   1.0    Initial version 
31
------------------------------------------------------------------------------
32
 
33
library ieee;
34
use ieee.std_logic_1164.all;
35 13 wfjm
use ieee.numeric_std.all;
36 2 wfjm
 
37
use work.slvtypes.all;
38
use work.memlib.all;
39
use work.iblib.all;
40
use work.pdp11.all;
41
 
42
-- ----------------------------------------------------------------------------
43
 
44
entity pdp11_ubmap is                   -- 11/70 unibus mapper
45
  port (
46
    CLK : in slbit;                     -- clock
47
    MREQ : in slbit;                    -- request mapping
48
    ADDR_UB : in slv18_1;               -- UNIBUS address (in)
49
    ADDR_PM : out slv22_1;              -- physical memory address (out)
50
    IB_MREQ : in ib_mreq_type;          -- ibus request
51
    IB_SRES : out ib_sres_type          -- ibus response
52
  );
53
end pdp11_ubmap;
54
 
55
architecture syn of pdp11_ubmap is
56
 
57 13 wfjm
  constant ibaddr_ubmap : slv16 := slv(to_unsigned(8#170200#,16));
58 2 wfjm
 
59 8 wfjm
  signal IBSEL_UBMAP : slbit := '0';
60
 
61 2 wfjm
  signal MAP_2_WE : slbit := '0';
62
  signal MAP_1_WE : slbit := '0';
63
  signal MAP_0_WE : slbit := '0';
64
  signal MAP_ADDR : slv5 := (others => '0');     -- map regs address
65
  signal MAP_DOUT : slv22_1 := (others => '0');  -- map regs output
66
 
67
begin
68
 
69
  MAP_2 : ram_1swar_gen                 -- bit 21:16 of map regs
70
    generic map (
71
      AWIDTH => 5,
72
      DWIDTH => 6)
73
    port map (
74
      CLK  => CLK,
75
      WE   => MAP_2_WE,
76
      ADDR => MAP_ADDR,
77
      DI   => IB_MREQ.din(5 downto 0),
78
      DO   => MAP_DOUT(21 downto 16));
79
 
80
  MAP_1 : ram_1swar_gen                 -- bit 15:08 of map regs
81
    generic map (
82
      AWIDTH => 5,
83
      DWIDTH => 8)
84
    port map (
85
      CLK  => CLK,
86
      WE   => MAP_1_WE,
87
      ADDR => MAP_ADDR,
88
      DI   => IB_MREQ.din(15 downto 8),
89
      DO   => MAP_DOUT(15 downto 8));
90
 
91
  MAP_0 : ram_1swar_gen                 -- bit 07:01 of map regs
92
    generic map (
93
      AWIDTH => 5,
94
      DWIDTH => 7)
95
    port map (
96
      CLK  => CLK,
97
      WE   => MAP_0_WE,
98
      ADDR => MAP_ADDR,
99
      DI   => IB_MREQ.din(7 downto 1),
100
      DO   => MAP_DOUT(7 downto 1));
101
 
102 8 wfjm
  SEL : ib_sel
103
    generic map (
104
      IB_ADDR => ibaddr_ubmap,
105
      SAWIDTH => 6)                     -- 2^6 = 64 = 2*32 words
106
    port map (
107
      CLK     => CLK,
108
      IB_MREQ => IB_MREQ,
109
      SEL     => IBSEL_UBMAP
110
    );
111
 
112
  proc_comb: process (MREQ, ADDR_UB, IBSEL_UBMAP, IB_MREQ, MAP_DOUT)
113 2 wfjm
    variable ibusy : slbit := '0';
114
    variable idout : slv16 := (others=>'0');
115
    variable iwe2  : slbit := '0';
116
    variable iwe1  : slbit := '0';
117
    variable iwe0  : slbit := '0';
118
    variable iaddr : slv5 := (others=>'0');
119
  begin
120
 
121
    ibusy := '0';
122
    idout := (others=>'0');
123
    iwe2  := '0';
124
    iwe1  := '0';
125
    iwe0  := '0';
126
    iaddr := (others=>'0');
127
 
128 8 wfjm
    if IBSEL_UBMAP = '1' then
129 2 wfjm
      if IB_MREQ.addr(1) = '1' then
130
        idout(5 downto 0)  := MAP_DOUT(21 downto 16);
131
      else
132
        idout(15 downto 1) := MAP_DOUT(15 downto 1);
133
      end if;
134
      if MREQ = '1' then                -- if map request, stall ib cycle
135
        ibusy := '1';
136
      end if;
137
    end if;
138
 
139 8 wfjm
    if IBSEL_UBMAP='1' and IB_MREQ.we='1' then
140 2 wfjm
      if IB_MREQ.addr(1)='1' then
141
        if IB_MREQ.be0 = '1' then
142
          iwe2 := '1';
143
        end if;
144
      else
145
        if IB_MREQ.be1 = '1' then
146
          iwe1 := '1';
147
        end if;
148
        if IB_MREQ.be0 = '1' then
149
          iwe0 := '1';
150
        end if;
151
      end if;
152
    end if;
153
 
154
    if MREQ = '1' then
155
      iaddr := ADDR_UB(17 downto 13);
156
    else
157
      iaddr := IB_MREQ.addr(6 downto 2);
158
    end if;
159
 
160
    MAP_ADDR <= iaddr;
161
    MAP_2_WE <= iwe2;
162
    MAP_1_WE <= iwe1;
163
    MAP_0_WE <= iwe0;
164
 
165 13 wfjm
    ADDR_PM  <= slv(unsigned(MAP_DOUT) +
166
                    unsigned("000000000"&ADDR_UB(12 downto 1)));
167 2 wfjm
 
168 8 wfjm
    IB_SRES.ack  <= IBSEL_UBMAP and (IB_MREQ.re or IB_MREQ.we);
169 2 wfjm
    IB_SRES.busy <= ibusy;
170
    IB_SRES.dout <= idout;
171
 
172
  end process proc_comb;
173
 
174
end syn;

powered by: WebSVN 2.1.0

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