wf_consumption.vhd 15.1 KB
Newer Older
1 2
--_________________________________________________________________________________________________
--                                                                                                |
3
--                                         |The nanoFIP|                                          |
4
--                                                                                                |
5
--                                         CERN,BE/CO-HT                                          |
6 7 8
--________________________________________________________________________________________________|

---------------------------------------------------------------------------------------------------
9
--                                                                                                |
10
--                                          wf_consumption                                        |
11
--                                                                                                |
12
---------------------------------------------------------------------------------------------------
13
-- File         wf_consumption.vhd                                                                |
14 15 16 17
--                                                                                                |
-- Description  The unit groups the main actions that regard data consumption.                    |
--              It instantiates the units:                                                        |
--                                                                                                |
18 19 20 21
--              o wf_cons_bytes_processor: for the handling of consumed RP_DAT data bytes (var_1, |
--                                         var_2, var_rst, var_4) as they arrive from the         |
--                                         wf_fd_receiver (registration to the RAM or outputting  |
--                                         to the DAT_O).                                         |
22 23
--                                                                                                |
--                                                                                                |
24
--              o wf_cons_outcome        : for the validation of the consumed frame at the end of |
25 26 27 28
--                                         its arrival (in terms of FSS, CTRL, PDU_TYPE, Lgth &   |
--                                         CRC bytes).                                            |
--                                                                                                |
--                     ___________________________________________________________                |
29
--                    |                       wf_consumption                      |               |
30 31 32
--                    |                                                           |               |
--                    |       _____________________________________________       |               |
--                    |      |                                             |      |               |
33
--                    |      |                wf_cons_outcome              |      |               |
34 35 36 37 38
--                    |      |                                             |      |               |
--                    |      |_____________________________________________|      |               |
--                    |                                                           |               |
--                    |       _____________________________________________       |               |
--                    |      |                                             |      |               |
39
--                    |      |            wf_cons_bytes_processor          |      |               |
40 41 42 43 44 45
--                    |      |                                             |      |               |
--                    |      |_____________________________________________|      |               |
--                    |___________________________________________________________|               |
--                                                 /\                                             |
--                     ___________________________________________________________                |
--                    |                                                           |               |
46
--                    |                       wf_fd_receiver                      |               |
47 48 49 50 51 52 53 54 55 56 57 58 59
--                    |___________________________________________________________|               |
--                                                 /\                                             |
--                   ___________________________________________________________________          |
--                 O____________________________FIELDBUS______________________________O           |
--                                                                                                |
--                                                                                                |
--              Note: In the entity declaration of this unit, below each input signal, we mark    |
--              for which of the instantiated units it is essential.                              |
--                                                                                                |
--                                                                                                |
-- Authors      Pablo Alvarez Sanchez (Pablo.Alvarez.Sanchez@cern.ch)                             |
--              Evangelia Gousiou     (Evangelia.Gousiou@cern.ch)                                 |
-- Date         11/01/2011                                                                        |
60
---------------------------------------------------------------------------------------------------
61

62
---------------------------------------------------------------------------------------------------
63 64
--                                      SOLDERPAD LICENSE                                         |
--                                   Copyright CERN 2014-2018                                     |
65
--                              ------------------------------------                              |
66 67 68 69 70 71 72
-- Copyright and related rights are licensed under the Solderpad Hardware License, Version 2.0    |
-- (the "License"); you may not use this file except in compliance with the License.              |
-- You may obtain a copy of the License at http://solderpad.org/licenses/SHL-2.0.                 |
-- Unless required by applicable law or agreed to in writing, software, hardware and materials    |
-- distributed under this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR       |
-- CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language   |
-- governing permissions and limitations under the License.                                       |
73 74 75 76 77 78 79 80 81 82 83 84 85 86
---------------------------------------------------------------------------------------------------



--=================================================================================================
--                                      Libraries & Packages
--=================================================================================================

