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

Subversion Repositories quark

[/] [quark/] [trunk/] [05_HDLConstruction/] [01_OldArchitecture_ReferenceOnly/] [Memory/] [RomMemory.vhd] - Blame information for rev 12

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

Line No. Rev Author Line
1 3 progman32
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.std_logic_unsigned.all;
4
 
5
entity ROM is port(
6
  Clock:       in  std_logic;
7
  Reset:       in  std_logic;
8
  WriteEnable: in  std_logic;
9
  DataOut:     out std_logic_vector(7 downto 0);
10
  DataIn:      in  std_logic_vector(7 downto 0);
11
  Address:     in  std_logic_vector(7 downto 0)
12
  );
13
end ROM;
14
 
15
architecture ArchRom of ROM is
16
  --****************************
17
  --* Define Opcodes
18
  --****************************
19
 
20
  constant nop:    std_logic_vector(7 downto 0) := x"00";
21
  constant ldr:    std_logic_vector(7 downto 0) := x"01";
22
  constant ldm:    std_logic_vector(7 downto 0) := x"02";
23
  constant addrr:  std_logic_vector(7 downto 0) := x"03";
24
  constant addrm:  std_logic_vector(7 downto 0) := x"04";
25
  constant addmr:  std_logic_vector(7 downto 0) := x"05";
26
  constant addmm:  std_logic_vector(7 downto 0) := x"06";
27
  constant breqrr: std_logic_vector(7 downto 0) := x"07";
28
  constant breqrm: std_logic_vector(7 downto 0) := x"08";
29
  constant breqmm: std_logic_vector(7 downto 0) := x"09";
30
  constant jmpr:   std_logic_vector(7 downto 0) := x"0A";
31
  constant jmpm:   std_logic_vector(7 downto 0) := x"0B";
32
 
33
  --****************************
34
  --* Define Registers
35
  --****************************
36
 
37
  constant rega: std_logic_vector(7 downto 0) := x"00";
38
  constant regb: std_logic_vector(7 downto 0) := x"01";
39
  constant regc: std_logic_vector(7 downto 0) := x"02";
40
  constant regx: std_logic_vector(7 downto 0) := x"03";
41
  constant regy: std_logic_vector(7 downto 0) := x"04";
42
  constant regz: std_logic_vector(7 downto 0) := x"05";
43
 
44
  --****************************
45
  --* Define Asm Labels
46
  --****************************
47
 
48
  constant LoopLabel: std_logic_vector(7 downto 0) := x"12";
49
 
50
  type ROMA is array(0 to 255) of std_logic_vector(7 downto 0);
