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

Subversion Repositories pcie_sg_dma

[/] [pcie_sg_dma/] [branches/] [Virtex6/] [ML605_ISE12.3/] [class_dlm.vhd] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 barabba
----------------------------------------------------------------------------------
2
-- Company:   ziti
3
-- Engineer:  wgao
4
-- 
5
-- Create Date:    17:01:32 19 Jun 2009
6
-- Design Name: 
7
-- Module Name:    class_dlm - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
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
library work;
26
use work.abb64Package.all;
27
 
28
---- Uncomment the following library declaration if instantiating
29
---- any Xilinx primitives in this code.
30
--library UNISIM;
31
--use UNISIM.VComponents.all;
32
 
33
entity class_dlm is
34
--    Generic (
35
--             C_PRO_DAQ_WIDTH  :  integer  :=  16 ;
36
--             C_PRO_DLM_WIDTH  :  integer  :=   4 ;
37
--             C_PRO_CTL_WIDTH  :  integer  :=  16
38
--            );
39
    Port (
40
 
41
           -- DLM Tx
42
           dlm2send_va              : OUT   std_logic;
43
           dlm2send_type            : OUT   std_logic_vector(4-1 downto 0);
44
 
45
           -- DLM Rx
46
           dlm_rec_va               : IN    std_logic;
47
           dlm_rec_type             : IN    std_logic_vector(4-1 downto 0);
48
 
49
           -- Link side: common signals
50
           link_tx_clk              : IN    std_logic;
51
           link_rx_clk              : IN    std_logic;
52
 
53
           -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
54
 
55
           -- Fabric side: DLM Rx
56
           dlm_tv                   : IN    std_logic;
57
           dlm_td                   : IN    std_logic_vector(C_DBUS_WIDTH/2-1 downto 0);
58
 
59
           -- Fabric side: DLM Tx
60
           dlm_rv                   : OUT   std_logic;
61
           dlm_rd                   : OUT   std_logic_vector(C_DBUS_WIDTH/2-1 downto 0);
62
 
63
           -- Interrupter trigger
64
           DLM_irq                  : OUT   std_logic;
65
 
66
           -- Fabric side: Common signals
67
           trn_clk                  : IN    std_logic;
68
           protocol_rst             : IN    std_logic
69
 
70
          );
71
end entity class_dlm;
72
 
73
 
74
architecture Behavioral of class_dlm is
75
 
76
  -- to synchronize the DLM messages across clock domains
77
  component v6_afifo_8x8
78
    port (
79
          wr_clk  : IN  std_logic;
80
          din     : IN  std_logic_VECTOR(8-1 downto 0);
81
          wr_en   : IN  std_logic;
82
          full    : OUT std_logic;
83
 
84
          rd_clk  : IN  std_logic;
85
          rd_en   : IN  std_logic;
86
          dout    : OUT std_logic_VECTOR(8-1 downto 0);
87
          empty   : OUT std_logic;
88
 
89
          rst     : IN  std_logic
90
          );
91
  end component;
92
 
93
  -- Interrupter trigger
94
  signal  DLM_irq_i             : std_logic;
95
 
96
  -- Fabric side: DLM Tx
97
  signal  dlm_rv_i              : std_logic;
98
  signal  dlm_rd_i              : std_logic_vector(C_DBUS_WIDTH/2-1 downto 0);
99
 
100
  -- protocol side: DLM Send
101
  signal  dlm2send_va_i         : std_logic;
102
  signal  dlm2send_type_i       : std_logic_vector(4-1 downto 0);
103
 
104
  signal  dlm_rx_din_padded     : std_logic_vector(8-1 downto 0);
105
  signal  dlm_rx_dout           : std_logic_vector(8-1 downto 0);
106
  signal  dlm_rx_empty          : std_logic;
107
  signal  dlm_rx_empty_r1       : std_logic;
108
  signal  dlm_rx_full           : std_logic;
109
 
110
  signal  dlm_tx_din_padded     : std_logic_vector(8-1 downto 0);
111
  signal  dlm_tx_dout           : std_logic_vector(8-1 downto 0);
112
  signal  dlm_tx_empty          : std_logic;
113
  signal  dlm_tx_empty_r1       : std_logic;
114
  signal  dlm_tx_full           : std_logic;
