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_slot.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- File        : fifo_slot.vhdl
3
-- Description : One slot for fifo register
4
--               Basically a Register(valid bit+data) and mux
5
-- Author      : Erno Salminen
6
-- Date        : 29.05.2003
7
-- Modified    : 
8
--
9
-------------------------------------------------------------------------------
10
library ieee;
11
use ieee.std_logic_1164.all;
12
use ieee.std_logic_arith.all;
13
use ieee.std_logic_unsigned.all;
14
 
15
 
16
entity fifo_slot is
17
 
18
  generic (
19
    width : integer := 0);
20
 
21
  port (
22
    Clk             : in std_logic;
23
    Rst_n           : in std_logic;
24
    Right_Valid_In  : in std_logic;
25
    Right_Enable_In : in std_logic;
26
    Right_Data_In   : in std_logic_vector ( width-1 downto 0);
27
 
28
    Left_Data_In  : in  std_logic_vector ( width-1 downto 0);
29
    Left_Valid_in : in  std_logic;
30
    Left_Enable   : in  std_logic;
31
    Valid_Out     : out std_logic;
32
    Data_Out      : out std_logic_vector ( width-1 downto 0)
33
    );
34
 
35
end fifo_slot;
36
 
37
 
38
 
39
architecture rtl of fifo_slot is
40
 
41
  type Fifo_slot_type is record
42
                           Valid : std_logic;
43
                           Data  : std_logic_vector ( width-1 downto 0);
44
                         end record;
45
 
46
  signal Data_reg : Fifo_slot_type;
47
 
48
 
49
begin  -- rtl
50
 
51
 
52
  -- CONC
53
  Data_Out  <= Data_reg.Data;
54
  Valid_Out <= Data_reg.Valid;
55
 
56
  -- PROC
57
  Sync : process (Clk, Rst_n)
58
  begin  -- process Sync
59
    if Rst_n = '0' then                 -- asynchronous reset (active low)
60
      Data_reg.Data  <= (others => '0');
61
      Data_reg.Valid <= '0';
62
 
63
    elsif Clk'event and Clk = '1' then  -- rising clock edge
64
 
65
      if Right_Enable_In = '1' and Left_Enable = '1' then
66
        -- ctrl = "11" = 3
67
        -- keep old values
68
        Data_reg.Data  <= Data_reg.Data;
69
        Data_reg.Valid <= Data_reg.Valid;
70
        assert false report "Simultaneous read+write" severity note;
71
 
72
 
73
      elsif Right_Enable_In = '1' and Left_Enable = '0' then
74
        -- ctrl = "10" = 2
75
        Data_reg.Data  <= Right_Data_In;
76
        Data_reg.Valid <= Right_Valid_In; --'1';
77
 
78
      elsif Right_Enable_In = '0' and Left_Enable = '1'then
79
        -- ctrl = "01" = 1
80
        Data_reg.Data  <= Left_Data_In;
81
        Data_reg.Valid <= Left_Valid_in;
82
 
83
      else
84
        -- ctrl = "00" = 0
85
        Data_reg.Data  <= Data_reg.Data;
86
        Data_reg.Valid <= Data_reg.Valid;
87
      end if;
88
 
89
 
90
    end if;
91
  end process Sync;
92
 
93
end rtl;

powered by: WebSVN 2.1.0

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