51
  signal ROM1: ROMA:=(
52
    --##################################
53
    --## PROGRAM 1
54
    --##################################
55
 
56
    ldr, rega, x"00",
57
    ldr, regb, x"00",
58
    ldr, regc, x"00",
59
    ldr, regx, x"01",
60
    ldr, regy, x"ff",
61
    ldr, regz, LoopLabel,
62
 
63
--LoopLabel:
64
    addrr,  rega, regx,
65
    breqrr, rega, regy, LoopLabel,
66
    ldr,    rega, x"00",
67
    addrr,  regb, regx,
68
    breqrr, regb, regy, LoopLabel,
69
    ldr,    regb, x"00",
70
    addrr,  regc, regx,
71
    jmpr,   regz,
72
 
73
 
74
    --adda,  x"01",
75
    --brnea, x"FF", x"00",
76
    --lda,   x"00", 
77
    --addb,  x"01",
78
    --brneb, x"FF", x"00",
79
    --addc,  x"01", 
80
    --ldgpc,
81
    --ldb,   x"00", 
82
    --jmp,   x"00",
83
 
84
    (x"00"),
85
    (x"00"),
86
    (x"00"),
87
    (x"00"),
88
    (x"00"),
89
    (x"00"),
90
    (x"00"),
91
    (x"00"),
92
    (x"00"),
93
    (x"00"),
94
    (x"00"),
95
    (x"00"),
96
    (x"00"),
97
    (x"00"),
98
    (x"00"),
99
    (x"00"),
100
    (x"00"),
101
    (x"00"),
102
    (x"00"),
103
    (x"00"),
104
    (x"00"),
105
    (x"00"),
106
    (x"00"),
107
    (x"00"),
108
    (x"00"),
109
    (x"00"),
110
    (x"00"),
111
    (x"00"),
112
    (x"00"),
113
    (x"00"),
114
    (x"00"),
115
    (x"00"),
116
    (x"00"),
117
    (x"00"),
118
    (x"00"),
119
    (x"00"),
120
    (x"00"),
121
    (x"00"),
122
    (x"00"),
123
    (x"00"),
124
    (x"00"),
125
    (x"00"),
126
    (x"00"),
127
    (x"00"),
128
    (x"00"),
129
    (x"00"),
130
    (x"00"),
131
    (x"00"),
132
    (x"00"),
133
    (x"00"),
134
    (x"00"),
135
    (x"00"),
136
    (x"00"),
137
    (x"00"),
138
    (x"00"),
139
    (x"00"),
140
    (x"00"),
141
    (x"00"),
142
    (x"00"),
143
    (x"00"),
144
    (x"00"),
145
    (x"00"),
146
    (x"00"),
147
    (x"00"),
148
    (x"00"),
149
    (x"00"),
150
    (x"00"),
151
    (x"00"),
152
    (x"00"),
153
    (x"00"),
154
    (x"00"),
155
    (x"00"),
156
    (x"00"),
157
    (x"00"),
158
    (x"00"),
159
    (x"00"),
160
    (x"00"),
161
    (x"00"),
162
    (x"00"),
163
    (x"00"),
164
    (x"00"),
165
    (x"00"),
166
    (x"00"),
167
    (x"00"),
168
    (x"00"),
169
    (x"00"),
170
    (x"00"),
171
    (x"00"),
172
    (x"00"),
173
    (x"00"),
174
    (x"00"),
175
    (x"00"),
176
    (x"00"),
177
    (x"00"),
178
    (x"00"),
179
    (x"00"),
180
    (x"00"),
181
    (x"00"),
182
    (x"00"),
183
    (x"00"),
184
    (x"00"),
185
    (x"00"),
186
    (x"00"),
187
    (x"00"),
188
    (x"00"),
189
    (x"00"),
190
    (x"00"),
191
    (x"00"),
192
    (x"00"),
193
    (x"00"),
194
    (x"00"),
195
    (x"00"),
196
    (x"00"),
197
    (x"00"),
198
    (x"00"),
199
    (x"00"),
200
    (x"00"),
201
    (x"00"),
202
    (x"00"),
203
    (x"00"),
204
    (x"00"),
205
    (x"00"),
206
    (x"00"),
207
    (x"00"),
208
    (x"00"),
209
    (x"00"),
210
    (x"00"),
211
    (x"00"),
212
    (x"00"),
213
    (x"00"),
214
    (x"00"),
215
    (x"00"),
216
    (x"00"),
217
    (x"00"),
218
    (x"00"),
219
    (x"00"),
220
    (x"00"),
221
    (x"00"),
222
    (x"00"),
223
    (x"00"),
224
    (x"00"),
225
    (x"00"),
226
    (x"00"),
227
    (x"00"),
228
    (x"00"),
229
    (x"00"),
230
    (x"00"),
231
    (x"00"),
232
    (x"00"),
233
    (x"00"),
234
    (x"00"),
235
    (x"00"),
236
    (x"00"),
237
    (x"00"),
238
    (x"00"),
239
    (x"00"),
240
    (x"00"),
241
    (x"00"),
242
    (x"00"),
243
    (x"00"),
244
    (x"00"),
245
    (x"00"),
246
    (x"00"),
247
    (x"00"),
248
    (x"00"),
249
    (x"00"),
250
    (x"00"),
251
    (x"00"),
252
    (x"00"),
253
    (x"00"),
254
    (x"00"),
255
    (x"00"),
256
    (x"00"),
257
    (x"00"),
258
    (x"00"),
259
    (x"00"),
260
    (x"00"),
261
    (x"00"),
262
    (x"00"),
263
    (x"00"),
264
    (x"00"),
265
    (x"00"),
266
    (x"00"),
267
    (x"00"),
268
    (x"00"),
269
    (x"00"),
270
    (x"00"),
271
    (x"00"),
272
    (x"00"),
273
    (x"00"),
274
    (x"00"),
275
    (x"00"),
276
    (x"00"),
277
    (x"00"),
278
    (x"00"),
279
    (x"00"),
280
    (x"00"),
281
    (x"00"),
282
    (x"00"),
283
    (x"00"),
284
    (x"00"),
285
    (x"00"),
286
    (x"00"),
287
    (x"00"),
288
    (x"00"),
289
    (x"00"),
290
    (x"00"),
291
    (x"00"),
292
    (x"00"),
293
    (x"00"),
294
    (x"00"),
295
    (x"00"),
296
    (x"00")
297
  );
298
  attribute ramstyle : string;
299
  --attribute ramstyle of ROM1 : signal is "M512";
300
begin
301
  process(Clock, Reset) begin
302
    if (Reset = '0') then
303
      DataOut <= x"00";
304
    elsif rising_edge(Clock) then
305
      if (WriteEnable = '1') then
306
        ROM1 (conv_integer(Address)) <= DataIn;
307
      else
308
        DataOut <= ROM1(conv_integer(Address));
309
      end if;
310
    end if;
311
  end process;
312
end ArchRom;

powered by: WebSVN 2.1.0

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