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/] [synchronizer/] [1.0/] [vhd/] [aif_read_in.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      :
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : latch synch
6
-- Author     : kulmala3
7
-- Created    : 01.07.2005
8
-- Last update: 17.02.2006
9
-- Description: Input: regular fifo IF: output asynchronous ack/nack IF
10
--
11
-------------------------------------------------------------------------------
12
-- Copyright (c) 2005 
13
-------------------------------------------------------------------------------
14
-- Revisions  :
15
-- Date        Version  Author  Description
16
-- 01.07.2005  1.0      AK      Created
17
-------------------------------------------------------------------------------
18
 
19
 
20
library ieee;
21
use ieee.std_logic_1164.all;
22
use ieee.std_logic_arith.all;
23
use ieee.std_logic_unsigned.all;
24
 
25
entity aif_read_in is
26
  generic (
27
    data_width_g : integer := 32
28
    );
29
  port (
30
    clk      : in  std_logic;
31
    rst_n    : in  std_logic;
32
    empty_in : in  std_logic;
33
    re_out   : out std_logic;
34
    data_in  : in  std_logic_vector(data_width_g-1 downto 0);
35
    data_out : out std_logic_vector(data_width_g-1 downto 0);
36
    a_we_out : out std_logic;
37
    ack_in   : in  std_logic
38
    );
39
end aif_read_in;
40
 
41
architecture rtl of aif_read_in is
42
  constant stages_c : integer := 2;     -- only works with 2 now
43
  signal   ack_r    : std_logic_vector(stages_c-1 downto 0);
44
 
45
 
46
  signal a_we_l : std_logic;
47
  signal data_r : std_logic_vector(data_width_g-1 downto 0);
48
  signal full_r : std_logic;
49
begin
50
 
51
  a_we_out <= a_we_l;
52
 
53
  data_out <= data_r;
54
 
55
  process (clk, rst_n)
56
  begin  -- process
57
    if rst_n = '0' then                 -- asynchronous reset (active low)
58
      a_we_l <= '0';
59
      re_out <= '0';
60
      ack_r  <= (others => '0');
61
      full_r <= '0';
62
 
63
    elsif clk'event and clk = '1' then  -- rising clock edge
64
      for i in 0 to stages_c-2 loop
65
        ack_r(i+1) <= ack_r(i);
66
      end loop;  -- i
67
      ack_r(0) <= ack_in;
68
      full_r   <= (a_we_l xor ack_r(stages_c-1));
69
 
70
      if empty_in = '0' and full_r = '0' then
71
        a_we_l <= not a_we_l;
72
        re_out <= '1';
73
        data_r <= data_in;
74
        full_r <= '1';
75
      else
76
        re_out <= '0';
77
        a_we_l <= a_we_l;
78
      end if;
79
 
80
    end if;
81
  end process;
82
 
83
--  full_r <= (a_we_l xor ack_in);
84
--  full_out <= full;
85
end rtl;

powered by: WebSVN 2.1.0

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