-- Standard library
library IEEE;
use IEEE.STD_LOGIC_1164.all; -- std_logic definitions
use IEEE.NUMERIC_STD.all;    -- conversion functions
-- Specific library
library work;
87
use work.WF_PACKAGE.all;     -- definitions of types, constants, entities
88 89 90


--=================================================================================================
91
--                           Entity declaration for wf_consumption
92
--=================================================================================================
93
entity wf_consumption is port(
94
  -- INPUTS
95

96
	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
97
    -- nanoFIP User Interface, General signals
98

99
      uclk_i                 : in std_logic;
100 101
      -- used by: all the units

102
      slone_i                : in std_logic;
103 104
      -- used by: wf_cons_bytes_processor for selecting the data storage (RAM or DAT_O bus)
      -- used by: wf_cons_outcome for the VAR2_RDY signal (stand-alone mode does not treat var_2)
105 106

	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
107
    -- nanoFIP WorldFIP Settings
108

109
       subs_i                : in std_logic_vector (7 downto 0);
110
      -- used by: wf_cons_outcome for checking if the 2 bytes of a var_rst match the station's addr
111 112

	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
113
    -- Signal from the wf_reset_unit
114

115
      nfip_rst_i             : in std_logic;
116 117
      -- used by: all the units

118
	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
119
    -- Signals from the wf_fd_receiver
120

121 122
      rx_byte_i              : in std_logic_vector (7 downto 0);
      rx_byte_ready_p_i      : in std_logic;
123
      -- used by: wf_cons_bytes_processor
124 125 126

      rx_fss_crc_fes_ok_p_i  : in std_logic;
      rx_crc_wrong_p_i       : in std_logic;
127
      -- used by: wf_cons_outcome
128

129
	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
egousiou's avatar
egousiou committed
130
    -- nanoFIP User Interface, WISHBONE Slave
131

132
      wb_clk_i               : in std_logic;
egousiou's avatar
egousiou committed
133
      wb_adr_i               : in std_logic_vector (8 downto 0);
134
      -- used by: wf_cons_bytes_processor for the managment of the Consumption RAM
135

136
	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
137
    -- Signals from the wf_engine_control unit
138

139
      cons_bytes_excess_i    : in std_logic;
140
      -- used by: wf_cons_outcome
141 142

      var_i                  : in t_var;
143
      -- used by: wf_cons_bytes_processor and wf_cons_outcome
144

145
      byte_index_i           : in std_logic_vector (7 downto 0);
146 147
      -- used by: wf_cons_bytes_processor for the reception coordination
      -- used by: wf_cons_outcome for the validation of the LGTH byte
148

egousiou's avatar
egousiou committed
149
	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
150
    -- Signal from the wf_jtag_controller unit
egousiou's avatar
egousiou committed
151
    jc_mem_adr_rd_i          : in std_logic_vector (8 downto 0);
152
      -- used by: wf_cons_bytes_processor for the readings from the JC_cons memory
egousiou's avatar
egousiou committed
153

154 155

  -------------------------------------------------------------------------------------------------
156
  -- OUTPUTS
157 158

    -- nanoFIP User Interface, NON-WISHBONE outputs
159 160
      var1_rdy_o             : out std_logic;
      var2_rdy_o             : out std_logic;
161

162
    -- nanoFIP User Interface, WISHBONE Slave outputs
163
      data_o                 : out std_logic_vector (15 downto 0);
164

165
    -- Signals to the wf_production
166
      nfip_status_r_tler_p_o : out std_logic;
167

168
    -- Signals to the wf_reset_unit
169
      assert_rston_p_o       : out std_logic;
egousiou's avatar
egousiou committed
170 171
      rst_nfip_and_fd_p_o    : out std_logic;

172 173 174
    -- Signals to the wf_jtag_controller unit
      jc_start_p_o             : out std_logic;
      jc_mem_data_o            : out std_logic_vector (7 downto 0));
175

176
end entity wf_consumption;
177 178 179 180



