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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [src/] [components/] [BRAM/] [ram16x16_poc.vhdl] - Blame information for rev 28

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

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
LIBRARY ieee;
21
USE ieee.std_logic_1164.ALL;
22
USE work.mux_parts.ALL;
23
 
24
-- Proof of concept
25
 
26
ENTITY ram16kx16 IS
27
 
28
  PORT (
29
    clk : IN  STD_LOGIC;
30
    we  : IN  STD_LOGIC;
31
    a1  : IN  STD_LOGIC_VECTOR(13 DOWNTO 0);   -- Data port address
32
    a2  : IN  STD_LOGIC_VECTOR(13 DOWNTO 0);   -- Instruction port address
33
    d1  : IN  STD_LOGIC_VECTOR(15 DOWNTO 0);   -- Data port input
34
    q1  : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);   -- Data port output
35
    q2  : OUT STD_LOGIC_VECTOR(15 DOWNTO 0));  -- Instruction port output
36
END ram16kx16;
37
 
38
ARCHITECTURE structural OF ram16kx16 IS
39
 
40
  COMPONENT RAM1kx16 IS
41
 
42
    PORT (
43
      clk : IN  STD_LOGIC;
44
      we  : IN  STD_LOGIC;
45
      a1  : IN  STD_LOGIC_VECTOR(10 DOWNTO 0);   -- Data port address
46
      a2  : IN  STD_LOGIC_VECTOR(10 DOWNTO 0);   -- Instruction port address
47
      d1  : IN  STD_LOGIC_VECTOR(15 DOWNTO 0);   -- Data port input
48
      q1  : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);   -- Data port output
49
      q2  : OUT STD_LOGIC_VECTOR(15 DOWNTO 0));  -- Instruction port output
50
 
51
  END COMPONENT RAM1kx16;
52
 
53
  SIGNAL data_address  : STD_LOGIC_VECTOR(10 DOWNTO 0);
54
  SIGNAL data_select   : STD_LOGIC_VECTOR(2 DOWNTO 0);
55
  SIGNAL instr_address : STD_LOGIC_VECTOR(10 DOWNTO 0);
56
  SIGNAL instr_select  : STD_LOGIC_VECTOR(2 DOWNTO 0);
57
 
58
  SIGNAL wr_sel : STD_LOGIC_VECTOR(7 DOWNTO 0);
59
 
60
  SIGNAL ds0 : STD_LOGIC_VECTOR(15 DOWNTO 0);
61
  SIGNAL ds1 : STD_LOGIC_VECTOR(15 DOWNTO 0);
62
  SIGNAL ds2 : STD_LOGIC_VECTOR(15 DOWNTO 0);
63
  SIGNAL ds3 : STD_LOGIC_VECTOR(15 DOWNTO 0);
64
  SIGNAL ds4 : STD_LOGIC_VECTOR(15 DOWNTO 0);
65
  SIGNAL ds5 : STD_LOGIC_VECTOR(15 DOWNTO 0);
66
  SIGNAL ds6 : STD_LOGIC_VECTOR(15 DOWNTO 0);
67
  SIGNAL ds7 : STD_LOGIC_VECTOR(15 DOWNTO 0);
68
 
69
  SIGNAL is0 : STD_LOGIC_VECTOR(15 DOWNTO 0);
70
  SIGNAL is1 : STD_LOGIC_VECTOR(15 DOWNTO 0);
71
  SIGNAL is2 : STD_LOGIC_VECTOR(15 DOWNTO 0);
72
  SIGNAL is3 : STD_LOGIC_VECTOR(15 DOWNTO 0);
73
  SIGNAL is4 : STD_LOGIC_VECTOR(15 DOWNTO 0);
74
  SIGNAL is5 : STD_LOGIC_VECTOR(15 DOWNTO 0);
75
  SIGNAL is6 : STD_LOGIC_VECTOR(15 DOWNTO 0);