115
 
116
 
117
begin
118
 
119
  -- Fabric side: DLM Tx
120
  dlm_rv             <=  dlm_rv_i         ;
121
  dlm_rd             <=  dlm_rd_i         ;
122
 
123
  -- protocol side: DLM Send
124
  dlm2send_va        <=  dlm2send_va_i    ;
125
  dlm2send_type      <=  dlm2send_type_i  ;
126
 
127
  DLM_irq            <=  DLM_irq_i        ;
128
  DLM_irq_i          <=  '0';
129
 
130
  -- DLM direction: upstream
131
  Transfer_DLM_upstream:
132
  process (trn_clk, protocol_rst )
133
  begin
134
    if protocol_rst = '1' then
135
      dlm_rx_empty_r1 <= '1'           ;
136
      dlm_rv_i        <= '0'           ;
137
      dlm_rd_i        <= (OTHERS=>'0') ;
138
    elsif trn_clk'event and trn_clk = '1' then
139
      dlm_rx_empty_r1 <= dlm_rx_empty        ;
140
      dlm_rv_i        <= not dlm_rx_empty_r1 ;
141
      dlm_rd_i        <= C_ALL_ZEROS(C_DBUS_WIDTH/2-1 downto 4) & dlm_rx_dout(4-1 downto 0)  ;
142
    end if;
143
  end process;
144
 
145
 
146
  -- DLM direction: downstream
147
  Transfer_DLM_downstream:
148
  process (link_tx_clk, protocol_rst )
149
  begin
150
    if protocol_rst = '1' then
151
      dlm_tx_empty_r1     <= '1'           ;
152
      dlm2send_va_i       <= '0'           ;
153
      dlm2send_type_i     <= (OTHERS=>'0') ;
154
    elsif link_tx_clk'event and link_tx_clk = '1' then
155
      dlm_tx_empty_r1     <= dlm_tx_empty             ;
156
      dlm2send_va_i       <= not dlm_tx_empty_r1      ;
157
      dlm2send_type_i     <= dlm_tx_dout(4-1 downto 0);
158
    end if;
159
  end process;
160
 
161
 
162
  dlm_rx_din_padded  <= X"0" & dlm_rec_type(4-1 downto 0);
163
  dlm_tx_din_padded  <= X"0" & dlm_td(4-1 downto 0);
164
 
165
 
166
  Sync_stage_from_ROC:
167
  v6_afifo_8x8
168
  port map (
169
          wr_clk   =>   link_tx_clk         ,     -- IN  std_logic;
170
          wr_en    =>   dlm_rec_va          ,     -- IN  std_logic;
171
          din      =>   dlm_rx_din_padded   ,     -- IN  std_logic_VECTOR(7 downto 0);
172
          full     =>   dlm_rx_full         ,     -- OUT std_logic;
173
 
174
          rd_clk   =>   trn_clk             ,     -- IN  std_logic;
175
          rd_en    =>   '1'                 ,     -- IN  std_logic;
176
          dout     =>   dlm_rx_dout         ,     -- OUT std_logic_VECTOR(7 downto 0);
177
          empty    =>   dlm_rx_empty        ,     -- OUT std_logic;
178
 
179
          rst      =>   protocol_rst              -- IN  std_logic
180
          );
181
 
182
 
183
  Sync_stage_to_ROC:
184
  v6_afifo_8x8
185
  port map (
186
          wr_clk   =>   trn_clk             ,     -- IN  std_logic;
187
          wr_en    =>   dlm_tv              ,     -- IN  std_logic;
188
          din      =>   dlm_tx_din_padded   ,     -- IN  std_logic_VECTOR(7 downto 0);
189
          full     =>   dlm_tx_full         ,     -- OUT std_logic;
190
 
191
          rd_clk   =>   link_tx_clk         ,     -- IN  std_logic;
192
          rd_en    =>   '1'                 ,     -- IN  std_logic;
193
          dout     =>   dlm_tx_dout         ,     -- OUT std_logic_VECTOR(7 downto 0);
194
          empty    =>   dlm_tx_empty        ,     -- OUT std_logic;
195
 
196
          rst      =>   protocol_rst              -- IN  std_logic
197
          );
198
 
199
end architecture Behavioral;

powered by: WebSVN 2.1.0

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