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 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 danv
-------------------------------------------------------------------------------
2
--
3 3 danv
-- Copyright 2020
4 2 danv
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
5
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
6 3 danv
-- 
7
-- Licensed under the Apache License, Version 2.0 (the "License");
8
-- you may not use this file except in compliance with the License.
9
-- You may obtain a copy of the License at
10
-- 
11
--     http://www.apache.org/licenses/LICENSE-2.0
12
-- 
13
-- Unless required by applicable law or agreed to in writing, software
14
-- distributed under the License is distributed on an "AS IS" BASIS,
15
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
-- See the License for the specific language governing permissions and
17
-- limitations under the License.
18 2 danv
--
19
-------------------------------------------------------------------------------
20
 
21
LIBRARY IEEE, common_pkg_lib, dp_pkg_lib, dp_components_lib;
22
USE IEEE.std_logic_1164.all;
23
USE dp_pkg_lib.dp_stream_pkg.ALL;
24
 
25
-- Purpose:
26
--   Pipeline the source input
27
-- Description:
28
--   This dp_pipeline_ready provides a single clock cycle delay of the source
29
--   input (i.e. siso). It does this by first going from RL = g_in_latency -->
30
--   0 and then to RL = g_out_latency. 
31
-- Data flow:
32
--   . out RL >  in RL                : incr(out RL - in RL)
33
--   . out RL <= in RL AND out RL = 0 : incr(1) --> adapt(out RL)
34
--   . out RL <= in RL AND out RL > 0 : adapt(0) --> incr(out RL)
35
-- Remark:
36
-- . The g_in_latency may be 0, but for g_in_latency=0 the sosi.ready acts
37
--   as an acknowledge and that could simply also be registered by the user.
38
 
39
ENTITY dp_pipeline_ready IS
40
  GENERIC (
41
    g_in_latency   : NATURAL := 1;  -- >= 0
42
    g_out_latency  : NATURAL := 1   -- >= 0
43
  );
44
  PORT (
45
    rst          : IN  STD_LOGIC;
46
    clk          : IN  STD_LOGIC;
47
    -- ST sink
48
    snk_out      : OUT t_dp_siso;
49
    snk_in       : IN  t_dp_sosi;
50
    -- ST source
51
    src_in       : IN  t_dp_siso;
52
    src_out      : OUT t_dp_sosi
53
  );
54
END dp_pipeline_ready;
55
 
56
 
57
ARCHITECTURE str OF dp_pipeline_ready IS
58
 
59
  SIGNAL internal_siso  : t_dp_siso;
60
  SIGNAL internal_sosi  : t_dp_sosi;
61
 
62
BEGIN
63
 
64
  gen_out_incr_rl : IF g_out_latency>g_in_latency GENERATE
65
    -- Register siso by incrementing the input RL first
66
    u_incr : ENTITY dp_components_lib.dp_latency_increase
67
    GENERIC MAP (
68
      g_in_latency   => g_in_latency,
69
      g_incr_latency => g_out_latency-g_in_latency
70
    )
71
    PORT MAP (
72
      rst          => rst,
73
      clk          => clk,
74
      -- ST sink
75
      snk_out      => snk_out,
76
      snk_in       => snk_in,
77
      -- ST source
78
      src_in       => src_in,
79
      src_out      => src_out
80
    );
81
  END GENERATE;
82
 
83
  gen_out_rl_0 : IF g_out_latency<=g_in_latency AND g_out_latency=0 GENERATE
84
    -- Register siso by incrementing the input RL first
85
    u_incr : ENTITY dp_components_lib.dp_latency_increase
86
    GENERIC MAP (
87
      g_in_latency   => g_in_latency,
88
      g_incr_latency => 1
89
    )
90
    PORT MAP (
91
      rst          => rst,
92
      clk          => clk,
93
      -- ST sink
94
      snk_out      => snk_out,
95
      snk_in       => snk_in,
96
      -- ST source
97
      src_in       => internal_siso,
98
      src_out      => internal_sosi
99
    );
100
 
101
    -- Input RL --> 0
102
    u_adapt : ENTITY dp_components_lib.dp_latency_adapter
103
    GENERIC MAP (
104
      g_in_latency   => g_in_latency+1,
105
      g_out_latency  => g_out_latency
106
    )
107
    PORT MAP (
108
      rst          => rst,
109
      clk          => clk,
110
      -- ST sink
111
      snk_out      => internal_siso,
112
      snk_in       => internal_sosi,
113
      -- ST source
114
      src_in       => src_in,
115
      src_out      => src_out
116
    );
117
  END GENERATE;
118
 
119
  gen_out_rl : IF g_out_latency<=g_in_latency AND g_out_latency>0 GENERATE
120
    -- First adapt the input RL --> 0
121
    u_adapt : ENTITY dp_components_lib.dp_latency_adapter
122
    GENERIC MAP (
123
      g_in_latency   => g_in_latency,
124
      g_out_latency  => 0
125
    )
126
    PORT MAP (
127
      rst          => rst,
128
      clk          => clk,
129
      -- ST sink
130
      snk_out      => snk_out,
131
      snk_in       => snk_in,
132
      -- ST source
133
      src_in       => internal_siso,
134
      src_out      => internal_sosi
135
    );
136
 
137
    -- Register siso by incrementing the internal RL = 0 --> the output RL
138
    u_incr : ENTITY dp_components_lib.dp_latency_increase
139
    GENERIC MAP (
140
      g_in_latency   => 0,
141
      g_incr_latency => g_out_latency
142
    )
143
    PORT MAP (
144
      rst          => rst,
145
      clk          => clk,
146
      -- ST sink
147
      snk_out      => internal_siso,
148
      snk_in       => internal_sosi,
149
      -- ST source
150
      src_in       => src_in,
151
      src_out      => src_out
152
    );
153
  END GENERATE;
154
 
155
END str;

powered by: WebSVN 2.1.0

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