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

powered by: WebSVN 2.1.0

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