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_out.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: 05.01.2006
9
-- Description: OUT: regular fifo IN: 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_out is
26
  generic (
27
    data_width_g : integer := 32
28
    );
29
  port (
30
    clk      : in  std_logic;
31
    rst_n    : in  std_logic;
32
    a_we_in  : in  std_logic;
33
    ack_out  : out std_logic;
34
    we_out   : out std_logic;
35
    data_in  : in  std_logic_vector(data_width_g-1 downto 0);
36
    data_out : out std_logic_vector(data_width_g-1 downto 0);
37
 
38
    full_in : in std_logic
39
    );
40
end aif_we_out;
41
 
42
architecture rtl of aif_we_out is
43
 
44
  constant stages_c : integer := 3;
45
 
46
  signal ack_r           : std_logic;
47
  signal received_data_r : std_logic;
48
  -- synchronizer, last two are xorred
49
  signal a_we_r          : std_logic_vector(stages_c-1 downto 0);
50
  signal data_r          : std_logic_vector(data_width_g-1 downto 0);
51
 
52
begin
53
  data_out <= data_r;
54
--  ack_out <= ack_r;
55
 
56
  process (clk, rst_n)
57
  begin  -- process
58
    if rst_n = '0' then                 -- asynchronous reset (active low)
59
      a_we_r          <= (others => '0');
60
      ack_r           <= '0';
61
      ack_out         <= '0';
62
      we_out          <= '0';
63
      received_data_r <= '0';
64
 
65
    elsif clk'event and clk = '1' then  -- rising clock edge
66
 
67
      for i in 0 to stages_c-2 loop
68
        a_we_r(i+1) <= a_we_r(i);
69
      end loop;  -- i
70
 
71
      a_we_r(0) <= a_we_in;
72
 
73
      -- now wait until we can write it to fifo
74
 
75
      if (a_we_r(stages_c-1) xor a_we_r(stages_c-2)) = '1' then
76
        ack_r  <= not ack_r;
77
        received_data_r <= '1';
78
        we_out <= '1';
79
        data_r <= data_in;
80
      else
81
        ack_r <= ack_r;
82
      end if;
83
 
84
      if full_in = '0' and received_data_r = '1' then
85
        -- acknowledge, stop writing
86
        ack_out         <= ack_r;
87
        we_out          <= '0';
88
        received_data_r <= '0';
89
      end if;
90
 
91
 
92
    end if;
93
  end process;
94
 
95
end rtl;

powered by: WebSVN 2.1.0

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