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

Subversion Repositories modular_oscilloscope

[/] [modular_oscilloscope/] [trunk/] [hdl/] [epp/] [memory_8bit_reset.vhd] - Blame information for rev 14

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

Line No. Rev Author Line
1 14 budinero
-------------------------------------------------------------------------------
2
-- Title      :  Single port RAM
3
-- Project    :  Memory Cores
4
-------------------------------------------------------------------------------
5
-- File        : spmem.vhd
6
-- Author      : Jamil Khatib  (khatib@ieee.org)
7
-- Organization: OpenIPCore Project
8
-- Created     : 1999/5/14
9
-- Last update : 2000/12/19
10
-- Platform    : 
11
-- Simulators  : Modelsim 5.3XE/Windows98
12
-- Synthesizers: Leonardo/WindowsNT
13
-- Target      : 
14
-- Dependency  : ieee.std_logic_1164,ieee.std_logic_unsigned
15
-------------------------------------------------------------------------------
16
-- Description:  Single Port memory
17
-------------------------------------------------------------------------------
18
-- Copyright (c) 2000 Jamil Khatib
19
-- 
20
-- This VHDL design file is an open design; you can redistribute it and/or
21
-- modify it and/or implement it after contacting the author
22
-- You can check the draft license at
23
-- http://www.opencores.org/OIPC/license.shtml
24
 
25
-------------------------------------------------------------------------------
26
-- Revisions  :
27
-- Revision Number :   1
28
-- Version         :   0.1
29
-- Date            :   12 May 1999
30
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
31
-- Desccription    :   Created
32
-- Known bugs      :   
33
-- To Optimze      :   
34
-------------------------------------------------------------------------------
35
-- Revisions  :
36
-- Revision Number :   2
37
-- Version         :   0.2
38
-- Date            :   19 Dec 2000
39
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
40
-- Desccription    :   General review
41
--                     Two versions are now available with reset and without
42
--                     Default output can can be defined
43
-- Known bugs      :   
44
-- To Optimze      :   
45
-------------------------------------------------------------------------------
46
-- Revisions  :
47
-- Revision Number :   3
48
-- Version         :   0.3
49
-- Date            :   5 Jan 2001
50
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
51
-- Desccription    :   Registered Read Address feature is added to make use of
52
--                     Altera's FPGAs memory bits
53
--                     This feature was added from Richard Herveille's
54
--                     contribution and his memory core
55
-- Known bugs      :   
56
-- To Optimze      :   
57
-------------------------------------------------------------------------------
58
 
59
-- (!)
60
-- Original file modified to reduce code.
61
 
62
 
63
library ieee;
64
 
65
use ieee.std_logic_1164.all;
66
 
67
use ieee.std_logic_unsigned.all;
68
 
69
-------------------------------------------------------------------------------
70
-- Single port Memory core with reset
71
-- To make use of on FPGA memory bits do not use the RESET option
72
-- For Altera's FPGA you have to use also OPTION := 1
73
 
74
entity mem_8bit_reset is
75
 
