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

Subversion Repositories System09

[/] [System09/] [trunk/] [rtl/] [VHDL/] [datram.vhd] - Blame information for rev 114

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

Line No. Rev Author Line
1 99 davidgb
--===========================================================================--
2
--                                                                           --
3
--         Synthesizable SWTPc 6809 Dynamic Address Translation Table        --
4
--                                                                           --
5
--===========================================================================--
6 19 dilbert57
--
7 99 davidgb
--  File name      : datram.vhd
8
--
9
--  Entity name    : dat_ram
10 19 dilbert57
--
11 99 davidgb
--  Purpose        : Implements a Dynamic Address Translation RAM module
12
--                   as found in the SWTPc MP-09 CPU card.
13
--                   Maps the high order 4 address bits to 8 address lines
14
--                   extending the memory addressing range from 64K to 1MByte
15
--                   Memory segments are mapped on 4 KByte boundaries
16
--                   The DAT registers are mapped at the the top of memory 
17
--                   ($FFF0 - $FFFF) and are write only so can map behind ROM.
18
--                   Since the DAT is not supported by SWTBUG for the 6800,
19
--                   the resgisters reset state map the bottom 64K of RAM. 
20 19 dilbert57
--                  
21 99 davidgb
--  Dependencies   : ieee.std_logic_1164
22
--                   ieee.std_logic_unsigned
23
--                   unisim.vcomponents
24
--
25
--  Author         : John E. Kent
26
--
27
--  Email          : dilbert57@opencores.org      
28
--
29
--  Web            : http://opencores.org/project,system09
30
--
31
--  Description    :
32
--
33
--  DAT is initializedas follows:
34 19 dilbert57
--
35 99 davidgb
--  DAT    Dat           Logical Physical
36
--  Reg    Val           Addr    Addr
37
--       fff0 - 0f - page 0 - $0xxx = $00xxx (RAM)
38
--       fff1 - 0e - page 1 - $1xxx = $01xxx (RAM) 
39
--       fff2 - 0d - page 0 - $2xxx = $02xxx (RAM)
40
--       fff3 - 0c - page 0 - $3xxx = $03xxx (RAM)
41
--       fff4 - 0b - page 0 - $4xxx = $04xxx (RAM)
42
--       fff5 - 0a - page 0 - $5xxx = $05xxx (RAM)
43
--       fff6 - 09 - page 0 - $6xxx = $06xxx (RAM)
44
--       fff7 - 08 - page 0 - $7xxx = $07xxx (RAM)
45
--       fff8 - 07 - page 0 - $8xxx = $08xxx (RAM)
46
--       fff9 - 06 - page 0 - $9xxx = $09xxx (RAM)
47
--       fffa - 05 - page 0 - $axxx = $0axxx (RAM)
48
--       fffb - 04 - page 0 - $bxxx = $0bxxx (RAM)
49
--       fffc - 03 - page 0 - $cxxx = $0cxxx (RAM)
50
--       fffd - 02 - page 0 - $dxxx = $0dxxx (RAM)
51
--       fffe - f1 - page 0 - $exxx = $fexxx (I/O)
52
--       ffff - f0 - page 0 - $fxxx = $ffxxx (ROM/DMFA2)
53
--
54
--  Copyright (C) 2003 - 2010 John Kent
55
--
56
--  This program is free software: you can redistribute it and/or modify
57
--  it under the terms of the GNU General Public License as published by
58
--  the Free Software Foundation, either version 3 of the License, or
59
--  (at your option) any later version.
60
--
61
--  This program is distributed in the hope that it will be useful,
62
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
63
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
64
--  GNU General Public License for more details.
65
--
66
--  You should have received a copy of the GNU General Public License
67
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
68
--
69
--===========================================================================--
70
--                                                                           --
71
--                              Revision  History                            --
72
--                                                                           --
73
--===========================================================================--
74
--
75
-- Version Date        Author     Changes
76
--
77
-- 0.1     2002-11-10  John Kent  Initial version
78 19 dilbert57
--
79 99 davidgb
-- 0.2     2006-11-21  John Kent  Inverted bottom 4 bits of dat_addr
80
--                                so that it is compatible with SWTPc MP-09 card.
81 19 dilbert57
--
82 99 davidgb
-- 0.3     2007-02-25  John Kent  Modify the sensitivity lists
83
--
84
-- 0.4     2010-06-17  John Kent  Update header and added GPL
85 19 dilbert57
--
86
 
87
library ieee;
88
  use ieee.std_logic_1164.all;
89
  use ieee.std_logic_unsigned.all;
90
library unisim;
91
  use unisim.vcomponents.all;
92
 
93
entity dat_ram is
94
        port (
95
         clk       : in  std_logic;
96
    rst       : in  std_logic;
97
    cs        : in  std_logic;
98
    addr_hi   : in  std_logic_vector(3 downto 0);
99
    addr_lo   : in  std_logic_vector(3 downto 0);
100 99 davidgb
    rw        : in  std_logic;
101 19 dilbert57
    data_in   : in  std_logic_vector(7 downto 0);
102
         data_out  : out std_logic_vector(7 downto 0));
103
end dat_ram;
104
 
