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

Subversion Repositories System11

[/] [System11/] [trunk/] [rtl/] [vhdl/] [datram.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dilbert57
--===========================================================================--
2
--
3
--  S Y N T H E Z I A B L E    datram - Dynamic Address Translation core
4
--
5
--  www.OpenCores.Org - September 2003
6
--  This core adheres to the GNU public license  
7
--
8
-- File name      : datram.vhd
9
--
10
-- Entity name    : dat_ram
11
--
12
-- Purpose        : Maps address bits A12 to A15 of an 8 bit
13
--                  Microprocessor to access 1Mbyte of RAM
14
--                  The 8 data output pins form addresses
15
--                  PA12 to PA19. 16 x 4K pages are selected
16
--                  by writing the high order physical address
17
--                  of memory into the 16 registers.
18
--                  Low order CPU addres bits A11 .. A0
19
--                  connect directly through to the Phyical
20
--                  address bits PA11 .. PA0
21
--                  Register 0  is for A15..A12 = "0000"
22
--                  Register 1  is for A15..A12 = "0001"
23
--                  Register 2  is for A15..A12 = "0010"
24
--                  Register 15 is for A15..A12 = "1111"
25
--                  Registers are pre-initialised to select
26
--                  the bottom 64K of physical address space
27
--
28
-- Dependencies   : ieee.std_logic_1164
29
--                  ieee.std_logic_unsigned
30
--
31
-- Uses           : Nothing
32
--
33
-------------------------------------------------------------------------------
34
-- Revision list
35
--
36
-- Revision 0.1 - 10 November 2002 - John Kent
37
--
38
-- Revision 1.0 - 7 September - John Kent
39
-- Initial release to open cores
40
--
41
 
42
library ieee;
43
use ieee.std_logic_1164.all;
44
use ieee.std_logic_unsigned.all;
45
 
46
entity dat_ram is
47
        port (
48
         clk       : in  std_logic;
49
    rst       : in  std_logic;
50
    cs        : in  std_logic;
51
    rw        : in  std_logic;
52
    addr_hi   : in  std_logic_vector(3 downto 0);
53
    addr_lo   : in  std_logic_vector(3 downto 0);
54
    data_in   : in  std_logic_vector(7 downto 0);
55
         data_out  : out std_logic_vector(7 downto 0));
56
end;
57
 
58
architecture datram_arch of dat_ram is
59
signal dat_reg0 : std_logic_vector(7 downto 0);
60
signal dat_reg1 : std_logic_vector(7 downto 0);
61
signal dat_reg2 : std_logic_vector(7 downto 0);
62
signal dat_reg3 : std_logic_vector(7 downto 0);
63
signal dat_reg4 : std_logic_vector(7 downto 0);
64
signal dat_reg5 : std_logic_vector(7 downto 0);
65
signal dat_reg6 : std_logic_vector(7 downto 0);
66
signal dat_reg7 : std_logic_vector(7 downto 0);
67
signal dat_reg8 : std_logic_vector(7 downto 0);
68
signal dat_reg9 : std_logic_vector(7 downto 0);
69
signal dat_reg10 : std_logic_vector(7 downto 0);
70
signal dat_reg11 : std_logic_vector(7 downto 0);
71
signal dat_reg12 : std_logic_vector(7 downto 0);
72
signal dat_reg13 : std_logic_vector(7 downto 0);
73
signal dat_reg14 : std_logic_vector(7 downto 0);
74
signal dat_reg15 : std_logic_vector(7 downto 0);
75
 
76
begin
77
 
78
 
79
--------------------------------
80
--
81
-- read I/O port
82
--
83
--------------------------------
84
 
85
 
86
---------------------------------
87
--
88
-- Write DAT RAM
89
--
90
---------------------------------
91
 
92
dat_write : process( clk, rst, addr_lo, cs, rw, data_in )
93
begin
94
    if rst = '1' then
95
      dat_reg0 <= "00000000";
96
      dat_reg1 <= "00000001";
97
      dat_reg2 <= "00000010";
98
      dat_reg3 <= "00000011";
99
      dat_reg4 <= "00000100";
100
      dat_reg5 <= "00000101";
101
      dat_reg6 <= "00000110";
102
      dat_reg7 <= "00000111";
103
      dat_reg8 <= "00001000";
104
      dat_reg9 <= "00001001";
105
      dat_reg10 <= "00001010";
106
      dat_reg11 <= "00001011";
107
      dat_reg12 <= "00001100";
108
      dat_reg13 <= "00001101";
109
      dat_reg14 <= "00001110";
110
      dat_reg15 <= "00001111";
111 4 dilbert57
    elsif clk'event and clk = '0' then
112 2 dilbert57
           if cs = '1' and rw = '0' then
113
        case addr_lo is
114
             when "0000" =>
115
                    dat_reg0 <= data_in;
116
             when "0001" =>
117
                    dat_reg1 <= data_in;
118
             when "0010" =>
119
                    dat_reg2 <= data_in;
120
             when "0011" =>
121
                    dat_reg3 <= data_in;
122
             when "0100" =>
123
                    dat_reg4 <= data_in;
124
             when "0101" =>
125
                    dat_reg5 <= data_in;
126
             when "0110" =>
127
                    dat_reg6 <= data_in;
128
             when "0111" =>
129
                    dat_reg7 <= data_in;
130
             when "1000" =>
131
                    dat_reg8 <= data_in;
132
             when "1001" =>
133
                    dat_reg9 <= data_in;
134
             when "1010" =>
135
                    dat_reg10 <= data_in;
136
             when "1011" =>
137
                    dat_reg11 <= data_in;
138
             when "1100" =>
139
                    dat_reg12 <= data_in;
140
             when "1101" =>
141
                    dat_reg13 <= data_in;
142
             when "1110" =>
143
                    dat_reg14 <= data_in;
144
             when "1111" =>
145
                    dat_reg15 <= data_in;
146
        when others =>
147
                    null;
148
                  end case;
149
           end if;
150
         end if;
151
end process;
152
 
153
dat_read : process(  addr_hi,
154
                     dat_reg0, dat_reg1, dat_reg2, dat_reg3,
155
                     dat_reg4, dat_reg5, dat_reg6, dat_reg7,
156
                     dat_reg8, dat_reg9, dat_reg10, dat_reg11,
157
                     dat_reg12, dat_reg13, dat_reg14, dat_reg15 )
158
begin
159
      case addr_hi is
160
             when "0000" =>
161
                    data_out <= dat_reg0;
162
             when "0001" =>
163
                    data_out <= dat_reg1;
164
             when "0010" =>
165
                    data_out <= dat_reg2;
166
             when "0011" =>
167
                    data_out <= dat_reg3;
168
             when "0100" =>
169
                    data_out <= dat_reg4;
170
             when "0101" =>
171
                    data_out <= dat_reg5;
172
             when "0110" =>
173
                    data_out <= dat_reg6;
174
             when "0111" =>
175
                    data_out <= dat_reg7;
176
             when "1000" =>
177
                    data_out <= dat_reg8;
178
             when "1001" =>
179
                    data_out <= dat_reg9;
180
             when "1010" =>
181
                    data_out <= dat_reg10;
182
             when "1011" =>
183
                    data_out <= dat_reg11;
184
             when "1100" =>
185
                    data_out <= dat_reg12;
186
             when "1101" =>
187
                    data_out <= dat_reg13;
188
             when "1110" =>
189
                    data_out <= dat_reg14;
190
             when "1111" =>
191
                    data_out <= dat_reg15;
192
        when others =>
193
                    null;
194
                end case;
195
end process;
196
 
197
end datram_arch;
198
 

powered by: WebSVN 2.1.0

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