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

Subversion Repositories astron_pipeline

[/] [astron_pipeline/] [trunk/] [dp_pipeline_ready.vhd] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 danv
-------------------------------------------------------------------------------
2
--
3
-- Copyright (C) 2010
4
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
5
-- JIVE (Joint Institute for VLBI in Europe) <http://www.jive.nl/>
6
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
7
--
8
-- This program is free software: you can redistribute it and/or modify
9
-- it under the terms of the GNU General Public License as published by
10
-- the Free Software Foundation, either version 3 of the License, or
11
-- (at your option) any later version.
12
--
13
-- This program is distributed in the hope that it will be useful,
14
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
-- GNU General Public License for more details.
17
--
18
-- You should have received a copy of the GNU General Public License
19
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
--
21
-------------------------------------------------------------------------------
22
 
23
LIBRARY IEEE, common_pkg_lib, dp_pkg_lib, dp_components_lib;
24
USE IEEE.std_logic_1164.all;
25
USE dp_pkg_lib.dp_stream_pkg.ALL;
26
 
27
-- Purpose:
28
--   Pipeline the source input
29
-- Description:
30
--   This dp_pipeline_ready provides a single clock cycle delay of the source
31
--   input (i.e. siso). It does this by first going from RL = g_in_latency -->
32
--   0 and then to RL = g_out_latency. 
33
-- Data flow:
34
--   . out RL >  in RL                : incr(out RL - in RL)
35
--   . out RL <= in RL AND out RL = 0 : incr(1) --> adapt(out RL)
36
--   . out RL <= in RL AND out RL > 0 : adapt(0) --> incr(out RL)
37
-- Remark:
38
-- . The g_in_latency may be 0, but for g_in_latency=0 the sosi.ready acts
39
--   as an acknowledge and that could simply also be registered by the user.
40
 
41
ENTITY dp_pipeline_ready IS
42
  GENERIC (
43
    g_in_latency   : NATURAL := 1;  -- >= 0
44
    g_out_latency  : NATURAL := 1   -- >= 0
45
  );
46
  PORT (
47
    rst          : IN  STD_LOGIC;
48
    clk          : IN  STD_LOGIC;
49
    -- ST sink
50
    snk_out      : OUT t_dp_siso;
51
    snk_in       : IN  t_dp_sosi;
52
    -- ST source
53
    src_in       : IN  t_dp_siso;
54
    src_out      : OUT t_dp_sosi
55
  );
56
END dp_pipeline_ready;
57
 
58
 
59
ARCHITECTURE str OF dp_pipeline_ready IS
60
 
61
  SIGNAL internal_siso  : t_dp_siso;
62
  SIGNAL internal_sosi  : t_dp_sosi;
63
 
64
BEGIN
65
 
66
  gen_out_incr_rl : IF g_out_latency>g_in_latency GENERATE
67
    -- Register siso by incrementing the input RL first
68
    u_incr : ENTITY dp_components_lib.dp_latency_increase
69
    GENERIC MAP (
70
      g_in_latency   => g_in_latency,
71
      g_incr_latency => g_out_latency-g_in_latency
72
    )
73
    PORT MAP (
74
      rst          => rst,
75
      clk          => clk,
76
      -- ST sink
77
      snk_out      => snk_out,
78
      snk_in       => snk_in,
79
      -- ST source
80
      src_in       => src_in,
81
      src_out      => src_out
82
    );
83
  END GENERATE;
84
 
85
  gen_out_rl_0 : IF g_out_latency<=g_in_latency AND g_out_latency=0 GENERATE
86
    -- Register siso by incrementing the input RL first
87
    u_incr : ENTITY dp_components_lib.dp_latency_increase
88
    GENERIC MAP (
89
      g_in_latency   => g_in_latency,
90
      g_incr_latency => 1
91
    )
92
    PORT MAP (
93
      rst          => rst,
94
      clk          => clk,
95
      -- ST sink
96
      snk_out      => snk_out,
97
      snk_in       => snk_in,
98
      -- ST source
99
      src_in       => internal_siso,
100
      src_out      => internal_sosi
101
    );
102
 
103
    -- Input RL --> 0
104
    u_adapt : ENTITY dp_components_lib.dp_latency_adapter
105
    GENERIC MAP (
106
      g_in_latency   => g_in_latency+1,
107
      g_out_latency  => g_out_latency
108
    )
109
    PORT MAP (
110
      rst          => rst,
111
      clk          => clk,
112
      -- ST sink
113
      snk_out      => internal_siso,
114
      snk_in       => internal_sosi,
115
      -- ST source
116
      src_in       => src_in,
117
      src_out      => src_out
118
    );
119
  END GENERATE;
120
 
121
  gen_out_rl : IF g_out_latency<=g_in_latency AND g_out_latency>0 GENERATE
122
    -- First adapt the input RL --> 0
123
    u_adapt : ENTITY dp_components_lib.dp_latency_adapter
124
    GENERIC MAP (
125
      g_in_latency   => g_in_latency,
126
      g_out_latency  => 0
127
    )
128
    PORT MAP (
129
      rst          => rst,
130
      clk          => clk,
131
      -- ST sink
132
      snk_out      => snk_out,
133
      snk_in       => snk_in,
134
      -- ST source
135
      src_in       => internal_siso,
136
      src_out      => internal_sosi
137
    );
138
 
139
    -- Register siso by incrementing the internal RL = 0 --> the output RL
140
    u_incr : ENTITY dp_components_lib.dp_latency_increase
141
    GENERIC MAP (
142
      g_in_latency   => 0,
143
      g_incr_latency => g_out_latency
144
    )
145
    PORT MAP (
146
      rst          => rst,
147
      clk          => clk,
148
      -- ST sink
149
      snk_out      => internal_siso,
150
      snk_in       => internal_sosi,
151
      -- ST source
152
      src_in       => src_in,
153
      src_out      => src_out
154
    );
155
  END GENERATE;
156
 
157
END str;

powered by: WebSVN 2.1.0

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