105
architecture rtl of dat_ram is
106 99 davidgb
signal dat_reg0  : std_logic_vector(7 downto 0);
107
signal dat_reg1  : std_logic_vector(7 downto 0);
108
signal dat_reg2  : std_logic_vector(7 downto 0);
109
signal dat_reg3  : std_logic_vector(7 downto 0);
110
signal dat_reg4  : std_logic_vector(7 downto 0);
111
signal dat_reg5  : std_logic_vector(7 downto 0);
112
signal dat_reg6  : std_logic_vector(7 downto 0);
113
signal dat_reg7  : std_logic_vector(7 downto 0);
114
signal dat_reg8  : std_logic_vector(7 downto 0);
115
signal dat_reg9  : std_logic_vector(7 downto 0);
116 19 dilbert57
signal dat_reg10 : std_logic_vector(7 downto 0);
117
signal dat_reg11 : std_logic_vector(7 downto 0);
118
signal dat_reg12 : std_logic_vector(7 downto 0);
119
signal dat_reg13 : std_logic_vector(7 downto 0);
120
signal dat_reg14 : std_logic_vector(7 downto 0);
121
signal dat_reg15 : std_logic_vector(7 downto 0);
122
 
123
begin
124
 
125
---------------------------------
126
--
127
-- Write DAT RAM
128
--
129
---------------------------------
130
 
131
--dat_write : process( clk, rst, addr_lo, cs, rw, data_in )
132
dat_write : process( clk )
133
begin
134
  if clk'event and clk = '0' then
135
    if rst = '1' then
136
      dat_reg0  <= "00001111";
137
      dat_reg1  <= "00001110";
138
      dat_reg2  <= "00001101";
139
      dat_reg3  <= "00001100";
140
      dat_reg4  <= "00001011";
141
      dat_reg5  <= "00001010";
142
      dat_reg6  <= "00001001";
143
      dat_reg7  <= "00001000";
144
      dat_reg8  <= "00000111";
145
      dat_reg9  <= "00000110";
146
      dat_reg10 <= "00000101";
147
      dat_reg11 <= "00000100";
148
      dat_reg12 <= "00000011";
149
      dat_reg13 <= "00000010";
150
      dat_reg14 <= "11110001";
151
      dat_reg15 <= "11110000";
152
    else
153
           if cs = '1' and rw = '0' then
154
        case addr_lo is
155
             when "0000" =>
156
                    dat_reg0 <= data_in;
157
             when "0001" =>
158
                    dat_reg1 <= data_in;
159
             when "0010" =>
160
                    dat_reg2 <= data_in;
161
             when "0011" =>
162
                    dat_reg3 <= data_in;
163
             when "0100" =>
164
                    dat_reg4 <= data_in;
165
             when "0101" =>
166
                    dat_reg5 <= data_in;
167
             when "0110" =>
168
                    dat_reg6 <= data_in;
169
             when "0111" =>
170
                    dat_reg7 <= data_in;
171
             when "1000" =>
172
                    dat_reg8 <= data_in;
173
             when "1001" =>
174
                    dat_reg9 <= data_in;
175
             when "1010" =>
176
                    dat_reg10 <= data_in;
177
             when "1011" =>
178
                    dat_reg11 <= data_in;
179
             when "1100" =>
180
                    dat_reg12 <= data_in;
181
             when "1101" =>
182
                    dat_reg13 <= data_in;
183
             when "1110" =>
184
                    dat_reg14 <= data_in;
185
             when "1111" =>
186
                    dat_reg15 <= data_in;
187
        when others =>
188
                    null;
189
                  end case;
190
           end if;
191
         end if;
192
  end if;
193
end process;
194
 
195
dat_read : process(  addr_hi,
196
                     dat_reg0, dat_reg1, dat_reg2, dat_reg3,
197
                     dat_reg4, dat_reg5, dat_reg6, dat_reg7,
198
                     dat_reg8, dat_reg9, dat_reg10, dat_reg11,
199
                     dat_reg12, dat_reg13, dat_reg14, dat_reg15 )
200
variable phy_addr : std_logic_vector( 7 downto 0 );
201
begin
202
      case addr_hi is
203
             when "0000" =>
204
                    phy_addr := dat_reg0;
205
             when "0001" =>
206
                    phy_addr := dat_reg1;
207
             when "0010" =>
208
                    phy_addr := dat_reg2;
209
             when "0011" =>
210
                    phy_addr := dat_reg3;
211
             when "0100" =>
212
                    phy_addr := dat_reg4;
213
             when "0101" =>
214
                    phy_addr := dat_reg5;
215
             when "0110" =>
216
                    phy_addr := dat_reg6;
217
             when "0111" =>
218
                    phy_addr := dat_reg7;
219
             when "1000" =>
220
                    phy_addr := dat_reg8;
221
             when "1001" =>
222
                    phy_addr := dat_reg9;
223
             when "1010" =>
224
                    phy_addr := dat_reg10;
225
             when "1011" =>
226
                    phy_addr := dat_reg11;
227
             when "1100" =>
228
                    phy_addr := dat_reg12;
229
             when "1101" =>
230
                    phy_addr := dat_reg13;
231
             when "1110" =>
232
                    phy_addr := dat_reg14;
233
             when "1111" =>
234
                    phy_addr := dat_reg15;
235
        when others =>
236
                    null;
237
                end case;
238
      data_out( 7 downto 4 ) <= phy_addr( 7 downto 4 );
239
      data_out( 3 downto 0 ) <= not( phy_addr( 3 downto 0 ) );
240
 
241
end process;
242
 
243
end rtl;
244
 

powered by: WebSVN 2.1.0

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