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

Subversion Repositories nocem

[/] [nocem/] [trunk/] [VHDL/] [fifo_reg.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_reg.vhd
32 4 schelleg
-- 
33 2 schelleg
-- Description: a single register FIFO
34 4 schelleg
-- 
35
 
36
 
37
 
38
library IEEE;
39
use IEEE.STD_LOGIC_1164.ALL;
40
use IEEE.STD_LOGIC_ARITH.ALL;
41
use IEEE.STD_LOGIC_UNSIGNED.ALL;
42
use work.pkg_nocem.all;
43
 
44
 
45
 
46
entity fifo_reg is
47 2 schelleg
        generic (
48 4 schelleg
                WIDTH : integer := 16
49
        );
50
        port (
51
        clk: IN std_logic;
52
        din: IN std_logic_VECTOR(WIDTH-1 downto 0);
53
        rd_en: IN std_logic;
54
        rst: IN std_logic;
55
        wr_en: IN std_logic;
56
        dout: OUT std_logic_VECTOR(WIDTH-1 downto 0);
57
        empty: OUT std_logic;
58
        full: OUT std_logic);
59
 
60
 
61
end fifo_reg;
62
 
63
architecture Behavioral of fifo_reg is
64
 
65
signal empty_i : std_logic;
66
 
67
 
68
 
69
 
70
begin
71
 
72
 
73
 
74
        full <= not empty_i;
75
        empty <= empty_i;
76
 
77
        delay_gen : process (clk,rst)
78
        begin
79
                if rst='1' then
80
                        dout <= (others => '0');
81
                        empty_i <= '1';
82
 
83
                elsif clk'event and clk='1' then
84
 
85
 
86
 
87
                        -- manage empty signal
88
                        if empty_i = '0' and rd_en ='1' and wr_en = '0'  then
89
                                empty_i <= '1';
90
                        elsif empty_i = '1' and rd_en='0' and  wr_en='1' then
91
                                empty_i <= '0';
92
                        end if;
93
 
94
                        --manage dout
95
                        if rd_en='1' and wr_en='0' then
96
                                dout <= (others => '0');
97
                        elsif wr_en='1' then
98
                                dout <= din;
99
                        end if;
100
 
101
 
102
 
103
                end if;
104
 
105
 
106
        end process;
107
 
108
 
109
 
110
end Behavioral;

powered by: WebSVN 2.1.0

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