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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.hwp.storage/] [fifos/] [synch_fifos/] [1.0/] [vhd/] [fifo_reg.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : fifo_reg
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : fifo_reg.vhd
6
-- Author     : 
7
-- Company    : 
8
-- Created    : 2005-05-23
9
-- Last update: 31.05.2005
10
-- Platform   : 
11
-- Standard   : VHDL'87
12
-------------------------------------------------------------------------------
13
-- Description: 
14
-------------------------------------------------------------------------------
15
-- Copyright (c) 2005 
16
-------------------------------------------------------------------------------
17
-- Revisions  :
18
-- Date        Version  Author  Description
19
-- 2005-05-23  1.0      penttin5        Created
20
-- 31.5.2005            AK      Naming scheme according to coding rules
21
-------------------------------------------------------------------------------
22
library ieee;
23
use ieee.std_logic_1164.all;
24
use ieee.std_logic_arith.all;
25
use ieee.std_logic_unsigned.all;
26
 
27
 
28
entity fifo_reg is
29
 
30
  generic (
31
    width_g : integer := 0
32
    );
33
 
34
  port (
35
    clk         : in  std_logic;
36
    rst_n       : in  std_logic;
37
    load_in     : in  std_logic;
38
    data1_in    : in  std_logic_vector(width_g - 1 downto 0);
39
    data2_in    : in  std_logic_vector(width_g - 1 downto 0);
40
    data_sel_in : in  std_logic;
41
    data_out    : out std_logic_vector(width_g - 1 downto 0)
42
    );
43
 
44
end fifo_reg;
45
 
46
architecture RTL of fifo_reg is
47
 
48
  signal data_r       : std_logic_vector(width_g - 1 downto 0);
49
  signal load_and_sel : std_logic_vector(1 downto 0);
50
 
51
begin  -- RTL
52
 
53
  load_and_sel <= load_in & data_sel_in;
54
  data_out     <= data_r;
55
 
56
  fifo_reg : process (clk, rst_n)
57
  begin  -- process fifo_reg
58
    if rst_n = '0' then                 -- asynchronous reset (active low)
59
      data_r <= (others => '0');
60
 
61
    elsif clk'event and clk = '1' then  -- rising clock edge
62
      case load_and_sel is
63
        when "10" =>
64
          data_r <= data1_in;
65
        when "11" =>
66
          data_r <= data2_in;
67
        when others =>
68
          data_r <= data_r;
69
      end case;
70
--      if load = '1' then
71
--        if data_sel = '0' then
72
--          data_r <= data1_in;
73
--       elsif data_sel = '1' then
74
--          data_r <= data2_in;
75
--        end if;
76
--      end if;
77
    end if;
78
  end process fifo_reg;
79
 
80
end RTL;

powered by: WebSVN 2.1.0

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