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

Subversion Repositories System11

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

Go to most recent revision | 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 clk'event and clk = '0' then
95
    if rst = '1' then
96
      dat_reg0 <= "00000000";
97
      dat_reg1 <= "00000001";
98
      dat_reg2 <= "00000010";
99
      dat_reg3 <= "00000011";
100
      dat_reg4 <= "00000100";
101
      dat_reg5 <= "00000101";
102
      dat_reg6 <= "00000110";
103
      dat_reg7 <= "00000111";
104
      dat_reg8 <= "00001000";
105
      dat_reg9 <= "00001001";
106
      dat_reg10 <= "00001010";
107
      dat_reg11 <= "00001011";
108
      dat_reg12 <= "00001100";
109
      dat_reg13 <= "00001101";
110
      dat_reg14 <= "00001110";
111
      dat_reg15 <= "00001111";
112
    else
113
           if cs = '1' and rw = '0' then
114
        case addr_lo is
115
             when "0000" =>
116
                    dat_reg0 <= data_in;
117
             when "0001" =>
118
                    dat_reg1 <= data_in;
119
             when "0010" =>
120
                    dat_reg2 <= data_in;
121
             when "0011" =>
122
                    dat_reg3 <= data_in;
123
             when "0100" =>
124
                    dat_reg4 <= data_in;
125
             when "0101" =>
126
                    dat_reg5 <= data_in;
127
             when "0110" =>
128
                    dat_reg6 <= data_in;
129
             when "0111" =>
130
                    dat_reg7 <= data_in;
131
             when "1000" =>
132
                    dat_reg8 <= data_in;
133
             when "1001" =>
134
                    dat_reg9 <= data_in;
135
             when "1010" =>
136
                    dat_reg10 <= data_in;
137
             when "1011" =>
138
                    dat_reg11 <= data_in;
139
             when "1100" =>
140
                    dat_reg12 <= data_in;
141
             when "1101" =>
142
                    dat_reg13 <= data_in;
143
             when "1110" =>
144
                    dat_reg14 <= data_in;
145
             when "1111" =>
146
                    dat_reg15 <= data_in;
147
        when others =>
148
                    null;
149
                  end case;
150
           end if;
151
         end if;
152
  end if;
153
end process;
154
 
155
dat_read : process(  addr_hi,
156
                     dat_reg0, dat_reg1, dat_reg2, dat_reg3,
157
                     dat_reg4, dat_reg5, dat_reg6, dat_reg7,
158
                     dat_reg8, dat_reg9, dat_reg10, dat_reg11,
159
                     dat_reg12, dat_reg13, dat_reg14, dat_reg15 )
160
begin
161
      case addr_hi is
162
             when "0000" =>
163
                    data_out <= dat_reg0;
164
             when "0001" =>
165
                    data_out <= dat_reg1;
166
             when "0010" =>
167
                    data_out <= dat_reg2;
168
             when "0011" =>
169
                    data_out <= dat_reg3;
170
             when "0100" =>
171
                    data_out <= dat_reg4;
172
             when "0101" =>
173
                    data_out <= dat_reg5;
174
             when "0110" =>
175
                    data_out <= dat_reg6;
176
             when "0111" =>
177
                    data_out <= dat_reg7;
178
             when "1000" =>
179
                    data_out <= dat_reg8;
180
             when "1001" =>
181
                    data_out <= dat_reg9;
182
             when "1010" =>
183
                    data_out <= dat_reg10;
184
             when "1011" =>
185
                    data_out <= dat_reg11;
186
             when "1100" =>
187
                    data_out <= dat_reg12;
188
             when "1101" =>
189
                    data_out <= dat_reg13;
190
             when "1110" =>
191
                    data_out <= dat_reg14;
192
             when "1111" =>
193
                    data_out <= dat_reg15;
194
        when others =>
195
                    null;
196
                end case;
197
end process;
198
 
199
end datram_arch;
200
 

powered by: WebSVN 2.1.0

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