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_we_in.vhd] - Blame information for rev 156

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      :
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : 
6
-- Author     : kulmala3
7
-- Created    : 01.07.2005
8
-- Last update: 10.01.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_we_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
    we_in    : in  std_logic;
33
    data_in  : in  std_logic_vector(data_width_g-1 downto 0);
34
    data_out : out std_logic_vector(data_width_g-1 downto 0);
35
    full_out : out std_logic;
36
    a_we_out : out std_logic;           -- must arrive after data!
37
    ack_in   : in  std_logic            -- actually, one clock cycle
38
    );                                  -- more for data in rx
39
end aif_we_in;
40
 
41
architecture rtl of aif_we_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
  signal a_we_l : std_logic;
46
  signal data_r : std_logic_vector(data_width_g-1 downto 0);
47
  signal full_r : std_logic;
48
begin
49
 
50
  a_we_out <= a_we_l;
51
 
52
  data_out <= data_r;
53
 
54
  process (clk, rst_n)
55
  begin  -- process
56
    if rst_n = '0' then                 -- asynchronous reset (active low)
57
      a_we_l <= '0';
58
      ack_r  <= (others => '0');
59
      full_r <= '0';
60
--      first_full_r <= '1';
61
--        data_r <= (others => '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
 
68
      ack_r(0) <= ack_in;
69
      full_r   <= (a_we_l xor ack_r(stages_c-1));
70
      if we_in = '1' and full_r = '0' then
71
        a_we_l <= not a_we_l;
72
        data_r <= data_in;
73
        full_r <= '1';                  -- react immediatelly
74
      else
75
        a_we_l <= a_we_l;
76
      end if;
77
 
78
    end if;
79
  end process;
80
 
81
  full_out <= full_r;
82
end rtl;

powered by: WebSVN 2.1.0

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