76
  generic ( --USE_RESET   : boolean   := false;  -- use system reset
77
 
78
            --USE_CS      : boolean   := false;  -- use chip select signal
79
 
80
            DEFAULT_OUT : std_logic := '0';  -- Default output
81
            --OPTION      : integer   := 1;  -- 1: Registered read Address(suitable
82
                                        -- for Altera's FPGAs
83
                                        -- 0: non registered read address
84
            ADD_WIDTH   : integer   := 8;
85
            WIDTH       : integer   := 8);
86
 
87
  port (
88
    cs       : in  std_logic;           -- chip select
89
    clk      : in  std_logic;           -- write clock
90
    reset    : in  std_logic;           -- System Reset
91
    add      : in  std_logic_vector(add_width -1 downto 0);  --  Address
92
    Data_In  : in  std_logic_vector(WIDTH -1 downto 0);  -- input data
93
    Data_Out : out std_logic_vector(WIDTH -1 downto 0);  -- Output Data
94
    WR       : in  std_logic);          -- Read Write Enable
95
end mem_8bit_reset;
96
 
97
 
98
 
99
architecture spmem_beh of mem_8bit_reset is
100
 
101
  type data_array is array (integer range <>) of std_logic_vector(WIDTH-1 downto 0);
102
                                                      -- Memory Type
103
  signal data : data_array(0 to (2** add_width-1) );  -- Local data
104
 
105
        -- FLEX/APEX devices require address to be registered with inclock for read operations
106
  -- This signal is used only when OPTION = 1 
107
        -- signal regA : std_logic_vector( (add_width -1) downto 0);
108
 
109
  procedure init_mem(signal memory_cell : inout data_array ) is
110
 
111
  begin
112
 
113
    for i in 0 to (2** add_width-1) loop
114
      memory_cell(i) <= (others => '0');
115
    end loop;
116
 
117
  end init_mem;
118
 
119
begin  -- spmem_beh
120
-- -------------------------------------------------------------------------------
121
-- -- Non Registered Read Address
122
-- -------------------------------------------------------------------------------
123
   -- NON_REG         : if OPTION = 0 generate
124
-- -------------------------------------------------------------------------------
125
-- -- Clocked Process with Reset
126
-- -------------------------------------------------------------------------------
127
   -- Reset_ENABLED : if USE_RESET = true generate
128
 
129
-- -------------------------------------------------------------------------------
130
--      CS_ENABLED  : if USE_CS = true generate
131
 
132
        process (clk, reset)
133
 
134
        begin  -- PROCESS
135
          -- activities triggered by asynchronous reset (active low)
136
 
137
          if reset = '0' then
138
            data_out <= (others => DEFAULT_OUT);
139
            init_mem ( data);
140
 
141
            -- activities triggered by rising edge of clock
142
          elsif clk'event and clk = '1' then
143
            if CS = '1' then
144
              if WR = '0' then
145
                data(conv_integer(add)) <= data_in;
146
                data_out                <= (others => DEFAULT_OUT);
147
              else
148
                data_out                <= data(conv_integer(add));
149
              end if;
150
            else
151
              data_out                  <= (others => DEFAULT_OUT);
152
            end if;
153
 
154
          end if;
155
 
156
        end process;
157
--     end generate CS_ENABLED;
158
-------------------------------------------------------------------------------
159
-------------------------------------------------------------------------------
160
      -- CS_DISABLED : if USE_CS = false generate
161
 
162
        -- process (clk, reset)
163
 
164
 
165
        -- begin  -- PROCESS
166
          -- -- activities triggered by asynchronous reset (active low)
167
 
168
          -- if reset = '0' then
169
            -- data_out <= (others => DEFAULT_OUT);
170
            -- init_mem ( data);
171
 
172
            -- -- activities triggered by rising edge of clock
173
          -- elsif clk'event and clk = '1' then
174
            -- if WR = '0' then
175
              -- data(conv_integer(add)) <= data_in;
176
              -- data_out                <= (others => DEFAULT_OUT);
177
            -- else
178
              -- data_out                <= data(conv_integer(add));
179
            -- end if;
180
 
181
          -- end if;
182
 
183
        -- end process;
184
      -- end generate CS_DISABLED;
185
 
186
-- -------------------------------------------------------------------------------
187
-- -------------------------------------------------------------------------------
188
    -- end generate Reset_ENABLED;
189
-- -------------------------------------------------------------------------------
190
-- -------------------------------------------------------------------------------
191
-- -------------------------------------------------------------------------------
192
-- -- Clocked Process without Reset
193
-- -------------------------------------------------------------------------------
194
    -- Reset_DISABLED : if USE_RESET = false generate
195
 
196
-- -------------------------------------------------------------------------------
197
-- -------------------------------------------------------------------------------    
198
      -- CS_ENABLED   : if USE_CS = true generate
199
 
200
        -- process (clk)
201
        -- begin  -- PROCESS
202
 
203
          -- -- activities triggered by rising edge of clock
204
          -- if clk'event and clk = '1' then
205
            -- if cs = '1' then
206
              -- if WR = '0' then
207
                -- data(conv_integer(add)) <= data_in;
208
                -- data_out                <= (others => DEFAULT_OUT);
209
              -- else
210
                -- data_out                <= data(conv_integer(add));
211
              -- end if;
212
            -- else
213
              -- data_out                  <= (others => DEFAULT_OUT);
214
            -- end if;
215
 
216
 
217
          -- end if;
218
 
219
        -- end process;
220
      -- end generate CS_ENABLED;
221
-- -------------------------------------------------------------------------------
222
-- -------------------------------------------------------------------------------
223
      -- CS_DISABLED : if USE_CS = false generate
224
 
225
        -- process (clk)
226
        -- begin  -- PROCESS
227
 
228
          -- -- activities triggered by rising edge of clock
229
          -- if clk'event and clk = '1' then
230
            -- if WR = '0' then
231
              -- data(conv_integer(add)) <= data_in;
232
              -- data_out                <= (others => DEFAULT_OUT);
233
            -- else
234
              -- data_out                <= data(conv_integer(add));
235
            -- end if;
236
 
237
          -- end if;
238
 
239
        -- end process;
240
      -- end generate CS_DISABLED;
241
-- -------------------------------------------------------------------------------
242
-- -------------------------------------------------------------------------------
243
    -- end generate Reset_DISABLED;
244
-- -------------------------------------------------------------------------------
245
-- -------------------------------------------------------------------------------
246
-- -------------------------------------------------------------------------------
247
  -- end generate NON_REG;
248
-------------------------------------------------------------------------------
249
-------------------------------------------------------------------------------
250
-------------------------------------------------------------------------------
251
-------------------------------------------------------------------------------
252
-- REG: if OPTION = 1 generate
253
-- -------------------------------------------------------------------------------
254
-- -- Clocked Process with Reset
255
-- -------------------------------------------------------------------------------
256
    -- Reset_ENABLED : if USE_RESET = true generate
257
 
258
-- -------------------------------------------------------------------------------
259
      -- CS_ENABLED  : if USE_CS = true generate
260
 
261
        -- process (clk, reset)
262
 
263
        -- begin  -- PROCESS
264
          -- -- activities triggered by asynchronous reset (active low)
265
 
266
          -- if reset = '0' then
267
            -- data_out <= (others => DEFAULT_OUT);
268
            -- init_mem ( data);
269
 
270
            -- -- activities triggered by rising edge of clock
271
          -- elsif clk'event and clk = '1' then
272
 
273
            -- regA <= add;
274
 
275
            -- if CS = '1' then
276
              -- if WR = '0' then
277
                -- data(conv_integer(add)) <= data_in;
278
                -- data_out                <= (others => DEFAULT_OUT);
279
              -- else
280
                -- data_out                <= data(conv_integer(regA));
281
              -- end if;
282
            -- else
283
              -- data_out                  <= (others => DEFAULT_OUT);
284
            -- end if;
285
 
286
          -- end if;
287
 
288
        -- end process;
289
      -- end generate CS_ENABLED;
290
-- -------------------------------------------------------------------------------
291
-- -------------------------------------------------------------------------------
292
      -- CS_DISABLED : if USE_CS = false generate
293
 
294
        -- process (clk, reset)
295
 
296
 
297
        -- begin  -- PROCESS
298
          -- -- activities triggered by asynchronous reset (active low)
299
 
300
          -- if reset = '0' then
301
            -- data_out <= (others => DEFAULT_OUT);
302
            -- init_mem ( data);
303
 
304
            -- -- activities triggered by rising edge of clock
305
          -- elsif clk'event and clk = '1' then
306
            -- regA <= add;
307
 
308
            -- if WR = '0' then
309
              -- data(conv_integer(add)) <= data_in;
310
              -- data_out                <= (others => DEFAULT_OUT);
311
            -- else
312
              -- data_out                <= data(conv_integer(regA));
313
            -- end if;
314
 
315
          -- end if;
316
 
317
        -- end process;
318
      -- end generate CS_DISABLED;
319
 
320
-- -------------------------------------------------------------------------------
321
-- -------------------------------------------------------------------------------
322
    -- end generate Reset_ENABLED;
323
-- -------------------------------------------------------------------------------
324
-- -------------------------------------------------------------------------------
325
-- -------------------------------------------------------------------------------
326
-- -- Clocked Process without Reset
327
-- -------------------------------------------------------------------------------
328
    -- Reset_DISABLED : if USE_RESET = false generate
329
 
330
-- -------------------------------------------------------------------------------
331
-- -------------------------------------------------------------------------------    
332
      -- CS_ENABLED   : if USE_CS = true generate
333
 
334
        -- process (clk)
335
        -- begin  -- PROCESS
336
 
337
          -- -- activities triggered by rising edge of clock
338
          -- if clk'event and clk = '1' then
339
 
340
            -- regA <= add;
341
 
342
            -- if cs = '1' then
343
              -- if WR = '0' then
344
                -- data(conv_integer(add)) <= data_in;
345
                -- data_out                <= (others => DEFAULT_OUT);
346
              -- else
347
                -- data_out                <= data(conv_integer(regA));
348
              -- end if;
349
            -- else
350
              -- data_out                  <= (others => DEFAULT_OUT);
351
            -- end if;
352
 
353
 
354
          -- end if;
355
 
356
        -- end process;
357
      -- end generate CS_ENABLED;
358
-- -------------------------------------------------------------------------------
359
-- -------------------------------------------------------------------------------
360
      -- CS_DISABLED : if USE_CS = false generate
361
 
362
        -- process (clk)
363
        -- begin  -- PROCESS
364
 
365
          -- -- activities triggered by rising edge of clock
366
          -- if clk'event and clk = '1' then
367
 
368
            -- regA <= add;
369
 
370
            -- if WR = '0' then
371
              -- data(conv_integer(add)) <= data_in;
372
              -- data_out                <= (others => DEFAULT_OUT);
373
            -- else
374
              -- data_out                <= data(conv_integer(regA));
375
            -- end if;
376
 
377
          -- end if;
378
 
379
        -- end process;
380
      -- end generate CS_DISABLED;
381
-- -------------------------------------------------------------------------------
382
-- -------------------------------------------------------------------------------
383
    -- end generate Reset_DISABLED;
384
-- -------------------------------------------------------------------------------
385
-- -------------------------------------------------------------------------------
386
-- -------------------------------------------------------------------------------
387
 
388
-- end generate REG;
389
 
390
end spmem_beh;
391
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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