76
  SIGNAL is7 : STD_LOGIC_VECTOR(15 DOWNTO 0);
77
 
78
BEGIN  -- structural
79
 
80
  data_address <= a1(10 DOWNTO 0);
81
  data_select  <= a1(13 DOWNTO 11);
82
 
83
  instr_address <= a2(10 DOWNTO 0);
84
  instr_select  <= a2(13 DOWNTO 11);
85
 
86
  WITH data_select SELECT
87
    wr_sel <=
88
    "00000001" WHEN "000",
89
    "00000010" WHEN "001",
90
    "00000100" WHEN "010",
91
    "00001000" WHEN "011",
92
    "00010000" WHEN "100",
93
    "00100000" WHEN "101",
94
    "01000000" WHEN "110",
95
    "10000000" WHEN "111";
96
 
97
  M1 : mux8to1
98
    PORT MAP (
99
      SEL => data_select,
100
      S0  => ds0,
101
      S1  => ds1,
102
      S2  => ds2,
103
      S3  => ds3,
104
      S4  => ds4,
105
      S5  => ds5,
106
      S6  => ds6,
107
      S7  => ds7,
108
      Y   => q1);
109
 
110
  M2 : mux8to1
111
    PORT MAP (
112
      SEL => instr_select,
113
      S0  => is0,
114
      S1  => is1,
115
      S2  => is2,
116
      S3  => is3,
117
      S4  => is4,
118
      S5  => is5,
119
      S6  => is6,
120
      S7  => is7,
121
      Y   => q2);
122
 
123
  R0 : RAM1kx16
124
    PORT MAP (
125
      clk => clk,
126
      we  => wr_sel(0),
127
      a1  => data_address,
128
      a2  => instr_address,
129
      d1  => d1,
130
      q1  => ds0,
131
      q2  => is0);
132
 
133
  R1 : RAM1kx16
134
    PORT MAP (
135
      clk => clk,
136
      we  => wr_sel(1),
137
      a1  => data_address,
138
      a2  => instr_address,
139
      d1  => d1,
140
      q1  => ds1,
141
      q2  => is1);
142
 
143
  R2 : RAM1kx16
144
    PORT MAP (
145
      clk => clk,
146
      we  => wr_sel(2),
147
      a1  => data_address,
148
      a2  => instr_address,
149
      d1  => d1,
150
      q1  => ds2,
151
      q2  => is2);
152
 
153
  R3 : RAM1kx16
154
    PORT MAP (
155
      clk => clk,
156
      we  => wr_sel(3),
157
      a1  => data_address,
158
      a2  => instr_address,
159
      d1  => d1,
160
      q1  => ds3,
161
      q2  => is3);
162
 
163
  R4 : RAM1kx16
164
    PORT MAP (
165
      clk => clk,
166
      we  => wr_sel(4),
167
      a1  => data_address,
168
      a2  => instr_address,
169
      d1  => d1,
170
      q1  => ds4,
171
      q2  => is4);
172
 
173
  R5 : RAM1kx16
174
    PORT MAP (
175
      clk => clk,
176
      we  => wr_sel(5),
177
      a1  => data_address,
178
      a2  => instr_address,
179
      d1  => d1,
180
      q1  => ds5,
181
      q2  => is5);
182
 
183
  R6 : RAM1kx16
184
    PORT MAP (
185
      clk => clk,
186
      we  => wr_sel(6),
187
      a1  => data_address,
188
      a2  => instr_address,
189
      d1  => d1,
190
      q1  => ds6,
191
      q2  => is6);
192
 
193
  R7 : RAM1kx16
194
    PORT MAP (
195
      clk => clk,
196
      we  => wr_sel(7),
197
      a1  => data_address,
198
      a2  => instr_address,
199
      d1  => d1,
200
      q1  => ds7,
201
      q2  => is7);
202
 
203
END structural;
204
 

powered by: WebSVN 2.1.0

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