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

Subversion Repositories astron_pipeline

[/] [astron_pipeline/] [trunk/] [dp_pipeline.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;
22
USE IEEE.std_logic_1164.all;
23
USE dp_pkg_lib.dp_stream_pkg.ALL;
24
 
25
-- Purpose:
26
--   Pipeline the source output by one cycle or by g_pipeline cycles.
27
-- Description:
28
--   The dp_pipeline instantiates 0:g_pipeline stages of dp_pipeline_one.
29
--   The dp_pipeline_one provides a single clock cycle delay of the source
30
--   output (i.e. sosi). The dp_pipeline_one holds valid sink input in case
31
--   src_in.ready goes low and makes src_out.valid high again when
32
--   src_in.ready goes high again, without the need for a valid sink input to
33
--   push this held data out.
34
--   The dp_pipeline delays the data, sop, eop by one cycle relative to the
35
--   valid. However the src_out.valid still has the same phase as the
36
--   snk_in.valid, because both valids depends on the same src_in.ready.
37
--   Therefore dp_pipeline cannot be used to delay the valid phase by one
38
--   cycle. Hence the may purpose of dp_pipeline is to register the sosi.
39
-- Remarks:
40
-- . Ready latency = 1
41
-- . Without flow control so when src_in.ready = '1' fixed, then the hold
42
--   logic in dp_pipeline becomes void and dp_pipeline then just pipelines the
43
--   snk_in sosi.
44
 
45
ENTITY dp_pipeline IS
46
  GENERIC (
47
    g_pipeline   : NATURAL := 1  -- 0 for wires, > 0 for registers, 
48
  );
49
  PORT (
50
    rst          : IN  STD_LOGIC;
51
    clk          : IN  STD_LOGIC;
52
    -- ST sink
53
    snk_out      : OUT t_dp_siso;
54
    snk_in       : IN  t_dp_sosi;
55
    -- ST source
56
    src_in       : IN  t_dp_siso := c_dp_siso_rdy;
57
    src_out      : OUT t_dp_sosi
58
  );
59
END dp_pipeline;
60
 
61
 
62
LIBRARY IEEE, common_pkg_lib, dp_pkg_lib;
63
USE IEEE.std_logic_1164.all;
64
USE dp_pkg_lib.dp_stream_pkg.ALL;
65
 
66
ENTITY dp_pipeline_one IS
67
  PORT (
68
    rst          : IN  STD_LOGIC;
69
    clk          : IN  STD_LOGIC;
70
    -- ST sink
71
    snk_out      : OUT t_dp_siso;
72
    snk_in       : IN  t_dp_sosi;
73
    -- ST source
74
    src_in       : IN  t_dp_siso := c_dp_siso_rdy;
75
    src_out      : OUT t_dp_sosi
76
  );
77
END dp_pipeline_one;
78
 
79
 
80
LIBRARY IEEE, common_pkg_lib, dp_pkg_lib;
81
USE IEEE.std_logic_1164.all;
82
USE dp_pkg_lib.dp_stream_pkg.ALL;
83
 
84
ARCHITECTURE str OF dp_pipeline IS
85
 
86
  SIGNAL snk_out_arr      : t_dp_siso_arr(0 TO g_pipeline);
87
  SIGNAL snk_in_arr       : t_dp_sosi_arr(0 TO g_pipeline);
88
 
89
BEGIN
90
 
91
  -- Input at index 0
92
  snk_out       <= snk_out_arr(0);
93
  snk_in_arr(0) <= snk_in;
94
 
95
  -- Output at index g_pipeline
96
  snk_out_arr(g_pipeline) <= src_in;
97
  src_out                 <= snk_in_arr(g_pipeline);
98
 
99
  gen_p : FOR I IN 1 TO g_pipeline GENERATE
100
    u_p : ENTITY work.dp_pipeline_one
101
    PORT MAP (
102
      rst          => rst,
103
      clk          => clk,
104
      -- ST sink
105
      snk_out      => snk_out_arr(I-1),
106
      snk_in       => snk_in_arr(I-1),
107
      -- ST source
108
      src_in       => snk_out_arr(I),
109
      src_out      => snk_in_arr(I)
110
    );
111
  END GENERATE;
112
 
113
END str;
114
 
115
 
116
LIBRARY IEEE, common_pkg_lib, dp_pkg_lib, dp_components_lib;
117
USE IEEE.std_logic_1164.all;
118
USE dp_pkg_lib.dp_stream_pkg.ALL;
119
 
120
ARCHITECTURE str OF dp_pipeline_one IS
121
 
122
  SIGNAL nxt_src_out      : t_dp_sosi;
123
  SIGNAL i_src_out        : t_dp_sosi;
124
 
125
BEGIN
126
 
127
  src_out <= i_src_out;
128
 
129
  -- Pipeline register
130
  p_clk : PROCESS(rst, clk)
131
  BEGIN
132
    IF rst='1' THEN
133
      i_src_out <= c_dp_sosi_rst;
134
    ELSIF rising_edge(clk) THEN
135
      i_src_out <= nxt_src_out;
136
    END IF;
137
  END PROCESS;
138
 
139
  -- Input control
140
  u_hold_input : ENTITY dp_components_lib.dp_hold_input
141
  PORT MAP (
142
    rst              => rst,
143
    clk              => clk,
144
    -- ST sink
145
    snk_out          => snk_out,
146
    snk_in           => snk_in,
147
    -- ST source
148
    src_in           => src_in,
149
    next_src_out     => nxt_src_out,
150
    pend_src_out     => OPEN,
151
    src_out_reg      => i_src_out
152
  );
153
 
154
END str;

powered by: WebSVN 2.1.0

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