--=================================================================================================
181
--                                architecture declaration
182
--=================================================================================================
183
architecture struc of wf_consumption is
184

185 186
  signal s_cons_ctrl_byte, s_cons_pdu_byte, s_cons_lgth_byte : std_logic_vector (7 downto 0);
  signal s_cons_var_rst_byte_1, s_cons_var_rst_byte_2        : std_logic_vector (7 downto 0);
187

188

189
--=================================================================================================
190
--                                       architecture begin
191
--=================================================================================================
192
begin
193

egousiou's avatar
egousiou committed
194

195
---------------------------------------------------------------------------------------------------
196
--                                   Consumed Bytes Processing                                   --
197
---------------------------------------------------------------------------------------------------
198

199
  Consumption_Bytes_Processor : wf_cons_bytes_processor
200 201 202 203 204 205 206 207 208 209 210
  port map(
    uclk_i                 => uclk_i,
    nfip_rst_i             => nfip_rst_i,
    slone_i                => slone_i,
    byte_ready_p_i         => rx_byte_ready_p_i,
    var_i                  => var_i,
    byte_index_i           => byte_index_i,
    byte_i                 => rx_byte_i,
    wb_clk_i               => wb_clk_i,
    wb_adr_i               => wb_adr_i,
    jc_mem_adr_rd_i        => jc_mem_adr_rd_i,
211
   --------------------------------------------------------
212 213 214 215 216 217 218
    data_o                 => data_o,
    jc_mem_data_o          => jc_mem_data_o,
    cons_ctrl_byte_o       => s_cons_ctrl_byte,
    cons_pdu_byte_o        => s_cons_pdu_byte,
    cons_lgth_byte_o       => s_cons_lgth_byte,
    cons_var_rst_byte_1_o  => s_cons_var_rst_byte_1,
    cons_var_rst_byte_2_o  => s_cons_var_rst_byte_2);
219
   --------------------------------------------------------
220

egousiou's avatar
egousiou committed
221 222


223
---------------------------------------------------------------------------------------------------
224
--                                      Consumption Outcome                                      --
225
---------------------------------------------------------------------------------------------------
226

227
  Consumption_Outcome : wf_cons_outcome
228
  port map(
229 230 231 232 233 234
    uclk_i                 => uclk_i,
    slone_i                => slone_i,
    subs_i                 => subs_i,
    nfip_rst_i             => nfip_rst_i,
    rx_fss_crc_fes_ok_p_i  => rx_fss_crc_fes_ok_p_i,
    rx_crc_wrong_p_i       => rx_crc_wrong_p_i,
235
    cons_bytes_excess_i    => cons_bytes_excess_i,
236
    var_i                  => var_i,
237
    byte_index_i           => byte_index_i,
238 239 240 241 242
    cons_ctrl_byte_i       => s_cons_ctrl_byte,
    cons_pdu_byte_i        => s_cons_pdu_byte,
    cons_lgth_byte_i       => s_cons_lgth_byte,
    cons_var_rst_byte_1_i  => s_cons_var_rst_byte_1,
    cons_var_rst_byte_2_i  => s_cons_var_rst_byte_2,
243
   --------------------------------------------------------
244 245
    var1_rdy_o             => var1_rdy_o,
    var2_rdy_o             => var2_rdy_o,
egousiou's avatar
egousiou committed
246
    jc_start_p_o           => jc_start_p_o,
247 248 249
    nfip_status_r_tler_p_o => nfip_status_r_tler_p_o,
    assert_rston_p_o       => assert_rston_p_o,
    rst_nfip_and_fd_p_o    => rst_nfip_and_fd_p_o);
250
   --------------------------------------------------------
251

252

253 254
end architecture struc;
--=================================================================================================
255
--                                        architecture end
256 257
--=================================================================================================
---------------------------------------------------------------------------------------------------
258
--                                      E N D   O F   F I L E
259
---------------------------------------------------------------------------------------------------