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

Subversion Repositories nocem

[/] [nocem/] [trunk/] [VHDL/] [fifo_allvhdl.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 schelleg
 
2
-----------------------------------------------------------------------------
3
-- NoCem -- Network on Chip Emulation Tool for System on Chip Research 
4
-- and Implementations
5
-- 
6
-- Copyright (C) 2006  Graham Schelle, Dirk Grunwald
7
-- 
8
-- This program is free software; you can redistribute it and/or
9
-- modify it under the terms of the GNU General Public License
10
-- as published by the Free Software Foundation; either version 2
11
-- of the License, or (at your option) any later version.
12
-- 
13
-- This program is distributed in the hope that it will be useful,
14
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
-- GNU General Public License for more details.
17
-- 
18
-- You should have received a copy of the GNU General Public License
19
-- along with this program; if not, write to the Free Software
20
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
21
-- 02110-1301, USA.
22
-- 
23
-- The authors can be contacted by email: <schelleg,grunwald>@cs.colorado.edu 
24
-- 
25
-- or by mail: Campus Box 430, Department of Computer Science,
26
-- University of Colorado at Boulder, Boulder, Colorado 80309
27
-------------------------------------------------------------------------------- 
28
 
29
 
30
-- 
31 2 schelleg
-- Filename: fifo_allvhdl.vhd
32 4 schelleg
-- 
33 2 schelleg
-- Description: a vhdl based FIFO implementation
34 4 schelleg
-- 
35
 
36
 
37 2 schelleg
-------------------------------------------------------------------------------
38
--
39
-- This implementation was heavily modified from 
40
--       http://www.geocities.com/SiliconValley/Pines/6639/ip/fifo_vhdl.html
41
--
42
-- and the following comment section describes the licensing and authorship
43
-- 
44
--      
45
-- NOTES:
46
--              1. removed buffer type ports because they are bad
47
--              2. usig FIFO_v7
48
--    
49
--
50
-------------------------------------------------------------------------------
51
 
52
-------------------------------------------------------------------------------
53
-- 
54
-- Copyright Jamil Khatib 1999
55
-- 
56
--
57
-- This VHDL design file is an open design; you can redistribute it and/or
58
-- modify it and/or implement it under the terms of the Openip General Public
59
-- License as it is going to be published by the OpenIP Organization and any
60
-- coming versions of this license.
61
-- You can check the draft license at
62
-- http://www.openip.org/oc/license.html
63
--
64
--
65
-- Creator : Jamil Khatib
66
-- Date 10/10/99
67
--
68
-- version 0.19991226
69
--
70
-- This file was tested on the ModelSim 5.2EE
71
-- The test vecors for model sim is included in vectors.do file
72
-- This VHDL design file is proved through simulation but not verified on Silicon
73
-- 
74
--
75
-------------------------------------------------------------------------------
76
-------------------------------------------------------------------------------
77
 
78
-------------------------------------------------------------------------------
79
-------------------------------------------------------------------------------
80
--
81
--entity listing in this file
82
--
83
--      1. dpmem: used in Khatib's FIFO implementation
84
--      3. fifo_allvhdl: my wrapper to match nocem interfaces
85
--
86
--
87
--
88
-------------------------------------------------------------------------------
89
-------------------------------------------------------------------------------
90
 
91
 
92
library IEEE;
93
use IEEE.STD_LOGIC_1164.ALL;
94
use IEEE.STD_LOGIC_ARITH.ALL;
95
use IEEE.STD_LOGIC_UNSIGNED.ALL;
96
use work.pkg_nocem.all;
97
---- Uncomment the following library declaration if instantiating
98
---- any Xilinx primitives in this code.
99
--library UNISIM;
100
--use UNISIM.VComponents.all;
101
 
102
 
103
ENTITY dpmem IS
104
generic ( ADD_WIDTH: integer := 8 ;
105
                 WIDTH : integer := 8);
106
  port (
107
    clk      : in  std_logic;                                -- write clock
108
    reset    : in  std_logic;                                -- System Reset
109
    W_add    : in  std_logic_vector(ADD_WIDTH -1 downto 0);  -- Write Address
110
    R_add    : in  std_logic_vector(ADD_WIDTH -1 downto 0);  -- Read Address
111
    Data_In  : in  std_logic_vector(WIDTH - 1  downto 0);    -- input data
112
    Data_Out : out std_logic_vector(WIDTH -1   downto 0);    -- output Data
113
    WR       : in  std_logic;                                -- Write Enable
114
    RE       : in  std_logic);                               -- Read Enable
115
end dpmem;
116
 
117
ARCHITECTURE dpmem_v3 OF dpmem IS
118
 
119
  type dpmemdata_array is array (integer range <>) of std_logic_vector(WIDTH -1  downto 0);                                        -- Memory Type
120
  signal data : dpmemdata_array(0 to (2** ADD_WIDTH)-1 );  -- Local data
121
 
122
begin  -- dpmem_v3
123
 
124
  mem_clkd : process (clk, reset,data)
125
 
126
  begin  -- PROCESS
127
 
128
 
129
    -- activities triggered by asynchronous reset (active low)
130
    if reset = '0' then
131
 
132
            for i in 0 to (2** add_width)-1 loop
133
              data(i) <= (others => '0');
134
            end loop;
135
 
136
      -- activities triggered by rising edge of clock
137
    elsif clk'event and clk = '1' then
138
      if WR = '1' then
139
        data(conv_integeR(W_add)) <= Data_In;
140
      end if;
141
 
142
    end if;
143
  end process;
144
 
145
        mem_uclkd : process (RE,data,r_add)
146
        begin
147
                data_out <= data(conv_integer(R_add));
148
        end process;
149
 
150
 
151
 
152
 
153
end dpmem_v3;
154
 
155
 
156
 
157
-------------------------------------------------------------------------------
158
-------------------------------------------------------------------------------
159
 
160
-------------------------------------------------------------------------------
161
-------------------------------------------------------------------------------
162
 
163
 
164
 
165
library IEEE;
166
use IEEE.STD_LOGIC_1164.ALL;
167
use IEEE.STD_LOGIC_ARITH.ALL;
168
use IEEE.STD_LOGIC_UNSIGNED.ALL;
169
use work.pkg_nocem.all;
170
 
171
 
172
entity fifo_allvhdl is
173
    generic(
174
                WIDTH : integer := 16;
175
                ADDR_WIDTH : integer := 3
176
         );
177
         port (
178
                        din : in std_logic_vector(WIDTH-1 downto 0);  -- Input data
179
                        dout : out std_logic_vector(WIDTH-1 downto 0);  -- Output data
180
                        clk : in std_logic;             -- System Clock
181
                        rst : in std_logic;     -- System global Reset
182
                        rd_en : in std_logic;           -- Read Enable
183
                        wr_en : in std_logic;           -- Write Enable
184
                        full : out std_logic;   -- Full Flag
185
                        empty : out std_logic   -- empty Flag
186
                        );
187
 
188
end fifo_allvhdl;
189
 
190
architecture behavioral of fifo_allvhdl is
191
 
192
begin
193
 
194 4 schelleg
        I_fk : fifo_gfs
195 2 schelleg
        Generic MAP(
196
                WIDTH => WIDTH,
197
                ADD_WIDTH => ADDR_WIDTH
198 4 schelleg
        )
199
        PORT MAP(
200
                Data_in => din,
201
                clk => clk,
202
                Reset => rst,
203
                RE => rd_en,
204
                WE => wr_en,
205
                Data_out => dout,
206
                Full => full,
207
                Half_full => open,
208
                empty => empty
209 2 schelleg
        );
210
 
211
 
212
 
213
end behavioral;

powered by: WebSVN 2.1.0

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