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

Subversion Repositories System09

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

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 122 dilbert57
--       fff2 - 0d - page 2 - $2xxx = $02xxx (RAM)
40
--       fff3 - 0c - page 3 - $3xxx = $03xxx (RAM)
41
--       fff4 - 0b - page 4 - $4xxx = $04xxx (RAM)
42
--       fff5 - 0a - page 5 - $5xxx = $05xxx (RAM)
43
--       fff6 - 09 - page 6 - $6xxx = $06xxx (RAM)
44
--       fff7 - 08 - page 7 - $7xxx = $07xxx (RAM)
45
--       fff8 - 07 - page 8 - $8xxx = $08xxx (RAM)
46
--       fff9 - 06 - page 9 - $9xxx = $09xxx (RAM)
47
--       fffa - 05 - page A - $axxx = $0axxx (RAM)
48
--       fffb - 04 - page B - $bxxx = $0bxxx (RAM)
49
--       fffc - 03 - page C - $cxxx = $0cxxx (RAM)
50
--       fffd - 02 - page D - $dxxx = $0dxxx (RAM)
51
--       fffe - f1 - page E - $exxx = $fexxx (I/O)
52
--       ffff - f0 - page F - $fxxx = $ffxxx (ROM/DMFA2)
53 99 davidgb
--
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 122 dilbert57
--
86
-- 0.5     2010-12-10  John Kent  Correction of pages in header documentation
87
-- 
88 19 dilbert57
 
89
library ieee;
90
  use ieee.std_logic_1164.all;
91
  use ieee.std_logic_unsigned.all;
92 118 dilbert57
--library unisim;
93
--  use unisim.vcomponents.all;
94 19 dilbert57
 
95
entity dat_ram is
96
        port (
97
         clk       : in  std_logic;
98
    rst       : in  std_logic;
99
    cs        : in  std_logic;
100
    addr_hi   : in  std_logic_vector(3 downto 0);
101
    addr_lo   : in  std_logic_vector(3 downto 0);
102 99 davidgb
    rw        : in  std_logic;
103 19 dilbert57
    data_in   : in  std_logic_vector(7 downto 0);
104
         data_out  : out std_logic_vector(7 downto 0));
105
end dat_ram;
106
 
107
architecture rtl of dat_ram is
108 99 davidgb
signal dat_reg0  : std_logic_vector(7 downto 0);
109
signal dat_reg1  : std_logic_vector(7 downto 0);
110
signal dat_reg2  : std_logic_vector(7 downto 0);
111
signal dat_reg3  : std_logic_vector(7 downto 0);
112
signal dat_reg4  : std_logic_vector(7 downto 0);
113
signal dat_reg5  : std_logic_vector(7 downto 0);
114
signal dat_reg6  : std_logic_vector(7 downto 0);
115
signal dat_reg7  : std_logic_vector(7 downto 0);
116
signal dat_reg8  : std_logic_vector(7 downto 0);
117
signal dat_reg9  : std_logic_vector(7 downto 0);
118 19 dilbert57
signal dat_reg10 : std_logic_vector(7 downto 0);
119
signal dat_reg11 : std_logic_vector(7 downto 0);
120
signal dat_reg12 : std_logic_vector(7 downto 0);
121
signal dat_reg13 : std_logic_vector(7 downto 0);
122
signal dat_reg14 : std_logic_vector(7 downto 0);
123
signal dat_reg15 : std_logic_vector(7 downto 0);
124
 
125
begin
126
 
127
---------------------------------
128
--
129
-- Write DAT RAM
130
--
131
---------------------------------
132
 
133
--dat_write : process( clk, rst, addr_lo, cs, rw, data_in )
134
dat_write : process( clk )
135
begin
136
  if clk'event and clk = '0' then
137
    if rst = '1' then
138
      dat_reg0  <= "00001111";
139
      dat_reg1  <= "00001110";
140
      dat_reg2  <= "00001101";
141
      dat_reg3  <= "00001100";
