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

Subversion Repositories dp_components

[/] [dp_components/] [trunk/] [dp_hold_input.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, dp_pkg_lib;
24
USE IEEE.std_logic_1164.all;
25
USE dp_pkg_lib.dp_stream_pkg.ALL;
26
 
27
-- Purpose:
28
--   Hold the sink input
29
-- Description:
30
--   This dp_hold_input provides the necessary input logic to hold the input
31
--   data and control to easily register the source output. Compared to
32
--   dp_pipeling the dp_hold_input is the same except for the output register
33
--   stage. In this way dp_hold_input can be used in a more complicated stream
34
--   component where the output is not always the same as the input.
35
--   The snk_in.valid and hold_in.valid are never high at the same time.
36
--   If src_in.ready goes low while snk_in.valid is high then this snk_in.valid
37
--   is held in hold_in.valid and the corresponding snk_in.data will get held
38
--   in the external src_out_reg.data. When src_in.ready goes high again then
39
--   the held data becomes valid via src_out_reg.valid and hold_in.valid goes
40
--   low. Due to the RL=1 the next cycle the snk_in.valid from the sink may go
41
--   high. The next_src_out control signals are equal to pend_src_out AND
42
--   src_in.ready, so they can directly be assigned to src_out_reg.data if the
43
--   snk_in.data needs to be passed on.
44
--   The internal pend_src_out control signals are available outside, in
45
--   addition to the next_src_out control signals, to support external control
46
--   independent of src_in.ready. Use pend_scr_out instead of next_src_out
47
--   to avoid combinatorial loop when src_in.ready depends on next_src_out.
48
--   The pend_src_out signals are used to implement show ahead behaviour like
49
--   with RL=0, but for RL=1. The input can then be stopped based on the snk_in
50
--   data and later on continued again without losing this snk_in data, because
51
--   it was held as described above.
52
-- Remarks:
53
-- . Ready latency = 1
54
-- . Without flow control so when src_in.ready = '1' fixed, then dp_hold_input
55
--   becomes void because the dp_hold_ctrl output then remains '0'.
56
 
57
ENTITY dp_hold_input IS
58
  PORT (
59
    rst              : IN  STD_LOGIC;
60
    clk              : IN  STD_LOGIC;
61
    -- ST sink
62
    snk_out          : OUT t_dp_siso;
63
    snk_in           : IN  t_dp_sosi;
64
    -- ST source
65
    src_in           : IN  t_dp_siso;
66
    next_src_out     : OUT t_dp_sosi;
67
    pend_src_out     : OUT t_dp_sosi;  -- the SOSI data fields are the same as for next_src_out
68
    src_out_reg      : IN  t_dp_sosi   -- uses only the SOSI data fields
69
  );
70
END dp_hold_input;
71
 
72
 
73
ARCHITECTURE rtl OF dp_hold_input IS
74
 
75
  SIGNAL i_pend_src_out : t_dp_sosi;
76
  SIGNAL hold_in        : t_dp_sosi;  -- uses only the SOSI ctrl fields
77
 
78
BEGIN
79
 
80
  pend_src_out <= i_pend_src_out;
81
 
82
  -- SISO:
83
  snk_out <= src_in;  --  No change in ready latency, pass on xon frame level flow control
84
 
85
  -- SOSI:
86
  -- Take care of active snk_in.valid, snk_in.sync, snk_in.sop and snk_in.eop
87
  -- when src_in.ready went low. If hold_in.valid would not be used for
88
  -- pend_src_out.valid and next_src_out.valid, then the pipeline would still
89
  -- work, but the valid snk_in.data that came when src_in.ready went low,
90
  -- will then only get pushed out on the next valid snk_in.valid. Whereas
91
  -- hold_in.valid ensures that it will get pushed out as soon as src_in.ready
92
  -- goes high again. This is typically necessary in case of packetized data
93
  -- where the eop of one packet should not have to wait for the valid (sop)
94
  -- of a next packet to get pushed out.
95
 
96
  u_hold_val : ENTITY work.dp_hold_ctrl
97
  PORT MAP (
98
    rst      => rst,
99
    clk      => clk,
100
    ready    => src_in.ready,
101
    in_ctrl  => snk_in.valid,
102
    hld_ctrl => hold_in.valid
103
  );
104
 
105
  u_hold_sync : ENTITY work.dp_hold_ctrl
106
  PORT MAP (
107
    rst      => rst,
108
    clk      => clk,
109
    ready    => src_in.ready,
110
    in_ctrl  => snk_in.sync,
111
    hld_ctrl => hold_in.sync
112
  );
113
 
114
  u_hold_sop : ENTITY work.dp_hold_ctrl
115
  PORT MAP (
116
    rst      => rst,
117
    clk      => clk,
118
    ready    => src_in.ready,
119
    in_ctrl  => snk_in.sop,
120
    hld_ctrl => hold_in.sop
121
  );
122
 
123
  u_hold_eop : ENTITY work.dp_hold_ctrl
124
  PORT MAP (
125
    rst      => rst,
126
    clk      => clk,
127
    ready    => src_in.ready,
128
    in_ctrl  => snk_in.eop,
129
    hld_ctrl => hold_in.eop
130
  );
131
 
132
  p_pend_src_out : PROCESS(snk_in, src_out_reg, hold_in)
133
  BEGIN
134
    -- Pend data
135
    IF snk_in.valid='1' THEN
136
      i_pend_src_out <= snk_in;       -- Input data
137
    ELSE
138
      i_pend_src_out <= src_out_reg;  -- Hold data
139
    END IF;
140
    i_pend_src_out.valid <= snk_in.valid OR hold_in.valid;
141
    i_pend_src_out.sync  <= snk_in.sync  OR hold_in.sync;
142
    i_pend_src_out.sop   <= snk_in.sop   OR hold_in.sop;
143
    i_pend_src_out.eop   <= snk_in.eop   OR hold_in.eop;
144
  END PROCESS;
145
 
146
  p_next_src_out : PROCESS(i_pend_src_out, src_in)
147
  BEGIN
148
    -- Next data
149
    next_src_out       <= i_pend_src_out;
150
    -- Next control
151
    next_src_out.valid <= i_pend_src_out.valid AND src_in.ready;
152
    next_src_out.sync  <= i_pend_src_out.sync  AND src_in.ready;
153
    next_src_out.sop   <= i_pend_src_out.sop   AND src_in.ready;
154
    next_src_out.eop   <= i_pend_src_out.eop   AND src_in.ready;
155
  END PROCESS;
156
 
157
END rtl;

powered by: WebSVN 2.1.0

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