142
      dat_reg4  <= "00001011";
143
      dat_reg5  <= "00001010";
144
      dat_reg6  <= "00001001";
145
      dat_reg7  <= "00001000";
146
      dat_reg8  <= "00000111";
147
      dat_reg9  <= "00000110";
148
      dat_reg10 <= "00000101";
149
      dat_reg11 <= "00000100";
150
      dat_reg12 <= "00000011";
151
      dat_reg13 <= "00000010";
152
      dat_reg14 <= "11110001";
153
      dat_reg15 <= "11110000";
154
    else
155
           if cs = '1' and rw = '0' then
156
        case addr_lo is
157
             when "0000" =>
158
                    dat_reg0 <= data_in;
159
             when "0001" =>
160
                    dat_reg1 <= data_in;
161
             when "0010" =>
162
                    dat_reg2 <= data_in;
163
             when "0011" =>
164
                    dat_reg3 <= data_in;
165
             when "0100" =>
166
                    dat_reg4 <= data_in;
167
             when "0101" =>
168
                    dat_reg5 <= data_in;
169
             when "0110" =>
170
                    dat_reg6 <= data_in;
171
             when "0111" =>
172
                    dat_reg7 <= data_in;
173
             when "1000" =>
174
                    dat_reg8 <= data_in;
175
             when "1001" =>
176
                    dat_reg9 <= data_in;
177
             when "1010" =>
178
                    dat_reg10 <= data_in;
179
             when "1011" =>
180
                    dat_reg11 <= data_in;
181
             when "1100" =>
182
                    dat_reg12 <= data_in;
183
             when "1101" =>
184
                    dat_reg13 <= data_in;
185
             when "1110" =>
186
                    dat_reg14 <= data_in;
187
             when "1111" =>
188
                    dat_reg15 <= data_in;
189
        when others =>
190
                    null;
191
                  end case;
192
           end if;
193
         end if;
194
  end if;
195
end process;
196
 
197
dat_read : process(  addr_hi,
198
                     dat_reg0, dat_reg1, dat_reg2, dat_reg3,
199
                     dat_reg4, dat_reg5, dat_reg6, dat_reg7,
200
                     dat_reg8, dat_reg9, dat_reg10, dat_reg11,
201
                     dat_reg12, dat_reg13, dat_reg14, dat_reg15 )
202
variable phy_addr : std_logic_vector( 7 downto 0 );
203
begin
204
      case addr_hi is
205
             when "0000" =>
206
                    phy_addr := dat_reg0;
207
             when "0001" =>
208
                    phy_addr := dat_reg1;
209
             when "0010" =>
210
                    phy_addr := dat_reg2;
211
             when "0011" =>
212
                    phy_addr := dat_reg3;
213
             when "0100" =>
214
                    phy_addr := dat_reg4;
215
             when "0101" =>
216
                    phy_addr := dat_reg5;
217
             when "0110" =>
218
                    phy_addr := dat_reg6;
219
             when "0111" =>
220
                    phy_addr := dat_reg7;
221
             when "1000" =>
222
                    phy_addr := dat_reg8;
223
             when "1001" =>
224
                    phy_addr := dat_reg9;
225
             when "1010" =>
226
                    phy_addr := dat_reg10;
227
             when "1011" =>
228
                    phy_addr := dat_reg11;
229
             when "1100" =>
230
                    phy_addr := dat_reg12;
231
             when "1101" =>
232
                    phy_addr := dat_reg13;
233
             when "1110" =>
234
                    phy_addr := dat_reg14;
235
             when "1111" =>
236
                    phy_addr := dat_reg15;
237
        when others =>
238
                    null;
239
                end case;
240
      data_out( 7 downto 4 ) <= phy_addr( 7 downto 4 );
241
      data_out( 3 downto 0 ) <= not( phy_addr( 3 downto 0 ) );
242
 
243
end process;
244
 
245
end rtl;
246
 

powered by: WebSVN 2.1.0

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